[Bf-blender-cvs] [f12040e088b] master: DRW: Opti: Fix hotspot in DRW_mesh_batch_cache_get_surface_shaded

2019-04-05 Thread Clément Foucault
Commit: f12040e088b66748340b0d7472d1155596e0f9e2
Author: Clément Foucault
Date:   Sat Apr 6 01:55:21 2019 +0200
Branches: master
https://developer.blender.org/rBf12040e088b66748340b0d7472d1155596e0f9e2

DRW: Opti: Fix hotspot in DRW_mesh_batch_cache_get_surface_shaded

The hotspot was generated by mesh_cd_layers_type_overlap who was testing
way more data than it should have.

Here we reduce the whole CD layer mask to a 32bit bitflag that is easily
or'ed and tested.

Bonus point: We use atomic operation to merge the mask in order to allow
future multi-threading. (this was a TODO)

In the scene attached to T58188 this removes 5% of CPU time.

===

M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/intern/draw_cache_impl_mesh.c

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index aea08f87a84..3ac606fc48f 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -41,6 +41,7 @@ set(INC
 
../../../intern/glew-mx
../../../intern/guardedalloc
+   ../../../intern/atomic
 )
 
 set(INC_SYS
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index e47d46aca09..5643d23c7cd 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -48,6 +48,7 @@
 #include "BKE_mesh_runtime.h"
 #include "BKE_object_deform.h"
 
+#include "atomic_ops.h"
 
 #include "bmesh.h"
 
@@ -78,6 +79,14 @@ typedef struct DRW_MeshWeightState {
int   defgroup_sel_count;
 } DRW_MeshWeightState;
 
+typedef struct DRW_MeshCDMask {
+   uint32_t uv : 8;
+   uint32_t tan : 8;
+   uint32_t vcol : 8;
+   uint32_t orco : 1;
+   uint32_t tan_orco : 1;
+} DRW_MeshCDMask;
+
 /* DRW_MeshWeightState.flags */
 enum {
DRW_MESH_WEIGHT_STATE_MULTIPAINT  = (1 << 0),
@@ -354,72 +363,63 @@ BLI_INLINE bool bm_edge_is_loose_and_visible(const BMEdge 
*e)
 }
 
 /* Return true is all layers in _b_ are inside _a_. */
-static bool mesh_cd_layers_type_overlap(
-const uchar av[CD_NUMTYPES], const ushort al[CD_NUMTYPES],
-const uchar bv[CD_NUMTYPES], const ushort bl[CD_NUMTYPES])
+BLI_INLINE bool mesh_cd_layers_type_overlap(DRW_MeshCDMask a, DRW_MeshCDMask b)
 {
-   for (int i = 0; i < CD_NUMTYPES; ++i) {
-   if ((av[i] & bv[i]) != bv[i]) {
-   return false;
-   }
-   if ((al[i] & bl[i]) != bl[i]) {
-   return false;
-   }
-   }
-   return true;
+   return (*((uint32_t *)&a) & *((uint32_t *)&b)) == *((uint32_t *)&b);
 }
 
-static void mesh_cd_layers_type_merge(
-uchar av[CD_NUMTYPES], ushort al[CD_NUMTYPES],
-uchar bv[CD_NUMTYPES], ushort bl[CD_NUMTYPES])
+BLI_INLINE void mesh_cd_layers_type_merge(DRW_MeshCDMask *a, DRW_MeshCDMask b)
 {
-   for (int i = 0; i < CD_NUMTYPES; ++i) {
-   av[i] |= bv[i];
-   al[i] |= bl[i];
-   }
+   atomic_fetch_and_or_uint32((uint32_t *)a, *(uint32_t *)&b);
+}
+
+BLI_INLINE void mesh_cd_layers_type_clear(DRW_MeshCDMask *a)
+{
+   *((uint32_t *)a) = 0;
 }
 
 static void mesh_cd_calc_active_uv_layer(
-const Mesh *me, ushort cd_lused[CD_NUMTYPES])
+const Mesh *me, DRW_MeshCDMask *cd_used)
 {
const CustomData *cd_ldata = (me->edit_mesh) ? 
&me->edit_mesh->bm->ldata : &me->ldata;
 
int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
if (layer != -1) {
-   cd_lused[CD_MLOOPUV] |= (1 << layer);
+   cd_used->uv |= (1 << layer);
}
 }
 
 static void mesh_cd_calc_active_mask_uv_layer(
-const Mesh *me, ushort cd_lused[CD_NUMTYPES])
+const Mesh *me, DRW_MeshCDMask *cd_used)
 {
const CustomData *cd_ldata = (me->edit_mesh) ? 
&me->edit_mesh->bm->ldata : &me->ldata;
 
int layer = CustomData_get_stencil_layer(cd_ldata, CD_MLOOPUV);
if (layer != -1) {
-   cd_lused[CD_MLOOPUV] |= (1 << layer);
+   cd_used->uv |= (1 << layer);
}
 }
 
 static void mesh_cd_calc_active_vcol_layer(
-const Mesh *me, ushort cd_lused[CD_NUMTYPES])
+const Mesh *me, DRW_MeshCDMask *cd_used)
 {
const CustomData *cd_ldata = (me->edit_mesh) ? 
&me->edit_mesh->bm->ldata : &me->ldata;
 
int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL);
if (layer != -1) {
-   cd_lused[CD_MLOOPCOL] |= (1 << layer);
+   cd_used->vcol |= (1 << layer);
}
 }
 
-static void mesh_cd_calc_used_gpu_layers(
-const Mesh *me, uchar cd_vused[CD_NUMTYPES], ushort 
cd_lused[CD_NUMTYPES],
-struct GPUMaterial **gpumat_array, int gpumat_array_len)
+static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(
+ 

[Bf-blender-cvs] [542725d3e97] master: GPU: Fix typo

2019-04-05 Thread Clément Foucault
Commit: 542725d3e97314019ec065beaa54a30793a4a613
Author: Clément Foucault
Date:   Fri Apr 5 20:46:13 2019 +0200
Branches: master
https://developer.blender.org/rB542725d3e97314019ec065beaa54a30793a4a613

GPU: Fix typo

===

M   source/blender/gpu/intern/gpu_codegen.c

===

diff --git a/source/blender/gpu/intern/gpu_codegen.c 
b/source/blender/gpu/intern/gpu_codegen.c
index 355ca083274..0b69b0c6cd8 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1963,7 +1963,7 @@ static bool gpu_pass_shader_validate(GPUPass *pass)
 
/* Validate against opengl limit. */
if ((frag_samplers_len > GPU_max_textures_frag()) ||
-   (frag_samplers_len > GPU_max_textures_vert()))
+   (vert_samplers_len > GPU_max_textures_vert()))
{
return false;
}

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


[Bf-blender-cvs] [fefc9c95e48] master: DRW: Opti: Replace bound tex/ubo tracking array by bitfields

2019-04-05 Thread Clément Foucault
Commit: fefc9c95e4818768ba08c665111d2e405ae72672
Author: Clément Foucault
Date:   Fri Apr 5 20:45:32 2019 +0200
Branches: master
https://developer.blender.org/rBfefc9c95e4818768ba08c665111d2e405ae72672

DRW: Opti: Replace bound tex/ubo tracking array by bitfields

release_texture_slots() and release_ubo_slots() were one hotspot when
drawing taking ~9% of total CPU counters for no reason.

This was because of the loops using GPU_max_textures that was overkill and
slow.

Replace those by a simple 64bit bitwise OR operation.

===

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

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index e31c2f5cbbd..cde7b283976 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -644,18 +644,7 @@ static void drw_viewport_var_init(void)
}
 
/* Alloc array of texture reference. */
-   if (DST.RST.bound_texs == NULL) {
-   DST.RST.bound_texs = MEM_callocN(sizeof(GPUTexture *) * 
GPU_max_textures(), "Bound GPUTexture refs");
-   }
-   if (DST.RST.bound_tex_slots == NULL) {
-   DST.RST.bound_tex_slots = MEM_callocN(sizeof(char) * 
GPU_max_textures(), "Bound Texture Slots");
-   }
-   if (DST.RST.bound_ubos == NULL) {
-   DST.RST.bound_ubos = MEM_callocN(sizeof(GPUUniformBuffer *) * 
GPU_max_ubo_binds(), "Bound GPUUniformBuffer refs");
-   }
-   if (DST.RST.bound_ubo_slots == NULL) {
-   DST.RST.bound_ubo_slots = MEM_callocN(sizeof(char) * 
GPU_max_ubo_binds(), "Bound Ubo Slots");
-   }
+   memset(&DST.RST, 0x0, sizeof(DST.RST));
 
if (G_draw.view_ubo == NULL) {
G_draw.view_ubo = 
DRW_uniformbuffer_create(sizeof(ViewUboStorage), NULL);
@@ -2796,11 +2785,6 @@ void DRW_engines_free(void)
DRW_TEXTURE_FREE_SAFE(G_draw.weight_ramp);
MEM_SAFE_FREE(g_pos_format);
 
-   MEM_SAFE_FREE(DST.RST.bound_texs);
-   MEM_SAFE_FREE(DST.RST.bound_tex_slots);
-   MEM_SAFE_FREE(DST.RST.bound_ubos);
-   MEM_SAFE_FREE(DST.RST.bound_ubo_slots);
-
MEM_SAFE_FREE(DST.uniform_names.buffer);
 
DRW_opengl_context_disable();
diff --git a/source/blender/draw/intern/draw_manager.h 
b/source/blender/draw/intern/draw_manager.h
index 45721951abf..03f6eef225e 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -313,6 +313,7 @@ typedef struct DRWDebugSphere {
 
 /* - DRAW MANAGER  */
 
+#define DST_MAX_SLOTS 64 /* Cannot be changed without modifying 
RST.bound_tex_slots */
 #define MAX_CLIP_PLANES 6 /* GL_MAX_CLIP_PLANES is at least 6 */
 #define STENCIL_UNDEFINED 256
 typedef struct DRWManager {
@@ -394,12 +395,16 @@ typedef struct DRWManager {
 
/** GPU Resource State: Memory storage between drawing. */
struct {
-   GPUTexture **bound_texs;
-   char *bound_tex_slots;
-   int bind_tex_inc;
-   GPUUniformBuffer **bound_ubos;
-   char *bound_ubo_slots;
-   int bind_ubo_inc;
+   /* High end GPUs supports up to 32 binds per shader stage.
+* We only use textures during the vertex and fragment stage,
+* so 2 * 32 slots is a nice limit. */
+   GPUTexture *bound_texs[DST_MAX_SLOTS];
+   uint64_t bound_tex_slots;
+   uint64_t bound_tex_slots_persist;
+
+   GPUUniformBuffer *bound_ubos[DST_MAX_SLOTS];
+   uint64_t bound_ubo_slots;
+   uint64_t bound_ubo_slots_persist;
} RST;
 
struct {
diff --git a/source/blender/draw/intern/draw_manager_exec.c 
b/source/blender/draw/intern/draw_manager_exec.c
index 7dc42c4d459..52c3f773e77 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -22,9 +22,9 @@
 
 #include "draw_manager.h"
 
+#include "BLI_math_bits.h"
 #include "BLI_mempool.h"
 
-
 #include "BKE_global.h"
 
 #include "GPU_draw.h"
@@ -892,55 +892,97 @@ enum {
BIND_PERSIST = 2,  /* Release slot only after the next shader 
change. */
 };
 
+static void set_bound_flags(uint64_t *slots, uint64_t *persist_slots, int 
slot_idx, char bind_type)
+{
+   uint64_t slot = 1lu << slot_idx;
+   *slots |= slot;
+   if (bind_type == BIND_PERSIST) {
+   *persist_slots |= slot;
+   }
+}
+
+static int get_empty_slot_index(uint64_t slots)
+{
+   uint64_t empty_slots = ~slots;
+   /* Find first empty slot using bitscan. */
+   if (empty_slots != 0) {
+   if ((empty_slots & 0xlu) != 0) {
+   return (int)bi

[Bf-blender-cvs] [1456a030f42] functions: initial IR for vector addition

2019-04-05 Thread Jacques Lucke
Commit: 1456a030f42161a374875227ab83f9b177625e86
Author: Jacques Lucke
Date:   Fri Apr 5 19:31:11 2019 +0200
Branches: functions
https://developer.blender.org/rB1456a030f42161a374875227ab83f9b177625e86

initial IR for vector addition

===

M   source/blender/functions/backends/llvm/builder.hpp
M   source/blender/functions/functions/vectors.cpp

===

diff --git a/source/blender/functions/backends/llvm/builder.hpp 
b/source/blender/functions/backends/llvm/builder.hpp
index ca3cfcb698b..bd259e4dcc0 100644
--- a/source/blender/functions/backends/llvm/builder.hpp
+++ b/source/blender/functions/backends/llvm/builder.hpp
@@ -217,6 +217,41 @@ namespace FN {
this->getModule(), llvm::Intrinsic::sin, 
value->getType());
return m_builder.CreateCall(function, value);
}
+
+   llvm::Value *CreateStructToVector(llvm::Value *value)
+   {
+   llvm::Type *struct_type = value->getType();
+   BLI_assert(struct_type->isStructTy());
+   uint length = struct_type->getStructNumElements();
+
+   llvm::Type *base_type = 
struct_type->getStructElementType(0);
+   llvm::Type *vector_type = llvm::VectorType::get(
+   base_type, length);
+
+   llvm::Value *output = 
llvm::UndefValue::get(vector_type);
+   for (uint i = 0; i < length; i++) {
+   output = m_builder.CreateInsertElement(output, 
m_builder.CreateExtractValue(value, i), i);
+   }
+   return output;
+   }
+
+   llvm::Value *CreateVectorToStruct(llvm::Value *value)
+   {
+   llvm::Type *vector_type = value->getType();
+   BLI_assert(vector_type->isVectorTy());
+   uint length = vector_type->getVectorNumElements();
+
+   llvm::Type *base_type = 
vector_type->getVectorElementType();
+   LLVMTypes types(length);
+   types.fill(base_type);
+   llvm::Type *struct_type = this->getStructType(types);
+
+   llvm::Value *output = 
llvm::UndefValue::get(struct_type);
+   for (uint i = 0; i < length; i++) {
+   output = m_builder.CreateInsertValue(output, 
m_builder.CreateExtractElement(value, i), i);
+   }
+   return output;
+   }
};
 
 } /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/functions/vectors.cpp 
b/source/blender/functions/functions/vectors.cpp
index d3a224dadfd..fd32604aa2d 100644
--- a/source/blender/functions/functions/vectors.cpp
+++ b/source/blender/functions/functions/vectors.cpp
@@ -112,10 +112,25 @@ namespace FN { namespace Functions {
}
};
 
+   class AddVectorsGen : public LLVMBuildIRBody {
+   void build_ir(
+   CodeBuilder &builder,
+   CodeInterface &interface,
+   const BuildIRSettings &UNUSED(settings)) const override
+   {
+   llvm::Value *a = 
builder.CreateStructToVector(interface.get_input(0));
+   llvm::Value *b = 
builder.CreateStructToVector(interface.get_input(1));
+   llvm::Value *result = builder.CreateFAdd(a, b);
+   result = builder.CreateVectorToStruct(result);
+   interface.set_output(0, result);
+   }
+   };
+
LAZY_INIT_REF__NO_ARG(SharedFunction, add_vectors)
{
auto fn = get_math_function__two_inputs("Add Vectors");
fn->add_body(new AddVectors());
+   fn->add_body(new AddVectorsGen());
return fn;
}

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


[Bf-blender-cvs] [0f42dd82ac8] functions: new Vector Math node

2019-04-05 Thread Jacques Lucke
Commit: 0f42dd82ac8bee12a7b5c87e3899e003e28eb15f
Author: Jacques Lucke
Date:   Fri Apr 5 18:57:31 2019 +0200
Branches: functions
https://developer.blender.org/rB0f42dd82ac8bee12a7b5c87e3899e003e28eb15f

new Vector Math node

===

A   release/scripts/startup/function_nodes/nodes/vector_math.py
M   source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
M   source/blender/functions/functions/vectors.cpp
M   source/blender/functions/functions/vectors.hpp

===

diff --git a/release/scripts/startup/function_nodes/nodes/vector_math.py 
b/release/scripts/startup/function_nodes/nodes/vector_math.py
new file mode 100644
index 000..ede35101eb3
--- /dev/null
+++ b/release/scripts/startup/function_nodes/nodes/vector_math.py
@@ -0,0 +1,25 @@
+import bpy
+from bpy.props import *
+from .. base import FunctionNode
+
+operation_items = [
+("ADD", "Add", "", "", 1),
+]
+
+class VectorMathNode(bpy.types.Node, FunctionNode):
+bl_idname = "fn_VectorMathNode"
+bl_label = "Vector Math"
+
+operation: EnumProperty(
+name="Operation",
+items=operation_items,
+update=FunctionNode.refresh,
+)
+
+def declaration(self, builder):
+builder.fixed_input("a", "A", "Vector")
+builder.fixed_input("b", "B", "Vector")
+builder.fixed_output("result", "Result", "Vector")
+
+def draw(self, layout):
+layout.prop(self, "operation", text="")
\ No newline at end of file
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp 
b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
index 8acbbda499e..ac9973c8c2a 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
@@ -55,6 +55,31 @@ namespace FN { namespace DataFlowNodes {
builder.map_sockets(node, bnode);
}
 
+   static SharedFunction &get_vector_math_function(int operation)
+   {
+   switch (operation)
+   {
+   case 1: return Functions::add_vectors();
+   default:
+   BLI_assert(false);
+   return *(SharedFunction *)nullptr;
+   }
+   }
+
+   static void insert_vector_math_node(
+   Builder &builder,
+   const BuilderContext &ctx,
+   bNode *bnode)
+   {
+   PointerRNA ptr;
+   ctx.get_rna(bnode, &ptr);
+   int operation = RNA_enum_get(&ptr, "operation");
+
+   SharedFunction &fn = get_vector_math_function(operation);
+   Node *node = builder.insert_function(fn, ctx.btree(), bnode);
+   builder.map_sockets(node, bnode);
+   }
+
static void insert_clamp_node(
Builder &builder,
const BuilderContext &ctx,
@@ -185,6 +210,7 @@ namespace FN { namespace DataFlowNodes {
 
inserters.reg_node_inserter("fn_ObjectTransformsNode", 
insert_object_transforms_node);
inserters.reg_node_inserter("fn_FloatMathNode", 
insert_float_math_node);
+   inserters.reg_node_inserter("fn_VectorMathNode", 
insert_vector_math_node);
inserters.reg_node_inserter("fn_ClampNode", insert_clamp_node);
inserters.reg_node_inserter("fn_GetListElementNode", 
insert_get_list_element_node);
inserters.reg_node_inserter("fn_PackListNode", 
insert_pack_list_node);
diff --git a/source/blender/functions/functions/vectors.cpp 
b/source/blender/functions/functions/vectors.cpp
index 96f84a0aec6..d3a224dadfd 100644
--- a/source/blender/functions/functions/vectors.cpp
+++ b/source/blender/functions/functions/vectors.cpp
@@ -89,4 +89,34 @@ namespace FN { namespace Functions {
return fn;
}
 
+
+   static SharedFunction get_math_function__two_inputs(std::string name)
+   {
+   auto fn = SharedFunction::New(name, Signature({
+   InputParameter("A", get_fvec3_type()),
+   InputParameter("B", get_fvec3_type()),
+   }, {
+   OutputParameter("Result", get_fvec3_type()),
+   }));
+   return fn;
+   }
+
+
+   class AddVectors : public TupleCallBody {
+   void call(Tuple &fn_in, Tuple &fn_out, ExecutionContext 
&UNUSED(ctx)) const override
+   {
+   Vector a = fn_in.get(0);
+   Vector b = fn_in.get(1);
+   Vector result(a.x + b.x, a.y + b.y, a.z + b.z);
+   fn_out.set(0, result);
+   }
+   };
+
+   LAZY_INIT_REF__NO_ARG(SharedFunction, add_vectors)
+   {
+   auto fn = get

[Bf-blender-cvs] [2219f28a68b] master: Cleanup: Fix compiler warning

2019-04-05 Thread Antonioya
Commit: 2219f28a68b69ba227270abadbcaa431601d42dc
Author: Antonioya
Date:   Fri Apr 5 18:50:13 2019 +0200
Branches: master
https://developer.blender.org/rB2219f28a68b69ba227270abadbcaa431601d42dc

Cleanup: Fix compiler warning

===

M   source/blender/editors/include/ED_view3d.h

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 02ea0027938..2a115f49c31 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -450,7 +450,7 @@ void ED_view3d_draw_offscreen(
 int drawtype,
 struct View3D *v3d, struct ARegion *ar, int winx, int winy, float 
viewmat[4][4],
 float winmat[4][4], bool do_sky, bool is_persp, const char *viewname,
-struct GPUFXSettings *fx_settings, bool do_color_managment,
+struct GPUFXSettings *fx_settings, const bool do_color_managment,
 struct GPUOffScreen *ofs, struct GPUViewport *viewport);
 void ED_view3d_draw_setup_view(
 struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene 
*scene, struct ARegion *ar, struct View3D *v3d,

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


[Bf-blender-cvs] [cb158219e0d] functions: Generate LLVM IR for Mul and Sin

2019-04-05 Thread Jacques Lucke
Commit: cb158219e0d25007527f041dfc5a8ff8d40b389a
Author: Jacques Lucke
Date:   Fri Apr 5 18:44:01 2019 +0200
Branches: functions
https://developer.blender.org/rBcb158219e0d25007527f041dfc5a8ff8d40b389a

Generate LLVM IR for Mul and Sin

===

M   source/blender/functions/backends/llvm/builder.hpp
M   source/blender/functions/functions/scalar_math.cpp

===

diff --git a/source/blender/functions/backends/llvm/builder.hpp 
b/source/blender/functions/backends/llvm/builder.hpp
index ecd49d6158b..ca3cfcb698b 100644
--- a/source/blender/functions/backends/llvm/builder.hpp
+++ b/source/blender/functions/backends/llvm/builder.hpp
@@ -131,6 +131,11 @@ namespace FN {
return m_builder.CreateFAdd(a, b);
}
 
+   llvm::Value *CreateFMul(llvm::Value *a, llvm::Value *b)
+   {
+   return m_builder.CreateFMul(a, b);
+   }
+
llvm::Value *CreateAllocaBytes_VoidPtr(uint amount)
{
llvm::Type *size_type = this->getFixedSizeType(amount);
@@ -205,6 +210,13 @@ namespace FN {
{
return m_builder.CreateGEP(addr, index);
}
+
+   llvm::Value *CreateSin(llvm::Value *value)
+   {
+   auto *function = llvm::Intrinsic::getDeclaration(
+   this->getModule(), llvm::Intrinsic::sin, 
value->getType());
+   return m_builder.CreateCall(function, value);
+   }
};
 
 } /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/functions/scalar_math.cpp 
b/source/blender/functions/functions/scalar_math.cpp
index cb0bc76b92d..71533aab758 100644
--- a/source/blender/functions/functions/scalar_math.cpp
+++ b/source/blender/functions/functions/scalar_math.cpp
@@ -73,10 +73,24 @@ namespace FN { namespace Functions {
}
};
 
+   class MultiplyFloatsGen : public LLVMBuildIRBody {
+   void build_ir(
+   CodeBuilder &builder,
+   CodeInterface &interface,
+   const BuildIRSettings &UNUSED(settings)) const override
+   {
+   auto output = builder.CreateFMul(
+   interface.get_input(0),
+   interface.get_input(1));
+   interface.set_output(0, output);
+   }
+   };
+
LAZY_INIT_REF__NO_ARG(SharedFunction, multiply_floats)
{
auto fn = get_math_function__two_inputs("Multiply Floats");
fn->add_body(new MultiplyFloats());
+   fn->add_body(new MultiplyFloatsGen());
return fn;
}
 
@@ -165,10 +179,22 @@ namespace FN { namespace Functions {
}
};
 
+   class SinFloatGen : public LLVMBuildIRBody {
+   void build_ir(
+   CodeBuilder &builder,
+   CodeInterface &interface,
+   const BuildIRSettings &UNUSED(settings)) const override
+   {
+   auto output = builder.CreateSin(interface.get_input(0));
+   interface.set_output(0, output);
+   }
+   };
+
LAZY_INIT_REF__NO_ARG(SharedFunction, sin_float)
{
auto fn = get_math_function__one_input("Sin");
fn->add_body(new SinFloat());
+   fn->add_body(new SinFloatGen());
return fn;
}

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


[Bf-blender-cvs] [f1be941769b] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-04-05 Thread Antonioya
Commit: f1be941769baf810eef7362af813f6e7bba670ae
Author: Antonioya
Date:   Fri Apr 5 18:29:11 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBf1be941769baf810eef7362af813f6e7bba670ae

Merge branch 'master' 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] [6e81e5c7095] sculpt-mode-features: Sculpt vertex colors: Initial implementation

2019-04-05 Thread Pablo Dobarro
Commit: 6e81e5c70952004f6d24f58d2047227f2e73f1e9
Author: Pablo Dobarro
Date:   Fri Apr 5 17:56:58 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rB6e81e5c70952004f6d24f58d2047227f2e73f1e9

Sculpt vertex colors: Initial implementation

This adds a new CustomDataLayer to store per vertex color data in a way
that can be used from sculpt mode. This vertex paint mode uses the same
brush, pbvh, undo and rendering code as sculpt mode, so it has much
better performance.  It also enables other features like sculpting and
painting at the same time.

I also added some extra features that are needed to start testing this
paint mode, such as:
- New paint brush optimized for painting. It doesn't modify any vertex
position data.
- Sculpt mode sample color operator that uses the active vertex from the
cursor
- Remesh reprojection support: sculpt vertex colors are reprojected into
the new mesh when using the remesh operator if the mesh has that option
enabled.
- Store and load sculpt vertex colors into the regular vertex color
layers to keep compatibility.
- Use the single color display mode to disable sculpt vertex colors in
sculpt mode.

A lot of decisions needs to be made to integrate this in Blender, so I
decided to keep the implementation as unintrusive as possible to start
working on the tools. This has the following limitations:

- Sculpt and paint at the same time is only enabled in the draw brush.
You need to set the Color Mode to Mix in the brush options.
- Dyntopo and multires modes and viewport display are broken
- Only mix as a color blend mode
- No brush texture support
- Sculpt and color share the same strength
- Limited to one layer per object
- No rendering support. You will need to copy the sculpt vertex colors
to the old color layers first.

All of these issues should be addressed once the main workflow, final UI
and behavior are decided.

===

M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   release/scripts/startup/bl_ui/space_topbar.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/pbvh.c
M   
source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
M   
source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
M   source/blender/draw/engines/workbench/workbench_materials.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_intern.h
M   source/blender/editors/object/object_ops.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   source/blender/gpu/GPU_buffers.h
M   source/blender/gpu/intern/gpu_buffers.c
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesdna/DNA_customdata_types.h
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/makesdna/DNA_meshdata_types.h
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index de178496c56..bf2a1d00d20 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -453,6 +453,10 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, Panel):
 col.operator("mesh.vertex_color_add", icon='ADD', text="")
 col.operator("mesh.vertex_color_remove", icon='REMOVE', text="")
 
+row = layout.row()
+col = row.column()
+col.operator("object.vertex_to_loop_colors", text="Store sculpt color")
+col.operator("object.loop_to_vertex_colors", text="Load sculpt color")
 
 class DATA_PT_remesh(MeshButtonsPanel, Panel):
 bl_label = "Remesh"
@@ -467,6 +471,7 @@ class DATA_PT_remesh(MeshButtonsPanel, Panel):
 mesh = context.mesh
 col.prop(mesh, "voxel_size")
 col.prop(mesh, "smooth_normals")
+col.prop(mesh, "reproject_vertex_paint")
 col.operator("object.remesh", text="Remesh")
 
 
diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 7b9b324066a..71c46b2f931 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -229,8 +229,10 @@ class _draw_left_context_mode:
 return
 
 from .properties_paint_common import (
+UnifiedPaintPanel,
 brush_basic_sculpt_settings,
 )
+UnifiedPaintPan

[Bf-blender-cvs] [e559074c4e5] master: Fix T61035 Draw manager crash opening file with curves

2019-04-05 Thread Clément Foucault
Commit: e559074c4e5d5c17b00f6b7e2466c179f05034d8
Author: Clément Foucault
Date:   Fri Apr 5 17:48:14 2019 +0200
Branches: master
https://developer.blender.org/rBe559074c4e5d5c17b00f6b7e2466c179f05034d8

Fix T61035 Draw manager crash opening file with curves

Move free callback call to GPU_batch_discard to prevent the crash.

The issue was that clearing can happen after referencing to an instance
buffer and that's perfectly legal.

===

M   source/blender/gpu/GPU_batch.h
M   source/blender/gpu/intern/gpu_batch.c

===

diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index 3d013eb8af4..d789a65a3a4 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -106,7 +106,7 @@ void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch 
*batch_src);
 #define GPU_batch_init(batch, prim, verts, elem) \
GPU_batch_init_ex(batch, prim, verts, elem, 0)
 
-void GPU_batch_clear(GPUBatch *); /* Same as discard but does not free. */
+void GPU_batch_clear(GPUBatch *); /* Same as discard but does not free. (does 
not clal free callback) */
 void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */
 
 void GPU_batch_vao_cache_clear(GPUBatch *);
diff --git a/source/blender/gpu/intern/gpu_batch.c 
b/source/blender/gpu/intern/gpu_batch.c
index 5f00fec7c88..ddd1b056ee7 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -120,10 +120,6 @@ void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch 
*batch_src)
 
 void GPU_batch_clear(GPUBatch *batch)
 {
-   if (batch->free_callback) {
-   batch->free_callback(batch, batch->callback_data);
-   }
-
if (batch->owns_flag & GPU_BATCH_OWNS_INDEX) {
GPU_indexbuf_discard(batch->elem);
}
@@ -145,6 +141,10 @@ void GPU_batch_clear(GPUBatch *batch)
 
 void GPU_batch_discard(GPUBatch *batch)
 {
+   if (batch->free_callback) {
+   batch->free_callback(batch, batch->callback_data);
+   }
+
GPU_batch_clear(batch);
MEM_freeN(batch);
 }

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


[Bf-blender-cvs] [d140e597a6a] master: Fix T63281: Drivers inside nodegroups inside nodegroups don't show up in Driver Editor

2019-04-05 Thread Sebastian Parborg
Commit: d140e597a6a8f2bef8cbc2626effef41025b5688
Author: Sebastian Parborg
Date:   Fri Apr 5 16:28:34 2019 +0200
Branches: master
https://developer.blender.org/rBd140e597a6a8f2bef8cbc2626effef41025b5688

Fix T63281: Drivers inside nodegroups inside nodegroups don't show up in Driver 
Editor

Recurse into node groups when looking for drivers.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D4653

===

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

===

diff --git a/source/blender/editors/animation/anim_filter.c 
b/source/blender/editors/animation/anim_filter.c
index 17d74e8324f..dad0727a82d 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1968,8 +1968,9 @@ static size_t animdata_filter_ds_nodetree(bAnimContext 
*ac, ListBase *anim_data,
if ((ads->filterflag & ADS_FILTER_ONLYSEL) && 
(node->flag & NODE_SELECT) == 0) {
continue;
}
-   items += animdata_filter_ds_nodetree_group(ac, 
anim_data, ads, owner_id, (bNodeTree *) node->id,
-  
filter_mode | ANIMFILTER_TMP_IGNORE_ONLYSEL);
+   /* Recurse into the node group */
+   items += animdata_filter_ds_nodetree(ac, 
anim_data, ads, owner_id, (bNodeTree *) node->id,
+
filter_mode | ANIMFILTER_TMP_IGNORE_ONLYSEL);
}
}
}

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


[Bf-blender-cvs] [df99c54b5b8] master: EEVEE: Fix compilation

2019-04-05 Thread Jeroen Bakker
Commit: df99c54b5b84a13532a44db06187e1a494de8889
Author: Jeroen Bakker
Date:   Fri Apr 5 15:02:55 2019 +0200
Branches: master
https://developer.blender.org/rBdf99c54b5b84a13532a44db06187e1a494de8889

EEVEE: Fix compilation

Introduced by f0d6879f5c7998be98ac406bd6ddaa5104961206

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 9f3ea4acfb1..034f93cc273 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2099,7 +2099,7 @@ void node_tex_image_linear_no_mip(vec3 co, sampler2D ima, 
out vec4 color, out fl
 void node_tex_image_nearest(vec3 co, sampler2D ima, out vec4 color, out float 
alpha)
 {
ivec2 pix = ivec2(fract(co.xy) * textureSize(ima, 0).xy);
-   color = clamp(texelFetch(ima, pix, 0));
+   color = safe_color(texelFetch(ima, pix, 0));
alpha = color.a;
 }

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


[Bf-blender-cvs] [d220a87b47e] master: Fix T63283: Second subdivision modifier does not ignore crease

2019-04-05 Thread Sergey Sharybin
Commit: d220a87b47e317996e58cf5c597c872bc8970925
Author: Sergey Sharybin
Date:   Fri Apr 5 14:13:05 2019 +0200
Branches: master
https://developer.blender.org/rBd220a87b47e317996e58cf5c597c872bc8970925

Fix T63283: Second subdivision modifier does not ignore crease

This is something where there is no single correct behavior,
sometimes it's needed to ignore the crease to make mesh more
smooth. But sometimes crease is to be considered after first
subdivision surface: for example, when adding extra subdivisions
for render-time displacement.

Made it an option whether modifier needs to take crease into
account or not.

Existing files should be openable in the 2.7 compatible way,
to re-create an old behavior the options is to be manually
disabled in the modifier settings.

Reviewers: brecht

Reviewed By: brecht

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

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_subdiv.h
M   source/blender/blenkernel/intern/multires_subdiv.c
M   source/blender/blenkernel/intern/subdiv_converter_mesh.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/intern/MOD_multires.c
M   source/blender/modifiers/intern/MOD_subsurf.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 59bf820560e..8e0021b64a8 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -658,6 +658,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 col.operator("object.multires_base_apply", text="Apply Base")
 col.prop(md, "uv_smooth", text="")
 col.prop(md, "show_only_control_edges")
+col.prop(md, "use_creases")
 
 layout.separator()
 
@@ -1035,6 +1036,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 sub.prop(md, "uv_smooth", text="")
 
 col.prop(md, "show_only_control_edges")
+col.prop(md, "use_creases")
 
 if show_adaptive_options and ob.cycles.use_adaptive_subdivision:
 col = layout.column(align=True)
diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 9ae85725488..4c88410134c 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -24,7 +24,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION  53
+#define BLENDER_SUBVERSION  54
 /* Several breakages with 280, e.g. collections vs layers */
 #define BLENDER_MINVERSION  280
 #define BLENDER_MINSUBVERSION   0
diff --git a/source/blender/blenkernel/BKE_subdiv.h 
b/source/blender/blenkernel/BKE_subdiv.h
index 8c6b92e3638..f14a11005e7 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -58,6 +58,7 @@ typedef struct SubdivSettings {
bool is_simple;
bool is_adaptive;
int level;
+   bool use_creases;
eSubdivVtxBoundaryInterpolation vtx_boundary_interpolation;
eSubdivFVarLinearInterpolation fvar_linear_interpolation;
 } SubdivSettings;
diff --git a/source/blender/blenkernel/intern/multires_subdiv.c 
b/source/blender/blenkernel/intern/multires_subdiv.c
index 3d1a019f427..59229f28751 100644
--- a/source/blender/blenkernel/intern/multires_subdiv.c
+++ b/source/blender/blenkernel/intern/multires_subdiv.c
@@ -41,6 +41,7 @@ void BKE_multires_subdiv_settings_init(
settings->is_simple = (mmd->simple != 0);
settings->is_adaptive = true;
settings->level = settings->is_simple ? 1 : mmd->quality;
+   settings->use_creases = (mmd->flags & eMultiresModifierFlag_UseCrease);
settings->vtx_boundary_interpolation = SUBDIV_VTX_BOUNDARY_EDGE_ONLY;
settings->fvar_linear_interpolation =
BKE_subdiv_fvar_interpolation_from_uv_smooth(mmd->uv_smooth);
diff --git a/source/blender/blenkernel/intern/subdiv_converter_mesh.c 
b/source/blender/blenkernel/intern/subdiv_converter_mesh.c
index 00a2436098e..eda6b522b85 100644
--- a/source/blender/blenkernel/intern/subdiv_converter_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_converter_mesh.c
@@ -168,6 +168,9 @@ static float get_edge_sharpness(const OpenSubdiv_Converter 
*converter,
return 10.0f;
}
 #endif
+   if (!storage->settings.use_creases) {
+   return 0.0f;
+   }
const int edge_index =
storage->manifo

[Bf-blender-cvs] [6de0da70de3] master: GPU not able to allocate texture

2019-04-05 Thread Jeroen Bakker
Commit: 6de0da70de303d6510564bc745a72b7c8a04d929
Author: Jeroen Bakker
Date:   Fri Apr 5 12:53:26 2019 +0200
Branches: master
https://developer.blender.org/rB6de0da70de303d6510564bc745a72b7c8a04d929

GPU not able to allocate texture

In the case of the report a GL_PROXY_TEXTURE_2D_ARRAY of 2509x2509x1 failed to 
be allocated.
This is a work around as the GL_PROXY_TEXTURE_* is not reliable.

Reviewed By: brecht, fclem

Maniphest Tasks: T63223

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

===

M   source/blender/gpu/intern/gpu_texture.c

===

diff --git a/source/blender/gpu/intern/gpu_texture.c 
b/source/blender/gpu/intern/gpu_texture.c
index 8aafe349be8..3ce42ce1d31 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -661,7 +661,7 @@ GPUTexture *GPU_texture_create_nD(
GLenum proxy = GL_PROXY_TEXTURE_2D;
 
if (n == 2) {
-   if (d > 0)
+   if (d > 1)
proxy = GL_PROXY_TEXTURE_2D_ARRAY;
}
else if (n == 1) {

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


[Bf-blender-cvs] [f0d6879f5c7] master: Fix T62892 EEVEE HDRI lightning glitch

2019-04-05 Thread Clément Foucault
Commit: f0d6879f5c7998be98ac406bd6ddaa5104961206
Author: Clément Foucault
Date:   Fri Apr 5 14:37:38 2019 +0200
Branches: master
https://developer.blender.org/rBf0d6879f5c7998be98ac406bd6ddaa5104961206

Fix T62892 EEVEE HDRI lightning glitch

Clamp the texture at sampling time. This is not the best way to do it but
this is the fastest/simplest. The cost is rather negligeable.

===

M   source/blender/gpu/shaders/gpu_shader_material.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 5f54b53987e..9f3ea4acfb1 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2081,22 +2081,25 @@ void node_tex_environment_empty(vec3 co, out vec4 color)
color = vec4(1.0, 0.0, 1.0, 1.0);
 }
 
+/* 16bits floats limits. Higher/Lower values produce +/-inf. */
+#define safe_color(a) (clamp(a, -65520.0, 65520.0))
+
 void node_tex_image_linear(vec3 co, sampler2D ima, out vec4 color, out float 
alpha)
 {
-   color = texture(ima, co.xy);
+   color = safe_color(texture(ima, co.xy));
alpha = color.a;
 }
 
 void node_tex_image_linear_no_mip(vec3 co, sampler2D ima, out vec4 color, out 
float alpha)
 {
-   color = textureLod(ima, co.xy, 0.0);
+   color = safe_color(textureLod(ima, co.xy, 0.0));
alpha = color.a;
 }
 
 void node_tex_image_nearest(vec3 co, sampler2D ima, out vec4 color, out float 
alpha)
 {
ivec2 pix = ivec2(fract(co.xy) * textureSize(ima, 0).xy);
-   color = texelFetch(ima, pix, 0);
+   color = clamp(texelFetch(ima, pix, 0));
alpha = color.a;
 }
 
@@ -2138,10 +2141,10 @@ void node_tex_image_cubic_ex(vec3 co, sampler2D ima, 
float do_extend, out vec4 c
}
final_co /= tex_size.xyxy;
 
-   color  = textureLod(ima, final_co.xy, 0.0) * s0.x * s0.y;
-   color += textureLod(ima, final_co.zy, 0.0) * s1.x * s0.y;
-   color += textureLod(ima, final_co.xw, 0.0) * s0.x * s1.y;
-   color += textureLod(ima, final_co.zw, 0.0) * s1.x * s1.y;
+   color  = safe_color(textureLod(ima, final_co.xy, 0.0)) * s0.x * s0.y;
+   color += safe_color(textureLod(ima, final_co.zy, 0.0)) * s1.x * s0.y;
+   color += safe_color(textureLod(ima, final_co.xw, 0.0)) * s0.x * s1.y;
+   color += safe_color(textureLod(ima, final_co.zw, 0.0)) * s1.x * s1.y;
 
 #else /* Reference bruteforce 16 tap. */
color  = texelFetch(ima, ivec2(tc + vec2(-1.0, -1.0)), 0) * w0.x * w0.y;

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


[Bf-blender-cvs] [a180b754eb4] master: Interface: New region type 'Footer', used by text editor

2019-04-05 Thread George Vogiatzis
Commit: a180b754eb40637a5d37eeb0ae60066f5a6f93d8
Author: George Vogiatzis
Date:   Fri Apr 5 13:48:26 2019 +0200
Branches: master
https://developer.blender.org/rBa180b754eb40637a5d37eeb0ae60066f5a6f93d8

Interface: New region type 'Footer', used by text editor

* It can be hidden by dragging it up/down.
* It can be at the top or bottom, independent of the header.
* It uses the color theme from the header.
* It does not change its color, when the area becomes active.

Currently, it is used in the text editor to display the file path.

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

===

M   release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_text.py
M   source/blender/blenkernel/intern/screen.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/interface/interface_context_menu.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_region_menu_popup.c
M   source/blender/editors/interface/interface_region_popover.c
M   source/blender/editors/interface/resources.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_edit.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_text/space_text.c
M   source/blender/makesdna/DNA_screen_types.h
M   source/blender/makesrna/intern/rna_screen.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py 
b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
index e64c78f7661..4fae134860e 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
@@ -55,6 +55,7 @@ _km_hierarchy = [
 ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
 ('Screen Editing', 'EMPTY', 'WINDOW', []),# re-sizing, action 
corners
 ('Header', 'EMPTY', 'WINDOW', []),# header stuff (per 
region)
+('Footer', 'EMPTY', 'WINDOW', []),# footer stuff (per 
region)
 ]),
 
 ('View2D', 'EMPTY', 'WINDOW', []),# view 2d navigation (per region)
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 84e97d5b764..9d4fcf7d0e7 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -535,6 +535,21 @@ def km_header(_params):
 return keymap
 
 
+def km_footer(_params):
+items = []
+keymap = (
+"Footer",
+{"space_type": 'EMPTY', "region_type": 'WINDOW'},
+{"items": items},
+)
+
+items.extend([
+("screen.footer_context_menu", {"type": 'RIGHTMOUSE', "value": 
'PRESS'}, None),
+])
+
+return keymap
+
+
 def km_view2d(_params):
 items = []
 keymap = (
@@ -6032,6 +6047,7 @@ def generate_keymaps(params=None):
 km_screen(params),
 km_screen_editing(params),
 km_header(params),
+km_footer(params),
 km_view2d(params),
 km_view2d_buttons_list(params),
 km_user_interface(params),
diff --git a/release/scripts/startup/bl_ui/space_text.py 
b/release/scripts/startup/bl_ui/space_text.py
index 6726a5d319d..b62e2d740b3 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -56,6 +56,29 @@ class TEXT_HT_header(Header):
 if text:
 is_osl = text.name.endswith((".osl", ".osl"))
 
+row = layout.row()
+if is_osl:
+row = layout.row()
+row.operator("node.shader_script_update")
+else:
+row = layout.row()
+row.active = text.name.endswith(".py")
+row.prop(text, "use_module")
+
+row = layout.row()
+row.operator("text.run_script")
+
+
+class TEXT_HT_footer(Header):
+bl_space_type = 'TEXT_EDITOR'
+bl_region_type = 'FOOTER'
+
+def draw(self, context):
+layout = self.layout
+
+st = context.space_data
+text = st.text
+if text:
 row = layout.row()
 if text.filepath:
 if text.is_dirty:
@@ -74,16 +97,6 @@ class TEXT_HT_header(Header):
 if text.library
 else "Text: Internal"
 )
-if is_osl:
-row = layout.row()
-row.operator("node.shader_script_update")
-else:
-row = layout.

[Bf-blender-cvs] [fce469a30c5] master: Cleanup: Replace deprecated finite with isfinite

2019-04-05 Thread Simon
Commit: fce469a30c5075216671f9ce3738ed401ad9c03f
Author: Simon
Date:   Fri Apr 5 13:41:28 2019 +0200
Branches: master
https://developer.blender.org/rBfce469a30c5075216671f9ce3738ed401ad9c03f

Cleanup: Replace deprecated finite with isfinite

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

===

M   intern/elbeem/intern/mvmcoords.cpp
M   intern/elbeem/intern/solver_adap.cpp
M   intern/elbeem/intern/solver_main.cpp

===

diff --git a/intern/elbeem/intern/mvmcoords.cpp 
b/intern/elbeem/intern/mvmcoords.cpp
index 3a465dac5d6..407a1b426f3 100644
--- a/intern/elbeem/intern/mvmcoords.cpp
+++ b/intern/elbeem/intern/mvmcoords.cpp
@@ -16,6 +16,7 @@
 
 #include "mvmcoords.h"
 #include 
+#include 
 
 #if defined(_MSC_VER) && _MSC_VER > 1600
 // std::greater
@@ -24,6 +25,7 @@
 
 
 using std::vector;
+using std::isfinite;
 
 void MeanValueMeshCoords::clear() 
 {
@@ -170,8 +172,8 @@ void MeanValueMeshCoords::computeWeights(vector 
&reference_vertices,
for (vector::iterator viter = tds.weights.begin();
viter != tds.weights.end(); ++viter) {
viter->weight *= invTotalWeight;  
-   //assert(finite(viter->weight) != 0);
-   if(!finite(viter->weight)) viter->weight=0.;
+   //assert(isfinite(viter->weight) != 0);
+   if(!isfinite(viter->weight)) viter->weight=0.;
}
 }
 
diff --git a/intern/elbeem/intern/solver_adap.cpp 
b/intern/elbeem/intern/solver_adap.cpp
index dc3a93b8046..9e5619ca4a5 100644
--- a/intern/elbeem/intern/solver_adap.cpp
+++ b/intern/elbeem/intern/solver_adap.cpp
@@ -14,7 +14,9 @@
 #include "solver_relax.h"
 #include "particletracer.h"
 
+#include 
 
+using std::isfinite;
 
 /*/
 //! coarse step functions
@@ -1244,7 +1246,7 @@ void LbmFsgrSolver::adaptTimestep() {
uz  += (dfDvecZ[l]*m); 
} 
 #ifndef WIN32
-   if (!finite(rho)) {
+   if (!isfinite(rho)) {
errMsg("adaptTimestep","Brute force non-finite 
rho at"<
+#include 
+
+using std::isfinite;
 
 /*/
 /*! perform a single LBM step */
@@ -216,8 +219,8 @@ void LbmFsgrSolver::stepMain() {
 
 #ifndef WIN32
// good indicator for instabilities
-   if( (!finite(mMxvx)) || (!finite(mMxvy)) || (!finite(mMxvz)) ) { 
CAUSE_PANIC; }
-   if( (!finite(mCurrentMass)) || (!finite(mCurrentVolume)) ) { 
CAUSE_PANIC; }
+   if( (!isfinite(mMxvx)) || (!isfinite(mMxvy)) || (!isfinite(mMxvz)) ) { 
CAUSE_PANIC; }
+   if( (!isfinite(mCurrentMass)) || (!isfinite(mCurrentVolume)) ) { 
CAUSE_PANIC; }
 #endif // WIN32
 
// output total step time
@@ -250,7 +253,7 @@ void LbmFsgrSolver::stepMain() {
if(!this->mPanic){ FSGR_FORIJK_BOUNDS(mMaxRefine) { \

if(RFLAG(mMaxRefine,i,j,k,mLevel[mMaxRefine].setCurr)&(CFFluid|CFInter)) { \
for(int l=0;lhttps://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2bd8f2dfadd] master: Cleanup: Spelling

2019-04-05 Thread Sergey Sharybin
Commit: 2bd8f2dfaddb0384b848916860a8655290fb45ea
Author: Sergey Sharybin
Date:   Fri Apr 5 12:52:57 2019 +0200
Branches: master
https://developer.blender.org/rB2bd8f2dfaddb0384b848916860a8655290fb45ea

Cleanup: Spelling

===

M   source/blender/blenkernel/BKE_subdiv.h

===

diff --git a/source/blender/blenkernel/BKE_subdiv.h 
b/source/blender/blenkernel/BKE_subdiv.h
index 1ade8a0e44d..8c6b92e3638 100644
--- a/source/blender/blenkernel/BKE_subdiv.h
+++ b/source/blender/blenkernel/BKE_subdiv.h
@@ -240,7 +240,7 @@ BLI_INLINE void BKE_subdiv_ptex_face_uv_to_grid_uv(
 const float ptex_u, const float ptex_v,
 float *r_grid_u, float *r_grid_v);
 
-/* Onverse of above. */
+/* Inverse of above. */
 BLI_INLINE void BKE_subdiv_grid_uv_to_ptex_face_uv(
 const float grid_u, const float grid_v,
 float *r_ptex_u, float *r_ptex_v);

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


[Bf-blender-cvs] [b3b335c398d] master: Fix T60390: add Cycles texture node mapping settings to node editor sidebar

2019-04-05 Thread Brecht Van Lommel
Commit: b3b335c398de4c792abccdcb506cfe2a5f8580c2
Author: Brecht Van Lommel
Date:   Fri Apr 5 12:47:34 2019 +0200
Branches: master
https://developer.blender.org/rBb3b335c398de4c792abccdcb506cfe2a5f8580c2

Fix T60390: add Cycles texture node mapping settings to node editor sidebar

These were missing from the UI previously.

===

M   release/scripts/startup/bl_ui/properties_texture.py
M   release/scripts/startup/bl_ui/space_node.py

===

diff --git a/release/scripts/startup/bl_ui/properties_texture.py 
b/release/scripts/startup/bl_ui/properties_texture.py
index 58ba9ddb9b8..313e0668b92 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -168,50 +168,6 @@ class TEXTURE_PT_node(TextureButtonsPanel, Panel):
 layout.template_node_view(ntree, node, None)
 
 
-class TEXTURE_PT_node_mapping(TextureButtonsPanel, Panel):
-bl_label = "Mapping"
-bl_context = "texture"
-COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
-
-@classmethod
-def poll(cls, context):
-node = context.texture_node
-# TODO(sergey): perform a faster/nicer check?
-return node and hasattr(node, "texture_mapping") and (context.engine 
in cls.COMPAT_ENGINES)
-
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-layout.use_property_decorate = False  # No animation.
-
-flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, 
even_rows=False, align=False)
-
-node = context.texture_node
-
-mapping = node.texture_mapping
-
-col = flow.column()
-col.prop(mapping, "vector_type")
-
-col.separator()
-
-col = col.column(align=True)
-col.prop(mapping, "mapping_x", text="Projection X")
-col.prop(mapping, "mapping_y", text="Y")
-col.prop(mapping, "mapping_z", text="Z")
-
-col.separator()
-
-col = flow.column()
-col.column().prop(mapping, "translation")
-
-col = flow.column()
-col.column().prop(mapping, "rotation")
-
-col = flow.column()
-col.column().prop(mapping, "scale")
-
-
 class TextureTypePanel(TextureButtonsPanel):
 
 @classmethod
@@ -918,7 +874,6 @@ classes = (
 TEXTURE_PT_preview,
 TEXTURE_PT_context,
 TEXTURE_PT_node,
-TEXTURE_PT_node_mapping,
 TEXTURE_PT_clouds,
 TEXTURE_PT_wood,
 TEXTURE_PT_marble,
diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index 764a05844ad..12c51da3e29 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -508,6 +508,43 @@ class NODE_PT_active_node_properties(Panel):
 socket.draw(context, row, node, iface_(socket.name, 
socket.bl_rna.translation_context))
 
 
+class NODE_PT_texture_mapping(Panel):
+bl_space_type = 'NODE_EDITOR'
+bl_region_type = 'UI'
+bl_category = "Node"
+bl_label = "Texture Mapping"
+bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+@classmethod
+def poll(cls, context):
+node = context.active_node
+return node and hasattr(node, "texture_mapping") and (context.engine 
in cls.COMPAT_ENGINES)
+
+def draw(self, context):
+layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False  # No animation.
+
+node = context.active_node
+mapping = node.texture_mapping
+
+layout.prop(mapping, "vector_type")
+
+layout.separator()
+
+col = layout.column(align=True)
+col.prop(mapping, "mapping_x", text="Projection X")
+col.prop(mapping, "mapping_y", text="Y")
+col.prop(mapping, "mapping_z", text="Z")
+
+layout.separator()
+
+layout.prop(mapping, "translation")
+layout.prop(mapping, "rotation")
+layout.prop(mapping, "scale")
+
+
 # Node Backdrop options
 class NODE_PT_backdrop(Panel):
 bl_space_type = 'NODE_EDITOR'
@@ -655,6 +692,7 @@ classes = (
 NODE_PT_active_node_generic,
 NODE_PT_active_node_color,
 NODE_PT_active_node_properties,
+NODE_PT_texture_mapping,
 NODE_PT_backdrop,
 NODE_PT_quality,
 NODE_PT_grease_pencil,

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


[Bf-blender-cvs] [6fa863f6d99] functions: Sin operation in Float Math node

2019-04-05 Thread Jacques Lucke
Commit: 6fa863f6d99e875a9e04f8eab67fc80a9f7f8670
Author: Jacques Lucke
Date:   Fri Apr 5 12:45:11 2019 +0200
Branches: functions
https://developer.blender.org/rB6fa863f6d99e875a9e04f8eab67fc80a9f7f8670

Sin operation in Float Math node

===

M   release/scripts/startup/function_nodes/nodes/float_math.py
M   source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
M   source/blender/functions/functions/scalar_math.cpp
M   source/blender/functions/functions/scalar_math.hpp

===

diff --git a/release/scripts/startup/function_nodes/nodes/float_math.py 
b/release/scripts/startup/function_nodes/nodes/float_math.py
index 66c7fb97959..2f9b60bbf7e 100644
--- a/release/scripts/startup/function_nodes/nodes/float_math.py
+++ b/release/scripts/startup/function_nodes/nodes/float_math.py
@@ -7,8 +7,13 @@ operation_items = [
 ("MULTIPLY", "Multiply", "", "", 2),
 ("MIN", "Minimum", "", "", 3),
 ("MAX", "Maximum", "", "", 4),
+("SIN", "Sin", "", "", 5),
 ]
 
+single_value_operations = {
+"SIN",
+}
+
 class FloatMathNode(bpy.types.Node, FunctionNode):
 bl_idname = "fn_FloatMathNode"
 bl_label = "Float Math"
@@ -21,11 +26,13 @@ class FloatMathNode(bpy.types.Node, FunctionNode):
 operation: EnumProperty(
 name="Operation",
 items=operation_items,
+update=FunctionNode.refresh,
 )
 
 def declaration(self, builder):
 builder.fixed_input("a", "A", "Float")
-builder.fixed_input("b", "B", "Float")
+if self.operation not in single_value_operations:
+builder.fixed_input("b", "B", "Float")
 builder.fixed_output("result", "Result", "Float")
 
 def draw(self, layout):
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp 
b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
index d18e0824839..8acbbda499e 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
@@ -34,6 +34,7 @@ namespace FN { namespace DataFlowNodes {
case 2: return Functions::multiply_floats();
case 3: return Functions::min_floats();
case 4: return Functions::max_floats();
+   case 5: return Functions::sin_float();
default:
BLI_assert(false);
return *(SharedFunction *)nullptr;
diff --git a/source/blender/functions/functions/scalar_math.cpp 
b/source/blender/functions/functions/scalar_math.cpp
index ccfbb5760de..cb0bc76b92d 100644
--- a/source/blender/functions/functions/scalar_math.cpp
+++ b/source/blender/functions/functions/scalar_math.cpp
@@ -1,3 +1,5 @@
+#include 
+
 #include "scalar_math.hpp"
 #include "FN_types.hpp"
 #include "FN_tuple_call.hpp"
@@ -9,7 +11,17 @@ namespace FN { namespace Functions {
 
using namespace Types;
 
-   static SharedFunction get_simple_math_function(std::string name)
+   static SharedFunction get_math_function__one_input(std::string name)
+   {
+   auto fn = SharedFunction::New(name, Signature({
+   InputParameter("Value", get_float_type()),
+   }, {
+   OutputParameter("Result", get_float_type()),
+   }));
+   return fn;
+   }
+
+   static SharedFunction get_math_function__two_inputs(std::string name)
{
auto fn = SharedFunction::New(name, Signature({
InputParameter("A", get_float_type()),
@@ -45,7 +57,7 @@ namespace FN { namespace Functions {
 
LAZY_INIT_REF__NO_ARG(SharedFunction, add_floats)
{
-   auto fn = get_simple_math_function("Add Floats");
+   auto fn = get_math_function__two_inputs("Add Floats");
//fn->add_body(new AddFloats());
fn->add_body(new GenAddFloats());
return fn;
@@ -63,7 +75,7 @@ namespace FN { namespace Functions {
 
LAZY_INIT_REF__NO_ARG(SharedFunction, multiply_floats)
{
-   auto fn = get_simple_math_function("Multiply Floats");
+   auto fn = get_math_function__two_inputs("Multiply Floats");
fn->add_body(new MultiplyFloats());
return fn;
}
@@ -80,7 +92,7 @@ namespace FN { namespace Functions {
 
LAZY_INIT_REF__NO_ARG(SharedFunction, min_floats)
{
-   auto fn = get_simple_math_function("Minimum");
+   auto fn = get_math_function__two_inputs("Minimum");
fn->add_body(new MinFloats());
return fn;
}
@@ -97,7 +109,7 @@ namespace FN { namespace Functions {
 
LAZY_INIT_REF__NO_ARG(SharedFunction, max_floats)
  

[Bf-blender-cvs] [3273d6be584] functions: remove notes and unused variable

2019-04-05 Thread Jacques Lucke
Commit: 3273d6be584f4d03cd1fbe62a1d21a9203b8b9fc
Author: Jacques Lucke
Date:   Fri Apr 5 12:31:34 2019 +0200
Branches: functions
https://developer.blender.org/rB3273d6be584f4d03cd1fbe62a1d21a9203b8b9fc

remove notes and unused variable

===

M   source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
D   source/blender/functions/notes.txt

===

diff --git a/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp 
b/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
index a9b71afbcc5..5bfc9f844a9 100644
--- a/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
+++ b/source/blender/functions/backends/llvm/ir_for_tuple_call.cpp
@@ -59,8 +59,6 @@ namespace FN {
CodeInterface &interface,
const BuildIRSettings &settings) const override
{
-
-   llvm::LLVMContext &context = builder.getContext();
Function *fn = m_tuple_call->owner();
 
/* Find relevant type information. */
diff --git a/source/blender/functions/notes.txt 
b/source/blender/functions/notes.txt
deleted file mode 100644
index 924244600f7..000
--- a/source/blender/functions/notes.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-- Some types can have multiple owners and are reference counted.
-- Function
-- Type
-- DataFlowGraph
-- TupleMeta
-
-- Function bodies are owned by a single function.
-- A function can have multiple bodies.
-- A function can have at most one body of a certain type.
-
-- Type extensions are owned by a single type.
-- A type can have multiple extensions.
-- A type can have at most one extensions of a certain type.
-
-Inside a tuple call:
-- A tuple call body can modify fn_in and fn_out.
-- The underlying tuple buffers are owned by the caller and might be freed 
any time after the function finished.
-- When a tuple is freed, all initialized values in it are freed.
-- A tuple call body has to initialize all values in fn_out.
-- fn_out might already contain initialized values on entry.
\ No newline at end of file

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


[Bf-blender-cvs] [52ff44d02cb] functions: Validate more aspects of the node tree while syncing

2019-04-05 Thread Jacques Lucke
Commit: 52ff44d02cbb56b94010f69a032e009d6b713d0a
Author: Jacques Lucke
Date:   Fri Apr 5 12:10:30 2019 +0200
Branches: functions
https://developer.blender.org/rB52ff44d02cbb56b94010f69a032e009d6b713d0a

Validate more aspects of the node tree while syncing

===

M   release/scripts/startup/function_nodes/base.py
M   release/scripts/startup/function_nodes/declaration/base.py
M   release/scripts/startup/function_nodes/declaration/dynamic_list.py
M   release/scripts/startup/function_nodes/declaration/fixed_type.py
M   release/scripts/startup/function_nodes/declaration/pack_list.py
M   release/scripts/startup/function_nodes/declaration/tree_interface.py
M   release/scripts/startup/function_nodes/declaration/variadic.py
M   release/scripts/startup/function_nodes/sync.py

===

diff --git a/release/scripts/startup/function_nodes/base.py 
b/release/scripts/startup/function_nodes/base.py
index e56fdc3eedb..2b547584ab4 100644
--- a/release/scripts/startup/function_nodes/base.py
+++ b/release/scripts/startup/function_nodes/base.py
@@ -13,8 +13,7 @@ class BaseTree:
 
 def update(self):
 from . sync import sync_trees_and_dependent_trees
-if self.name in bpy.data.node_groups:
-sync_trees_and_dependent_trees({self})
+sync_trees_and_dependent_trees({self})
 
 
 class SocketValueStates:
diff --git a/release/scripts/startup/function_nodes/declaration/base.py 
b/release/scripts/startup/function_nodes/declaration/base.py
index 807517b4d0f..75b15f99903 100644
--- a/release/scripts/startup/function_nodes/declaration/base.py
+++ b/release/scripts/startup/function_nodes/declaration/base.py
@@ -21,4 +21,16 @@ class SocketDeclBase:
 pass
 
 def get_socket_name(self, socket, index):
-return socket.name
\ No newline at end of file
+return socket.name
+
+def _data_socket_test(self, socket, name, data_type, identifier):
+from .. base import DataSocket
+if not isinstance(socket, DataSocket):
+return False
+if socket.name != name:
+return False
+if socket.data_type != data_type:
+return False
+if socket.identifier != identifier:
+return False
+return True
\ No newline at end of file
diff --git a/release/scripts/startup/function_nodes/declaration/dynamic_list.py 
b/release/scripts/startup/function_nodes/declaration/dynamic_list.py
index 9378aab9826..bbc53f2a2bb 100644
--- a/release/scripts/startup/function_nodes/declaration/dynamic_list.py
+++ b/release/scripts/startup/function_nodes/declaration/dynamic_list.py
@@ -21,7 +21,8 @@ class ListSocketDecl(SocketDeclBase):
 def validate(self, sockets):
 if len(sockets) != 1:
 return False
-return sockets[0].data_type == self.get_data_type()
+return self._data_socket_test(sockets[0],
+self.display_name, self.get_data_type(), self.identifier)
 
 def get_data_type(self):
 base_type = getattr(self.node, self.prop_name)
diff --git a/release/scripts/startup/function_nodes/declaration/fixed_type.py 
b/release/scripts/startup/function_nodes/declaration/fixed_type.py
index 849e99b04b0..2026aef2d39 100644
--- a/release/scripts/startup/function_nodes/declaration/fixed_type.py
+++ b/release/scripts/startup/function_nodes/declaration/fixed_type.py
@@ -18,7 +18,8 @@ class FixedSocketDecl(SocketDeclBase):
 def validate(self, sockets):
 if len(sockets) != 1:
 return False
-return sockets[0].data_type == self.data_type
+return self._data_socket_test(sockets[0],
+self.display_name, self.data_type, self.identifier)
 
 def amount(self):
 return 1
\ No newline at end of file
diff --git a/release/scripts/startup/function_nodes/declaration/pack_list.py 
b/release/scripts/startup/function_nodes/declaration/pack_list.py
index 1c8418c38e5..fad91e2ea4b 100644
--- a/release/scripts/startup/function_nodes/declaration/pack_list.py
+++ b/release/scripts/startup/function_nodes/declaration/pack_list.py
@@ -41,14 +41,10 @@ class PackListDecl(SocketDeclBase):
 return False
 
 for socket, item in zip(sockets[:-1], collection):
-if item.state == "BASE":
-if socket.data_type != self.base_type:
-return False
-elif item.state == "LIST":
-if socket.data_type != self.list_type:
-return False
-else:
-assert False
+data_type = self.base_type if item.state == "BASE" else 
self.list_type
+identifier = item.identifier_prefix + self.identifier_suffix
+if not self._data_socket_test(socket, "", data_type, identifier):
+return False
 
 if sockets[-1].bl_idname != "fn_OperatorSocket":
 re

[Bf-blender-cvs] [4a3720740dd] functions: use the socket name directly, instead of a getter function

2019-04-05 Thread Jacques Lucke
Commit: 4a3720740dd2f52dfd20bfa505b888576fd0a5af
Author: Jacques Lucke
Date:   Fri Apr 5 12:29:07 2019 +0200
Branches: functions
https://developer.blender.org/rB4a3720740dd2f52dfd20bfa505b888576fd0a5af

use the socket name directly, instead of a getter function

===

M   release/scripts/startup/function_nodes/base.py
M   release/scripts/startup/function_nodes/declaration/base.py
M   release/scripts/startup/function_nodes/declaration/pack_list.py
M   release/scripts/startup/function_nodes/declaration/variadic.py
M   release/scripts/startup/function_nodes/function_tree.py
M   source/blender/functions/frontends/data_flow_nodes/builder.cpp

===

diff --git a/release/scripts/startup/function_nodes/base.py 
b/release/scripts/startup/function_nodes/base.py
index 2b547584ab4..7e717db081b 100644
--- a/release/scripts/startup/function_nodes/base.py
+++ b/release/scripts/startup/function_nodes/base.py
@@ -193,10 +193,6 @@ class BaseSocket:
 else:
 return tuple(node.inputs).index(self)
 
-def get_name(self, node):
-decl, index = self.get_decl_with_index(node)
-return decl.get_socket_name(self, index)
-
 def to_id(self, node):
 return (node, self.is_output, self.identifier)
 
diff --git a/release/scripts/startup/function_nodes/declaration/base.py 
b/release/scripts/startup/function_nodes/declaration/base.py
index 75b15f99903..310e5009164 100644
--- a/release/scripts/startup/function_nodes/declaration/base.py
+++ b/release/scripts/startup/function_nodes/declaration/base.py
@@ -20,9 +20,6 @@ class SocketDeclBase:
 def operator_socket_call(self, own_socket, other_socket):
 pass
 
-def get_socket_name(self, socket, index):
-return socket.name
-
 def _data_socket_test(self, socket, name, data_type, identifier):
 from .. base import DataSocket
 if not isinstance(socket, DataSocket):
diff --git a/release/scripts/startup/function_nodes/declaration/pack_list.py 
b/release/scripts/startup/function_nodes/declaration/pack_list.py
index fad91e2ea4b..8109d097e6b 100644
--- a/release/scripts/startup/function_nodes/declaration/pack_list.py
+++ b/release/scripts/startup/function_nodes/declaration/pack_list.py
@@ -104,9 +104,6 @@ class PackListDecl(SocketDeclBase):
 def get_collection(self):
 return getattr(self.node, self.prop_name)
 
-def get_socket_name(self, socket, index):
-return "Pack Input " + str(index)
-
 @classmethod
 def Property(cls):
 return CollectionProperty(type=PackListPropertyGroup)
diff --git a/release/scripts/startup/function_nodes/declaration/variadic.py 
b/release/scripts/startup/function_nodes/declaration/variadic.py
index 12ba8840f4d..fa8533c044a 100644
--- a/release/scripts/startup/function_nodes/declaration/variadic.py
+++ b/release/scripts/startup/function_nodes/declaration/variadic.py
@@ -21,7 +21,7 @@ class AnyVariadicDecl(SocketDeclBase):
 yield type_infos.build(
 item.data_type,
 node_sockets,
-item.name,
+item.display_name,
 item.identifier_prefix + self.identifier_suffix)
 yield node_sockets.new("fn_OperatorSocket", "Operator")
 
@@ -34,7 +34,7 @@ class AnyVariadicDecl(SocketDeclBase):
 
 for item, socket in zip(self.get_collection(), sockets[:-1]):
 identifier = item.identifier_prefix + self.identifier_suffix
-if not self._data_socket_test(socket, item.name, item.data_type, 
identifier):
+if not self._data_socket_test(socket, item.display_name, 
item.data_type, identifier):
 return False
 
 if not isinstance(sockets[-1], OperatorSocket):
@@ -71,7 +71,7 @@ class AnyVariadicDecl(SocketDeclBase):
 
 is_output = own_socket.is_output
 
-item = self.add_item(connected_type, 
connected_socket.get_name(connected_node))
+item = self.add_item(connected_type, connected_socket.name)
 self.node.rebuild()
 
 identifier = item.identifier_prefix + self.identifier_suffix
@@ -87,13 +87,6 @@ class AnyVariadicDecl(SocketDeclBase):
 self.node.refresh()
 return item
 
-def get_socket_name(self, socket, index):
-collection = self.get_collection()
-if index < len(collection):
-return collection[index].display_name
-else:
-return socket.name
-
 @classmethod
 def Property(cls):
 return CollectionProperty(type=DataTypeGroup)
diff --git a/release/scripts/startup/function_nodes/function_tree.py 
b/release/scripts/startup/function_nodes/function_tree.py
index 8dd655c1184..d4d3552e79d 100644
--- a/release/scripts/startup/function_nodes/function_tree.py
+++ b/release/scripts/startup/function_nodes/function_tree.py
@@ -22,7 +22,7 @@ class FunctionTree(bpy.types.Node

[Bf-blender-cvs] [23a88646691] functions: Splitup C API for separate components in different files

2019-04-05 Thread Jacques Lucke
Commit: 23a8864669115d4a00978ee31924fa1249d05b58
Author: Jacques Lucke
Date:   Fri Apr 5 11:32:34 2019 +0200
Branches: functions
https://developer.blender.org/rB23a8864669115d4a00978ee31924fa1249d05b58

Splitup C API for separate components in different files

===

M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/functions/CMakeLists.txt
D   source/blender/functions/FN-C.h
A   source/blender/functions/FN_all-c.h
M   source/blender/functions/FN_all.hpp
A   source/blender/functions/FN_core-c.h
M   source/blender/functions/FN_core.hpp
A   source/blender/functions/FN_data_flow_nodes-c.h
M   source/blender/functions/FN_data_flow_nodes.hpp
A   source/blender/functions/FN_dependencies-c.h
M   source/blender/functions/FN_dependencies.hpp
A   source/blender/functions/FN_tuple_call-c.h
M   source/blender/functions/FN_tuple_call.hpp
A   source/blender/functions/FN_types-c.h
M   source/blender/functions/FN_types.hpp
A   source/blender/functions/backends/dependencies/dependencies-c.cpp
A   source/blender/functions/backends/dependencies/dependencies-c.h
A   source/blender/functions/backends/tuple_call/tuple_call-c.cpp
A   source/blender/functions/backends/tuple_call/tuple_call-c.h
D   source/blender/functions/c_wrapper.cpp
A   source/blender/functions/core/core-c.cpp
A   source/blender/functions/core/core-c.h
A   source/blender/functions/frontends/data_flow_nodes/data_flow_nodes-c.cpp
A   source/blender/functions/frontends/data_flow_nodes/data_flow_nodes-c.h
A   source/blender/functions/initialize.cpp
A   source/blender/functions/types/tuple_access-c.cpp
A   source/blender/functions/types/tuple_access-c.h
A   source/blender/functions/types/types-c.cpp
A   source/blender/functions/types/types-c.h
M   source/blender/modifiers/intern/MOD_displace.c
M   source/blender/modifiers/intern/MOD_functiondeform.c
M   source/blender/modifiers/intern/MOD_functionpoints.c
M   source/creator/creator.c

===

diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 502a58e881e..505f1e5b9ee 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -57,7 +57,7 @@
 
 #include "RNA_access.h"
 
-#include "FN-C.h"
+#include "FN_all-c.h"
 
 #include "atomic_ops.h"
 
diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index b8fee3654de..d0313d51a7a 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -27,9 +27,14 @@ set(SRC
FN_types.hpp
FN_functions.hpp
FN_data_flow_nodes.hpp
-   FN-C.h
 
-   c_wrapper.cpp
+   FN_all-c.h
+   FN_core-c.h
+   FN_types-c.h
+   FN_dependencies-c.h
+   FN_data_flow_nodes-c.h
+
+   initialize.cpp
 
core/type.hpp
core/parameter.hpp
@@ -43,6 +48,8 @@ set(SRC
core/source_info.hpp
core/source_info.cpp
core/dot_export.cpp
+   core/core-c.h
+   core/core-c.cpp
 
backends/tuple_call/cpp_types.hpp
backends/tuple_call/cpp_types.cpp
@@ -56,11 +63,15 @@ set(SRC
backends/tuple_call/lazy_to_normal.cpp
backends/tuple_call/execution_context.hpp
backends/tuple_call/execution_context.cpp
+   backends/tuple_call/tuple_call-c.h
+   backends/tuple_call/tuple_call-c.cpp
 
backends/dependencies/dependencies.hpp
backends/dependencies/dependencies.cpp
backends/dependencies/fgraph_dependencies.hpp
backends/dependencies/fgraph_dependencies.cpp
+   backends/dependencies/dependencies-c.h
+   backends/dependencies/dependencies-c.cpp
 
backends/llvm/initialize.hpp
backends/llvm/initialize.cpp
@@ -86,6 +97,10 @@ set(SRC
types/numeric.cpp
types/boolean.hpp
types/boolean.cpp
+   types/types-c.h
+   types/types-c.cpp
+   types/tuple_access-c.h
+   types/tuple_access-c.cpp
 
functions/object_input.hpp
functions/object_input.cpp
@@ -115,6 +130,8 @@ set(SRC
frontends/data_flow_nodes/inserters/sockets.cpp
frontends/data_flow_nodes/inserters/conversions.cpp
frontends/data_flow_nodes/util_wrappers.hpp
+   frontends/data_flow_nodes/data_flow_nodes-c.h
+   frontends/data_flow_nodes/data_flow_nodes-c.cpp
 )
 
 blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/functions/FN-C.h b/source/blender/functions/FN-C.h
deleted file mode 100644
index 7e54a5c0ab9..000
--- a/source/blender/functions/FN-C.h
+++ /dev/null
@@ -1,129 +0,0 @@
-#ifndef __FUNCTIONS_H__
-#define __FUNCTIONS_H__
-
-#include "BLI_utildefines.h"
-#include "BLI_alloca.h"
-#include "DNA_node_types.h"
-
-#ifde

[Bf-blender-cvs] [a6efbe95cf7] master: Fix T63292: Crash Workbench Texture Drawing

2019-04-05 Thread Jeroen Bakker
Commit: a6efbe95cf768d420b87f25fc9d6a3f85f5d6520
Author: Jeroen Bakker
Date:   Fri Apr 5 11:26:48 2019 +0200
Branches: master
https://developer.blender.org/rBa6efbe95cf768d420b87f25fc9d6a3f85f5d6520

Fix T63292: Crash Workbench Texture Drawing

===

M   source/blender/draw/engines/workbench/workbench_deferred.c

===

diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index 45fa7c8c453..f75d385714f 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -921,7 +921,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data 
*vedata, Object *ob)
int interp;

workbench_material_get_image_and_mat(ob, i + 1, &image, &iuser, &interp, &mat);
int color_type = 
workbench_material_determine_color_type(wpd, image, ob);
-   if (color_type == 
V3D_SHADING_MATERIAL_COLOR && mat->a < 1.0) {
+   if (color_type == 
V3D_SHADING_MATERIAL_COLOR && mat && mat->a < 1.0) {
material = 
workbench_forward_get_or_create_material_data(vedata, ob, mat, image, iuser, 
color_type, 0);
has_transp_mat = true;
}

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


[Bf-blender-cvs] [d40581a7149] master: GPencil: Improve drawing feeling in big files

2019-04-05 Thread Antonioya
Commit: d40581a71492c9d488dd68bb7fbd004881f9113d
Author: Antonioya
Date:   Fri Apr 5 11:26:04 2019 +0200
Branches: master
https://developer.blender.org/rBd40581a71492c9d488dd68bb7fbd004881f9113d

GPencil: Improve drawing feeling in big files

When drawing in big files, the first points of the stroke were not smooth 
because the system was doing a copy of the depsgraph datablock.

Now, the depsgraph is not updated at the beginning and the feeling is far 
better, especially for big files.

To avoid the copy, the original datablock is used while drawing, because it's 
faster the lookup of the original data, than a full datablock copy.

Also some cleanup of the code.

===

M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 1cc493dd8f5..3a74e44836d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -617,9 +617,20 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
}
 
/* draw current painting strokes
-* (only if region is equal to originated paint region) */
+* (only if region is equal to originated paint region)
+*
+* Need to use original data because to use the copy of data, 
the paint
+* operator must update depsgraph and this makes that first 
events of the
+* mouse are missed if the datablock is very big due the time 
required to
+* copy the datablock. The search of the original data is 
faster than a
+* full datablock copy.
+* Using the original data doesn't require a copy and the feel 
when drawing
+* is far better.
+*/
+
+   bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
if ((draw_ctx->obact == ob) &&
-   ((gpd->runtime.ar == NULL) || (gpd->runtime.ar == 
draw_ctx->ar)))
+   ((gpd_orig->runtime.ar == NULL) || 
(gpd_orig->runtime.ar == draw_ctx->ar)))
{
DRW_gpencil_populate_buffer_strokes(&e_data, vedata, 
ts, ob);
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index b66956b090d..d544bd8f9b6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1708,6 +1708,9 @@ static void gp_session_validatebuffer(tGPsdata *p)
/* reset flags */
gpd->runtime.sbuffer_sflag = 0;
 
+   /* reset region */
+   gpd->runtime.ar = NULL;
+
/* reset inittime */
p->inittime = 0.0;
 
@@ -1784,11 +1787,12 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata 
*p)
ToolSettings *ts = CTX_data_tool_settings(C);
 
Paint *paint = &ts->gp_paint->paint;
-
+   bool changed = false;
/* if not exist, create a new one */
if (paint->brush == NULL) {
/* create new brushes */
BKE_brush_gpencil_presets(C);
+   changed = true;
}
/* be sure curves are initializated */

curvemapping_initialize(paint->brush->gpencil_settings->curve_sensitivity);
@@ -1813,7 +1817,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata 
*p)
 * Maybe this update can be removed when the new tool system
 * will be in place, but while, we need this to keep drawing working.
 */
-   DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+   if (changed) {
+   DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+   }
 }
 
 
@@ -1946,13 +1952,6 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
p->gpd = *gpd_ptr;
}
 
-   if (ED_gpencil_session_active() == 0) {
-   /* initialize undo stack,
-* also, existing undo stack would make buffer drawn
-*/
-   gpencil_undo_init(p->gpd);
-   }
-
/* clear out buffer (stored in gp-data), in case something contaminated 
it */
gp_session_validatebuffer(p);
 
@@ -1961,6 +1960,9 @@ static bool gp_session_initdata(bContext *C, wmOperator 
*op, tGPsdata *p)
 
/* setup active color */
if (curarea->spacetype == SPACE_VIEW3D) {
+   /* region where paint was originated */
+   p->gpd->runtime.ar = CTX_wm_region(C);
+
/* NOTE: This is only done for 3D view, as Materials aren't 
used for
 *   annotations in 2D editors
 */
@@ -1984,9 +1986,6 @@ static bool gp_session_ini