[Bf-blender-cvs] [d1a761c4d4c] master: Cycles: Fix compilation error of standalone application

2017-11-13 Thread Sergey Sharybin
Commit: d1a761c4d4c0d31eb7688a5892aaa67bf73fddb6
Author: Sergey Sharybin
Date:   Mon Nov 13 10:49:05 2017 +0100
Branches: master
https://developer.blender.org/rBd1a761c4d4c0d31eb7688a5892aaa67bf73fddb6

Cycles: Fix compilation error of standalone application

===

M   intern/cycles/app/cycles_xml.cpp
M   intern/cycles/util/util_xml.h

===

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 3a1c7205c34..f2db9271a89 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -358,7 +358,7 @@ static void xml_read_shader(XMLReadState& state, xml_node 
node)
 
 /* Background */
 
-static void xml_read_background(XMLReadState& state, pugi::xml_node node)
+static void xml_read_background(XMLReadState& state, xml_node node)
 {
/* Background Settings */
xml_read_node(state, state.scene->background, node);
diff --git a/intern/cycles/util/util_xml.h b/intern/cycles/util/util_xml.h
index c9c1ea47e96..6f06f17937b 100644
--- a/intern/cycles/util/util_xml.h
+++ b/intern/cycles/util/util_xml.h
@@ -31,8 +31,10 @@ OIIO_NAMESPACE_USING
 #  define PUGIXML_NAMESPACE OIIO_NAMESPACE::pugi
 #endif
 
-using PUGIXML_NAMESPACE::xml_node;
 using PUGIXML_NAMESPACE::xml_attribute;
+using PUGIXML_NAMESPACE::xml_document;
+using PUGIXML_NAMESPACE::xml_node;
+using PUGIXML_NAMESPACE::xml_parse_result;
 
 CCL_NAMESPACE_END

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


[Bf-blender-cvs] [8b97a539aa5] greasepencil-object: New Smooth modifer

2017-11-13 Thread Antonio Vazquez
Commit: 8b97a539aa5bb62d65e6a3505600df80253e09ea
Author: Antonio Vazquez
Date:   Mon Nov 13 11:01:44 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB8b97a539aa5bb62d65e6a3505600df80253e09ea

New Smooth modifer

Allow to apply smooth to the stroke after drawing.

This is not related to the smooth of the stroke while drawing.

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/blenkernel/BKE_gpencil.h
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/editors/gpencil/gpencil_brush.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/space_outliner/outliner_draw.c
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/CMakeLists.txt
M   source/blender/modifiers/MOD_modifiertypes.h
A   source/blender/modifiers/intern/MOD_gpencilsmooth.c
M   source/blender/modifiers/intern/MOD_util.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index e582e90ad22..da68565e571 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1578,6 +1578,38 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 row.prop(md, "affect_strength", text="Strength", icon='COLOR', 
toggle=True)
 row.prop(md, "affect_thickness", text="Thickness", icon='LINE_DATA', 
toggle=True)
 
+def GP_SMOOTH(self, layout, ob, md):
+gpd = ob.data
+split = layout.split()
+
+col = split.column()
+row = col.row(align=False)
+row.prop(md, "factor")
+row.prop(md, "step")
+
+split = layout.split()
+col = split.column()
+col.label("Layer:")
+row = col.row(align=True)
+row.prop_search(md, "layer", gpd, "layers", text="", 
icon='GREASEPENCIL')
+row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
+
+col.label("Vertex Group:")
+row = col.row(align=True)
+row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+row.prop(md, "inverse_vertex", text="", icon="ARROW_LEFTRIGHT")
+
+row = col.row(align=True)
+row.prop(md, "pass_index", text="Pass")
+row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
+
+row = layout.row(align=True)
+row.label("Affect:")
+row = layout.row(align=True)
+row.prop(md, "affect_position", text="Position", icon='MESH_DATA', 
toggle=True)
+row.prop(md, "affect_strength", text="Strength", icon='COLOR', 
toggle=True)
+row.prop(md, "affect_thickness", text="Thickness", icon='LINE_DATA', 
toggle=True)
+
 def GP_SUBDIV(self, layout, ob, md):
 gpd = ob.data
 split = layout.split()
diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index ac242620005..5b4ed72c82d 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -211,5 +211,8 @@ void BKE_gpencil_simplify_stroke(struct bGPDlayer *gpl, 
struct bGPDstroke *gps,
 
 void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
 
+bool BKE_gp_smooth_stroke(struct bGPDstroke *gps, int i, float inf, bool 
affect_pressure);
+bool BKE_gp_smooth_stroke_strength(struct bGPDstroke *gps, int i, float inf);
+bool BKE_gp_smooth_stroke_thickness(struct bGPDstroke *gps, int i, float inf);
 
 #endif /*  __BKE_GPENCIL_H__ */
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index a710bd344eb..be9d62f7b9c 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2349,3 +2349,160 @@ bool BKE_gpencil_vgroup_remove_point_weight(bGPDspoint 
*pt, int index)
 
 
 /* ** */
+/**
+* Apply smooth to stroke point
+* \param gps  Stroke to smooth
+* \param iPoint index
+* \param inf  Amount of smoothing to apply
+* \param affect_pressure  Apply smoothing to pressure values too?
+*/
+bool BKE_gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool 
affect_pressure)
+{
+   bGPDspoint *pt = >points[i];
+   float pressure = 0.0f;
+   float sco[3] = { 0.0f };
+
+   /* Do nothing if not enough points to smooth out */
+   if (gps->totpoints <= 2) {
+   return false;
+   }
+
+   /* Only affect endpoints by a fraction of the normal strength,
+   * to prevent the stroke from shrinking too much
+   */
+   if ((i == 0) || (i == 

[Bf-blender-cvs] [42dff6cc2eb] master: Cycles: Fix compilation error with OIIO compiled against system PugiXML

2017-11-13 Thread Sergey Sharybin
Commit: 42dff6cc2ebe21bee401bc115139c4f62aabc6f5
Author: Sergey Sharybin
Date:   Mon Nov 13 10:40:19 2017 +0100
Branches: master
https://developer.blender.org/rB42dff6cc2ebe21bee401bc115139c4f62aabc6f5

Cycles: Fix compilation error with OIIO compiled against system PugiXML

===

M   build_files/cmake/Modules/FindOpenImageIO.cmake
M   intern/cycles/CMakeLists.txt
M   intern/cycles/util/util_xml.h

===

diff --git a/build_files/cmake/Modules/FindOpenImageIO.cmake 
b/build_files/cmake/Modules/FindOpenImageIO.cmake
index d59f9cfcdfc..e7527f15755 100644
--- a/build_files/cmake/Modules/FindOpenImageIO.cmake
+++ b/build_files/cmake/Modules/FindOpenImageIO.cmake
@@ -76,6 +76,8 @@ IF(OPENIMAGEIO_FOUND)
   SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
   IF(EXISTS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/pugixml.hpp)
 SET(OPENIMAGEIO_PUGIXML_FOUND TRUE)
+  ELSE()
+SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
   ENDIF()
 ELSE()
   SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 5844c2480d6..dbf1bcece16 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -209,6 +209,10 @@ if(WITH_CYCLES_DEBUG)
add_definitions(-DWITH_CYCLES_DEBUG)
 endif()
 
+if(NOT OPENIMAGEIO_PUGIXML_FOUND)
+   add_definitions(-DWITH_SYSTEM_PUGIXML)
+endif()
+
 include_directories(
SYSTEM
${BOOST_INCLUDE_DIR}
diff --git a/intern/cycles/util/util_xml.h b/intern/cycles/util/util_xml.h
index e1a28df9433..c9c1ea47e96 100644
--- a/intern/cycles/util/util_xml.h
+++ b/intern/cycles/util/util_xml.h
@@ -23,10 +23,17 @@
 
 CCL_NAMESPACE_BEGIN
 
-using OIIO_NAMESPACE::pugi::xml_node;
-using OIIO_NAMESPACE::pugi::xml_attribute;
+OIIO_NAMESPACE_USING
+
+#ifdef WITH_SYSTEM_PUGIXML
+#  define PUGIXML_NAMESPACE pugi
+#else
+#  define PUGIXML_NAMESPACE OIIO_NAMESPACE::pugi
+#endif
+
+using PUGIXML_NAMESPACE::xml_node;
+using PUGIXML_NAMESPACE::xml_attribute;
 
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_XML_H__ */
-

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


[Bf-blender-cvs] [31a73fe79d2] split-kernel-faster-building: Cycles: Fix shadow catcher and branched path after recent split changes

2017-11-13 Thread Mai Lavelle
Commit: 31a73fe79d289f99e976fee6b1023af95559fbf2
Author: Mai Lavelle
Date:   Mon Nov 13 22:45:06 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rB31a73fe79d289f99e976fee6b1023af95559fbf2

Cycles: Fix shadow catcher and branched path after recent split changes

===

M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/split/kernel_direct_lighting.h
M   intern/cycles/kernel/split/kernel_shadow_blocked_dl.h

===

diff --git a/intern/cycles/kernel/kernel_shader.h 
b/intern/cycles/kernel/kernel_shader.h
index 6096239ac2b..5f0945a0be5 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -964,6 +964,10 @@ ccl_device float3 shader_holdout_eval(KernelGlobals *kg, 
ShaderData *sd)
 ccl_device void shader_eval(KernelGlobals *kg, ShaderData *sd,
ccl_addr_space PathState *state, ShaderEvalTask *eval_task)
 {
+   if(eval_task->intent == SHADER_EVAL_INTENT_SKIP) {
+   return;
+   }
+
sd->num_closure = 0;
sd->num_closure_left = eval_task->max_closure;
 
diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index 9032f847ec3..bc822523b06 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -933,6 +933,7 @@ typedef enum ShaderEvalIntent {
SHADER_EVAL_INTENT_SURFACE,
SHADER_EVAL_INTENT_BACKGROUND,
SHADER_EVAL_INTENT_CONSTANT,
+   SHADER_EVAL_INTENT_SKIP, /* dont evaluate shader, used by the split 
kernel */
 } ShaderEvalIntent;
 
 typedef ccl_addr_space struct ShaderData {
diff --git a/intern/cycles/kernel/split/kernel_direct_lighting.h 
b/intern/cycles/kernel/split/kernel_direct_lighting.h
index 176c0ec16ad..4dea050c89f 100644
--- a/intern/cycles/kernel/split/kernel_direct_lighting.h
+++ b/intern/cycles/kernel/split/kernel_direct_lighting.h
@@ -59,6 +59,7 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg,
if(IS_STATE(kernel_split_state.ray_state, ray_index, RAY_ACTIVE)) {
ccl_global PathState *state = 
_split_state.path_state[ray_index];
ShaderData *sd = kernel_split_sd(sd, ray_index);
+   ShaderEvalTask *eval_task = 
_split_state.shader_eval_task[ray_index];
 
/* direct lighting */
 #ifdef __EMISSION__
@@ -68,14 +69,16 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg,
 #  ifdef __BRANCHED_PATH__
if(flag && kernel_data.integrator.branched) {
flag = false;
-   enqueue_flag = 1; // XXX
+   eval_task->intent = SHADER_EVAL_INTENT_SKIP;
+   enqueue_flag = 1;
}
 #  endif  /* __BRANCHED_PATH__ */
 
 #  ifdef __SHADOW_TRICKS__
if(flag && state->flag & PATH_RAY_SHADOW_CATCHER) {
flag = false;
-   enqueue_flag = 1; // XXX
+   eval_task->intent = SHADER_EVAL_INTENT_SKIP;
+   enqueue_flag = 1;
}
 #  endif  /* __SHADOW_TRICKS__ */
 
@@ -93,7 +96,6 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg,
))
{
ShaderData *emission_sd = 
AS_SHADER_DATA(_split_state.sd_DL_shadow[ray_index]);
-   ShaderEvalTask *eval_task = 
_split_state.shader_eval_task[ray_index];
 
if(direct_emission_setup(kg, sd, emission_sd, 
, state, eval_task)) {
/* Write intermediate data to global 
memory to access from
diff --git a/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h 
b/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
index cde46d2250d..8f21ef88049 100644
--- a/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
+++ b/intern/cycles/kernel/split/kernel_shadow_blocked_dl.h
@@ -45,20 +45,6 @@ ccl_device void kernel_shadow_blocked_dl(KernelGlobals *kg)
ShaderData *sd = kernel_split_sd(sd, ray_index);
float3 throughput = kernel_split_state.throughput[ray_index];
ShaderData *emission_sd = 
AS_SHADER_DATA(_split_state.sd_DL_shadow[ray_index]);
-   LightSample ls = kernel_split_state.light_sample[ray_index];
-   ShaderEvalTask *eval_task = 
_split_state.shader_eval_task[ray_index];
-
-   float terminate = path_state_rng_light_termination(kg, state);
-
-   Ray ray;
-   ray.time = sd->time;
-
-   BsdfEval L_light;
-   bool is_lamp;
-
-   if(!direct_emission_finish(kg, sd, emission_sd, , state, , 
_light, _lamp, terminate, eval_task)) {
-   return;
-   }
 
 #  if defined(__BRANCHED_PATH__) || defined(__SHADOW_TRICKS__)
bool use_branched = false;
@@ 

[Bf-blender-cvs] [f8b14305668] blender2.8: Eevee: Initial Separable Subsurface Scattering implementation.

2017-11-13 Thread Clément Foucault
Commit: f8b14305668ff7b1f3ba6f886b9e1881c764b201
Author: Clément Foucault
Date:   Tue Nov 14 00:49:54 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBf8b14305668ff7b1f3ba6f886b9e1881c764b201

Eevee: Initial Separable Subsurface Scattering implementation.

How to use:
- Enable subsurface scattering in the render options.
- Add Subsurface BSDF to your shader.
- Check "Screen Space Subsurface Scattering" in the material panel options.

This initial implementation has a few limitations:
- only supports gaussian SSS.
- Does not support principled shader.
- The radius parameters is baked down to a number of samples and then put into 
an UBO. This means the radius input socket cannot be used. You need to tweak 
the default vector directly.
- The "texture blur" is considered as always set to 1

===

M   release/scripts/startup/bl_ui/properties_material.py
M   release/scripts/startup/bl_ui/properties_render.py
M   release/scripts/startup/bl_ui/properties_render_layer.py
M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/eevee/eevee_effects.c
M   source/blender/draw/engines/eevee/eevee_engine.c
M   source/blender/draw/engines/eevee/eevee_materials.c
M   source/blender/draw/engines/eevee/eevee_private.h
A   source/blender/draw/engines/eevee/eevee_subsurface.c
M   source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
A   source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl
M   source/blender/gpu/GPU_material.h
M   source/blender/gpu/intern/gpu_material.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_material.c
M   source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index 42a132004d4..b914bafaf3f 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -1186,6 +1186,8 @@ class EEVEE_MATERIAL_PT_options(MaterialButtonsPanel, 
Panel):
 layout.prop(mat, "use_screen_refraction")
 layout.prop(mat, "refraction_depth")
 
+layout.prop(mat, "use_screen_subsurface")
+
 
 classes = (
 MATERIAL_MT_sss_presets,
diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 6be6bea5a52..65fa38af652 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -757,6 +757,29 @@ class RENDER_PT_eevee_volumetric(RenderButtonsPanel, 
Panel):
 col.prop(props, "volumetric_colored_transmittance")
 
 
+class RENDER_PT_eevee_subsurface_scattering(RenderButtonsPanel, Panel):
+bl_label = "Subsurface Scattering"
+bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_EEVEE'}
+
+@classmethod
+def poll(cls, context):
+scene = context.scene
+return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
+
+def draw_header(self, context):
+scene = context.scene
+props = scene.layer_properties['BLENDER_EEVEE']
+self.layout.prop(props, "sss_enable", text="")
+
+def draw(self, context):
+layout = self.layout
+scene = context.scene
+props = scene.layer_properties['BLENDER_EEVEE']
+
+col = layout.column()
+
+
 class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel):
 bl_label = "Screen Space Reflections"
 bl_options = {'DEFAULT_CLOSED'}
@@ -870,6 +893,7 @@ classes = (
 RENDER_PT_eevee_sampling,
 RENDER_PT_eevee_shadows,
 RENDER_PT_eevee_indirect_lighting,
+RENDER_PT_eevee_subsurface_scattering,
 RENDER_PT_eevee_screen_space_reflections,
 RENDER_PT_eevee_ambient_occlusion,
 RENDER_PT_eevee_volumetric,
diff --git a/release/scripts/startup/bl_ui/properties_render_layer.py 
b/release/scripts/startup/bl_ui/properties_render_layer.py
index 270902ea54a..c4013480c74 100644
--- a/release/scripts/startup/bl_ui/properties_render_layer.py
+++ b/release/scripts/startup/bl_ui/properties_render_layer.py
@@ -318,6 +318,34 @@ class 
RENDERLAYER_PT_eevee_volumetric(RenderLayerButtonsPanel, Panel):
 col.template_override_property(layer_props, scene_props, 
"volumetric_colored_transmittance")
 
 
+class RENDERLAYER_PT_eevee_subsurface_scattering(RenderLayerButtonsPanel, 
Panel):
+bl_label = "Subsurface Scattering"
+bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_EEVEE'}
+
+@classmethod
+def poll(cls, context):
+scene = context.scene
+

[Bf-blender-cvs] [289f9f42ff0] blender2.8: Eevee: SSS: Add Quality settings.

2017-11-13 Thread Clément Foucault
Commit: 289f9f42ff049a672b5235230435c16bc361b04e
Author: Clément Foucault
Date:   Tue Nov 14 02:17:34 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB289f9f42ff049a672b5235230435c16bc361b04e

Eevee: SSS: Add Quality settings.

Samples : pretty self explanatory.
Jitter Threshold : Reduce cache misses and improve performance (greatly) by 
lowering this value. This settings let user decide how many samples should be 
jittered (rotated) to reduce banding artifacts.

===

M   release/scripts/startup/bl_ui/properties_render.py
M   release/scripts/startup/bl_ui/properties_render_layer.py
M   source/blender/draw/engines/eevee/eevee_engine.c
M   source/blender/draw/engines/eevee/eevee_materials.c
M   source/blender/draw/engines/eevee/eevee_private.h
M   source/blender/draw/engines/eevee/eevee_subsurface.c
M   source/blender/draw/engines/eevee/shaders/effect_subsurface_frag.glsl
M   source/blender/gpu/GPU_material.h
M   source/blender/gpu/intern/gpu_material.c
M   source/blender/makesrna/intern/rna_layer.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 65fa38af652..51ebc79294f 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -778,6 +778,8 @@ class 
RENDER_PT_eevee_subsurface_scattering(RenderButtonsPanel, Panel):
 props = scene.layer_properties['BLENDER_EEVEE']
 
 col = layout.column()
+col.prop(props, "sss_samples")
+col.prop(props, "sss_jitter_threshold")
 
 
 class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_render_layer.py 
b/release/scripts/startup/bl_ui/properties_render_layer.py
index c4013480c74..1a2ed307c6d 100644
--- a/release/scripts/startup/bl_ui/properties_render_layer.py
+++ b/release/scripts/startup/bl_ui/properties_render_layer.py
@@ -344,6 +344,8 @@ class 
RENDERLAYER_PT_eevee_subsurface_scattering(RenderLayerButtonsPanel, Panel)
 layer_props = layer.engine_overrides['BLENDER_EEVEE']
 
 col = layout.column()
+col.template_override_property(layer_props, scene_props, "sss_samples")
+col.template_override_property(layer_props, scene_props, 
"sss_jitter_threshold")
 
 
 class RENDERLAYER_PT_eevee_screen_space_reflections(RenderLayerButtonsPanel, 
Panel):
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c 
b/source/blender/draw/engines/eevee/eevee_engine.c
index 217dc2f0227..4ca59aaa39e 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -323,6 +323,8 @@ static void EEVEE_scene_layer_settings_create(RenderEngine 
*UNUSED(engine), IDPr
BKE_collection_engine_property_add_int(props, "taa_samples", 8);
 
BKE_collection_engine_property_add_bool(props, "sss_enable", false);
+   BKE_collection_engine_property_add_int(props, "sss_samples", 7);
+   BKE_collection_engine_property_add_float(props, "sss_jitter_threshold", 
0.3f);
 
BKE_collection_engine_property_add_bool(props, "ssr_enable", false);
BKE_collection_engine_property_add_bool(props, "ssr_refraction", false);
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c 
b/source/blender/draw/engines/eevee/eevee_materials.c
index f7985fb7ddf..23057bd91c0 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1006,7 +1006,8 @@ static void material_opaque(
add_standard_uniforms(*shgrp, sldata, vedata, ssr_id, 
>refract_depth, use_refract, false);
 
if (use_sss) {
-   struct GPUUniformBuffer *sss_profile = 
GPU_material_sss_profile_get(*gpumat);
+   struct GPUUniformBuffer *sss_profile = 
GPU_material_sss_profile_get(*gpumat,
+   
stl->effects->sss_sample_count);
if (sss_profile) {
DRW_shgroup_stencil_mask(*shgrp, 
e_data.sss_count + 1);
EEVEE_subsurface_add_pass(vedata, 
e_data.sss_count + 1, sss_profile);
diff --git a/source/blender/draw/engines/eevee/eevee_private.h 
b/source/blender/draw/engines/eevee/eevee_private.h
index 43540762a52..b1ed108bad0 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -429,6 +429,10 @@ typedef struct EEVEE_EffectsInfo {
int enabled_effects;
bool swap_double_buffer;
 
+   /*  */
+   int sss_sample_count;
+   float sss_jitter_threshold;
+
/* 

[Bf-blender-cvs] [ab013224adf] blender2.8: GPUMaterial : Add sss_data to Closure struct.

2017-11-13 Thread Clément Foucault
Commit: ab013224adf5bb07c1467637592cd8c7bb5cb2fe
Author: Clément Foucault
Date:   Mon Nov 13 21:56:49 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBab013224adf5bb07c1467637592cd8c7bb5cb2fe

GPUMaterial : Add sss_data to Closure struct.

===

M   source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/shader/node_shader_tree.c
M   source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c

===

diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl 
b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
index b2c72126c40..bbb69d557c4 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -580,6 +580,9 @@ Closure closure_add(Closure cl1, Closure cl2)
 struct Closure {
vec3 radiance;
float opacity;
+#ifdef USE_SSS
+   vec4 sss_data;
+#endif
vec4 ssr_data;
vec2 ssr_normal;
int ssr_id;
@@ -589,19 +592,29 @@ struct Closure {
 #define TRANSPARENT_CLOSURE_FLAG -2
 #define REFRACT_CLOSURE_FLAG -3
 
+#ifdef USE_SSS
+#define CLOSURE_DEFAULT Closure(vec3(0.0), 1.0, vec4(0.0), vec4(0.0), 
vec2(0.0), -1)
+#else
 #define CLOSURE_DEFAULT Closure(vec3(0.0), 1.0, vec4(0.0), vec2(0.0), -1)
+#endif
 
 uniform int outputSsrId;
 
 Closure closure_mix(Closure cl1, Closure cl2, float fac)
 {
Closure cl;
+
+#ifdef USE_SSS
+   cl.sss_data = mix(cl1.sss_data, cl2.sss_data, fac);
+#endif
+
if (cl1.ssr_id == outputSsrId) {
cl.ssr_data = mix(cl1.ssr_data.xyzw, vec4(vec3(0.0), 
cl1.ssr_data.w), fac); /* do not blend roughness */
cl.ssr_normal = cl1.ssr_normal;
cl.ssr_id = cl1.ssr_id;
}
else {
+   cl.ssr_data = mix(vec4(vec3(0.0), cl2.ssr_data.w), 
cl2.ssr_data.xyzw, fac); /* do not blend roughness */
cl.ssr_data = mix(vec4(vec3(0.0), cl2.ssr_data.w), 
cl2.ssr_data.xyzw, fac); /* do not blend roughness */
cl.ssr_normal = cl2.ssr_normal;
cl.ssr_id = cl2.ssr_id;
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 2cf66c78db1..e829c4a0c0e 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2672,7 +2672,11 @@ void node_bsdf_diffuse(vec4 color, float roughness, vec3 
N, out Closure result)
 #ifdef EEVEE_ENGINE
vec3 L = eevee_surface_diffuse_lit(N, vec3(1.0), 1.0);
vec3 vN = normalize(mat3(ViewMatrix) * N);
-   result = Closure(L * color.rgb, 1.0, vec4(0.0), normal_encode(vN, 
viewCameraVec), -1);
+   result.radiance = L * color.rgb;
+   result.opacity = 1.0;
+   result.ssr_data = vec4(0.0);
+   result.ssr_normal = normal_encode(vN, viewCameraVec);
+   result.ssr_id = -1;
 #else
/* ambient light */
vec3 L = vec3(0.2);
@@ -2697,7 +2701,11 @@ void node_bsdf_glossy(vec4 color, float roughness, vec3 
N, float ssr_id, out Clo
roughness = sqrt(roughness);
vec3 L = eevee_surface_glossy_lit(N, vec3(1.0), roughness, 1.0, 
int(ssr_id), ssr_spec);
vec3 vN = normalize(mat3(ViewMatrix) * N);
-   result = Closure(L * color.rgb, 1.0, vec4(ssr_spec * color.rgb, 
roughness), normal_encode(vN, viewCameraVec), int(ssr_id));
+   result.radiance = L * color.rgb;
+   result.opacity = 1.0;
+   result.ssr_data = vec4(ssr_spec * color.rgb, roughness);
+   result.ssr_normal = normal_encode(vN, viewCameraVec);
+   result.ssr_id = int(ssr_id);
 #else
/* ambient light */
vec3 L = vec3(0.2);
@@ -2735,7 +2743,11 @@ void node_bsdf_glass(vec4 color, float roughness, float 
ior, vec3 N, float ssr_i
roughness = sqrt(roughness);
vec3 L = eevee_surface_glass(N, (refractionDepth > 0.0) ? color.rgb : 
vec3(1.0), roughness, ior, int(ssr_id), ssr_spec);
vec3 vN = normalize(mat3(ViewMatrix) * N);
-   result = Closure(L * color.rgb, 1.0, vec4(ssr_spec * color.rgb, 
roughness), normal_encode(vN, viewCameraVec), int(ssr_id));
+   result.radiance = L * color.rgb;
+   result.opacity = 1.0;
+   result.ssr_data = vec4(ssr_spec * color.rgb, roughness);
+   result.ssr_normal = normal_encode(vN, viewCameraVec);
+   result.ssr_id = int(ssr_id);
 #else
node_bsdf_diffuse(color, 0.0, N, result);
 #endif
@@ -2856,7 +2868,11 @@ void node_bsdf_principled_simple(vec4 base_color, float 
subsurface, vec3 subsurf
 
vec3 L = eevee_surface_lit(N, diffuse, f0, roughness, 1.0, int(ssr_id), 
ssr_spec);
vec3 vN = normalize(mat3(ViewMatrix) * N);
-   result = 

[Bf-blender-cvs] [89e9f6ea790] blender2.8: DRW: Better stencil support.

2017-11-13 Thread Clément Foucault
Commit: 89e9f6ea79078f846d78b6effda2ae8a8a32de84
Author: Clément Foucault
Date:   Mon Nov 13 23:33:06 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB89e9f6ea79078f846d78b6effda2ae8a8a32de84

DRW: Better stencil support.

A stencil mask is now assigned to each shading group and the stencil test is 
defined like the depth test via the DRW_STATE_* defines.

===

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

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 1941ad0a441..e96ed220066 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -173,6 +173,7 @@ typedef enum {
DRW_TEX_R_32,
DRW_TEX_DEPTH_16,
DRW_TEX_DEPTH_24,
+   DRW_TEX_DEPTH_24_STENCIL_8,
DRW_TEX_DEPTH_32,
 } DRWTextureFormat;
 
@@ -289,10 +290,8 @@ typedef enum {
DRW_STATE_TRANSMISSION  = (1 << 17),
DRW_STATE_CLIP_PLANES   = (1 << 18),
 
-   DRW_STATE_WRITE_STENCIL_SELECT = (1 << 27),
-   DRW_STATE_WRITE_STENCIL_ACTIVE = (1 << 28),
-   DRW_STATE_TEST_STENCIL_SELECT  = (1 << 29),
-   DRW_STATE_TEST_STENCIL_ACTIVE  = (1 << 30),
+   DRW_STATE_WRITE_STENCIL= (1 << 27),
+   DRW_STATE_STENCIL_EQUAL= (1 << 28),
 } DRWState;
 
 #define DRW_STATE_DEFAULT (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | 
DRW_STATE_DEPTH_LESS)
@@ -335,6 +334,7 @@ void DRW_shgroup_set_instance_count(DRWShadingGroup 
*shgroup, int count);
 
 void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state);
 void DRW_shgroup_state_disable(DRWShadingGroup *shgroup, DRWState state);
+void DRW_shgroup_stencil_mask(DRWShadingGroup *shgroup, unsigned int mask);
 void DRW_shgroup_attrib_float(DRWShadingGroup *shgroup, const char *name, int 
size);
 
 void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, 
const struct GPUTexture *tex);
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 2e35a30351a..275edb9bf42 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -277,6 +277,7 @@ struct DRWShadingGroup {
 
DRWState state_extra;/* State changes for this batch only 
(or'd with the pass's state) */
DRWState state_extra_disable;/* State changes for this batch only 
(and'd with the pass's state) */
+   unsigned int stencil_mask;   /* Stencil mask to use for stencil 
test / write operations */
int type;
 
ID *instance_data; /* Object->data to instance */
@@ -330,6 +331,7 @@ static struct DRWGlobalState {
 
/* Managed by `DRW_state_set`, `DRW_state_reset` */
DRWState state;
+   unsigned int stencil_mask;
 
/* Per viewport */
GPUViewport *viewport;
@@ -418,6 +420,7 @@ static void drw_texture_get_format(
 #endif
case DRW_TEX_DEPTH_16: *r_data_type = GPU_DEPTH_COMPONENT16; 
break;
case DRW_TEX_DEPTH_24: *r_data_type = GPU_DEPTH_COMPONENT24; 
break;
+   case DRW_TEX_DEPTH_24_STENCIL_8: *r_data_type = 
GPU_DEPTH24_STENCIL8; break;
case DRW_TEX_DEPTH_32: *r_data_type = GPU_DEPTH_COMPONENT32F; 
break;
default :
/* file type not supported you must uncomment it from 
above */
@@ -791,6 +794,7 @@ DRWShadingGroup *DRW_shgroup_create(struct GPUShader 
*shader, DRWPass *pass)
shgroup->shader = shader;
shgroup->state_extra = 0;
shgroup->state_extra_disable = ~0x0;
+   shgroup->stencil_mask = 0;
shgroup->batch_geom = NULL;
shgroup->instance_geom = NULL;
shgroup->instance_data = NULL;
@@ -1132,6 +1136,11 @@ void DRW_shgroup_state_disable(DRWShadingGroup *shgroup, 
DRWState state)
shgroup->state_extra_disable &= ~state;
 }
 
+void DRW_shgroup_stencil_mask(DRWShadingGroup *shgroup, unsigned int mask)
+{
+   shgroup->stencil_mask = mask;
+}
+
 void DRW_shgroup_attrib_float(DRWShadingGroup *shgroup, const char *name, int 
size)
 {
DRW_interface_attrib(shgroup, name, DRW_ATTRIB_FLOAT, size, false);
@@ -1664,34 +1673,22 @@ static void DRW_state_set(DRWState state)
{
DRWState test;
if (CHANGED_ANY_STORE_VAR(
-   DRW_STATE_WRITE_STENCIL_SELECT |
-   DRW_STATE_WRITE_STENCIL_ACTIVE |
-   DRW_STATE_TEST_STENCIL_SELECT |
-   DRW_STATE_TEST_STENCIL_ACTIVE,
+   DRW_STATE_WRITE_STENCIL |
+   DRW_STATE_STENCIL_EQUAL,
test))
{
if (test) {
glEnable(GL_STENCIL_TEST);
 
 

[Bf-blender-cvs] [93936b8643b] blender2.8: GPUTexture: Add for stencil to default depth buffers.

2017-11-13 Thread Clément Foucault
Commit: 93936b8643b9c4f77fe13d35b41ecaa246843dd8
Author: Clément Foucault
Date:   Mon Nov 13 23:25:46 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB93936b8643b9c4f77fe13d35b41ecaa246843dd8

GPUTexture: Add for stencil to default depth buffers.

Theses will be used by eevee SSS.

TODO: only allocate stencil if needed.

===

M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/intern/gpu_framebuffer.c
M   source/blender/gpu/intern/gpu_texture.c
M   source/blender/gpu/intern/gpu_viewport.c

===

diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index fa8ed992c72..82e215f6fae 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -162,6 +162,7 @@ GPUTexture *GPU_texture_create_cube_custom(
 GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256]);
 GPUTexture *GPU_texture_create_depth_with_stencil(int w, int h, char 
err_out[256]);
 GPUTexture *GPU_texture_create_depth_multisample(int w, int h, int samples, 
char err_out[256]);
+GPUTexture *GPU_texture_create_depth_with_stencil_multisample(int w, int h, 
int samples, char err_out[256]);
 
 GPUTexture *GPU_texture_from_blender(
 struct Image *ima, struct ImageUser *iuser, int textarget, bool 
is_data, double time, int mipmap);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c 
b/source/blender/gpu/intern/gpu_framebuffer.c
index 9f0ccffb8eb..884a305bd02 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -670,7 +670,7 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, 
int samples, char err_
}
}
 
-   ofs->depth = GPU_texture_create_depth_multisample(width, height, 
samples, err_out);
+   ofs->depth = GPU_texture_create_depth_with_stencil_multisample(width, 
height, samples, err_out);
if (!ofs->depth) {
GPU_offscreen_free(ofs);
return NULL;
diff --git a/source/blender/gpu/intern/gpu_texture.c 
b/source/blender/gpu/intern/gpu_texture.c
index ac8c8bacac1..252eede8758 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -711,6 +711,11 @@ GPUTexture *GPU_texture_create_depth_multisample(int w, 
int h, int samples, char
return GPU_texture_create_nD(w, h, 0, 2, NULL, GPU_DEPTH_COMPONENT24, 
1, samples, false, err_out);
 }
 
+GPUTexture *GPU_texture_create_depth_with_stencil_multisample(int w, int h, 
int samples, char err_out[256])
+{
+   return GPU_texture_create_nD(w, h, 0, 2, NULL, GPU_DEPTH24_STENCIL8, 1, 
samples, false, err_out);
+}
+
 void GPU_texture_update(GPUTexture *tex, const float *pixels)
 {
BLI_assert(tex->format > -1);
diff --git a/source/blender/gpu/intern/gpu_viewport.c 
b/source/blender/gpu/intern/gpu_viewport.c
index bdbf829a1ca..bd563a36f57 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -381,7 +381,8 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti 
*rect)
}
 
/* Depth */
-   dtxl->multisample_depth = 
GPU_texture_create_depth_multisample(rect_w, rect_h, U.ogl_multisamples, NULL);
+   dtxl->multisample_depth = 
GPU_texture_create_depth_with_stencil_multisample(rect_w, rect_h,
+   
U.ogl_multisamples, NULL);
 
if (!dtxl->multisample_depth) {
ok = false;
@@ -430,7 +431,7 @@ cleanup_multisample:
}
 
/* Depth */
-   dtxl->depth = GPU_texture_create_depth(rect_w, rect_h, NULL);
+   dtxl->depth = GPU_texture_create_depth_with_stencil(rect_w, 
rect_h, NULL);
 
if (dtxl->depth) {
/* Define texture parameters */

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


[Bf-blender-cvs] [b5eeec715ef] blender2.8: Cleanup: remove BLI_blenlib from ghash header

2017-11-13 Thread Campbell Barton
Commit: b5eeec715efd7124610316b3ebf0791eb2fd6fef
Author: Campbell Barton
Date:   Tue Nov 14 17:00:10 2017 +1100
Branches: blender2.8
https://developer.blender.org/rBb5eeec715efd7124610316b3ebf0791eb2fd6fef

Cleanup: remove BLI_blenlib from ghash header

This causes source files to depend on ghash header
for BLI_string/rect/listbase.

Also quiet warnings.

===

M   source/blender/blenlib/BLI_ghash.h
M   source/blender/blenloader/intern/versioning_280.c
M   
source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
M   source/blender/depsgraph/intern/depsgraph_build.cc
M   source/blender/depsgraph/intern/depsgraph_query.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_cache_impl_particles.c
M   source/blender/draw/modes/edit_mesh_mode_text.c
M   source/blender/editors/scene/scene_edit.c
M   source/blender/editors/space_node/node_manipulators.c
M   source/blender/editors/space_outliner/outliner_collections.c
M   source/blender/editors/space_outliner/outliner_draw.c
M   source/blender/imbuf/intern/thumbs.c
M   source/blender/python/intern/bpy_library_load.c
M   
source/blender/windowmanager/manipulators/intern/wm_manipulator_group_type.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
M   source/blender/windowmanager/manipulators/intern/wm_manipulator_type.c

===

diff --git a/source/blender/blenlib/BLI_ghash.h 
b/source/blender/blenlib/BLI_ghash.h
index 3fde19b11e4..b42a36a3567 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -32,7 +32,6 @@
  *  \ingroup bli
  */
 
-#include "BLI_blenlib.h"
 #include "BLI_sys_types.h" /* for bool */
 #include "BLI_compiler_attrs.h"
 
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index 09744f54170..7ce7ef54040 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -30,6 +30,12 @@
 
 #include 
 
+#include "BLI_listbase.h"
+#include "BLI_mempool.h"
+#include "BLI_string.h"
+#include "BLI_string_utf8.h"
+#include "BLI_utildefines.h"
+
 #include "DNA_object_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_gpu_types.h"
@@ -54,11 +60,6 @@
 #include "BKE_scene.h"
 #include "BKE_workspace.h"
 
-#include "BLI_listbase.h"
-#include "BLI_mempool.h"
-#include "BLI_string.h"
-#include "BLI_utildefines.h"
-
 #include "BLO_readfile.h"
 #include "readfile.h"
 
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
index 3d099416d1e..8f67c64f1b3 100644
--- 
a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
+++ 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
@@ -39,6 +39,8 @@
 
 extern "C" {
 #include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
 
 #include "BKE_layer.h"
 
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc 
b/source/blender/depsgraph/intern/depsgraph_build.cc
index 7083e6134dd..80d3df2811c 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -36,6 +36,7 @@
 
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
+#include "BLI_listbase.h"
 
 #ifdef DEBUG_TIME
 #  include "PIL_time.h"
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc 
b/source/blender/depsgraph/intern/depsgraph_query.cc
index 940cadba872..ee75b9b348b 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -33,12 +33,14 @@
 #include "MEM_guardedalloc.h"
 
 extern "C" {
+#include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 #include "BLI_math.h"
 #include "BKE_anim.h"
 #include "BKE_idcode.h"
 #include "BKE_layer.h"
 #include "BKE_main.h"
+#include "BLI_listbase.h"
 } /* extern "C" */
 
 #include "DNA_object_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 c9cce520147..1d3c2d596ee 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
@@ -43,6 +43,7 @@
 
 #include "BLI_utildefines.h"
 #include "BLI_threads.h"
+#include "BLI_string.h"
 
 #include "BKE_global.h"
 #include "BKE_layer.h"
@@ -510,9 +511,9 @@ void update_copy_on_write_scene(const Depsgraph *depsgraph,
scene_cow->obedit = NULL;
}
/* Synchronize active render engine. */
-   BLI_strncpy_utf8(scene_cow->view_render.engine_id,
-

[Bf-blender-cvs] [7adc698eedf] master: Cleanup: order BLI before BKE headers

2017-11-13 Thread Campbell Barton
Commit: 7adc698eedfc325dc8485aa52d56730f87bbb586
Author: Campbell Barton
Date:   Tue Nov 14 17:23:40 2017 +1100
Branches: master
https://developer.blender.org/rB7adc698eedfc325dc8485aa52d56730f87bbb586

Cleanup: order BLI before BKE headers

This was done nearly everywhere already

===

M   source/blender/blenkernel/intern/bmfont.c
M   source/blender/blenkernel/intern/freestyle.c
M   source/blender/blenkernel/intern/outliner_treehash.c
M   source/blender/editors/animation/anim_channels_edit.c
M   source/blender/editors/sculpt_paint/paint_curve.c
M   source/blender/makesrna/intern/rna_cachefile.c
M   source/blender/makesrna/intern/rna_mask.c
M   source/blender/makesrna/intern/rna_sculpt_paint.c
M   source/blender/makesrna/intern/rna_smoke.c
M   source/blender/python/intern/bpy_rna_array.c
M   source/blender/render/intern/source/render_result.c

===

diff --git a/source/blender/blenkernel/intern/bmfont.c 
b/source/blender/blenkernel/intern/bmfont.c
index 79b3f89da20..8018629ef2a 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -52,11 +52,10 @@
 #include "MEM_guardedalloc.h"
 #include "IMB_imbuf_types.h"
 
-#include "BKE_bmfont.h"
-#include "BKE_bmfont_types.h"
-
 #include "BLI_utildefines.h"
 
+#include "BKE_bmfont.h"
+#include "BKE_bmfont_types.h"
 #include "BKE_global.h"
 
 void printfGlyph(bmGlyph *glyph)
diff --git a/source/blender/blenkernel/intern/freestyle.c 
b/source/blender/blenkernel/intern/freestyle.c
index e45a938a4fc..686fe3bda93 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -34,14 +34,14 @@
 #include "DNA_freestyle_types.h"
 #include "DNA_group_types.h"
 
-#include "BKE_freestyle.h"
-#include "BKE_library.h"
-#include "BKE_linestyle.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_string_utils.h"
 
+#include "BKE_freestyle.h"
+#include "BKE_library.h"
+#include "BKE_linestyle.h"
+
 // function declarations
 static FreestyleLineSet *alloc_lineset(void);
 static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet 
*lineset, const int flag);
diff --git a/source/blender/blenkernel/intern/outliner_treehash.c 
b/source/blender/blenkernel/intern/outliner_treehash.c
index f31ba34a984..4d97121e2a3 100644
--- a/source/blender/blenkernel/intern/outliner_treehash.c
+++ b/source/blender/blenkernel/intern/outliner_treehash.c
@@ -28,14 +28,14 @@
 
 #include 
 
-#include "BKE_outliner_treehash.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 #include "BLI_mempool.h"
 
 #include "DNA_outliner_types.h"
 
+#include "BKE_outliner_treehash.h"
+
 #include "MEM_guardedalloc.h"
 
 typedef struct TseGroup {
diff --git a/source/blender/editors/animation/anim_channels_edit.c 
b/source/blender/editors/animation/anim_channels_edit.c
index 25f1e206be5..82f24c91df1 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -34,11 +34,9 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_depsgraph.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 #include "BLI_listbase.h"
-#include "BKE_library.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_object_types.h"
@@ -52,11 +50,13 @@
 
 #include "BKE_animsys.h"
 #include "BKE_action.h"
+#include "BKE_depsgraph.h"
 #include "BKE_fcurve.h"
 #include "BKE_gpencil.h"
 #include "BKE_context.h"
 #include "BKE_mask.h"
 #include "BKE_global.h"
+#include "BKE_library.h"
 
 #include "UI_view2d.h"
 
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c 
b/source/blender/editors/sculpt_paint/paint_curve.c
index 0ee78d61fb8..337f7a1ef2b 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -33,13 +33,13 @@
 #include "DNA_space_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BLI_math_vector.h"
+#include "BLI_string.h"
+
 #include "BKE_context.h"
 #include "BKE_main.h"
 #include "BKE_paint.h"
 
-#include "BLI_math_vector.h"
-#include "BLI_string.h"
-
 #include "ED_paint.h"
 #include "ED_view3d.h"
 
diff --git a/source/blender/makesrna/intern/rna_cachefile.c 
b/source/blender/makesrna/intern/rna_cachefile.c
index 81b0c539e33..73928d377f1 100644
--- a/source/blender/makesrna/intern/rna_cachefile.c
+++ b/source/blender/makesrna/intern/rna_cachefile.c
@@ -34,11 +34,11 @@
 
 #ifdef RNA_RUNTIME
 
+#include "BLI_string.h"
+
 #include "BKE_cachefile.h"
 #include "BKE_depsgraph.h"
 
-#include "BLI_string.h"
-
 #include "DEG_depsgraph.h"
 
 #include "WM_api.h"
diff --git a/source/blender/makesrna/intern/rna_mask.c 
b/source/blender/makesrna/intern/rna_mask.c
index f4f4685d1bf..c266e0e7f31 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -52,13 +52,13 @@
 

[Bf-blender-cvs] [40ad1cf0b12] master: BLI: sync changes from 2.8

2017-11-13 Thread Campbell Barton
Commit: 40ad1cf0b1203848508cf6389e4337eb5071edf6
Author: Campbell Barton
Date:   Tue Nov 14 16:10:48 2017 +1100
Branches: master
https://developer.blender.org/rB40ad1cf0b1203848508cf6389e4337eb5071edf6

BLI: sync changes from 2.8

===

M   source/blender/blenlib/BLI_listbase.h
M   source/blender/blenlib/BLI_math_color.h
M   source/blender/blenlib/BLI_math_matrix.h
M   source/blender/blenlib/BLI_math_vector.h
M   source/blender/blenlib/BLI_rand.h
M   source/blender/blenlib/BLI_utildefines.h
M   source/blender/blenlib/intern/listbase.c
M   source/blender/blenlib/intern/math_color_inline.c
M   source/blender/blenlib/intern/math_matrix.c
M   source/blender/blenlib/intern/math_vector.c
M   source/blender/blenlib/intern/math_vector_inline.c
M   source/blender/blenlib/intern/rand.c

===

diff --git a/source/blender/blenlib/BLI_listbase.h 
b/source/blender/blenlib/BLI_listbase.h
index b06944e4985..c1e28d5ebc3 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -77,6 +77,7 @@ int  BLI_listbase_count(const struct ListBase *listbase) 
ATTR_WARN_UNUSED_RESULT
 void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1);
 
 void BLI_listbase_swaplinks(struct ListBase *listbase, void *vlinka, void 
*vlinkb) ATTR_NONNULL(1, 2);
+void BLI_listbases_swaplinks(struct ListBase *listbasea, struct ListBase 
*listbaseb, void *vlinka, void *vlinkb) ATTR_NONNULL(2, 3);
 
 void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) 
ATTR_NONNULL(1, 2);
 void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) 
ATTR_NONNULL(1, 2);
diff --git a/source/blender/blenlib/BLI_math_color.h 
b/source/blender/blenlib/BLI_math_color.h
index 5e6b1256d30..34fc52c12c0 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -141,7 +141,11 @@ MINLINE void float_to_byte_dither_v3(unsigned char b[3], 
const float f[3], float
 #define rgba_char_args_set_fl(col, r, g, b, a) \
rgba_char_args_set(col, (r) * 255, (g) * 255, (b) * 255, (a) * 255)
 
+#define rgba_float_args_set_ch(col, r, g, b, a) \
+   rgba_float_args_set(col, (r) / 255.0f, (g) / 255.0f, (b) / 255.0f, (a) 
/ 255.0f)
+
 MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const 
char b, const char a);
+MINLINE void rgba_float_args_set(float col[4], const float r, const float g, 
const float b, const float a);
 MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, 
const char b, const char a);
 MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack);
 
diff --git a/source/blender/blenlib/BLI_math_matrix.h 
b/source/blender/blenlib/BLI_math_matrix.h
index d0dfad2a02f..173ef6861e6 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -210,6 +210,7 @@ void scale_m4_fl(float R[4][4], float scale);
 
 float mat3_to_scale(float M[3][3]);
 float mat4_to_scale(float M[4][4]);
+float mat4_to_xy_scale(float M[4][4]);
 
 void size_to_mat3(float R[3][3], const float size[3]);
 void size_to_mat4(float R[4][4], const float size[3]);
diff --git a/source/blender/blenlib/BLI_math_vector.h 
b/source/blender/blenlib/BLI_math_vector.h
index 4fdb33926a2..3f603311530 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -151,6 +151,7 @@ MINLINE void negate_v3_short(short r[3]);
 MINLINE void negate_v3_db(double r[3]);
 
 MINLINE void invert_v2(float r[2]);
+MINLINE void invert_v3(float r[3]);
 
 MINLINE void abs_v2(float r[2]);
 MINLINE void abs_v2_v2(float r[2], const float a[2]);
@@ -311,6 +312,7 @@ void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], 
const float n[3]);
 void ortho_v3_v3(float out[3], const float v[3]);
 void ortho_v2_v2(float out[2], const float v[2]);
 void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const 
float c[3]);
+void rotate_v2_v2fl(float r[2], const float p[2], const float angle);
 void rotate_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const 
float angle);
 void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float 
axis[3], const float angle);
 
@@ -326,6 +328,7 @@ void print_vn(const char *str, const float v[], const int 
n);
 #define print_v4_id(v) print_v4(STRINGIFY(v), v)
 #define print_vn_id(v, n) print_vn(STRINGIFY(v), v, n)
 
+MINLINE void normal_float_to_short_v2(short r[2], const float n[2]);
 MINLINE void normal_short_to_float_v3(float r[3], const short n[3]);
 MINLINE void normal_float_to_short_v3(short r[3], const float n[3]);
 
diff --git a/source/blender/blenlib/BLI_rand.h 
b/source/blender/blenlib/BLI_rand.h
index f36d2faa1b8..69b23b2473f 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ 

[Bf-blender-cvs] [f7cc97e8cf5] split-kernel-faster-building: Cycles: Add shader_eval_state to allow eval of ray states besides RAY_ACTIVE

2017-11-13 Thread Mai Lavelle
Commit: f7cc97e8cf57806505fced4e79fff7f2a883d43c
Author: Mai Lavelle
Date:   Tue Nov 14 01:26:53 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rBf7cc97e8cf57806505fced4e79fff7f2a883d43c

Cycles: Add shader_eval_state to allow eval of ray states besides RAY_ACTIVE

===

M   intern/cycles/kernel/split/kernel_direct_lighting.h
M   intern/cycles/kernel/split/kernel_shader_eval.h
M   intern/cycles/kernel/split/kernel_shader_sort.h
M   intern/cycles/kernel/split/kernel_split_data_types.h

===

diff --git a/intern/cycles/kernel/split/kernel_direct_lighting.h 
b/intern/cycles/kernel/split/kernel_direct_lighting.h
index 4dea050c89f..57f92d9d822 100644
--- a/intern/cycles/kernel/split/kernel_direct_lighting.h
+++ b/intern/cycles/kernel/split/kernel_direct_lighting.h
@@ -123,6 +123,7 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg,
 
if(ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0) == 0) {
kernel_split_params.shader_eval_queue = 
QUEUE_SHADOW_RAY_CAST_DL_RAYS;
+   kernel_split_params.shader_eval_state = RAY_ACTIVE;
}
 #endif
 
diff --git a/intern/cycles/kernel/split/kernel_shader_eval.h 
b/intern/cycles/kernel/split/kernel_shader_eval.h
index e72c483c6ca..c95e625b840 100644
--- a/intern/cycles/kernel/split/kernel_shader_eval.h
+++ b/intern/cycles/kernel/split/kernel_shader_eval.h
@@ -24,6 +24,7 @@ ccl_device void kernel_shader_eval(KernelGlobals *kg)
int ray_index = ccl_global_id(1) * ccl_global_size(0) + 
ccl_global_id(0);
 
int queue = kernel_split_params.shader_eval_queue;
+   int shade_state = kernel_split_params.shader_eval_state;
int queue_index = kernel_split_params.queue_index[queue];
 
if(ray_index >= queue_index) {
@@ -39,7 +40,7 @@ ccl_device void kernel_shader_eval(KernelGlobals *kg)
return;
}
 
-   if(IS_STATE(kernel_split_state.ray_state, ray_index, RAY_ACTIVE)) {
+   if(IS_STATE(kernel_split_state.ray_state, ray_index, shade_state)) {
ShaderEvalTask *eval_task = 
_split_state.shader_eval_task[ray_index];
ShaderData *sd = (ShaderData*)(((ccl_global 
char*)_split_state) + eval_task->sd_offset);
ccl_global PathState *state = 
_split_state.path_state[ray_index];
diff --git a/intern/cycles/kernel/split/kernel_shader_sort.h 
b/intern/cycles/kernel/split/kernel_shader_sort.h
index 7e3e3ca92b4..2accd8f938b 100644
--- a/intern/cycles/kernel/split/kernel_shader_sort.h
+++ b/intern/cycles/kernel/split/kernel_shader_sort.h
@@ -25,12 +25,14 @@ ccl_device void kernel_shader_sort(KernelGlobals *kg,
/* Sorting on cuda split is not implemented */
if(tid == 0) {
kernel_split_params.shader_eval_queue = 
QUEUE_ACTIVE_AND_REGENERATED_RAYS;
+   kernel_split_params.shader_eval_state = RAY_ACTIVE;
}
 #else
uint qsize = 
kernel_split_params.queue_index[QUEUE_ACTIVE_AND_REGENERATED_RAYS];
if(tid == 0) {
kernel_split_params.queue_index[QUEUE_SHADER_SORTED_RAYS] = 
qsize;
kernel_split_params.shader_eval_queue = 
QUEUE_SHADER_SORTED_RAYS;
+   kernel_split_params.shader_eval_state = RAY_ACTIVE;
}
 
uint offset = (tid/SHADER_SORT_LOCAL_SIZE)*SHADER_SORT_BLOCK_SIZE;
diff --git a/intern/cycles/kernel/split/kernel_split_data_types.h 
b/intern/cycles/kernel/split/kernel_split_data_types.h
index 8698ae7e9d5..1589f929f22 100644
--- a/intern/cycles/kernel/split/kernel_split_data_types.h
+++ b/intern/cycles/kernel/split/kernel_split_data_types.h
@@ -33,6 +33,7 @@ typedef struct SplitParams {
 
/* queue for kernel_shader_eval */
QueueNumber shader_eval_queue;
+   char shader_eval_state;
 
/* Place for storing sd->flag. AMD GPU OpenCL compiler workaround */
int dummy_sd_flag;

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


[Bf-blender-cvs] [04d3288a439] split-kernel-faster-building: Cycles: Split kernel_path_background

2017-11-13 Thread Mai Lavelle
Commit: 04d3288a439eec6cd7d9513431c39e8e1784b79f
Author: Mai Lavelle
Date:   Tue Nov 14 00:12:41 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rB04d3288a439eec6cd7d9513431c39e8e1784b79f

Cycles: Split kernel_path_background

===

M   intern/cycles/kernel/kernel_path.h

===

diff --git a/intern/cycles/kernel/kernel_path.h 
b/intern/cycles/kernel/kernel_path.h
index 207ba741e6f..741fdb81252 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -127,13 +127,14 @@ ccl_device_forceinline void kernel_path_lamp_emission(
 #endif  /* __LAMP_MIS__ */
 }
 
-ccl_device_forceinline void kernel_path_background(
+ccl_device_forceinline bool kernel_path_background_setup(
KernelGlobals *kg,
ccl_addr_space PathState *state,
ccl_addr_space Ray *ray,
float3 throughput,
ShaderData *sd,
-   PathRadiance *L)
+   PathRadiance *L,
+   ShaderEvalTask *eval_task)
 {
/* eval background shader if nothing hit */
if(kernel_data.background.transparent && (state->flag & 
PATH_RAY_CAMERA)) {
@@ -142,7 +143,7 @@ ccl_device_forceinline void kernel_path_background(
 #ifdef __PASSES__
if(!(kernel_data.film.pass_flag & PASS_BACKGROUND))
 #endif  /* __PASSES__ */
-   return;
+   return false;
}
 
/* When using the ao bounces approximation, adjust background
@@ -153,11 +154,47 @@ ccl_device_forceinline void kernel_path_background(
 
 #ifdef __BACKGROUND__
/* sample background shader */
-   float3 L_background = indirect_background(kg, sd, state, ray);
+   return indirect_background_setup(kg, sd, state, ray, eval_task);
+#else
+   return false;
+#endif  /* __BACKGROUND__ */
+}
+
+ccl_device_forceinline void kernel_path_background_finish(
+   KernelGlobals *kg,
+   ccl_addr_space PathState *state,
+   ccl_addr_space Ray *ray,
+   float3 throughput,
+   ShaderData *sd,
+   PathRadiance *L,
+   ShaderEvalTask *eval_task)
+{
+#ifdef __BACKGROUND__
+   /* sample background shader */
+   float3 L_background = indirect_background_finish(kg, sd, state, ray, 
eval_task);
path_radiance_accum_background(L, state, throughput, L_background);
 #endif  /* __BACKGROUND__ */
 }
 
+ccl_device_forceinline void kernel_path_background(
+   KernelGlobals *kg,
+   ccl_addr_space PathState *state,
+   ccl_addr_space Ray *ray,
+   float3 throughput,
+   ShaderData *sd,
+   PathRadiance *L)
+{
+#ifdef __BACKGROUND__
+   MAKE_POINTER_TO_LOCAL_OBJ(ShaderEvalTask, shader_eval_task);
+   if(kernel_path_background_setup(kg, state, ray, throughput, sd, L, 
shader_eval_task)) {
+   shader_eval(kg, sd, state, shader_eval_task);
+   kernel_path_background_finish(kg, state, ray, throughput, sd, 
L, shader_eval_task);
+   }
+#else
+   kernel_path_background_setup(kg, state, ray, throughput, sd, L, NULL);
+#endif  /* __BACKGROUND__ */
+}
+
 #ifndef __SPLIT_KERNEL__
 
 #ifdef __VOLUME__

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


[Bf-blender-cvs] [711c2d328aa] split-kernel-faster-building: Cycles: Split the indirect_background function

2017-11-13 Thread Mai Lavelle
Commit: 711c2d328aafd2918c30827c69d1d24c9d353f25
Author: Mai Lavelle
Date:   Tue Nov 14 00:00:24 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rB711c2d328aafd2918c30827c69d1d24c9d353f25

Cycles: Split the indirect_background function

===

M   intern/cycles/kernel/kernel_emission.h

===

diff --git a/intern/cycles/kernel/kernel_emission.h 
b/intern/cycles/kernel/kernel_emission.h
index 65ed8edea9c..4b693a274b7 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -351,10 +351,11 @@ ccl_device_noinline bool 
indirect_lamp_emission(KernelGlobals *kg,
 
 /* Indirect Background */
 
-ccl_device_noinline float3 indirect_background(KernelGlobals *kg,
+ccl_device_noinline bool indirect_background_setup(KernelGlobals *kg,
ShaderData *emission_sd,
ccl_addr_space PathState *state,
-   ccl_addr_space Ray *ray)
+   ccl_addr_space Ray *ray,
+   ShaderEvalTask *eval_task)
 {
 #ifdef __BACKGROUND__
int shader = kernel_data.background.surface_shader;
@@ -367,7 +368,7 @@ ccl_device_noinline float3 
indirect_background(KernelGlobals *kg,
   ((shader & SHADER_EXCLUDE_TRANSMIT) && (state->flag & 
PATH_RAY_TRANSMIT)) ||
   ((shader & SHADER_EXCLUDE_CAMERA) && (state->flag & 
PATH_RAY_CAMERA)) ||
   ((shader & SHADER_EXCLUDE_SCATTER) && (state->flag & 
PATH_RAY_VOLUME_SCATTER)))
-   return make_float3(0.0f, 0.0f, 0.0f);
+   return false;
}
 
/* evaluate background closure */
@@ -376,13 +377,25 @@ ccl_device_noinline float3 
indirect_background(KernelGlobals *kg,
shader_setup_from_background(kg, emission_sd, _ray);
 #  else
shader_setup_from_background(kg, emission_sd, ray);
-#  endif
+#  endif  /* __SPLIT_KERNEL__ */
 
path_state_modify_bounce(state, true);
-   float3 L = shader_eval_background(kg, emission_sd, state, state->flag);
+   shader_eval_task_setup(kg, eval_task, emission_sd, 
SHADER_EVAL_INTENT_BACKGROUND, state->flag, 0);
+#endif  /* __BACKGROUND__ */
+   return true;
+}
+
+ccl_device_noinline float3 indirect_background_finish(KernelGlobals *kg,
+   ShaderData *emission_sd,
+   ccl_addr_space PathState *state,
+   ccl_addr_space Ray *ray,
+   ShaderEvalTask *eval_task)
+{
+#ifdef __BACKGROUND__
+   float3 L = eval_task->eval_result;
path_state_modify_bounce(state, false);
 
-#ifdef __BACKGROUND_MIS__
+#  ifdef __BACKGROUND_MIS__
/* check if background light exists or if we should skip pdf */
int res = kernel_data.integrator.pdf_background_res;
 
@@ -394,12 +407,29 @@ ccl_device_noinline float3 
indirect_background(KernelGlobals *kg,
 
return L*mis_weight;
}
-#endif
+#  endif  /* __BACKGROUND_MIS__ */
 
return L;
 #else
return make_float3(0.8f, 0.8f, 0.8f);
-#endif
+#endif  /* __BACKGROUND__ */
+}
+
+ccl_device_noinline float3 indirect_background(KernelGlobals *kg,
+   ShaderData *emission_sd,
+   ccl_addr_space PathState *state,
+   ccl_addr_space Ray *ray)
+{
+#ifdef __BACKGROUND__
+   MAKE_POINTER_TO_LOCAL_OBJ(ShaderEvalTask, shader_eval_task);
+   if(!indirect_background_setup(kg, emission_sd, state, ray, 
shader_eval_task)) {
+   return make_float3(0.0f, 0.0f, 0.0f);
+   }
+   shader_eval(kg, emission_sd, state, shader_eval_task);
+   return indirect_background_finish(kg, emission_sd, state, ray, 
shader_eval_task);
+#else
+   return make_float3(0.8f, 0.8f, 0.8f);
+#endif  /* __BACKGROUND__ */
 }
 
 CCL_NAMESPACE_END

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


[Bf-blender-cvs] [2cacb36c77e] split-kernel-faster-building: Cycles: Modify kernel_indirect_background to remove call to svm_eval_nodes

2017-11-13 Thread Mai Lavelle
Commit: 2cacb36c77e56026990644beb6b84ab58b204e10
Author: Mai Lavelle
Date:   Tue Nov 14 01:36:39 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rB2cacb36c77e56026990644beb6b84ab58b204e10

Cycles: Modify kernel_indirect_background to remove call to svm_eval_nodes

Speeds up kernel building by another 2-3 seconds. Rendering is
another 1% slower.

===

M   intern/cycles/device/device_split_kernel.cpp
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
M   intern/cycles/kernel/kernels/cuda/kernel_split.cu
M   intern/cycles/kernel/kernels/opencl/kernel_indirect_background.cl
M   
intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
M   intern/cycles/kernel/split/kernel_indirect_background.h
M   intern/cycles/kernel/split/kernel_queue_enqueue.h

===

diff --git a/intern/cycles/device/device_split_kernel.cpp 
b/intern/cycles/device/device_split_kernel.cpp
index bcc438c86c2..7135169f238 100644
--- a/intern/cycles/device/device_split_kernel.cpp
+++ b/intern/cycles/device/device_split_kernel.cpp
@@ -245,6 +245,7 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
ENQUEUE_SPLIT_KERNEL(do_volume, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(queue_enqueue, 
global_size, local_size);
ENQUEUE_SPLIT_KERNEL(indirect_background, 
global_size, local_size);
+   ENQUEUE_SPLIT_KERNEL(shader_eval, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(shader_setup, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(shader_sort, global_size, 
local_size);
ENQUEUE_SPLIT_KERNEL(shader_eval, global_size, 
local_size);
diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index bc822523b06..a861d5ec30a 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -1447,6 +1447,9 @@ typedef enum QueueNumber {
 #  endif
 #endif  /* __BRANCHED_PATH__ */
 
+   /* For temporarily holding rays that need to be shaded. */
+   QUEUE_SHADER_EVAL,
+
NUM_QUEUES
 } QueueNumber;
 
diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h 
b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
index fdeb7dcd3e4..ecc2bb13eba 100644
--- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
+++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
@@ -215,7 +215,7 @@ DEFINE_SPLIT_KERNEL_FUNCTION(scene_intersect)
 DEFINE_SPLIT_KERNEL_FUNCTION(lamp_emission)
 DEFINE_SPLIT_KERNEL_FUNCTION(do_volume)
 DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(queue_enqueue, QueueEnqueueLocals)
-DEFINE_SPLIT_KERNEL_FUNCTION(indirect_background)
+DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(indirect_background, uint)
 DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(shader_setup, uint)
 DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(shader_sort, ShaderSortLocals)
 DEFINE_SPLIT_KERNEL_FUNCTION(shader_eval)
diff --git a/intern/cycles/kernel/kernels/cuda/kernel_split.cu 
b/intern/cycles/kernel/kernels/cuda/kernel_split.cu
index 43b3d0aa0e6..41044b65347 100644
--- a/intern/cycles/kernel/kernels/cuda/kernel_split.cu
+++ b/intern/cycles/kernel/kernels/cuda/kernel_split.cu
@@ -108,7 +108,7 @@ DEFINE_SPLIT_KERNEL_FUNCTION(scene_intersect)
 DEFINE_SPLIT_KERNEL_FUNCTION(lamp_emission)
 DEFINE_SPLIT_KERNEL_FUNCTION(do_volume)
 DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(queue_enqueue, QueueEnqueueLocals)
-DEFINE_SPLIT_KERNEL_FUNCTION(indirect_background)
+DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(indirect_background, uint)
 DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(shader_setup, uint)
 DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(shader_sort, ShaderSortLocals)
 DEFINE_SPLIT_KERNEL_FUNCTION(shader_eval)
diff --git a/intern/cycles/kernel/kernels/opencl/kernel_indirect_background.cl 
b/intern/cycles/kernel/kernels/opencl/kernel_indirect_background.cl
index 192d01444ba..77d25aee295 100644
--- a/intern/cycles/kernel/kernels/opencl/kernel_indirect_background.cl
+++ b/intern/cycles/kernel/kernels/opencl/kernel_indirect_background.cl
@@ -19,6 +19,8 @@
 #include "kernel/split/kernel_indirect_background.h"
 
 #define KERNEL_NAME indirect_background
+#define LOCALS_TYPE unsigned int
 #include "kernel/kernels/opencl/kernel_split_function.h"
 #undef KERNEL_NAME
+#undef LOCALS_TYPE
 
diff --git 
a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
 
b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
index f638a230e12..df8ebfc6480 100644
--- 
a/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
+++ 
b/intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
@@ -66,8 +66,31 @@ ccl_device void 

[Bf-blender-cvs] [212a8d9e5ae] master: Cycles: Make per-object random value output also work for Lamps

2017-11-13 Thread Lukas Stockner
Commit: 212a8d9e5ae78a30ed4c35161d91eeca35eaa41f
Author: Lukas Stockner
Date:   Sun Nov 5 21:59:17 2017 +0100
Branches: master
https://developer.blender.org/rB212a8d9e5ae78a30ed4c35161d91eeca35eaa41f

Cycles: Make per-object random value output also work for Lamps

===

M   intern/cycles/blender/blender_object.cpp
M   intern/cycles/blender/blender_sync.h
M   intern/cycles/kernel/geom/geom_object.h
M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/svm/svm_geometry.h
M   intern/cycles/render/light.cpp
M   intern/cycles/render/light.h

===

diff --git a/intern/cycles/blender/blender_object.cpp 
b/intern/cycles/blender/blender_object.cpp
index eb573b75e9e..f02d5496112 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -112,6 +112,7 @@ static uint object_ray_visibility(BL::Object& b_ob)
 void BlenderSync::sync_light(BL::Object& b_parent,
  int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
  BL::Object& b_ob,
+ BL::DupliObject& b_dupli_ob,
  Transform& tfm,
  bool *use_portal)
 {
@@ -193,6 +194,13 @@ void BlenderSync::sync_light(BL::Object& b_parent,
 
light->max_bounces = get_int(clamp, "max_bounces");
 
+   if(b_dupli_ob) {
+   light->random_id = b_dupli_ob.random_id();
+   }
+   else {
+   light->random_id = 
hash_int_2d(hash_string(b_ob.name().c_str()), 0);
+   }
+
if(light->type == LIGHT_AREA)
light->is_portal = get_boolean(clamp, "is_portal");
else
@@ -271,7 +279,7 @@ Object *BlenderSync::sync_object(BL::Object& b_parent,
if(object_is_light(b_ob)) {
/* don't use lamps for excluded layers used as mask layer */
if(!motion && !((layer_flag & render_layer.holdout_layer) && 
(layer_flag & render_layer.exclude_layer)))
-   sync_light(b_parent, persistent_id, b_ob, tfm, 
use_portal);
+   sync_light(b_parent, persistent_id, b_ob, b_dupli_ob, 
tfm, use_portal);
 
return NULL;
}
diff --git a/intern/cycles/blender/blender_sync.h 
b/intern/cycles/blender/blender_sync.h
index 11e279b81c4..e7b71ae9310 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -131,6 +131,7 @@ private:
void sync_light(BL::Object& b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::Object& b_ob,
+   BL::DupliObject& b_dupli_ob,
Transform& tfm,
bool *use_portal);
void sync_background_light(bool use_portal);
diff --git a/intern/cycles/kernel/geom/geom_object.h 
b/intern/cycles/kernel/geom/geom_object.h
index 1ffc143be34..a276096a745 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -244,6 +244,17 @@ ccl_device_inline float object_pass_id(KernelGlobals *kg, 
int object)
return f.y;
 }
 
+/* Per lamp random number for shader variation */
+
+ccl_device_inline float lamp_random_number(KernelGlobals *kg, int lamp)
+{
+   if(lamp == LAMP_NONE)
+   return 0.0f;
+
+   float4 f = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 4);
+   return f.y;
+}
+
 /* Per object random number for shader variation */
 
 ccl_device_inline float object_random_number(KernelGlobals *kg, int object)
diff --git a/intern/cycles/kernel/kernel_shader.h 
b/intern/cycles/kernel/kernel_shader.h
index 239c6b12bdf..26d3fcf15b2 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -57,6 +57,7 @@ ccl_device_noinline void shader_setup_from_ray(KernelGlobals 
*kg,
 #ifdef __INSTANCING__
sd->object = (isect->object == PRIM_NONE)? 
kernel_tex_fetch(__prim_object, isect->prim): isect->object;
 #endif
+   sd->lamp = LAMP_NONE;
 
sd->type = isect->type;
sd->flag = 0;
@@ -265,6 +266,7 @@ ccl_device_inline void 
shader_setup_from_sample(KernelGlobals *kg,
 #ifdef __INSTANCING__
sd->object = object;
 #endif
+   sd->lamp = LAMP_NONE;
/* currently no access to bvh prim index for strand sd->prim*/
sd->prim = prim;
 #ifdef __UV__
@@ -286,6 +288,7 @@ ccl_device_inline void 
shader_setup_from_sample(KernelGlobals *kg,
else if(lamp != LAMP_NONE) {
sd->ob_tfm  = lamp_fetch_transform(kg, lamp, false);
sd->ob_itfm = lamp_fetch_transform(kg, lamp, true);
+   sd->lamp = lamp;
 #endif
}
 
@@ -391,6 +394,7 @@ ccl_device_inline void 
shader_setup_from_background(KernelGlobals *kg, ShaderDat
 #ifdef __INSTANCING__

[Bf-blender-cvs] [d8066fb0f14] master: Cycles: Refactor closure roughness detection to fix a potential bug with Denoising of specular shaders

2017-11-13 Thread Lukas Stockner
Commit: d8066fb0f145395594d0a952a4c0f70206dc0214
Author: Lukas Stockner
Date:   Sun Nov 5 21:43:23 2017 +0100
Branches: master
https://developer.blender.org/rBd8066fb0f145395594d0a952a4c0f70206dc0214

Cycles: Refactor closure roughness detection to fix a potential bug with 
Denoising of specular shaders

===

M   intern/cycles/kernel/closure/bsdf.h
M   intern/cycles/kernel/kernel_passes.h
M   intern/cycles/kernel/svm/svm_types.h
M   intern/cycles/util/util_math.h

===

diff --git a/intern/cycles/kernel/closure/bsdf.h 
b/intern/cycles/kernel/closure/bsdf.h
index 0a3f9ff23fe..e4573024e85 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -36,6 +36,22 @@
 
 CCL_NAMESPACE_BEGIN
 
+/* Returns the square of the roughness of the closure if it has roughness,
+ * 0 for singular closures and 1 otherwise. */
+ccl_device_inline float bsdf_get_roughness_sqr(const ShaderClosure *sc)
+{
+   if(CLOSURE_IS_BSDF_SINGULAR(sc->type)) {
+   return 0.0f;
+   }
+
+   if(CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
+   MicrofacetBsdf *bsdf = (MicrofacetBsdf*) sc;
+   return bsdf->alpha_x*bsdf->alpha_y;
+   }
+
+   return 1.0f;
+}
+
 ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
ShaderData *sd,
const ShaderClosure *sc,
@@ -438,23 +454,5 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure 
*b)
 #endif
 }
 
-/* Classifies a closure as diffuse-like or specular-like.
- * This is needed for the denoising feature pass generation,
- * which are written on the first bounce where more than 25%
- * of the sampling weight belongs to diffuse-line closures. */
-ccl_device_inline bool bsdf_is_specular_like(ShaderClosure *sc)
-{
-   if(CLOSURE_IS_BSDF_TRANSPARENT(sc->type)) {
-   return true;
-   }
-
-   if(CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
-   MicrofacetBsdf *bsdf = (MicrofacetBsdf*) sc;
-   return (bsdf->alpha_x*bsdf->alpha_y <= 0.075f*0.075f);
-   }
-
-   return false;
-}
-
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/kernel_passes.h 
b/intern/cycles/kernel/kernel_passes.h
index b31356905f2..6bed73ad459 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -140,7 +140,7 @@ ccl_device_inline void 
kernel_update_denoising_features(KernelGlobals *kg,
/* All closures contribute to the normal feature, but only 
diffuse-like ones to the albedo. */
normal += sc->N * sc->sample_weight;
sum_weight += sc->sample_weight;
-   if(!bsdf_is_specular_like(sc)) {
+   if(bsdf_get_roughness_sqr(sc) > sqr(0.075f)) {
albedo += sc->weight;
sum_nonspecular_weight += sc->sample_weight;
}
diff --git a/intern/cycles/kernel/svm/svm_types.h 
b/intern/cycles/kernel/svm/svm_types.h
index f08ec76c055..c7fe7948422 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -465,13 +465,16 @@ typedef enum ClosureType {
 #define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_REFLECTION_ID && 
type <= CLOSURE_BSDF_HAIR_REFLECTION_ID)
 #define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= 
CLOSURE_BSDF_TRANSLUCENT_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID)
 #define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID || type 
== CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID)
+#define CLOSURE_IS_BSDF_SINGULAR(type) (type == CLOSURE_BSDF_REFLECTION_ID || \
+type == CLOSURE_BSDF_REFRACTION_ID || \
+type == CLOSURE_BSDF_TRANSPARENT_ID)
 #define CLOSURE_IS_BSDF_TRANSPARENT(type) (type == CLOSURE_BSDF_TRANSPARENT_ID)
-#define CLOSURE_IS_BSDF_ANISOTROPIC(type) (type >= 
CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID && type <= 
CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID)
 #define CLOSURE_IS_BSDF_MULTISCATTER(type) (type == 
CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID ||\
 type == 
CLOSURE_BSDF_MICROFACET_MULTI_GGX_ANISO_ID || \
 type == 
CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID)
-#define CLOSURE_IS_BSDF_MICROFACET(type) ((type >= CLOSURE_BSDF_REFLECTION_ID 
&& type <= CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID) ||\
-  (type >= CLOSURE_BSDF_REFRACTION_ID 
&& type <= CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID))
+#define CLOSURE_IS_BSDF_MICROFACET(type) ((type >= 
CLOSURE_BSDF_MICROFACET_GGX_ID && type <= 
CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID) ||\
+  (type >= 
CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID && type <= 

[Bf-blender-cvs] [f4026382116] master: Cleanup on depsgraph logic

2017-11-13 Thread Dalai Felinto
Commit: f4026382116b2fbd93c5f539addd5c03db01892a
Author: Dalai Felinto
Date:   Mon Nov 13 12:17:14 2017 -0200
Branches: master
https://developer.blender.org/rBf4026382116b2fbd93c5f539addd5c03db01892a

Cleanup on depsgraph logic

===

M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index ce56901c52f..3ec42fd956f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1581,7 +1581,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Object 
*ob)
 mom_geom_key,
 "Metaball Motherball Transform -> 
Geometry");
}
-   else if (mom != ob) {
+   else {
ComponentKey transform_key(>id, 
DEG_NODE_TYPE_TRANSFORM);
add_relation(geom_key, mom_geom_key, "Metaball 
Motherball");
add_relation(transform_key, mom_geom_key, 
"Metaball Motherball");

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


[Bf-blender-cvs] [1cb6cea71c1] blender2.8: Merge remote-tracking branch 'origin/master' into blender2.8

2017-11-13 Thread Dalai Felinto
Commit: 1cb6cea71c10c0d22ba9cdd3eee5111d0734c193
Author: Dalai Felinto
Date:   Mon Nov 13 11:48:48 2017 -0200
Branches: blender2.8
https://developer.blender.org/rB1cb6cea71c10c0d22ba9cdd3eee5111d0734c193

Merge remote-tracking branch 'origin/master' into blender2.8

===



===

diff --cc source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 2c0aa951ffa,35bb24cc6aa..3e7ea039cad
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@@ -987,18 -813,24 +987,25 @@@ void DepsgraphNodeBuilder::build_obdata
case OB_MBALL:
{
Object *mom = BKE_mball_basis_find(scene_, ob);
-   /* Motherball - mom depends on children! */
+   /* NOTE: Only the motherball gets evaluated, it's 
children are
+* having empty placeholders for the correct relations 
being built.
+*/
if (mom == ob) {
/* metaball evaluation operations */
-   /* NOTE: only the motherball gets evaluated! */
op_node = add_operation_node(obdata,
 
DEG_NODE_TYPE_GEOMETRY,
 -   
function_bind(BKE_mball_eval_geometry,
 - _1,
 - 
(MetaBall *)obdata),
 +   function_bind(
 +   
BKE_mball_eval_geometry,
 +   _1,
 +   (MetaBall 
*)obdata_cow),
 
DEG_OPCODE_PLACEHOLDER,
 "Geometry Eval");
+   } else {
+   op_node = add_operation_node(obdata,
+
DEG_NODE_TYPE_GEOMETRY,
+NULL,
+
DEG_OPCODE_PLACEHOLDER,
+"Geometry Eval");
op_node->set_as_entry();
}
break;

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


[Bf-blender-cvs] [330febba5a5] greasepencil-object: Cleanup UI and unused fields

2017-11-13 Thread Antonio Vazquez
Commit: 330febba5a547ef1238dfb51c0ea1d8905eaf374
Author: Antonio Vazquez
Date:   Mon Nov 13 14:35:14 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB330febba5a547ef1238dfb51c0ea1d8905eaf374

Cleanup UI and unused fields

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/modifiers/intern/MOD_gpencilsmooth.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index da68565e571..e54dd19dfb3 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1580,10 +1580,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
 def GP_SMOOTH(self, layout, ob, md):
 gpd = ob.data
-split = layout.split()
-
-col = split.column()
-row = col.row(align=False)
+row = layout.row(align=False)
 row.prop(md, "factor")
 row.prop(md, "step")
 
@@ -1594,6 +1591,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 row.prop_search(md, "layer", gpd, "layers", text="", 
icon='GREASEPENCIL')
 row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
 
+col = split.column()
 col.label("Vertex Group:")
 row = col.row(align=True)
 row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
diff --git a/source/blender/modifiers/intern/MOD_gpencilsmooth.c 
b/source/blender/modifiers/intern/MOD_gpencilsmooth.c
index 43bc0b0803a..d9fde45f7e1 100644
--- a/source/blender/modifiers/intern/MOD_gpencilsmooth.c
+++ b/source/blender/modifiers/intern/MOD_gpencilsmooth.c
@@ -87,7 +87,6 @@ static void deformStroke(ModifierData *md, const 
EvaluationContext *UNUSED(eval_
 
/* smooth stroke */
if (mmd->factor > 0.0f) {
-   float reduce = 0.0f;
for (int r = 0; r < mmd->step; ++r) {
for (int i = 0; i < gps->totpoints; i++) {
pt = >points[i];
@@ -97,7 +96,7 @@ static void deformStroke(ModifierData *md, const 
EvaluationContext *UNUSED(eval_
continue;
}
 
-   val = (mmd->factor - reduce) * weight;
+   val = mmd->factor * weight;
/* perform smoothing */
if (mmd->flag & GP_SMOOTH_MOD_LOCATION) {
BKE_gp_smooth_stroke(gps, i, val, 
false);
@@ -109,7 +108,6 @@ static void deformStroke(ModifierData *md, const 
EvaluationContext *UNUSED(eval_
BKE_gp_smooth_stroke_thickness(gps, i, 
val);
}
}
-   //reduce += 0.25f;  // reduce the factor
}
}
 }

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


[Bf-blender-cvs] [8a03e4d409e] master: Depsgraph: Fix relations for metaballs

2017-11-13 Thread Sergey Sharybin
Commit: 8a03e4d409ec71beab612facf432eb57f3bc5f34
Author: Sergey Sharybin
Date:   Mon Nov 13 14:43:08 2017 +0100
Branches: master
https://developer.blender.org/rB8a03e4d409ec71beab612facf432eb57f3bc5f34

Depsgraph: Fix relations for metaballs

Initially spotted and investigated by Dalai and Germano.

===

M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 7ac94141f39..35bb24cc6aa 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -813,10 +813,11 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object *ob)
case OB_MBALL:
{
Object *mom = BKE_mball_basis_find(scene_, ob);
-   /* Motherball - mom depends on children! */
+   /* NOTE: Only the motherball gets evaluated, it's 
children are
+* having empty placeholders for the correct relations 
being built.
+*/
if (mom == ob) {
/* metaball evaluation operations */
-   /* NOTE: only the motherball gets evaluated! */
op_node = add_operation_node(obdata,
 
DEG_NODE_TYPE_GEOMETRY,
 
function_bind(BKE_mball_eval_geometry,
@@ -824,6 +825,12 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object *ob)
   
(MetaBall *)obdata),
 
DEG_OPCODE_PLACEHOLDER,
 "Geometry Eval");
+   } else {
+   op_node = add_operation_node(obdata,
+
DEG_NODE_TYPE_GEOMETRY,
+NULL,
+
DEG_OPCODE_PLACEHOLDER,
+"Geometry Eval");
op_node->set_as_entry();
}
break;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 3448525a50d..ce56901c52f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1572,13 +1572,19 @@ void DepsgraphRelationBuilder::build_obdata_geom(Object 
*ob)
case OB_MBALL:
{
Object *mom = BKE_mball_basis_find(scene_, ob);
+   ComponentKey mom_geom_key(>id, 
DEG_NODE_TYPE_GEOMETRY);
/* motherball - mom depends on children! */
-   if (mom != ob) {
-   /* non-motherball -> cannot be directly 
evaluated! */
-   ComponentKey mom_key(>id, 
DEG_NODE_TYPE_GEOMETRY);
+   if (mom == ob) {
+   ComponentKey mom_transform_key(>id,
+  
DEG_NODE_TYPE_TRANSFORM);
+   add_relation(mom_transform_key,
+mom_geom_key,
+"Metaball Motherball Transform -> 
Geometry");
+   }
+   else if (mom != ob) {
ComponentKey transform_key(>id, 
DEG_NODE_TYPE_TRANSFORM);
-   add_relation(geom_key, mom_key, "Metaball 
Motherball");
-   add_relation(transform_key, mom_key, "Metaball 
Motherball");
+   add_relation(geom_key, mom_geom_key, "Metaball 
Motherball");
+   add_relation(transform_key, mom_geom_key, 
"Metaball Motherball");
}
break;
}

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


[Bf-blender-cvs] [0dc9be1ef99] greasepencil-object: Fix merge errors

2017-11-13 Thread Antonio Vazquez
Commit: 0dc9be1ef995e2185724ed5d351f40c659398928
Author: Antonio Vazquez
Date:   Mon Nov 13 19:13:12 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB0dc9be1ef995e2185724ed5d351f40c659398928

Fix merge errors

===

M   source/blender/draw/engines/gpencil/gpencil_engine.h

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 8d259fcf7ac..ea5acc6b00a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -53,8 +53,8 @@ struct GPENCIL_StorageList;
 #define MULTISAMPLE_GP_SYNC_ENABLE(dfbl, fbl) { \
if ((U.ogl_multisamples > 0) && (dfbl->multisample_fb != NULL)) { \
DRW_stats_query_start("GP Multisample Blit"); \
-   DRW_framebuffer_blit(fbl->temp_color_fb, dfbl->multisample_fb, 
false); \
-   DRW_framebuffer_blit(fbl->temp_color_fb, dfbl->multisample_fb, 
true); \
+   DRW_framebuffer_blit(fbl->temp_color_fb, dfbl->multisample_fb, 
false, false); \
+   DRW_framebuffer_blit(fbl->temp_color_fb, dfbl->multisample_fb, 
true, false); \
DRW_framebuffer_bind(dfbl->multisample_fb); \
DRW_stats_query_end(); \
} \
@@ -63,8 +63,8 @@ struct GPENCIL_StorageList;
 #define MULTISAMPLE_GP_SYNC_DISABLE(dfbl, fbl) { \
if ((U.ogl_multisamples > 0) && (dfbl->multisample_fb != NULL)) { \
DRW_stats_query_start("GP Multisample Resolve"); \
-   DRW_framebuffer_blit(dfbl->multisample_fb, fbl->temp_color_fb, 
false); \
-   DRW_framebuffer_blit(dfbl->multisample_fb, fbl->temp_color_fb, 
true); \
+   DRW_framebuffer_blit(dfbl->multisample_fb, fbl->temp_color_fb, 
false, false); \
+   DRW_framebuffer_blit(dfbl->multisample_fb, fbl->temp_color_fb, 
true, false); \
DRW_framebuffer_bind(fbl->temp_color_fb); \
DRW_stats_query_end(); \
} \

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


[Bf-blender-cvs] [28142f5fa53] greasepencil-object: WIP: More work in smooth process

2017-11-13 Thread Antonio Vazquez
Commit: 28142f5fa537a492dbb788d3c1aef306ef78f233
Author: Antonio Vazquez
Date:   Mon Nov 13 19:31:40 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB28142f5fa537a492dbb788d3c1aef306ef78f233

WIP: More work in smooth process

===

M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/modifiers/intern/MOD_gpencilsmooth.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 394dcb59b89..26a2217f9a3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1138,8 +1138,11 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
for (int r = 0; r < brush->draw_smoothlvl; ++r) {
for (i = 0; i < gps->totpoints; i++) {
BKE_gp_smooth_stroke(gps, i, 
brush->draw_smoothfac - reduce, false);
-   BKE_gp_smooth_stroke_strength(gps, i, 
brush->draw_smoothfac - reduce);
-   BKE_gp_smooth_stroke_thickness(gps, i, 
brush->draw_smoothfac - reduce);
+   BKE_gp_smooth_stroke_strength(gps, i, 
brush->draw_smoothfac);
+   /* thickness needs to repeat process 
several times */
+   for (int r2 = 0; r2 < 10; ++r2) {
+   
BKE_gp_smooth_stroke_thickness(gps, i, brush->draw_smoothfac);
+   }
}
reduce += 0.25f;  // reduce the factor
}
diff --git a/source/blender/modifiers/intern/MOD_gpencilsmooth.c 
b/source/blender/modifiers/intern/MOD_gpencilsmooth.c
index d9fde45f7e1..38791383c04 100644
--- a/source/blender/modifiers/intern/MOD_gpencilsmooth.c
+++ b/source/blender/modifiers/intern/MOD_gpencilsmooth.c
@@ -104,8 +104,11 @@ static void deformStroke(ModifierData *md, const 
EvaluationContext *UNUSED(eval_
if (mmd->flag & GP_SMOOTH_MOD_STRENGTH) {
BKE_gp_smooth_stroke_strength(gps, i, 
val);
}
-   if (mmd->flag & GP_SMOOTH_MOD_THICKNESS) {
-   BKE_gp_smooth_stroke_thickness(gps, i, 
val);
+   if ((mmd->flag & GP_SMOOTH_MOD_THICKNESS)  && 
(val > 0)) {
+   /* thickness need to repeat process 
several times */
+   for (int r2 = 0; r2 < r * 10; ++r2) {
+   
BKE_gp_smooth_stroke_thickness(gps, i, val);
+   }
}
}
}

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


[Bf-blender-cvs] [5819ab66fab] greasepencil-object: WIP: Check minimum tablet pressure

2017-11-13 Thread Antonio Vazquez
Commit: 5819ab66fabbb86fed31dff6417401ae9ee2b254
Author: Antonio Vazquez
Date:   Mon Nov 13 16:45:33 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5819ab66fabbb86fed31dff6417401ae9ee2b254

WIP: Check minimum tablet pressure

In some tablets when the user ends the stroke the tablet send several events 
with a pressure of 0 or with very low values. These low pressure values produce 
weird lines at the end of the stroke.

===

M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/makesdna/DNA_gpencil_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index d45c42f0f05..df125cc2ec7 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -417,7 +417,11 @@ class GreasePencilBrushOptionsPanel:
 col.label(text="Stroke Quality:")
 col.prop(brush, "pen_smooth_factor")
 col.prop(brush, "pen_smooth_steps")
-col.prop(brush, "pen_stabilize_factor")
+
+row = col.row(align=True)
+row.prop(brush, "pen_stabilize_factor")
+row.prop(brush, "pen_pressure_threshold")
+
 row = col.row(align=True)
 row.prop(brush, "pen_density")
 row.prop(brush, "pen_noise_factor")
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index b44a88da903..ea3042dcc01 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -279,11 +279,15 @@ static bool gp_stroke_filtermval(tGPsdata *p, const int 
mval[2], int pmval[2])
 {
int dx = abs(mval[0] - pmval[0]);
int dy = abs(mval[1] - pmval[1]);
-   
+
+   /* check a minimum amount of pressure (some tablets send very low 
values at the end of stroke) */
+   if (p->pressure < p->brush->draw_threshold)
+   return false;
+
/* if buffer is empty, just let this go through (i.e. so that dots will 
work) */
if (p->gpd->sbuffer_size == 0)
return true;
-   
+
/* check if mouse moved at least certain distance on both axes (best 
case)
 *  - aims to eliminate some jitter-noise from input when trying to 
draw straight lines freehand
 */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h 
b/source/blender/makesdna/DNA_gpencil_types.h
index 0d9111cee0e..972ec658c63 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -130,6 +130,8 @@ typedef struct bGPDbrush {
float draw_stabangle; /* factor to determine if the point is noise 
or not */
float draw_thicknesfac;   /* factor to smooth thickness */
float draw_strengthfac;   /* factor to smooth strength (alpha) */
+   float draw_threshold; /* minimum pressure to consider is drawing */
+   char pad[4];
 } bGPDbrush;
 
 /* bGPDbrush->flag */
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 59a4d09e4a1..0d37af14875 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2367,6 +2367,15 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
"Amount of smoothing while drawing for strength");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
+   /* Minimum amount of pressure in tablets while drawing */
+   prop = RNA_def_property(srna, "pen_pressure_threshold", PROP_FLOAT, 
PROP_NONE);
+   RNA_def_property_float_sdna(prop, NULL, "draw_threshold");
+   RNA_def_property_range(prop, 0.0, 1.0f);
+   RNA_def_property_float_default(prop, 0.0f);
+   RNA_def_property_ui_text(prop, "Threshold",
+   "Minimum tablet pressure to consider the pencil is drawing");
+   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
/* Subdivision level for new strokes */
prop = RNA_def_property(srna, "pen_subdivision_steps", PROP_INT, 
PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sublevel");

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


[Bf-blender-cvs] [f4beb64020d] blender2.8: Fix quick smoke getting view_render from the wrong place

2017-11-13 Thread Dalai Felinto
Commit: f4beb64020dec7729b298bd6660e19a02b89e948
Author: Dalai Felinto
Date:   Mon Nov 13 14:15:36 2017 -0200
Branches: blender2.8
https://developer.blender.org/rBf4beb64020dec7729b298bd6660e19a02b89e948

Fix quick smoke getting view_render from the wrong place

===

M   release/scripts/startup/bl_operators/object_quick_effects.py

===

diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py 
b/release/scripts/startup/bl_operators/object_quick_effects.py
index 39191a896c9..c18f50def82 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -365,7 +365,7 @@ class QuickSmoke(Operator):
 # Setup material
 
 # Cycles
-if context.scene.render.use_shading_nodes:
+if context.scene.view_render.use_shading_nodes or 
context.view_render.use_shading_nodes:
 bpy.ops.object.material_slot_add()
 
 mat = bpy.data.materials.new("Smoke Domain Material")

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


[Bf-blender-cvs] [c03361474b2] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

2017-11-13 Thread Antonio Vazquez
Commit: c03361474b28da3766a074c10e79e90780c7ebf1
Author: Antonio Vazquez
Date:   Mon Nov 13 19:02:50 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc03361474b28da3766a074c10e79e90780c7ebf1

Merge branch 'blender2.8' into greasepencil-object

===



===



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


[Bf-blender-cvs] [e70c28e484e] fluid-mantaflow: fix for alembic mesh exporter

2017-11-13 Thread Sebastián Barschkis
Commit: e70c28e484efb81d0e5e3f15e622e5c8b4577fa8
Author: Sebastián Barschkis
Date:   Mon Nov 13 19:45:34 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBe70c28e484efb81d0e5e3f15e622e5c8b4577fa8

fix for alembic mesh exporter

liquids and smoke can both be of domain type. checking for smoke domain needed 
to be more specific, i.e. now checking domain type as well.

===

M   source/blender/alembic/intern/abc_exporter.cc

===

diff --git a/source/blender/alembic/intern/abc_exporter.cc 
b/source/blender/alembic/intern/abc_exporter.cc
index 4fe65b96f36..dfcf0e2cf2d 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -42,6 +42,7 @@ extern "C" {
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_space_types.h"  /* for FILE_MAX */
+#include "DNA_smoke_types.h"
 
 #include "BLI_string.h"
 
@@ -102,7 +103,8 @@ static bool object_is_smoke_sim(Object *ob)
 
if (md) {
SmokeModifierData *smd = reinterpret_cast(md);
-   return (smd->type == MOD_SMOKE_TYPE_DOMAIN);
+   return (smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain &&
+   smd->domain->type == MOD_SMOKE_DOMAIN_TYPE_GAS);
}
 
return false;

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


[Bf-blender-cvs] [b668b186d7f] fluid-mantaflow: fix for alembic particle exporter

2017-11-13 Thread Sebastián Barschkis
Commit: b668b186d7fcaffe6f3356dc941b14eaeaf24852
Author: Sebastián Barschkis
Date:   Mon Nov 13 20:52:56 2017 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBb668b186d7fcaffe6f3356dc941b14eaeaf24852

fix for alembic particle exporter

added missing type checks for manta particle systems

===

M   source/blender/alembic/intern/abc_exporter.cc

===

diff --git a/source/blender/alembic/intern/abc_exporter.cc 
b/source/blender/alembic/intern/abc_exporter.cc
index dfcf0e2cf2d..14d987ed108 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -541,7 +541,11 @@ void AbcExporter::createParticleSystemsWriters(Object *ob, 
AbcTransformWriter *x
m_settings.export_child_hairs = true;
m_shapes.push_back(new AbcHairWriter(m_scene, ob, 
xform, m_shape_sampling_index, m_settings, psys));
}
-   else if (m_settings.export_particles && psys->part->type == 
PART_EMITTER) {
+   else if (m_settings.export_particles &&
+(psys->part->type == PART_EMITTER || 
psys->part->type == PART_MANTA_FLIP ||
+ psys->part->type == PART_MANTA_DROP || 
psys->part->type == PART_MANTA_BUBBLE ||
+ psys->part->type == PART_MANTA_FLOAT || 
psys->part->type == PART_MANTA_TRACER))
+   {
m_shapes.push_back(new AbcPointsWriter(m_scene, ob, 
xform, m_shape_sampling_index, m_settings, psys));
}
}

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


[Bf-blender-cvs] [0b7c2ef28b5] greasepencil-object: Smooth Strength and Thickness too

2017-11-13 Thread Antonio Vazquez
Commit: 0b7c2ef28b5c4ea9df07219c93332ed41a82333f
Author: Antonio Vazquez
Date:   Mon Nov 13 18:12:52 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB0b7c2ef28b5c4ea9df07219c93332ed41a82333f

Smooth Strength and Thickness too

===

M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index d98c5335013..394dcb59b89 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1137,8 +1137,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
float reduce = 0.0f;
for (int r = 0; r < brush->draw_smoothlvl; ++r) {
for (i = 0; i < gps->totpoints; i++) {
-   /* NOTE: No pressure smoothing, or else 
we get annoying thickness changes while drawing... */
BKE_gp_smooth_stroke(gps, i, 
brush->draw_smoothfac - reduce, false);
+   BKE_gp_smooth_stroke_strength(gps, i, 
brush->draw_smoothfac - reduce);
+   BKE_gp_smooth_stroke_thickness(gps, i, 
brush->draw_smoothfac - reduce);
}
reduce += 0.25f;  // reduce the factor
}

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


[Bf-blender-cvs] [aaed57792fa] greasepencil-object: Improve subdivide stroke while drawing

2017-11-13 Thread Antonio Vazquez
Commit: aaed57792fa29dae5fbfe586018d79dafdc20770
Author: Antonio Vazquez
Date:   Mon Nov 13 17:58:58 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBaaed57792fa29dae5fbfe586018d79dafdc20770

Improve subdivide stroke while drawing

Now instead of create a point half way, a smooth process is applicated.

===

M   source/blender/editors/gpencil/gpencil_intern.h
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_utils.c

===

diff --git a/source/blender/editors/gpencil/gpencil_intern.h 
b/source/blender/editors/gpencil/gpencil_intern.h
index f09373662c6..ff0a6cf0848 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -118,7 +118,7 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, 
bGPDstroke *gps, bGPDstroke
 bool gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool affect_pressure);
 bool gp_smooth_stroke_strength(bGPDstroke *gps, int i, float inf);
 bool gp_smooth_stroke_thickness(bGPDstroke *gps, int i, float inf);
-void gp_subdivide_stroke(bGPDstroke *gps, const int new_totpoints);
+void gp_subdivide_stroke(bGPDstroke *gps, const int sublevel);
 void gp_randomize_stroke(bGPDstroke *gps, bGPDbrush *brush);
 
 /* Layers Enums -- */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index ea3042dcc01..d98c5335013 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -964,13 +964,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->flag |= GP_STROKE_RECALC_CACHES;
 
/* allocate enough memory for a continuous array for storage points */
-   int sublevel = brush->sublevel;
-   int new_totpoints = gps->totpoints;
-   
-   for (i = 0; i < sublevel; i++) {
-   new_totpoints += new_totpoints - 1;
-   }
-   gps->points = MEM_callocN(sizeof(bGPDspoint) * new_totpoints, 
"gp_stroke_points");
+   const int sublevel = brush->sublevel;
+
+   gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, 
"gp_stroke_points");
/* initialize triangle memory to dummy data */
gps->triangles = MEM_callocN(sizeof(bGPDtriangle), "GP Stroke 
triangulation");
gps->flag |= GP_STROKE_RECALC_CACHES;
@@ -1124,15 +1120,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
pt->weights = NULL;
}
 
-   /* subdivide the stroke */
+   /* subdivide and smooth the stroke */
if (sublevel > 0) {
-   int totpoints = gps->totpoints;
-   for (i = 0; i < sublevel; i++) {
-   /* we're adding one new point between each pair 
of verts on each step */
-   totpoints += totpoints - 1;
-
-   gp_subdivide_stroke(gps, totpoints);
-   }
+   gp_subdivide_stroke(gps, sublevel);
}
/* apply randomness to stroke */
if (brush->draw_random_sub > 0.0f) {
diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index b3b33b6b3aa..b6327bc62ae 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -702,34 +702,77 @@ bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, Scene 
*scene, const float screen
 /**
  * Subdivide a stroke once, by adding a point half way between each pair of 
existing points
  * \param gps   Stroke data
- * \param new_totpoints Total number of points (after subdividing)
+ * \param sublevel  Number of times to subdivide
  */
-void gp_subdivide_stroke(bGPDstroke *gps, const int new_totpoints)
+void gp_subdivide_stroke(bGPDstroke *gps, const int sublevel)
 {
-   /* Move points towards end of enlarged points array to leave space for 
new points */
-   int y = 1;
-   for (int i = gps->totpoints - 1; i > 0; i--) {
-   gps->points[new_totpoints - y] = gps->points[i];
-   y += 2;
-   }
-   
-   /* Create interpolated points */
-   for (int i = 0; i < new_totpoints - 1; i += 2) {
-   bGPDspoint *prev  = >points[i];
-   bGPDspoint *pt= >points[i + 1];
-   bGPDspoint *next  = >points[i + 2];
-   
-   /* Interpolate all values */
-   interp_v3_v3v3(>x, >x, >x, 0.5f);
-   
-   pt->pressure = interpf(prev->pressure, next->pressure, 0.5f);
-   pt->strength = interpf(prev->strength, next->strength, 0.5f);
-   CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f);
-