[Bf-blender-cvs] [aa1b77dccbd] master: DRW: support clipping for object outlines

2019-01-23 Thread Campbell Barton
Commit: aa1b77dccbda5b57f857d27ed8f7d46544c82503
Author: Campbell Barton
Date:   Thu Jan 24 18:27:26 2019 +1100
Branches: master
https://developer.blender.org/rBaa1b77dccbda5b57f857d27ed8f7d46544c82503

DRW: support clipping for object outlines

===

M   source/blender/draw/modes/object_mode.c
M   source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
M   source/blender/draw/modes/shaders/object_outline_prepass_vert.glsl

===

diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 1f0bb4738db..bd8a112f710 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -418,12 +418,15 @@ static void OBJECT_engine_init(void *vedata)
 
if (!sh_data->outline_resolve) {
/* Outline */
-   sh_data->outline_prepass = 
DRW_shader_create_3D(datatoc_object_outline_prepass_frag_glsl, NULL);
-
-   sh_data->outline_prepass_wire = DRW_shader_create(
-   datatoc_object_outline_prepass_vert_glsl,
-   datatoc_object_outline_prepass_geom_glsl,
-   datatoc_object_outline_prepass_frag_glsl, NULL);
+   sh_data->outline_prepass = DRW_shader_create_from_arrays({
+   .vert = (const char *[]){world_clip_lib_or_empty, 
datatoc_drw_shader_3D_vert_glsl, NULL},
+   .frag = (const char 
*[]){datatoc_object_outline_prepass_frag_glsl, NULL},
+   .defs = (const char *[]){world_clip_def_or_empty, 
NULL}});
+   sh_data->outline_prepass_wire = DRW_shader_create_from_arrays({
+   .vert = (const char *[]){world_clip_lib_or_empty, 
datatoc_object_outline_prepass_vert_glsl, NULL},
+   .geom = (const char *[]){world_clip_lib_or_empty, 
datatoc_object_outline_prepass_geom_glsl, NULL},
+   .frag = (const char 
*[]){datatoc_object_outline_prepass_frag_glsl, NULL},
+   .defs = (const char *[]){world_clip_def_or_empty, 
NULL}});
 
sh_data->outline_resolve = 
DRW_shader_create_fullscreen(datatoc_object_outline_resolve_frag_glsl, NULL);
 
@@ -665,11 +668,14 @@ static void OBJECT_engine_free(void)
}
 }
 
-static DRWShadingGroup *shgroup_outline(DRWPass *pass, const int *ofs, 
GPUShader *sh)
+static DRWShadingGroup *shgroup_outline(DRWPass *pass, const int *ofs, 
GPUShader *sh, eDRW_ShaderSlot shader_slot)
 {
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
DRW_shgroup_uniform_int(grp, "baseId", ofs, 1);
 
+   if (shader_slot == DRW_SHADER_SLOT_CLIPPED) {
+   DRW_shgroup_world_clip_planes_from_rv3d(grp, 
DRW_context_state_get()->rv3d);
+   }
return grp;
 }
 
@@ -1002,10 +1008,10 @@ static void OBJECT_cache_init(void *vedata)
sh = sh_data->outline_prepass_wire;
}
 
-   g_data->outlines_select = shgroup_outline(psl->outlines, 
&g_data->id_ofs_select, sh);
-   g_data->outlines_select_dupli = shgroup_outline(psl->outlines, 
&g_data->id_ofs_select_dupli, sh);
-   g_data->outlines_transform = shgroup_outline(psl->outlines, 
&g_data->id_ofs_transform, sh);
-   g_data->outlines_active = shgroup_outline(psl->outlines, 
&g_data->id_ofs_active, sh);
+   g_data->outlines_select = shgroup_outline(psl->outlines, 
&g_data->id_ofs_select, sh, draw_ctx->shader_slot);
+   g_data->outlines_select_dupli = shgroup_outline(psl->outlines, 
&g_data->id_ofs_select_dupli, sh, draw_ctx->shader_slot);
+   g_data->outlines_transform = shgroup_outline(psl->outlines, 
&g_data->id_ofs_transform, sh, draw_ctx->shader_slot);
+   g_data->outlines_active = shgroup_outline(psl->outlines, 
&g_data->id_ofs_active, sh, draw_ctx->shader_slot);
 
g_data->id_ofs_select = 0;
g_data->id_ofs_select_dupli = 0;
diff --git a/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl 
b/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
index 1fa0a9137c0..85da0f25654 100644
--- a/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_prepass_geom.glsl
@@ -7,6 +7,14 @@ uniform mat4 ProjectionMatrix;
 in vec4 pPos[];
 in vec3 vPos[];
 
+void vert_from_gl_in(int v)
+{
+   gl_Position = pPos[v];
+#ifdef USE_WORLD_CLIP_PLANES
+   world_clip_planes_set_clip_distance(gl_in[v].gl_ClipDistance);
+#endif
+}
+
 void main()
 {
bool is_persp = (ProjectionMatrix[3][3] == 0.0);
@@ -34,7 +42,11 @@ void main()
// if (dot(n0, v13) > 0.01)
//  return;
 
-   gl_Position = pPos[1]; EmitVertex();
-   gl_Position = pPos[2]; EmitVertex();
+   ver

[Bf-blender-cvs] [0b37399cbe2] master: Fix T60790, T60636, T60631: MMB emulation issues after recent changes.

2019-01-23 Thread Brecht Van Lommel
Commit: 0b37399cbe241cb6c99cd4b758d5701e2791c7e3
Author: Brecht Van Lommel
Date:   Thu Jan 24 07:06:49 2019 +0100
Branches: master
https://developer.blender.org/rB0b37399cbe241cb6c99cd4b758d5701e2791c7e3

Fix T60790, T60636, T60631: MMB emulation issues after recent changes.

The statusbar keymap display should not affect actual event handling.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index ad8c7bb60a3..29bbd6b0641 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3721,7 +3721,7 @@ static int convert_key(GHOST_TKey key)
}
 }
 
-static void wm_eventemulation(wmEvent *event)
+static void wm_eventemulation(wmEvent *event, bool test_only)
 {
/* Store last mmb/rmb event value to make emulation work when modifier 
keys
 * are released first. This really should be in a data structure 
somewhere. */
@@ -3734,13 +3734,19 @@ static void wm_eventemulation(wmEvent *event)
if (event->val == KM_PRESS && event->alt) {
event->type = MIDDLEMOUSE;
event->alt = 0;
-   emulating_event = MIDDLEMOUSE;
+
+   if (!test_only) {
+   emulating_event = MIDDLEMOUSE;
+   }
}
 #ifdef __APPLE__
else if (event->val == KM_PRESS && event->oskey) {
event->type = RIGHTMOUSE;
event->oskey = 0;
-   emulating_event = RIGHTMOUSE;
+
+   if (!test_only) {
+   emulating_event = RIGHTMOUSE;
+   }
}
 #endif
else if (event->val == KM_RELEASE) {
@@ -3753,7 +3759,10 @@ static void wm_eventemulation(wmEvent *event)
event->type = RIGHTMOUSE;
event->oskey = 0;
}
-   emulating_event = EVENT_NONE;
+
+   if (!test_only) {
+   emulating_event = EVENT_NONE;
+   }
}
}
 
@@ -4036,7 +4045,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, 
wmWindow *win, int type, int U
else
event.type = MIDDLEMOUSE;
 
-   wm_eventemulation(&event);
+   wm_eventemulation(&event, false);
 
/* copy previous state to prev event state (two old!) */
evt->prevval = evt->val;
@@ -4096,7 +4105,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, 
wmWindow *win, int type, int U
memcpy(event.utf8_buf, kd->utf8_buf, 
sizeof(event.utf8_buf)); /* might be not null terminated*/
event.val = (type == GHOST_kEventKeyDown) ? KM_PRESS : 
KM_RELEASE;
 
-   wm_eventemulation(&event);
+   wm_eventemulation(&event, false);
 
/* copy previous state to prev event state (two old!) */
evt->prevval = evt->val;
@@ -4674,7 +4683,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, 
wmWindow *win)
wmEvent test_event = *win->eventstate;
test_event.type = event_data[data_index].event_type;
test_event.val = event_data[data_index].event_value;
-   wm_eventemulation(&test_event);
+   wm_eventemulation(&test_event, true);
wmKeyMapItem *kmi = NULL;
for (int handler_index = 0; handler_index < 
ARRAY_SIZE(handlers); handler_index++) {
kmi = wm_kmi_from_event(C, wm, handlers[handler_index], 
&test_event);

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


[Bf-blender-cvs] [cd8a342d7cc] master: Cleanup: fix compiler warnings.

2019-01-23 Thread Brecht Van Lommel
Commit: cd8a342d7cce97b764123668b2c4edbcd09bdffc
Author: Brecht Van Lommel
Date:   Thu Jan 24 07:30:24 2019 +0100
Branches: master
https://developer.blender.org/rBcd8a342d7cce97b764123668b2c4edbcd09bdffc

Cleanup: fix compiler warnings.

===

M   source/blender/draw/intern/draw_builtin_shader.c
M   source/blender/draw/modes/paint_vertex_mode.c

===

diff --git a/source/blender/draw/intern/draw_builtin_shader.c 
b/source/blender/draw/intern/draw_builtin_shader.c
index 56bdd652f9f..5c0c005cb9d 100644
--- a/source/blender/draw/intern/draw_builtin_shader.c
+++ b/source/blender/draw/intern/draw_builtin_shader.c
@@ -97,12 +97,14 @@ static GPUShader 
*drw_shader_get_builtin_shader_clipped(eGPUBuiltinShader shader
return shader;
 }
 
+#ifndef NDEBUG
 static bool drw_shader_get_builtin_shader_test_all(eGPUBuiltinShader shader_id)
 {
bool test = false;
drw_shader_get_builtin_shader_clipped(shader_id, &test);
return test;
 }
+#endif
 
 GPUShader *DRW_shader_get_builtin_shader(eGPUBuiltinShader shader_id, 
eDRW_ShaderSlot slot)
 {
@@ -123,6 +125,7 @@ GPUShader *DRW_shader_get_builtin_shader(eGPUBuiltinShader 
shader_id, eDRW_Shade
}
else {
BLI_assert(0);
+   return NULL;
}
 }
 
diff --git a/source/blender/draw/modes/paint_vertex_mode.c 
b/source/blender/draw/modes/paint_vertex_mode.c
index 9fb307b556d..d63f6216e92 100644
--- a/source/blender/draw/modes/paint_vertex_mode.c
+++ b/source/blender/draw/modes/paint_vertex_mode.c
@@ -85,7 +85,7 @@ typedef struct PAINT_VERTEX_Shaders {
 
 static struct {
PAINT_VERTEX_Shaders sh_data[DRW_SHADER_SLOT_LEN];
-} e_data = {NULL}; /* Engine data */
+} e_data = {{{NULL}}}; /* Engine data */
 
 typedef struct PAINT_VERTEX_PrivateData {
DRWShadingGroup *fvcolor_shgrp;

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


[Bf-blender-cvs] [11428e0b7f7] master: DRW: use clipping for depth buffer

2019-01-23 Thread Campbell Barton
Commit: 11428e0b7f7aafd3c6fa6b0cd0a77f4c1ff8e48c
Author: Campbell Barton
Date:   Thu Jan 24 17:12:06 2019 +1100
Branches: master
https://developer.blender.org/rB11428e0b7f7aafd3c6fa6b0cd0a77f4c1ff8e48c

DRW: use clipping for depth buffer

Object selection now supports clipping.

===

M   source/blender/draw/engines/basic/basic_engine.c
M   source/blender/draw/engines/external/external_engine.c
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_builtin_shader.c
M   source/blender/draw/intern/draw_manager_shader.c
M   source/blender/draw/modes/edit_mesh_mode.c

===

diff --git a/source/blender/draw/engines/basic/basic_engine.c 
b/source/blender/draw/engines/basic/basic_engine.c
index 0ee6853409a..7f4da54e63d 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -66,11 +66,15 @@ typedef struct BASIC_Data {
BASIC_StorageList *stl;
 } BASIC_Data;
 
+typedef struct BASIC_Shaders {
+   /* Depth Pre Pass */
+   struct GPUShader *depth;
+} BASIC_Shaders;
+
 /* *** STATIC *** */
 
 static struct {
-   /* Depth Pre Pass */
-   struct GPUShader *depth_sh;
+   BASIC_Shaders sh_data[DRW_SHADER_SLOT_LEN];
 } e_data = {NULL}; /* Engine data */
 
 typedef struct BASIC_PrivateData {
@@ -83,9 +87,12 @@ typedef struct BASIC_PrivateData {
 
 static void basic_engine_init(void *UNUSED(vedata))
 {
+   const DRWContextState *draw_ctx = DRW_context_state_get();
+   BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_slot];
+
/* Depth prepass */
-   if (!e_data.depth_sh) {
-   e_data.depth_sh = DRW_shader_create_3D_depth_only();
+   if (!sh_data->depth) {
+   sh_data->depth = 
DRW_shader_create_3D_depth_only(draw_ctx->shader_slot);
}
 }
 
@@ -94,6 +101,15 @@ static void basic_cache_init(void *vedata)
BASIC_PassList *psl = ((BASIC_Data *)vedata)->psl;
BASIC_StorageList *stl = ((BASIC_Data *)vedata)->stl;
 
+   const DRWContextState *draw_ctx = DRW_context_state_get();
+   BASIC_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_slot];
+   const RegionView3D *rv3d = draw_ctx->rv3d;
+   const bool is_clip = (rv3d->rflag & RV3D_CLIPPING) != 0;
+
+   if (is_clip) {
+   DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
+   }
+
if (!stl->g_data) {
/* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
@@ -102,12 +118,18 @@ static void basic_cache_init(void *vedata)
{
psl->depth_pass = DRW_pass_create(
"Depth Pass", DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
-   stl->g_data->depth_shgrp = DRW_shgroup_create(e_data.depth_sh, 
psl->depth_pass);
+   stl->g_data->depth_shgrp = DRW_shgroup_create(sh_data->depth, 
psl->depth_pass);
+   if (rv3d->rflag & RV3D_CLIPPING) {
+   
DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->depth_shgrp, rv3d);
+   }
 
psl->depth_pass_cull = DRW_pass_create(
"Depth Pass Cull",
DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | 
DRW_STATE_CULL_BACK);
-   stl->g_data->depth_shgrp_cull = 
DRW_shgroup_create(e_data.depth_sh, psl->depth_pass_cull);
+   stl->g_data->depth_shgrp_cull = 
DRW_shgroup_create(sh_data->depth, psl->depth_pass_cull);
+   if (rv3d->rflag & RV3D_CLIPPING) {
+   
DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->depth_shgrp_cull, rv3d);
+   }
}
 }
 
diff --git a/source/blender/draw/engines/external/external_engine.c 
b/source/blender/draw/engines/external/external_engine.c
index c7d5b4a49e1..f0a83b7c926 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -103,7 +103,7 @@ static void external_engine_init(void *UNUSED(vedata))
 {
/* Depth prepass */
if (!e_data.depth_sh) {
-   e_data.depth_sh = DRW_shader_create_3D_depth_only();
+   e_data.depth_sh = 
DRW_shader_create_3D_depth_only(DRW_SHADER_SLOT_DEFAULT);
}
 }
 
diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 22d740bd512..395d9483deb 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -94,6 +94,16 @@ typedef struct BoundSphere {
float center[3], radius;
 } BoundSphere;
 
+/**
+ * Support selecting shaders with different options compiled in.
+ * Needed for clipping support because it means using a separate set of 
shaders.
+ */
+typedef enum eDRW_Sha

[Bf-blender-cvs] [4d29312c66d] master: Cleanup: trailing space guardedalloc & memutil

2019-01-23 Thread Campbell Barton
Commit: 4d29312c66dd56498fbab35e2892944d33484461
Author: Campbell Barton
Date:   Thu Jan 24 16:20:16 2019 +1100
Branches: master
https://developer.blender.org/rB4d29312c66dd56498fbab35e2892944d33484461

Cleanup: trailing space guardedalloc & memutil

===

M   intern/guardedalloc/MEM_guardedalloc.h
M   intern/guardedalloc/intern/mallocn_guarded_impl.c
M   intern/guardedalloc/intern/mallocn_inline.h
M   intern/guardedalloc/intern/mmap_win.c
M   intern/guardedalloc/mmap_win.h
M   intern/guardedalloc/test/simpletest/memtest.c
M   intern/memutil/MEM_Allocator.h
M   intern/memutil/MEM_RefCounted.h
M   intern/memutil/MEM_RefCountedC-Api.h

===

diff --git a/intern/guardedalloc/MEM_guardedalloc.h 
b/intern/guardedalloc/MEM_guardedalloc.h
index 65650209711..c8a1441acf9 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -48,11 +48,11 @@
  *
  * There are currently no known issues with MEM. Note that there is a
  * second intern/ module with MEM_ prefix, for use in c++.
- * 
+ *
  * \subsection memdependencies Dependencies
  * - stdlib
  * - stdio
- * 
+ *
  * \subsection memdocs API Documentation
  * See \ref MEM_guardedalloc.h
  */
@@ -146,11 +146,11 @@ extern "C" {
extern void *(*MEM_mapallocN)(size_t len, const char *str) /* 
ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2);
 
/** Print a list of the names and sizes of all allocated memory
-* blocks. as a python dict for easy investigation */ 
+* blocks. as a python dict for easy investigation */
extern void (*MEM_printmemlist_pydict)(void);
 
/** Print a list of the names and sizes of all allocated memory
-* blocks. */ 
+* blocks. */
extern void (*MEM_printmemlist)(void);
 
/** calls the function on all allocated memory blocks. */
@@ -158,7 +158,7 @@ extern "C" {
 
/** Print statistics about memory usage */
extern void (*MEM_printmemlist_stats)(void);
-   
+
/** Set the callback function for error output. */
extern void (*MEM_set_error_callback)(void (*func)(const char *));
 
@@ -171,7 +171,7 @@ extern "C" {
/** Set thread locking functions for safe memory allocation from 
multiple
 * threads, pass NULL pointers to disable thread locking again. */
extern void (*MEM_set_lock_callback)(void (*lock)(void), void 
(*unlock)(void));
-   
+
/** Attempt to enforce OSX (or other OS's) to have malloc and stack 
nonzero */
extern void (*MEM_set_memory_debug)(void);
 
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c 
b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index d09f1b83ad4..d6ae11637db 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -197,7 +197,7 @@ static const char *check_memlist(MemHead *memh);
 /* - */
 /* vars  */
 /* - */
-   
+
 
 static unsigned int totblock = 0;
 static size_t mem_in_use = 0, mmap_in_use = 0, peak_mem = 0;
@@ -289,7 +289,7 @@ bool MEM_guarded_consistency_check(void)
/* check_memlist starts from the front, and runs until it finds
 * the requested chunk. For this test, that's the last one. */
listend = membase->last;
-   
+
err_val = check_memlist(listend);
 
return (err_val == NULL);
@@ -316,7 +316,7 @@ size_t MEM_guarded_allocN_len(const void *vmemh)
 {
if (vmemh) {
const MemHead *memh = vmemh;
-   
+
memh--;
return memh->len;
}
@@ -328,7 +328,7 @@ size_t MEM_guarded_allocN_len(const void *vmemh)
 void *MEM_guarded_dupallocN(const void *vmemh)
 {
void *newp = NULL;
-   
+
if (vmemh) {
const MemHead *memh = vmemh;
memh--;
@@ -378,7 +378,7 @@ void *MEM_guarded_dupallocN(const void *vmemh)
 void *MEM_guarded_reallocN_id(void *vmemh, size_t len, const char *str)
 {
void *newp = NULL;
-   
+
if (vmemh) {
MemHead *memh = vmemh;
memh--;
@@ -485,7 +485,7 @@ static void print_memhead_backtrace(MemHead *memh)
 static void make_memhead_header(MemHead *memh, size_t len, const char *str)
 {
MemTail *memt;
-   
+
memh->tag1 = MEMTAG1;
memh->name = str;
memh->nextname = NULL;
@@ -522,7 +522,7 @@ void *MEM_guarded_mallocN(size_t len, const char *str)
MemHead *memh;
 
len = SIZET_ALIGN_4(len);
-   
+
memh = (MemHead *)malloc(len + sizeof(MemHead) + sizeof(MemTail));
 
if (LIKELY(memh)) {
@@ -7

[Bf-blender-cvs] [d8a082f914c] master: Correct doxy file

2019-01-23 Thread Campbell Barton
Commit: d8a082f914c04e93e4e77463fcc7f8514ce6bfff
Author: Campbell Barton
Date:   Thu Jan 24 16:19:45 2019 +1100
Branches: master
https://developer.blender.org/rBd8a082f914c04e93e4e77463fcc7f8514ce6bfff

Correct doxy file

===

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

===

diff --git a/source/blender/draw/intern/draw_builtin_shader.c 
b/source/blender/draw/intern/draw_builtin_shader.c
index 3f49f9d2731..e89e257c2fe 100644
--- a/source/blender/draw/intern/draw_builtin_shader.c
+++ b/source/blender/draw/intern/draw_builtin_shader.c
@@ -19,7 +19,7 @@
  *
  */
 
-/** \file draw_armature.c
+/** \file draw_builtin_shader.c
  *  \ingroup draw
  * Draw manager versions of #eGPUBuiltinShader, see 
#GPU_shader_get_builtin_shader.
  *

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


[Bf-blender-cvs] [04d18b117c2] master: DRW: API for own versions of builtin GPU shaders

2019-01-23 Thread Campbell Barton
Commit: 04d18b117c2f95b0b28df12c9ddac06b018d6236
Author: Campbell Barton
Date:   Thu Jan 24 15:02:40 2019 +1100
Branches: master
https://developer.blender.org/rB04d18b117c2f95b0b28df12c9ddac06b018d6236

DRW: API for own versions of builtin GPU shaders

DRW_shader_get_builtin_shader can replace GPU_shader_get_builtin_shader
when we need to support clipping.

Use this for loose point & wire drawing in object mode,
clips edges in lattice edit mode.

===

M   source/blender/draw/CMakeLists.txt
A   source/blender/draw/intern/draw_builtin_shader.c
A   source/blender/draw/intern/draw_builtin_shader.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/modes/edit_lattice_mode.c
M   source/blender/draw/modes/object_mode.c
A   source/blender/draw/modes/shaders/drw_shader_3D_smooth_color_vert.glsl
A   source/blender/draw/modes/shaders/drw_shader_3D_vert.glsl

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index a305d18a592..c25d5564b21 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -55,6 +55,7 @@ set(INC_SYS
 set(SRC
intern/draw_anim_viz.c
intern/draw_armature.c
+   intern/draw_builtin_shader.c
intern/draw_cache.c
intern/draw_cache_impl_curve.c
intern/draw_cache_impl_displist.c
@@ -133,6 +134,7 @@ set(SRC
 
DRW_engine.h
intern/DRW_render.h
+   intern/draw_builtin_shader.h
intern/draw_cache.h
intern/draw_cache_impl.h
intern/draw_common.h
@@ -323,6 +325,8 @@ data_to_c_simple(modes/shaders/particle_strand_frag.glsl 
SRC)
 data_to_c_simple(modes/shaders/particle_strand_vert.glsl SRC)
 data_to_c_simple(modes/shaders/sculpt_mask_vert.glsl SRC)
 data_to_c_simple(modes/shaders/volume_velocity_vert.glsl SRC)
+data_to_c_simple(modes/shaders/drw_shader_3D_vert.glsl SRC)
+data_to_c_simple(modes/shaders/drw_shader_3D_smooth_color_vert.glsl SRC)
 
 data_to_c_simple(engines/gpencil/shaders/gpencil_fill_vert.glsl SRC)
 data_to_c_simple(engines/gpencil/shaders/gpencil_fill_frag.glsl SRC)
diff --git a/source/blender/draw/intern/draw_builtin_shader.c 
b/source/blender/draw/intern/draw_builtin_shader.c
new file mode 100644
index 000..3f49f9d2731
--- /dev/null
+++ b/source/blender/draw/intern/draw_builtin_shader.c
@@ -0,0 +1,131 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * * END GPL LICENSE BLOCK *
+ *
+ */
+
+/** \file draw_armature.c
+ *  \ingroup draw
+ * Draw manager versions of #eGPUBuiltinShader, see 
#GPU_shader_get_builtin_shader.
+ *
+ * Allows for modifications to shaders (currently only clipping support).
+ * Follow GPU_shader.h conventions to avoid annoyance.
+ */
+
+#include "BLI_utildefines.h"
+
+#include "GPU_shader.h"
+
+#include "DRW_render.h"
+
+#include "draw_builtin_shader.h"  /* own include */
+
+
+extern char datatoc_common_world_clip_lib_glsl[];
+
+extern char datatoc_drw_shader_3D_vert_glsl[];
+extern char datatoc_drw_shader_3D_smooth_color_vert_glsl[];
+
+extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
+extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
+
+
+/* cache of built-in shaders (each is created on first use) */
+static struct {
+   GPUShader *builtin_shaders[GPU_NUM_BUILTIN_SHADERS];
+} g_sh_data[DRW_SHADER_SLOT_LEN - 1] = {{{NULL}}};
+
+static GPUShader *drw_shader_get_builtin_shader_clipped(eGPUBuiltinShader 
shader_id, bool *r_test_only)
+{
+   const char *world_clip_lib = datatoc_common_world_clip_lib_glsl;
+   const char *world_clip_def = "#define USE_WORLD_CLIP_PLANES\n";
+
+   if (r_test_only) {
+   *r_test_only = true;
+   }
+
+   GPUShader *shader = NULL;
+   switch (shader_id) {
+   case GPU_SHADER_3D_UNIFORM_COLOR:
+   if (r_test_only) {
+   break;
+   }
+   shader = DRW_shader_create_from_arrays({
+   .vert = (const char *[]){world_clip_lib, 
datatoc_drw_shader_3D_vert_glsl, NULL},
+   .

[Bf-blender-cvs] [1d908bffddb] master: WM: Repeat Last no longer reuses skip-save properties

2019-01-23 Thread Campbell Barton
Commit: 1d908bffddb4c9815a986305ad4588032b81deee
Author: Campbell Barton
Date:   Thu Jan 24 12:06:47 2019 +1100
Branches: master
https://developer.blender.org/rB1d908bffddb4c9815a986305ad4588032b81deee

WM: Repeat Last no longer reuses skip-save properties

PROP_SKIP_SAVE is often used as a way to detect the difference between
adjusting options from the redo panel and initial execution.

Repeat last operator was executing with skip-save properties set,
preventing operators from initializing them based on the context.

Fixes 60777.

===

M   source/blender/editors/screen/screen_ops.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 6d332f8e427..8736664d23c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3359,7 +3359,7 @@ static int repeat_last_exec(bContext *C, wmOperator 
*UNUSED(op))
 
if (lastop) {
WM_operator_free_all_after(wm, lastop);
-   WM_operator_repeat(C, lastop);
+   WM_operator_repeat_interactive(C, lastop);
}
 
return OPERATOR_CANCELLED;
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 4f73e731457..99e4950f3db 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -321,6 +321,8 @@ boolWM_operator_poll_context(struct bContext *C, 
struct wmOperatorType *
 int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, 
const bool store);
 intWM_operator_call(struct bContext *C, 
struct wmOperator *op);
 intWM_operator_call_notest(struct bContext *C, struct 
wmOperator *op);
+
+intWM_operator_repeat_interactive(struct bContext *C, 
struct wmOperator *op);
 intWM_operator_repeat  (struct bContext *C, 
struct wmOperator *op);
 boolWM_operator_repeat_check(const struct bContext *C, struct 
wmOperator *op);
 boolWM_operator_is_repeat(const struct bContext *C, const struct 
wmOperator *op);
@@ -345,6 +347,7 @@ voidWM_operator_last_properties_ensure(struct 
wmOperatorType *ot, struct
 wmOperator *WM_operator_last_redo(const struct bContext *C);
 ID *WM_operator_drop_load_path(struct bContext *C, struct wmOperator 
*op, const short idcode);
 
+boolWM_operator_last_properties_init_ex(struct wmOperator *op, struct 
IDProperty *last_properties);
 boolWM_operator_last_properties_init(struct wmOperator *op);
 boolWM_operator_last_properties_store(struct wmOperator *op);
 
diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 5feacea9666..ad8c7bb60a3 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1040,6 +1040,42 @@ int WM_operator_repeat(bContext *C, wmOperator *op)
 {
return wm_operator_exec(C, op, true, true);
 }
+/**
+ * Execute this operator again interactively
+ * without using #PROP_SKIP_SAVE properties, see: T60777.
+ */
+int WM_operator_repeat_interactive(bContext *C, wmOperator *op)
+{
+   IDProperty *properties = op->properties ? IDP_New(IDP_GROUP, 
&(IDPropertyTemplate){0}, "wmOperatorProperties") : NULL;
+   PointerRNA *ptr = MEM_dupallocN(op->ptr);
+
+   SWAP(IDProperty *, op->properties, properties);
+   SWAP(PointerRNA *, op->ptr, ptr);
+   if (op->ptr) {
+   op->ptr->data = op->properties;
+   }
+
+   /* Use functionality to initialize from previous execution to avoid 
re-using PROP_SKIP_SAVE. */
+   if (properties) {
+   WM_operator_last_properties_init_ex(op, properties);
+   }
+
+   int retval = wm_operator_exec(C, op, true, true);
+
+   SWAP(IDProperty *, op->properties, properties);
+   SWAP(PointerRNA *, op->ptr, ptr);
+
+   if (properties) {
+   IDP_FreeProperty(properties);
+   MEM_freeN(properties);
+   }
+   if (ptr) {
+   MEM_freeN(ptr);
+   }
+
+   return retval;
+}
+
 /**
  * \return true if #WM_operator_repeat can run
  * simple check for now but may become more involved.
@@ -1226,13 +1262,13 @@ static bool 
operator_last_properties_init_impl(wmOperator *op, IDProperty *last_
return changed;
 }
 
-bool WM_operator_last_properties_init(wmOperator *op)
+bool WM_operator_last_properties_init_ex(wmOperator *op, IDProperty 
*last_properties)
 {
bool changed = false;
-   if (op->type->last_properties) {
-   changed |= operator_last_properties_init_impl(op, 
op->type->last

[Bf-blender-cvs] [7f77961f1c3] master: Fix theme color use for clipping region

2019-01-23 Thread Campbell Barton
Commit: 7f77961f1c387a93f3fe1df71558d5602f2ca521
Author: Campbell Barton
Date:   Thu Jan 24 10:35:34 2019 +1100
Branches: master
https://developer.blender.org/rB7f77961f1c387a93f3fe1df71558d5602f2ca521

Fix theme color use for clipping region

Color needed to be converted to linear in the engine,
not the theme.

===

M   release/datafiles/userdef/userdef_default_theme.c
M   source/blender/draw/engines/workbench/workbench_data.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 39ba48eef0a..aa275d6a99e 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -355,7 +355,7 @@ const bTheme U_theme_default = {
.outline_width = 1,
.facedot_size = 3,
.editmesh_active = RGBA(0xff80),
-   .clipping_border_3d = RGBA(0x0f0f0fff),
+   .clipping_border_3d = RGBA(0x313131ff),
.bundle_solid = RGBA(0xc8c8c8ff),
.camera_path = RGBA(0x00ff),
.gp_vertex_size = 3,
diff --git a/source/blender/draw/engines/workbench/workbench_data.c 
b/source/blender/draw/engines/workbench/workbench_data.c
index 931dfd63088..b5e55d157d0 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -121,6 +121,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
wpd->world_clip_planes = rv3d->clip;
DRW_state_clip_planes_set_from_rv3d(rv3d);
UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, 
wpd->world_clip_planes_color);
+   srgb_to_linearrgb_v3_v3(wpd->world_clip_planes_color, 
wpd->world_clip_planes_color);
}
else {
wpd->world_clip_planes = NULL;

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


[Bf-blender-cvs] [41a7dd383cc] master: Cleanup: style

2019-01-23 Thread Campbell Barton
Commit: 41a7dd383cc77566655a60e35e74ec1276d04020
Author: Campbell Barton
Date:   Thu Jan 24 09:27:14 2019 +1100
Branches: master
https://developer.blender.org/rB41a7dd383cc77566655a60e35e74ec1276d04020

Cleanup: style

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2c95a9207ec..321e61ac092 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -271,8 +271,9 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 brush_basic_sculpt_settings(col, context, brush)
 
 # topology_rake_factor
-if capabilities.has_topology_rake and \
-   context.sculpt_object.use_dynamic_topology_sculpting:
+if (capabilities.has_topology_rake and
+context.sculpt_object.use_dynamic_topology_sculpting
+):
 col.separator()
 row = col.row()
 row.prop(brush, "topology_rake_factor", slider=True)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index a34b7eeb913..1cb9385c848 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -395,7 +395,8 @@ void 
DepsgraphRelationBuilder::add_particle_forcefield_relations(
add_relation(eff_key, key, name);
 
if (ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, 
PFIELD_SHAPE_POINTS) ||
-   relation->pd->forcefield == PFIELD_GUIDE) {
+   relation->pd->forcefield == PFIELD_GUIDE)
+   {
ComponentKey mod_key(&relation->ob->id, 
DEG_NODE_TYPE_GEOMETRY);
add_relation(mod_key, key, name);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index b25b9f4fff6..dc607fe91fd 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2160,10 +2160,10 @@ static void bmesh_topology_rake(
settings.use_threading = ((sd->flags & SCULPT_USE_OPENMP) && 
totnode > SCULPT_THREADED_LIMIT);
 
BLI_task_parallel_range(
-   0, totnode,
-   &data,
-   do_topology_rake_bmesh_task_cb_ex,
-   &settings);
+   0, totnode,
+   &data,
+   do_topology_rake_bmesh_task_cb_ex,
+   &settings);
}
 }
 
@@ -4625,6 +4625,7 @@ static void 
sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
mul_mat3_m4_v3(imat, cache->grab_delta);
break;
default:
+   /* Use for 
'Brush.topology_rake_factor'. */
sub_v3_v3v3(cache->grab_delta, 
grab_location, cache->old_grab_location);
break;

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


[Bf-blender-cvs] [32c2e941e63] master: Fix T60417: Hair not instantly updating when editing curve guide

2019-01-23 Thread Philipp Oeser
Commit: 32c2e941e639c6e6e6eb5c60ceacdf360eb13d03
Author: Philipp Oeser
Date:   Fri Jan 11 13:13:55 2019 +0100
Branches: master
https://developer.blender.org/rB32c2e941e639c6e6e6eb5c60ceacdf360eb13d03

Fix T60417: Hair not instantly updating when editing curve guide

Reviewers: sergey, brecht

Maniphest Tasks: T60417

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

===

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

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 838905ac977..a34b7eeb913 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -394,7 +394,8 @@ void 
DepsgraphRelationBuilder::add_particle_forcefield_relations(
ComponentKey eff_key(&relation->ob->id, 
DEG_NODE_TYPE_TRANSFORM);
add_relation(eff_key, key, name);
 
-   if (ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, 
PFIELD_SHAPE_POINTS)) {
+   if (ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, 
PFIELD_SHAPE_POINTS) ||
+   relation->pd->forcefield == PFIELD_GUIDE) {
ComponentKey mod_key(&relation->ob->id, 
DEG_NODE_TYPE_GEOMETRY);
add_relation(mod_key, key, name);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc 
b/source/blender/depsgraph/intern/depsgraph_physics.cc
index 8d1b923f834..e091f612a05 100644
--- a/source/blender/depsgraph/intern/depsgraph_physics.cc
+++ b/source/blender/depsgraph/intern/depsgraph_physics.cc
@@ -155,7 +155,8 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle,
handle, relation->ob, DEG_OB_COMP_TRANSFORM, name);
 
if (relation->psys ||
-   ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, 
PFIELD_SHAPE_POINTS))
+   ELEM(relation->pd->shape, PFIELD_SHAPE_SURFACE, 
PFIELD_SHAPE_POINTS) ||
+   relation->pd->forcefield == PFIELD_GUIDE)
{
/* TODO(sergey): Consider going more granular with more 
dedicated
 * particle system operation. */

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


[Bf-blender-cvs] [657806691b9] master: Fix T58438: wrong display of brush angle rotation preview.

2019-01-23 Thread Pablo Dobarro
Commit: 657806691b99f1e6f0f297f273e5ff9c1085564c
Author: Pablo Dobarro
Date:   Wed Jan 23 20:25:37 2019 +0100
Branches: master
https://developer.blender.org/rB657806691b99f1e6f0f297f273e5ff9c1085564c

Fix T58438: wrong display of brush angle rotation preview.

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

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index 0f2e6a18af4..8351a62b760 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2192,14 +2192,14 @@ static void radial_control_paint_cursor(bContext 
*UNUSED(C), int x, int y, void
GPU_matrix_push();
 
/* draw original angle line */
-   GPU_matrix_rotate_2d(RAD2DEGF(rc->initial_value));
+   GPU_matrix_rotate_3f(RAD2DEGF(rc->initial_value), 0.0f, 0.0f, 
1.0f);
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 
0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
 
/* draw new angle line */
-   GPU_matrix_rotate_2d(RAD2DEGF(rc->current_value - 
rc->initial_value));
+   GPU_matrix_rotate_3f(RAD2DEGF(rc->current_value - 
rc->initial_value), 0.0f, 0.0f, 1.0f);
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 
0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);

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


[Bf-blender-cvs] [b592e34559d] master: Sculpt: add Topology Rake, to align edges along brush while painting.

2019-01-23 Thread Jean Da Costa
Commit: b592e34559da82f86339e97b25ceac9f844719ab
Author: Jean Da Costa
Date:   Wed Jan 23 18:38:40 2019 +0100
Branches: master
https://developer.blender.org/rBb592e34559da82f86339e97b25ceac9f844719ab

Sculpt: add Topology Rake, to align edges along brush while painting.

This helps to generate cleaner topology and define sharp features for dynamic
topology. Best used on relatively low-poly meshes, it is not needed as much
for high detail areas and has a performance impact.

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

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/intern/brush.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 95f97ee454f..2c95a9207ec 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -270,6 +270,13 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 if not self.is_popover:
 brush_basic_sculpt_settings(col, context, brush)
 
+# topology_rake_factor
+if capabilities.has_topology_rake and \
+   context.sculpt_object.use_dynamic_topology_sculpting:
+col.separator()
+row = col.row()
+row.prop(brush, "topology_rake_factor", slider=True)
+
 # auto_smooth_factor and use_inverse_smooth_pressure
 if capabilities.has_auto_smooth:
 col.separator()
diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index f9ba8765d04..bb42f7412e6 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -79,6 +79,7 @@ static void brush_defaults(Brush *brush)
brush->size = 35; /* radius of the brush in pixels */
brush->alpha = 0.5f; /* brush strength/intensity probably variable 
should be renamed? */
brush->autosmooth_factor = 0.0f;
+   brush->topology_rake_factor = 0.0f;
brush->crease_pinch_factor = 0.5f;
brush->sculpt_plane = SCULPT_DISP_DIR_AREA;
brush->plane_offset = 0.0f; /* how far above or below the plane that is 
found by averaging the faces */
@@ -739,6 +740,8 @@ void BKE_brush_debug_print_state(Brush *br)
 
BR_TEST(autosmooth_factor, f);
 
+   BR_TEST(topology_rake_factor, f);
+
BR_TEST(crease_pinch_factor, f);
 
BR_TEST(plane_trim, f);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index b2df942b2fa..b25b9f4fff6 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -142,13 +142,22 @@ static bool sculpt_tool_is_proxy_used(const char 
sculpt_tool)
SCULPT_TOOL_LAYER);
 }
 
+static bool sculpt_brush_use_topology_rake(
+const SculptSession *ss, const Brush *brush)
+{
+   return SCULPT_TOOL_HAS_TOPOLOGY_RAKE(brush->sculpt_tool) &&
+  (brush->topology_rake_factor > 0.0f) &&
+  (ss->bm != NULL);
+}
+
 /**
  * Test whether the #StrokeCache.sculpt_normal needs update in #do_brush_action
  */
-static int sculpt_brush_needs_normal(const Brush *brush, float normal_weight)
+static int sculpt_brush_needs_normal(
+const SculptSession *ss, const Brush *brush)
 {
return ((SCULPT_TOOL_HAS_NORMAL_WEIGHT(brush->sculpt_tool) &&
-(normal_weight > 0.0f)) ||
+(ss->cache->normal_weight > 0.0f)) ||
 
ELEM(brush->sculpt_tool,
 SCULPT_TOOL_BLOB,
@@ -159,7 +168,8 @@ static int sculpt_brush_needs_normal(const Brush *brush, 
float normal_weight)
 SCULPT_TOOL_ROTATE,
 SCULPT_TOOL_THUMB) ||
 
-   (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA));
+   (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)) ||
+   sculpt_brush_use_topology_rake(ss, brush);
 }
 /** \} */
 
@@ -1598,6 +1608,94 @@ static void bmesh_neighbor_average(float avg[3], BMVert 
*v)
copy_v3_v3(avg, v->co);
 }
 
+/* For bmesh: average only the four most aligned (parallel and perpendicular) 
edges
+ * relative to a direction. Naturally converges to a quad-like tesselation. */
+static void bmesh_four_neighbor_average(float avg[3], float direction[3], 
BMVert *v)
+{
+   /* Logic for 3 or more is identical. */
+   const int vfcount = BM_vert_face_count_at_most(v, 3);
+
+   /* Don't modify corner vertices. */
+   if (vfcount < 2) {
+   copy_v3_v3(avg, v->co);
+   return;
+   

[Bf-blender-cvs] [4e9817a4fb2] master: Fix wrong f-curve modifier mute checkbox icon / tooltip.

2019-01-23 Thread Anton Stötzer
Commit: 4e9817a4fb2986b3d08da8380a6ce1d40c108970
Author: Anton Stötzer
Date:   Wed Jan 23 18:23:01 2019 +0100
Branches: master
https://developer.blender.org/rB4e9817a4fb2986b3d08da8380a6ce1d40c108970

Fix wrong f-curve modifier mute checkbox icon / tooltip.

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

===

M   source/blender/makesrna/intern/rna_fcurve.c
M   source/blender/makesrna/intern/rna_nla.c

===

diff --git a/source/blender/makesrna/intern/rna_fcurve.c 
b/source/blender/makesrna/intern/rna_fcurve.c
index e58b659d399..5062468387f 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1404,9 +1404,9 @@ static void rna_def_fmodifier(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
-   RNA_def_property_ui_text(prop, "Muted", "F-Curve Modifier will not be 
evaluated");
+   RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier 
evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, 
"rna_FModifier_update");
-   RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
+   RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
 
prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2008,7 +2008,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
-   RNA_def_property_ui_text(prop, "Muted", "F-Curve is not evaluated");
+   RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier 
evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, 
"rna_FCurve_update_eval");
 
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_nla.c 
b/source/blender/makesrna/intern/rna_nla.c
index ceedb5078a2..02a63fa0df6 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -725,7 +725,7 @@ static void rna_def_nlastrip(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_MUTED);
-   RNA_def_property_ui_text(prop, "Muted", "NLA Strip is not evaluated");
+   RNA_def_property_ui_text(prop, "Muted", "Disable NLA Strip evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, 
"rna_NlaStrip_update");
 
prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
@@ -822,7 +822,7 @@ static void rna_def_nlatrack(BlenderRNA *brna)
 
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_MUTED);
-   RNA_def_property_ui_text(prop, "Muted", "NLA Track is not evaluated");
+   RNA_def_property_ui_text(prop, "Muted", "Disable NLA Track evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, 
"rna_NlaStrip_update");
 
prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);

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


[Bf-blender-cvs] [9770d071ff4] master: Fix T54834: VSE can't import OGG Theora video

2019-01-23 Thread Sergey Sharybin
Commit: 9770d071ff4306ccec940d1f44169297bb3f5747
Author: Sergey Sharybin
Date:   Wed Jan 23 17:15:56 2019 +0100
Branches: master
https://developer.blender.org/rB9770d071ff4306ccec940d1f44169297bb3f5747

Fix T54834: VSE can't import OGG Theora video

===

M   intern/ffmpeg/ffmpeg_compat.h
M   tests/python/ffmpeg_tests.py

===

diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index bc65f19ef59..47d20113190 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -520,6 +520,14 @@ AVRational av_get_r_frame_rate_compat(AVFormatContext *ctx,
/* For until r_frame_rate was deprecated use it. */
return stream->r_frame_rate;
 #else
+#  ifdef AV_USING_FFMPEG
+   /* Some of the videos might have average frame rate set to, while the
+* r_frame_rate will show a correct value. This happens, for example, 
for
+* OGG video files saved with Blender. */
+   if (stream->avg_frame_rate.den == 0) {
+   return stream->r_frame_rate;
+   }
+#  endif
return stream->avg_frame_rate;
 #endif
 }
diff --git a/tests/python/ffmpeg_tests.py b/tests/python/ffmpeg_tests.py
index 3d38ebd5edc..d6e7127c35a 100755
--- a/tests/python/ffmpeg_tests.py
+++ b/tests/python/ffmpeg_tests.py
@@ -42,15 +42,29 @@ class AbstractFFmpegSequencerTest(AbstractFFmpegTest):
 "bpy.context.scene.sequence_editor_create(); " \
 "strip = bpy.context.scene.sequence_editor.sequences.new_movie(" \
 "'test_movie', %r, channel=1, frame_start=1); " \
-"print(f'fps:{strip.fps}')" % movie.as_posix()
+"print(f'fps:{strip.fps}'); " \
+"print(f'duration:{strip.frame_final_duration}'); " % 
movie.as_posix()
 
-def get_movie_file_fps(self, filename: pathlib.Path) -> float:
+def get_movie_file_field(self, filename: pathlib.Path, field: str) -> str:
 script = self.get_script_for_file(filename)
 output = self.run_blender('', script)
+prefix = field + ":"
 for line in output.splitlines():
-if line.startswith('fps:'):
-return float(line.split(':')[1])
-return 0.0
+if line.startswith(prefix):
+return line.split(':')[1]
+return ""
+
+def get_movie_file_field_float(self, filename: pathlib.Path, field: str) 
-> float:
+return float(self.get_movie_file_field(filename, field))
+
+def get_movie_file_field_int(self, filename: pathlib.Path, field: str) -> 
float:
+return int(self.get_movie_file_field(filename, field))
+
+def get_movie_file_fps(self, filename: pathlib.Path) -> float:
+return self.get_movie_file_field_float(filename, "fps")
+
+def get_movie_file_duration(self, filename: pathlib.Path) -> float:
+return self.get_movie_file_field_int(filename, "duration")
 
 
 class FPSDetectionTest(AbstractFFmpegSequencerTest):
@@ -72,6 +86,11 @@ class FPSDetectionTest(AbstractFFmpegSequencerTest):
 1.0,
 places=2)
 
+def test_T54834(self):
+self.assertEqual(
+self.get_movie_file_duration('T54834.ogg'),
+50)
+
 
 if __name__ == '__main__':
 parser = argparse.ArgumentParser()

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


[Bf-blender-cvs] [8377263e0d7] master: Sequencer: Fix python error on Add menu on default workspace

2019-01-23 Thread Sergey Sharybin
Commit: 8377263e0d768838c2e87e50617f463509eeaeb9
Author: Sergey Sharybin
Date:   Wed Jan 23 16:56:23 2019 +0100
Branches: master
https://developer.blender.org/rB8377263e0d768838c2e87e50617f463509eeaeb9

Sequencer: Fix python error on Add menu on default workspace

It is possible that context does have selected_sequences but
it will be set to None. In this case getattr() will return
None, breaking the intended logic.

===

M   release/scripts/startup/bl_ui/space_sequencer.py

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 622fc3ba201..741cb49c314 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -36,7 +36,10 @@ def act_strip(context):
 
 
 def sel_sequences(context):
-return len(getattr(context, "selected_sequences", ()))
+selected_sequences = getattr(context, "selected_sequences", None)
+if not selected_sequences:
+return 0
+return len(selected_sequences)
 
 
 def draw_color_balance(layout, color_balance):

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


[Bf-blender-cvs] [7a9e4e41a92] master: Cleanup: More clear function name

2019-01-23 Thread Sergey Sharybin
Commit: 7a9e4e41a924a1dacb120263ca7181fe69b6a397
Author: Sergey Sharybin
Date:   Wed Jan 23 16:58:37 2019 +0100
Branches: master
https://developer.blender.org/rB7a9e4e41a924a1dacb120263ca7181fe69b6a397

Cleanup: More clear function name

Otherwise it was read as it does select sequences rather
than counts them.

===

M   release/scripts/startup/bl_ui/space_sequencer.py

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 741cb49c314..a757bb4c21d 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -35,7 +35,7 @@ def act_strip(context):
 return None
 
 
-def sel_sequences(context):
+def selected_sequences_len(context):
 selected_sequences = getattr(context, "selected_sequences", None)
 if not selected_sequences:
 return 0
@@ -393,7 +393,7 @@ class SEQUENCER_MT_add(Menu):
 
 col = layout.column()
 col.menu("SEQUENCER_MT_add_transitions")
-col.enabled = sel_sequences(context) >= 2
+col.enabled = selected_sequences_len(context) >= 2
 
 
 class SEQUENCER_MT_add_empty(Menu):
@@ -419,7 +419,7 @@ class SEQUENCER_MT_add_transitions(Menu):
 col.separator()
 
 col.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
-col.enabled = sel_sequences(context) >= 2
+col.enabled = selected_sequences_len(context) >= 2
 
 
 class SEQUENCER_MT_add_effect(Menu):
@@ -438,7 +438,7 @@ class SEQUENCER_MT_add_effect(Menu):
 col.operator("sequencer.effect_strip_add", text="Alpha Over").type = 
'ALPHA_OVER'
 col.operator("sequencer.effect_strip_add", text="Alpha Under").type = 
'ALPHA_UNDER'
 col.operator("sequencer.effect_strip_add", text="Color Mix").type = 
'COLORMIX'
-col.enabled = sel_sequences(context) >= 2
+col.enabled = selected_sequences_len(context) >= 2
 
 layout.separator()
 
@@ -454,7 +454,7 @@ class SEQUENCER_MT_add_effect(Menu):
 
 col.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
 col.operator("sequencer.effect_strip_add", text="Gaussian Blur").type 
= 'GAUSSIAN_BLUR'
-col.enabled = sel_sequences(context) != 0
+col.enabled = selected_sequences_len(context) != 0
 
 
 class SEQUENCER_MT_strip_transform(Menu):

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


[Bf-blender-cvs] [1f907b30d45] master: UI: Particles UIList

2019-01-23 Thread Pablo Vazquez
Commit: 1f907b30d451fbc659c03babac05b508fd319b1b
Author: Pablo Vazquez
Date:   Wed Jan 23 17:05:12 2019 +0100
Branches: master
https://developer.blender.org/rB1f907b30d451fbc659c03babac05b508fd319b1b

UI: Particles UIList

Swap show_render and show_viewport to match outliner (first viewport then 
render)

Also make list item into an aligned row so it uses less space and looks closer 
to the outliner.

Before/After: 
http://pasteall.org/pic/show.php?id=5c9fff53dc6a0e2465f5b86aa751a942

===

M   release/scripts/startup/bl_ui/properties_particle.py

===

diff --git a/release/scripts/startup/bl_ui/properties_particle.py 
b/release/scripts/startup/bl_ui/properties_particle.py
index c7b97836267..14094922a32 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -128,18 +128,19 @@ class PARTICLE_UL_particle_systems(bpy.types.UIList):
 
 if self.layout_type in {'DEFAULT', 'COMPACT'}:
 md = find_modifier(ob, psys)
+row = layout.row(align=True)
 
-layout.prop(psys, "name", text="", emboss=False, icon_value=icon)
+row.prop(psys, "name", text="", emboss=False, icon_value=icon)
 if md:
-layout.prop(
+row.prop(
 md,
-"show_render",
+"show_viewport",
 emboss=False,
 icon_only=True,
 )
-layout.prop(
+row.prop(
 md,
-"show_viewport",
+"show_render",
 emboss=False,
 icon_only=True,
 )

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


[Bf-blender-cvs] [22bc6142c3c] master: Fix T59152: dynamic topology constant detail should be in world space.

2019-01-23 Thread Brecht Van Lommel
Commit: 22bc6142c3c505de2f2a9a85941c43236f53b941
Author: Brecht Van Lommel
Date:   Wed Jan 23 16:48:02 2019 +0100
Branches: master
https://developer.blender.org/rB22bc6142c3c505de2f2a9a85941c43236f53b941

Fix T59152: dynamic topology constant detail should be in world space.

It seems more predictable, and makes more sense for future multi-object modes.

===

M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 47fedb565fc..0067f63ded0 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -108,7 +108,7 @@ bool BKE_pbvh_node_raycast(
 bool BKE_pbvh_bmesh_node_raycast_detail(
 PBVHNode *node,
 const float ray_start[3], const float ray_normal[3],
-float *depth, float *r_detail);
+float *depth, float *r_edge_length);
 
 /* for orthographic cameras, project the far away ray segment points to the 
root node so
  * we can have better precision. */
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c 
b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 3369b05ea60..53dafdc9787 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -1549,7 +1549,7 @@ bool pbvh_bmesh_node_raycast(
 bool BKE_pbvh_bmesh_node_raycast_detail(
 PBVHNode *node,
 const float ray_start[3], const float ray_normal[3],
-float *depth, float *r_detail)
+float *depth, float *r_edge_length)
 {
if (node->flag & PBVH_FullyHidden)
return 0;
@@ -1588,7 +1588,7 @@ bool BKE_pbvh_bmesh_node_raycast_detail(
float len3 = len_squared_v3v3(v_tri[2]->co, v_tri[0]->co);
 
/* detail returned will be set to the maximum allowed size, so 
take max here */
-   *r_detail = sqrtf(max_fff(len1, len2, len3));
+   *r_edge_length = sqrtf(max_fff(len1, len2, len3));
}
 
return hit;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index e72b5490f8a..b2df942b2fa 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1644,7 +1644,7 @@ typedef struct {
const float *ray_start, *ray_normal;
bool hit;
float depth;
-   float detail;
+   float edge_length;
 } SculptDetailRaycastData;
 
 typedef struct {
@@ -4684,7 +4684,7 @@ static void sculpt_raycast_detail_cb(PBVHNode *node, void 
*data_v, float *tmin)
if (BKE_pbvh_node_get_tmin(node) < *tmin) {
SculptDetailRaycastData *srd = data_v;
if (BKE_pbvh_bmesh_node_raycast_detail(node, srd->ray_start, 
srd->ray_normal,
-  &srd->depth, 
&srd->detail))
+  &srd->depth, 
&srd->edge_length))
{
srd->hit = 1;
*tmin = srd->depth;
@@ -4972,7 +4972,8 @@ static void sculpt_stroke_update_step(bContext *C, struct 
PaintStroke *UNUSED(st
sculpt_restore_mesh(sd, ob);
 
if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | 
SCULPT_DYNTOPO_DETAIL_MANUAL)) {
-   BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / 
sd->constant_detail);
+   float object_space_constant_detail = sd->constant_detail * 
mat4_to_scale(ob->imat);
+   BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / 
object_space_constant_detail);
}
else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {
BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * 
sd->detail_percent / 100.0f);
@@ -5915,7 +5916,8 @@ static int sculpt_detail_flood_fill_exec(bContext *C, 
wmOperator *UNUSED(op))
size = max_fff(dim[0], dim[1], dim[2]);
 
/* update topology size */
-   BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / sd->constant_detail);
+   float object_space_constant_detail = sd->constant_detail * 
mat4_to_scale(ob->imat);
+   BKE_pbvh_bmesh_detail_size_set(ss->pbvh, 1.0f / 
object_space_constant_detail);
 
sculpt_undo_push_begin("Dynamic topology flood fill");
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_COORDS);
@@ -5988,14 +5990,14 @@ static void sample_detail(bContext *C, int mx, int my)
srd.ray_start = ray_start;
srd.ray_normal = ray_normal;
srd.depth = depth;
-   srd.detail = sd->constant_detail;
+   srd.edge_length = 0.0f;
 
BKE_pbvh_raycast(ob->sculpt->pbvh, sculpt_raycast_detail_cb, &srd,
 ray_start, ray_normal, false);
 
-   if (srd.hit) {
-   /* convert edge len

[Bf-blender-cvs] [5e3ce0b6629] master: GP: Remove unneeded armature code

2019-01-23 Thread Antonioya
Commit: 5e3ce0b66291ee35fc3e5a3ea8d99274275c8536
Author: Antonioya
Date:   Wed Jan 23 16:52:07 2019 +0100
Branches: master
https://developer.blender.org/rB5e3ce0b66291ee35fc3e5a3ea8d99274275c8536

GP: Remove unneeded armature code

This line looks a mistake and it's not needed.

===

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

===

diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index a1b44265356..490b6bbcf34 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1377,9 +1377,7 @@ void armature_deform_verts(
smat = summat;
}
else {
-   if (target->type != OB_GPENCIL) {
-   mul_v3_fl(vec, armature_weight / 
contrib);
-   }
+   mul_v3_fl(vec, armature_weight / contrib);
add_v3_v3v3(co, vec, co);
}

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


[Bf-blender-cvs] [409443500b2] master: UI: fix horizontal scrollbar overlapping last row of files

2019-01-23 Thread gsr b3d
Commit: 409443500b299a2f2112e669e7085d3f16191e8c
Author: gsr b3d
Date:   Wed Jan 23 15:31:47 2019 +0100
Branches: master
https://developer.blender.org/rB409443500b299a2f2112e669e7085d3f16191e8c

UI: fix horizontal scrollbar overlapping last row of files

Depending on area size, the scrollbar covered the bottom of the text,
with the extra it will only cover the padding at worst.

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

===

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

===

diff --git a/source/blender/editors/space_file/filesel.c 
b/source/blender/editors/space_file/filesel.c
index f25d3e25f0b..9a38c16e020 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -76,6 +76,7 @@
 
 #include "UI_interface.h"
 #include "UI_interface_icons.h"
+#include "UI_view2d.h"
 
 #include "file_intern.h"
 #include "filelist.h"
@@ -547,7 +548,9 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, 
ARegion *ar)
layout->prv_border_y = 0;
layout->tile_h = textheight * 3 / 2;
layout->height = (int)(BLI_rctf_size_y(&v2d->cur) - 2 * 
layout->tile_border_y);
-   layout->rows = layout->height / (layout->tile_h + 2 * 
layout->tile_border_y);
+   /* Padding by full scrollbar H is too much, can overlap tile 
border Y. */
+   layout->rows = (layout->height - V2D_SCROLL_HEIGHT + 
layout->tile_border_y) /
+  (layout->tile_h + 2 * layout->tile_border_y);
 
column_widths(params, layout);

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


[Bf-blender-cvs] [93d226952b4] master: UI: make editor corner splitting / joining more reliable.

2019-01-23 Thread Harley Acheson
Commit: 93d226952b4eb70a5e5ed4525128ca559b03d349
Author: Harley Acheson
Date:   Wed Jan 23 14:44:40 2019 +0100
Branches: master
https://developer.blender.org/rB93d226952b4eb70a5e5ed4525128ca559b03d349

UI: make editor corner splitting / joining more reliable.

* Add threshold for minimum amount of mouse movement for dragging to
  get activated.
* Limit angles at which dragging is considered an action, do nothing if
  mouse does not clearly move up/down/left/right.
* Increase action zone size vertically.

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

===

M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_intern.h
M   source/blender/editors/screen/screen_ops.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 76c907a964a..7525e83458d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -760,21 +760,21 @@ static void area_azone_initialize(wmWindow *win, const 
bScreen *screen, ScrArea
/* Bottom-left. */
{sa->totrct.xmin,
 sa->totrct.ymin,
-sa->totrct.xmin + (AZONESPOT - 1),
-sa->totrct.ymin + (AZONESPOT - 1)},
+sa->totrct.xmin + AZONESPOTW,
+sa->totrct.ymin + AZONESPOTH},
/* Bottom-right. */
-   {sa->totrct.xmax - (AZONESPOT - 1),
+   {sa->totrct.xmax - AZONESPOTW,
 sa->totrct.ymin,
 sa->totrct.xmax,
-sa->totrct.ymin + (AZONESPOT - 1)},
+sa->totrct.ymin + AZONESPOTH},
/* Top-left. */
{sa->totrct.xmin,
-sa->totrct.ymax - (AZONESPOT - 1),
-sa->totrct.xmin + (AZONESPOT - 1),
+sa->totrct.ymax - AZONESPOTH,
+sa->totrct.xmin + AZONESPOTW,
 sa->totrct.ymax},
/* Top-right. */
-   {sa->totrct.xmax - (AZONESPOT - 1),
-sa->totrct.ymax - (AZONESPOT - 1),
+   {sa->totrct.xmax - AZONESPOTW,
+sa->totrct.ymax - AZONESPOTH,
 sa->totrct.xmax,
 sa->totrct.ymax}};
 
diff --git a/source/blender/editors/screen/screen_intern.h 
b/source/blender/editors/screen/screen_intern.h
index 5f36f4a06ab..4c7d859e4ee 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -37,7 +37,8 @@ struct Main;
 
 /* internal exports only */
 
-#define AZONESPOT   (0.4f * U.widget_unit)
+#define AZONESPOTW  UI_HEADER_OFFSET   /* width of corner azone - max 
*/
+#define AZONESPOTH  (0.6f * U.widget_unit) /* height of corner azone */
 #define AZONEFADEIN (5.0f * U.widget_unit) /* when azone is totally 
visible */
 #define AZONEFADEOUT(6.5f * U.widget_unit) /* when we start seeing the 
azone */
 
diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index 7e0116ea64d..6d332f8e427 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -709,7 +709,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const 
int xy[2], const boo
}
else {
const int mouse_sq = 
SQUARE(xy[0] - az->x2) + SQUARE(xy[1] - az->y2);
-   const int spot_sq = 
SQUARE(AZONESPOT);
+   const int spot_sq = 
SQUARE(AZONESPOTW);
const int fadein_sq = 
SQUARE(AZONEFADEIN);
const int fadeout_sq = 
SQUARE(AZONEFADEOUT);
 
@@ -916,10 +916,19 @@ static int actionzone_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
const int delta_x = (event->x - sad->x);
const int delta_y = (event->y - sad->y);
 
-   /* calculate gesture direction */
+   /* Movement in dominant direction. */
+   const int delta_max = max_ii(ABS(delta_x), 
ABS(delta_y));
+   /* Movement in secondary direction. */
+   const int delta_min = min_ii(ABS(delta_x), 
ABS(delta_y));
+   /* Movement required in dominant direction. */
+   const int delta_threshold = (0.2 * U.widget_unit);
+   /* Must be over threshold and 2:1 ratio or more. */
+   const int delta_okay = (delta_max > delta_threshold) && 
(delta_min * 2 <= delta_max);
+
+   /* Calculate gesture cardinal direction. */
if (delta_y > ABS(delta_x))
sad->gesture_dir = 'n';
-   

[Bf-blender-cvs] [ac5278b682c] master: Fix T60791: Don't show automatic weights option when not supported

2019-01-23 Thread Jacques Lucke
Commit: ac5278b682cfb090aafe93082e95349cb7d993d3
Author: Jacques Lucke
Date:   Wed Jan 23 15:20:35 2019 +0100
Branches: master
https://developer.blender.org/rBac5278b682cfb090aafe93082e95349cb7d993d3

Fix T60791: Don't show automatic weights option when not supported

There are probably many more cases in which the menu looks a little different.
However, I don't know them all and it's too easy to break something 
accidentally here.
Maybe a user could try the different combinations of object types and check if 
there are entries that should not be there.

Reviewers: brecht

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

===

M   source/blender/editors/object/object_relations.c

===

diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index 05d968660f2..80ae81ba737 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -920,7 +920,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
 
 static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const 
wmEvent *UNUSED(event))
 {
-   Object *ob = ED_object_active_context(C);
+   Object *parent = ED_object_active_context(C);
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Set Parent To"), 
ICON_NONE);
uiLayout *layout = UI_popup_menu_layout(pup);
 
@@ -940,26 +940,46 @@ static int parent_set_invoke(bContext *C, wmOperator 
*UNUSED(op), const wmEvent
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", true);
 #endif
-   /* ob becomes parent, make the associated menus */
-   if (ob->type == OB_ARMATURE) {
+
+   struct {
+   bool mesh, gpencil;
+   } has_children_of_type = { 0 };
+
+   CTX_DATA_BEGIN (C, Object *, child, selected_editable_objects)
+   {
+   if (child == parent) {
+   continue;
+   }
+   if (child->type == OB_MESH) {
+   has_children_of_type.mesh = true;
+   }
+   if (child->type == OB_GPENCIL) {
+   has_children_of_type.gpencil = true;
+   }
+   }
+   CTX_DATA_END;
+
+   if (parent->type == OB_ARMATURE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_NAME);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", 
PAR_ARMATURE_ENVELOPE);
-   uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
+   if (has_children_of_type.mesh || has_children_of_type.gpencil) {
+   uiItemEnumO_ptr(layout, ot, NULL, 0, "type", 
PAR_ARMATURE_AUTO);
+   }
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
}
-   else if (ob->type == OB_CURVE) {
+   else if (parent->type == OB_CURVE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_FOLLOW);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_PATH_CONST);
}
-   else if (ob->type == OB_LATTICE) {
+   else if (parent->type == OB_LATTICE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_LATTICE);
}
 
/* vertex parenting */
-   if (OB_TYPE_SUPPORT_PARVERT(ob->type)) {
+   if (OB_TYPE_SUPPORT_PARVERT(parent->type)) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX_TRI);
}

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


[Bf-blender-cvs] [db78a8ee2e8] master: Fix T59939: Masks not Animating in Render

2019-01-23 Thread Philipp Oeser
Commit: db78a8ee2e8c365804c8a4a4adab9ebea6977307
Author: Philipp Oeser
Date:   Sat Dec 29 17:15:28 2018 +0100
Branches: master
https://developer.blender.org/rBdb78a8ee2e8c365804c8a4a4adab9ebea6977307

Fix T59939: Masks not Animating in Render

For now this is not part of copy-on-write, and needs extra animation
evaluation.

Reviewers: sergey, brecht

Maniphest Tasks: T59939

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

===

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

===

diff --git a/source/blender/render/intern/source/pipeline.c 
b/source/blender/render/intern/source/pipeline.c
index f5dc638c3f6..35c85bb3292 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -70,6 +70,7 @@
 #include "BKE_layer.h"
 #include "BKE_library.h"
 #include "BKE_library_remap.h"
+#include "BKE_mask.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
 #include "BKE_object.h"
@@ -1628,6 +1629,9 @@ static void do_render_all_options(Render *re)
 * work with copy-on-write. */
BKE_animsys_evaluate_all_animation(re->main, NULL, re->scene, 
(float)cfra);
 
+   /* Update for masks (these do not use animsys but own lighter weight 
structure to define animation). */
+   BKE_mask_evaluate_all_masks(re->main, (float)cfra, true);
+
if (RE_engine_render(re, 1)) {
/* in this case external render overrides all */
}

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


[Bf-blender-cvs] [82bd3e08e11] greasepencil-experimental: Merge branch 'greasepencil-object' into greasepencil-experimental

2019-01-23 Thread Charlie Jolly
Commit: 82bd3e08e11a0356b073fc34ec248825db5079ce
Author: Charlie Jolly
Date:   Wed Jan 23 13:56:31 2019 +
Branches: greasepencil-experimental
https://developer.blender.org/rB82bd3e08e11a0356b073fc34ec248825db5079ce

Merge branch 'greasepencil-object' into greasepencil-experimental

# Conflicts:
#   source/blender/editors/gpencil/gpencil_fill.c

===



===



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


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

2019-01-23 Thread Charlie Jolly
Commit: 1af7837e6d71b1c6aa5d5167aa78ede7ab9d2802
Author: Charlie Jolly
Date:   Wed Jan 23 13:40:28 2019 +
Branches: greasepencil-object
https://developer.blender.org/rB1af7837e6d71b1c6aa5d5167aa78ede7ab9d2802

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] [ddc278da24a] master: Cleanup: comments above struct members, shader group assignments

2019-01-23 Thread Campbell Barton
Commit: ddc278da24a784c613dc43e99da6b52f6558aab5
Author: Campbell Barton
Date:   Wed Jan 23 23:59:40 2019 +1100
Branches: master
https://developer.blender.org/rBddc278da24a784c613dc43e99da6b52f6558aab5

Cleanup: comments above struct members, shader group assignments

Avoid using pointer to pointer when building shader groups.

===

M   source/blender/draw/engines/workbench/workbench_deferred.c
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/modes/edit_mesh_mode.c

===

diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index 44bc35bfc41..68f93a51425 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -641,10 +641,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
}
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), 
NULL);
 
-   if (draw_ctx->rv3d &&
-   (draw_ctx->rv3d->rflag & RV3D_CLIPPING) &&
-   draw_ctx->rv3d->clipbb)
-   {
+   if (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) 
&& draw_ctx->rv3d->clipbb) {
GPUShader *shader = 
GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND);
grp = DRW_shgroup_create(shader, psl->background_pass);
wpd->world_clip_planes_batch = 
DRW_draw_background_clipping_batch_from_rv3d(draw_ctx->rv3d);
diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 4280359976e..22d740bd512 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -291,16 +291,20 @@ typedef enum {
DRW_STATE_CULL_FRONT= (1 << 9),
DRW_STATE_WIRE  = (1 << 10),
DRW_STATE_POINT = (1 << 11),
-   DRW_STATE_OFFSET_POSITIVE = (1 << 12), /* Polygon offset. Does not work 
with lines and points. */
-   DRW_STATE_OFFSET_NEGATIVE = (1 << 13), /* Polygon offset. Does not work 
with lines and points. */
+   /** Polygon offset. Does not work with lines and points. */
+   DRW_STATE_OFFSET_POSITIVE = (1 << 12),
+   /** Polygon offset. Does not work with lines and points. */
+   DRW_STATE_OFFSET_NEGATIVE = (1 << 13),
/* DRW_STATE_STIPPLE_4 = (1 << 14), */ /* Not used */
DRW_STATE_BLEND = (1 << 15),
DRW_STATE_ADDITIVE  = (1 << 16),
DRW_STATE_MULTIPLY  = (1 << 17),
/* DRW_STATE_TRANSMISSION  = (1 << 18), */ /* Not used */
DRW_STATE_CLIP_PLANES   = (1 << 19),
-   DRW_STATE_ADDITIVE_FULL = (1 << 20), /* Same as DRW_STATE_ADDITIVE but 
let alpha accumulate without premult. */
-   DRW_STATE_BLEND_PREMUL  = (1 << 21), /* Use that if color is already 
premult by alpha. */
+   /** Same as DRW_STATE_ADDITIVE but let alpha accumulate without 
premult. */
+   DRW_STATE_ADDITIVE_FULL = (1 << 20),
+   /** Use that if color is already premult by alpha. */
+   DRW_STATE_BLEND_PREMUL  = (1 << 21),
DRW_STATE_WIRE_SMOOTH   = (1 << 22),
DRW_STATE_TRANS_FEEDBACK = (1 << 23),
DRW_STATE_BLEND_OIT = (1 << 24),
@@ -598,7 +602,7 @@ typedef struct DRWContextState {
 
eDRW_ShaderSlot shader_slot;
 
-   /* Last resort (some functions take this as an arg so we can't easily 
avoid).
+   /** Last resort (some functions take this as an arg so we can't easily 
avoid).
 * May be NULL when used for selection or depth buffer. */
const struct bContext *evil_C;
 
diff --git a/source/blender/draw/modes/edit_mesh_mode.c 
b/source/blender/draw/modes/edit_mesh_mode.c
index 48a3d003a37..fcc841f2ff5 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -364,68 +364,70 @@ static DRWPass *edit_mesh_create_overlay_pass(
"Edit Mesh Face Overlay Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_POINT | statemod);
 
+   DRWShadingGroup *grp;
+
if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) {
-   *r_lverts_shgrp = DRW_shgroup_create(sh_data->overlay_lvert, 
pass);
-   DRW_shgroup_uniform_block(*r_lverts_shgrp, "globalsBlock", 
G_draw.block_ubo);
-   DRW_shgroup_uniform_vec2(*r_lverts_shgrp, "viewportSize", 
DRW_viewport_size_get(), 1);
-   DRW_shgroup_uniform_float(*r_lverts_shgrp, "edgeScale", 
edge_width_scale, 1);
-   DRW_shgroup_state_enable(*r_lverts_shgrp, 
DRW_STATE_WRITE_DEPTH);
-   DRW_shgroup_state_disable(*r_lverts_shgrp, DRW_STATE_BLEND);
+   grp = *r_lverts_shgrp = 
DRW_shgroup_create(sh_data->overlay_lvert, pass);
+   DRW_

[Bf-blender-cvs] [48eed058b17] master: 3D View: draw clipping region

2019-01-23 Thread Campbell Barton
Commit: 48eed058b170e3def90fbc420933638d3986ca2c
Author: Campbell Barton
Date:   Wed Jan 23 23:30:30 2019 +1100
Branches: master
https://developer.blender.org/rB48eed058b170e3def90fbc420933638d3986ca2c

3D View: draw clipping region

Only for workbench solid/wire modes.

===

M   release/datafiles/userdef/userdef_default_theme.c
M   source/blender/draw/engines/workbench/workbench_data.c
M   source/blender/draw/engines/workbench/workbench_deferred.c
M   source/blender/draw/engines/workbench/workbench_forward.c
M   source/blender/draw/engines/workbench/workbench_private.h
M   source/blender/draw/intern/draw_view.c
M   source/blender/draw/intern/draw_view.h
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/intern/gpu_shader.c
M   source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index aa275d6a99e..39ba48eef0a 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -355,7 +355,7 @@ const bTheme U_theme_default = {
.outline_width = 1,
.facedot_size = 3,
.editmesh_active = RGBA(0xff80),
-   .clipping_border_3d = RGBA(0x313131ff),
+   .clipping_border_3d = RGBA(0x0f0f0fff),
.bundle_solid = RGBA(0xc8c8c8ff),
.camera_path = RGBA(0x00ff),
.gp_vertex_size = 3,
diff --git a/source/blender/draw/engines/workbench/workbench_data.c 
b/source/blender/draw/engines/workbench/workbench_data.c
index 0d17c4a5c5d..931dfd63088 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -28,6 +28,8 @@
 
 #include "UI_resources.h"
 
+#include "GPU_batch.h"
+
 
 void workbench_effect_info_init(WORKBENCH_EffectInfo *effect_info)
 {
@@ -118,6 +120,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
if (rv3d->rflag & RV3D_CLIPPING) {
wpd->world_clip_planes = rv3d->clip;
DRW_state_clip_planes_set_from_rv3d(rv3d);
+   UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, 
wpd->world_clip_planes_color);
}
else {
wpd->world_clip_planes = NULL;
@@ -212,4 +215,5 @@ void workbench_private_data_free(WORKBENCH_PrivateData *wpd)
 {
BLI_ghash_free(wpd->material_hash, NULL, MEM_freeN);
DRW_UBO_FREE_SAFE(wpd->world_ubo);
+   GPU_BATCH_DISCARD_SAFE(wpd->world_clip_planes_batch);
 }
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index af6b83679ea..44bc35bfc41 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -640,6 +640,17 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
DRW_shgroup_uniform_texture_ref(grp, "objectId", 
&e_data.object_id_tx);
}
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), 
NULL);
+
+   if (draw_ctx->rv3d &&
+   (draw_ctx->rv3d->rflag & RV3D_CLIPPING) &&
+   draw_ctx->rv3d->clipbb)
+   {
+   GPUShader *shader = 
GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR_BACKGROUND);
+   grp = DRW_shgroup_create(shader, psl->background_pass);
+   wpd->world_clip_planes_batch = 
DRW_draw_background_clipping_batch_from_rv3d(draw_ctx->rv3d);
+   DRW_shgroup_call_add(grp, wpd->world_clip_planes_batch, 
NULL);
+   DRW_shgroup_uniform_vec4(grp, "color", 
&wpd->world_clip_planes_color[0], 1);
+   }
}
 
/* Deferred Mix Pass */
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c 
b/source/blender/draw/engines/workbench/workbench_forward.c
index 3ced267ce89..c8f3a9a7bff 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -364,6 +364,16 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), 
NULL);
}
 
+   if (draw_ctx->rv3d && (draw_ctx->rv3d->rflag & RV3D_CLIPPING) && 
draw_ctx->rv3d->clipbb) {
+   psl->background_pass = DRW_pass_create(
+   "Background", DRW_STATE_WRITE_COLOR | 
DRW_STATE_DEPTH_EQUAL);
+   GPUShader *shader = 
GPU_shader

[Bf-blender-cvs] [44e9fe024bb] master: Fix T56877: Enabling mask Motion Blur overrides the Feather Falloff

2019-01-23 Thread Sergey Sharybin
Commit: 44e9fe024bba014aa49b3a106fe89aa0b6e610cd
Author: Sergey Sharybin
Date:   Wed Jan 23 13:04:32 2019 +0100
Branches: master
https://developer.blender.org/rB44e9fe024bba014aa49b3a106fe89aa0b6e610cd

Fix T56877: Enabling mask Motion Blur overrides the Feather Falloff

Compositor makes a copy of mask before sampling the mask on different
time steps. The copy of layers did not copy falloff Settings.

===

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

===

diff --git a/source/blender/blenkernel/intern/mask.c 
b/source/blender/blenkernel/intern/mask.c
index 3f6eaffa552..f219c225d9d 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -207,6 +207,7 @@ MaskLayer *BKE_mask_layer_copy(const MaskLayer *masklay)
masklay_new->blend = masklay->blend;
masklay_new->blend_flag = masklay->blend_flag;
masklay_new->flag = masklay->flag;
+   masklay_new->falloff = masklay->falloff;
masklay_new->restrictflag = masklay->restrictflag;
 
for (spline = masklay->splines.first; spline; spline = spline->next) {

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


[Bf-blender-cvs] [e6ad4ec3fc7] master: Fix T58994: Subdivision modifier generates artifacts with crease=1

2019-01-23 Thread Sergey Sharybin
Commit: e6ad4ec3fc7db82062e93d49395275ac326f2a37
Author: Sergey Sharybin
Date:   Wed Jan 23 12:14:34 2019 +0100
Branches: master
https://developer.blender.org/rBe6ad4ec3fc7db82062e93d49395275ac326f2a37

Fix T58994: Subdivision modifier generates artifacts with crease=1

The issue was caused by the lack of averaging of normals for
vertices which are on the ptex face boundaries.

===

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

===

diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c 
b/source/blender/blenkernel/intern/subdiv_mesh.c
index 9c4793a9efc..13ade957839 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_mesh.c
@@ -65,6 +65,24 @@ typedef struct SubdivMeshContext {
/* UV layers interpolation. */
int num_uv_layers;
MLoopUV *uv_layers[MAX_MTFACE];
+   /* Accumulated values.
+*
+* Averaging is happening for vertices along the coarse edges and 
corners.
+* This is needed for both displacement and normals.
+*
+* Displacement is being accumulated to a verticies coordinates, since 
those
+* are not needed during traversal of edge/corner vertices.
+*
+* For normals we are using dedicated array, since we can not use same
+* vertices (normals are `short`, which will cause a lot of precision
+* issues). */
+   float (*accumulated_normals)[3];
+   /* Per-subdivided vertex counter of averaged values. */
+   int *accumulated_counters;
+   /* Denotes whether normals can be evaluated from a limit surface. One 
case
+* when it's not possible is when displacement is used. */
+   bool can_evaluate_normals;
+   bool have_displacement;
 } SubdivMeshContext;
 
 static void subdiv_mesh_ctx_cache_uv_layers(SubdivMeshContext *ctx)
@@ -94,6 +112,30 @@ static void 
subdiv_mesh_ctx_cache_custom_data_layers(SubdivMeshContext *ctx)
subdiv_mesh_ctx_cache_uv_layers(ctx);
 }
 
+static void subdiv_mesh_prepare_accumulator(
+SubdivMeshContext *ctx, int num_vertices)
+{
+   if (!ctx->can_evaluate_normals && !ctx->have_displacement) {
+   return;
+   }
+   /* TODO(sergey): Technically, this is overallocating, we don't need 
memory
+* for an inner subdivision vertices. */
+   ctx->accumulated_normals = MEM_calloc_arrayN(
+   sizeof(*ctx->accumulated_normals),
+   num_vertices,
+   "subdiv accumulated normals");
+   ctx->accumulated_counters = MEM_calloc_arrayN(
+   sizeof(*ctx->accumulated_counters),
+   num_vertices,
+   "subdiv accumulated counters");
+}
+
+static void subdiv_mesh_context_free(SubdivMeshContext *ctx)
+{
+   MEM_SAFE_FREE(ctx->accumulated_normals);
+   MEM_SAFE_FREE(ctx->accumulated_counters);
+}
+
 /* 
=
  * Loop custom data copy helpers.
  */
@@ -120,8 +162,7 @@ static void loops_of_ptex_get(
/* Loop which look in the (opposite) V direction of the current
 * ptex face.
 *
-* TODO(sergey): Get rid of using module on every iteration.
-*/
+* TODO(sergey): Get rid of using module on every iteration. */
const int last_ptex_loop_index =
coarse_poly->loopstart +
(ptex_of_poly_index + coarse_poly->totloop - 1) %
@@ -143,14 +184,12 @@ static void loops_of_ptex_get(
  */
 
 /* TODO(sergey): Somehow de-duplicate with loops storage, without too much
- * exception cases all over the code.
- */
+ * exception cases all over the code. */
 
 typedef struct VerticesForInterpolation {
/* This field points to a vertex data which is to be used for 
interpolation.
 * The idea is to avoid unnecessary allocations for regular faces, where
-* we can simply
-*/
+* we can simply use corner verticies. */
const CustomData *vertex_data;
/* Vertices data calculated for ptex corners. There are always 4 
elements
 * in this custom data, aligned the following way:
@@ -160,13 +199,11 @@ typedef struct VerticesForInterpolation {
 *   index 2 -> uv (1, 1)
 *   index 3 -> uv (1, 0)
 *
-* Is allocated for non-regular faces (triangles and n-gons).
-*/
+* Is allocated for non-regular faces (triangles and n-gons). */
CustomData vertex_data_storage;
bool vertex_data_storage_allocated;
/* Infices within vertex_data to interpolate for. The indices are 
aligned
-* with uv coordinates in a similar way as indices in loop_data_storage.
-*/
+* with uv coordinates in a similar way as indices in 
loop_data_storage. */
int vertex_indices[4];
 } VerticesForInterpolation;
 
@@ 

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

2019-01-23 Thread Brecht Van Lommel
Commit: 2392f311e9c4c924f100612405932c4b38e50296
Author: Brecht Van Lommel
Date:   Wed Jan 23 12:09:08 2019 +0100
Branches: master
https://developer.blender.org/rB2392f311e9c4c924f100612405932c4b38e50296

Merge branch 'blender2.7'

===



===



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


[Bf-blender-cvs] [d753726ce71] blender2.7: Add font selection to VSE text strips

2019-01-23 Thread Richard Antalik
Commit: d753726ce71260296abdccd953fcf95e53b6502f
Author: Richard Antalik
Date:   Sun Jan 13 21:28:07 2019 -0800
Branches: blender2.7
https://developer.blender.org/rBd753726ce71260296abdccd953fcf95e53b6502f

Add font selection to VSE text strips

Allows users to select a font for text strips in the video sequence editor.

Related: 3610f1fc43d0 Sequencer: refactor clipboard copy to no longer increase 
user count.

Reviewed by: Brecht

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

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenfont/BLF_api.h
M   source/blender/blenfont/intern/blf.c
M   source/blender/blenfont/intern/blf_internal_types.h
M   source/blender/blenkernel/BKE_sequencer.h
M   source/blender/blenkernel/intern/library_query.c
M   source/blender/blenkernel/intern/seqeffects.c
M   source/blender/blenkernel/intern/sequencer.c
M   source/blender/blenloader/intern/readfile.c
M   source/blender/editors/interface/interface_templates.c
M   source/blender/makesdna/DNA_sequence_types.h
M   source/blender/makesrna/intern/rna_sequencer.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 47e7b02211a..8d75f695e88 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -758,6 +758,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
 elif strip.type == 'TEXT':
 col = layout.column()
 col.prop(strip, "text")
+col.template_ID(strip, "font", open="font.open", 
unlink="font.unlink")
 col.prop(strip, "font_size")
 
 row = col.row()
diff --git a/source/blender/blenfont/BLF_api.h 
b/source/blender/blenfont/BLF_api.h
index 0a4212ff233..7a6d00299c9 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -46,6 +46,7 @@ void BLF_default_set(int fontid);
 
 void BLF_cache_clear(void);
 
+/* Loads a font, or returns an already loaded font and increments its 
reference count. */
 int BLF_load(const char *name) ATTR_NONNULL();
 int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size) 
ATTR_NONNULL();
 
diff --git a/source/blender/blenfont/intern/blf.c 
b/source/blender/blenfont/intern/blf.c
index 75aabf1f713..5fe1a12d7a3 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -184,7 +184,8 @@ int BLF_load(const char *name)
/* check if we already load this font. */
i = blf_search(name);
if (i >= 0) {
-   /*font = global_font[i];*/ /*UNUSED*/
+   font = global_font[i];
+   font->reference_count++;
return i;
}
 
@@ -208,6 +209,7 @@ int BLF_load(const char *name)
return -1;
}
 
+   font->reference_count = 1;
global_font[i] = font;
return i;
 }
@@ -241,6 +243,7 @@ int BLF_load_unique(const char *name)
return -1;
}
 
+   font->reference_count = 1;
global_font[i] = font;
return i;
 }
@@ -282,6 +285,7 @@ int BLF_load_mem(const char *name, const unsigned char 
*mem, int mem_size)
return -1;
}
 
+   font->reference_count = 1;
global_font[i] = font;
return i;
 }
@@ -312,6 +316,7 @@ int BLF_load_mem_unique(const char *name, const unsigned 
char *mem, int mem_size
return -1;
}
 
+   font->reference_count = 1;
global_font[i] = font;
return i;
 }
@@ -325,8 +330,13 @@ void BLF_unload(const char *name)
font = global_font[i];
 
if (font && (STREQ(font->name, name))) {
-   blf_font_free(font);
-   global_font[i] = NULL;
+   BLI_assert(font->reference_count > 0);
+   font->reference_count--;
+
+   if (font->reference_count == 0) {
+   blf_font_free(font);
+   global_font[i] = NULL;
+   }
}
}
 }
@@ -335,8 +345,13 @@ void BLF_unload_id(int fontid)
 {
FontBLF *font = blf_get(fontid);
if (font) {
-   blf_font_free(font);
-   global_font[fontid] = NULL;
+   BLI_assert(font->reference_count > 0);
+   font->reference_count--;
+
+   if (font->reference_count == 0) {
+   blf_font_free(font);
+   global_font[fontid] = NULL;
+   }
}
 }
 
diff --git a/source/blender/blenfont/intern/blf_internal_types.h 
b/source/blender/blenfont/intern/blf_internal_types.h
index 5723f08d44b..8c2e24724f0 100644
--- a/source/blender/blenfont/

[Bf-blender-cvs] [40cb41647e6] blender2.7: Sequencer: refactor clipboard copy to no longer increase user count.

2019-01-23 Thread Brecht Van Lommel
Commit: 40cb41647e6404e9c61416fdeef5f12ed9663f33
Author: Brecht Van Lommel
Date:   Fri Dec 28 13:37:51 2018 +0100
Branches: blender2.7
https://developer.blender.org/rB40cb41647e6404e9c61416fdeef5f12ed9663f33

Sequencer: refactor clipboard copy to no longer increase user count.

The clipboard is not a real user and should not be counted. Only on paste
should the user count increase.

This is part of D3621, and was implemented by Richard Antalik and me.

===

M   source/blender/blenkernel/BKE_sequencer.h
M   source/blender/blenkernel/intern/seqeffects.c
M   source/blender/blenkernel/intern/sequencer.c
M   source/blender/editors/space_sequencer/sequencer_edit.c

===

diff --git a/source/blender/blenkernel/BKE_sequencer.h 
b/source/blender/blenkernel/BKE_sequencer.h
index d395fca0bbd..2f78b36 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -145,10 +145,10 @@ struct SeqEffectHandle {
void (*load)(struct Sequence *seq);
 
/* duplicate */
-   void (*copy)(struct Sequence *dst, struct Sequence *src);
+   void (*copy)(struct Sequence *dst, struct Sequence *src, const int 
flag);
 
/* destruct */
-   void (*free)(struct Sequence *seq);
+   void (*free)(struct Sequence *seq, const bool do_id_user);
 
/* returns: -1: no input needed,
 * 0: no early out,
@@ -226,12 +226,8 @@ int BKE_sequencer_recursive_apply(struct Sequence *seq, 
int (*apply_func)(struct
 
 void BKE_sequencer_free_clipboard(void);
 
-void BKE_sequence_clipboard_pointers_free(struct Sequence *seq);
-void BKE_sequence_clipboard_pointers_store(struct Sequence *seq);
-void BKE_sequence_clipboard_pointers_restore(struct Sequence *seq, struct Main 
*bmain);
-
 void BKE_sequencer_base_clipboard_pointers_free(struct ListBase *seqbase);
-void BKE_sequencer_base_clipboard_pointers_store(struct ListBase *seqbase);
+void BKE_sequencer_base_clipboard_pointers_store(struct Main *bmain, struct 
ListBase *seqbase);
 void BKE_sequencer_base_clipboard_pointers_restore(struct ListBase *seqbase, 
struct Main *bmain);
 
 void BKE_sequence_free(struct Scene *scene, struct Sequence *seq);
diff --git a/source/blender/blenkernel/intern/seqeffects.c 
b/source/blender/blenkernel/intern/seqeffects.c
index c69f8ff074f..5ac83a65bb6 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -751,7 +751,7 @@ static void load_gammacross(Sequence *UNUSED(seq))
 {
 }
 
-static void free_gammacross(Sequence *UNUSED(seq))
+static void free_gammacross(Sequence *UNUSED(seq), const bool 
UNUSED(do_id_user))
 {
 }
 
@@ -1875,7 +1875,7 @@ static int num_inputs_wipe(void)
return 2;
 }
 
-static void free_wipe_effect(Sequence *seq)
+static void free_wipe_effect(Sequence *seq, const bool UNUSED(do_id_user))
 {
if (seq->effectdata)
MEM_freeN(seq->effectdata);
@@ -1883,7 +1883,7 @@ static void free_wipe_effect(Sequence *seq)
seq->effectdata = NULL;
 }
 
-static void copy_wipe_effect(Sequence *dst, Sequence *src)
+static void copy_wipe_effect(Sequence *dst, Sequence *src, const int 
UNUSED(flag))
 {
dst->effectdata = MEM_dupallocN(src->effectdata);
 }
@@ -2066,13 +2066,13 @@ static int num_inputs_transform(void)
return 1;
 }
 
-static void free_transform_effect(Sequence *seq)
+static void free_transform_effect(Sequence *seq, const bool UNUSED(do_id_user))
 {
if (seq->effectdata) MEM_freeN(seq->effectdata);
seq->effectdata = NULL;
 }
 
-static void copy_transform_effect(Sequence *dst, Sequence *src)
+static void copy_transform_effect(Sequence *dst, Sequence *src, const int 
UNUSED(flag))
 {
dst->effectdata = MEM_dupallocN(src->effectdata);
 }
@@ -2384,7 +2384,7 @@ static int num_inputs_glow(void)
return 1;
 }
 
-static void free_glow_effect(Sequence *seq)
+static void free_glow_effect(Sequence *seq, const bool UNUSED(do_id_user))
 {
if (seq->effectdata)
MEM_freeN(seq->effectdata);
@@ -2392,7 +2392,7 @@ static void free_glow_effect(Sequence *seq)
seq->effectdata = NULL;
 }
 
-static void copy_glow_effect(Sequence *dst, Sequence *src)
+static void copy_glow_effect(Sequence *dst, Sequence *src, const int 
UNUSED(flag))
 {
dst->effectdata = MEM_dupallocN(src->effectdata);
 }
@@ -2478,7 +2478,7 @@ static int num_inputs_color(void)
return 0;
 }
 
-static void free_solid_color(Sequence *seq)
+static void free_solid_color(Sequence *seq, const bool UNUSED(do_id_user))
 {
if (seq->effectdata)
MEM_freeN(seq->effectdata);
@@ -2486,7 +2486,7 @@ static void free_solid_color(Sequence *seq)
seq->effectdata = NULL;
 }
 
-static void copy_solid_color(Sequence *dst, Sequence *src)
+static void copy_solid_color(Sequence *dst, Sequence *src, co

[Bf-blender-cvs] [ac442da4a14] master: Refactor: use guard clauses instead of nested conditionals

2019-01-23 Thread Jacques Lucke
Commit: ac442da4a14de0fbb4b35e3c31d2a698aec5de13
Author: Jacques Lucke
Date:   Wed Jan 23 10:44:52 2019 +0100
Branches: master
https://developer.blender.org/rBac442da4a14de0fbb4b35e3c31d2a698aec5de13

Refactor: use guard clauses instead of nested conditionals

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c 
b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 7100bf33a47..28e9816befe 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -625,13 +625,13 @@ static void gradientVertUpdate__mapFunc(
 const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
WPGradient_userData *grad_data = userData;
-   Mesh *me = grad_data->me;
-   if ((grad_data->use_select == false) || (me->mvert[index].flag & 
SELECT)) {
-   WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
-   if (vs->sco[0] != FLT_MAX) {
-   gradientVert_update(grad_data, index);
-   }
+   WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
+
+   if (vs->sco[0] == FLT_MAX) {
+   return;
}
+
+   gradientVert_update(grad_data, index);
 }
 
 static void gradientVertInit__mapFunc(
@@ -640,42 +640,41 @@ static void gradientVertInit__mapFunc(
 {
WPGradient_userData *grad_data = userData;
Mesh *me = grad_data->me;
+   WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
 
-   if ((grad_data->use_select == false) || (me->mvert[index].flag & 
SELECT)) {
-   /* run first pass only,
-* the screen coords of the verts need to be cached because
-* updating the mesh may move them about (entering feedback 
loop) */
-
-   if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
-   WPGradient_vertStore *vs = 
&grad_data->vert_cache->elem[index];
-   if (ED_view3d_project_float_object(
-   grad_data->ar,
-   co, vs->sco,
-   V3D_PROJ_TEST_CLIP_BB | 
V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
-   {
-   /* ok */
-   MDeformVert *dv = &me->dvert[index];
-   const MDeformWeight *dw;
-   dw = defvert_find_index(dv, grad_data->def_nr);
-   if (dw) {
-   vs->weight_orig = dw->weight;
-   vs->flag = VGRAD_STORE_DW_EXIST;
-   }
-   else {
-   vs->weight_orig = 0.0f;
-   vs->flag = VGRAD_STORE_NOP;
-   }
+   if (grad_data->use_select && !(me->mvert[index].flag & SELECT)) {
+   copy_v2_fl(vs->sco, FLT_MAX);
+   return;
+   }
 
-   BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
+   /* run first pass only,
+* the screen coords of the verts need to be cached because
+* updating the mesh may move them about (entering feedback loop) */
+   if (BLI_BITMAP_TEST(grad_data->vert_visit, index)) {
+   copy_v2_fl(vs->sco, FLT_MAX);
+   return;
+   }
 
-   gradientVert_update(grad_data, index);
-   }
-   else {
-   /* no go */
-   copy_v2_fl(vs->sco, FLT_MAX);
-   }
-   }
+   if (ED_view3d_project_float_object(
+   grad_data->ar,
+   co, vs->sco,
+   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) != 
V3D_PROJ_RET_OK)
+   {
+   return;
+   }
+
+   MDeformVert *dv = &me->dvert[index];
+   const MDeformWeight *dw = defvert_find_index(dv, grad_data->def_nr);
+   if (dw) {
+   vs->weight_orig = dw->weight;
+   vs->flag = VGRAD_STORE_DW_EXIST;
+   }
+   else {
+   vs->weight_orig = 0.0f;
+   vs->flag = VGRAD_STORE_NOP;
}
+   BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
+   gradientVert_update(grad_data, index);
 }
 
 static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const 
wmEvent *event)

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


[Bf-blender-cvs] [6555e177e9c] master: 3D View: add back clipping draw code (disabled)

2019-01-23 Thread Campbell Barton
Commit: 6555e177e9cccdde66c373ce3e382edf74eb46cc
Author: Campbell Barton
Date:   Wed Jan 23 20:44:08 2019 +1100
Branches: master
https://developer.blender.org/rB6555e177e9cccdde66c373ce3e382edf74eb46cc

3D View: add back clipping draw code (disabled)

Disabled for now because of draw-order issues.

Also move clipping test out of view3d_draw_legacy.c

===

M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_draw_legacy.c

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 8a699d8c9fb..f8130ee73fa 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -452,6 +452,8 @@ void ED_view3d_draw_setup_view(
 struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene 
*scene, struct ARegion *ar, struct View3D *v3d,
 float viewmat[4][4], float winmat[4][4], const struct rcti *rect);
 
+void ED_view3d_draw_clipping(const struct RegionView3D *rv3d);
+
 enum {
V3D_OFSDRAW_NONE = (0),
 
diff --git a/source/blender/editors/space_view3d/view3d_draw.c 
b/source/blender/editors/space_view3d/view3d_draw.c
index 9d6eb6f76e7..8d259986114 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1730,4 +1730,80 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
draw_flags, alpha_mode, samples, viewname, ofs, err_out);
 }
 
+/** \} */
+
+/*  */
+/** \name Viewport Clipping
+ * \{ */
+
+void ED_view3d_draw_clipping(const RegionView3D *rv3d)
+{
+   const BoundBox *bb = rv3d->clipbb;
+   if (bb == NULL) {
+   return;
+   }
+
+   const uint clipping_index[6][4] = {
+   {0, 1, 2, 3},
+   {0, 4, 5, 1},
+   {4, 7, 6, 5},
+   {7, 3, 2, 6},
+   {1, 5, 6, 2},
+   {7, 4, 0, 3}
+   };
+
+   GPUVertBuf *vbo;
+   GPUIndexBuf *el;
+   GPUIndexBufBuilder elb = {0};
+
+   /* Elements */
+   GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, ARRAY_SIZE(clipping_index) * 2, 
ARRAY_SIZE(bb->vec));
+   for (int i = 0; i < ARRAY_SIZE(clipping_index); i++) {
+   const uint *idx = clipping_index[i];
+   GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);
+   GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[2], idx[3]);
+   }
+   el = GPU_indexbuf_build(&elb);
+
+   GPUVertFormat format = {0};
+   uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, 
GPU_FETCH_FLOAT);
+
+   vbo = GPU_vertbuf_create_with_format(&format);
+   GPU_vertbuf_data_alloc(vbo, ARRAY_SIZE(bb->vec));
+   GPU_vertbuf_attr_fill(vbo, pos_id, bb->vec);
+
+   GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, el, 
GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX);
+   GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR);
+
+   float color[4];
+   UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, color);
+
+   GPU_batch_uniform_4fv(batch, "color", color);
+
+   /* Draw. */
+   glEnable(GL_BLEND);
+   GPU_batch_draw(batch);
+   GPU_batch_discard(batch);
+   glDisable(GL_BLEND);
+}
+
+static bool view3d_clipping_test(const float co[3], const float clip[6][4])
+{
+   if (plane_point_side_v3(clip[0], co) > 0.0f)
+   if (plane_point_side_v3(clip[1], co) > 0.0f)
+   if (plane_point_side_v3(clip[2], co) > 0.0f)
+   if (plane_point_side_v3(clip[3], co) > 0.0f)
+   return false;
+
+   return true;
+}
+
+/* for 'local' ED_view3d_clipping_local must run first
+ * then all comparisons can be done in localspace */
+bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], 
const bool is_local)
+{
+   return view3d_clipping_test(co, is_local ? rv3d->clip_local : 
rv3d->clip);
+}
+
+
 /** \} */
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c 
b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 734e4471a19..187413e6e62 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -140,24 +140,6 @@ void ED_view3d_clipping_enable(void)
}
 }
 
-static bool view3d_clipping_test(const float co[3], const float clip[6][4])
-{
-   if (plane_point_side_v3(clip[0], co) > 0.0f)
-   if (plane_point_side_v3(clip[1], co) > 0.0f)
-   if (plane_point_side_v3(clip[2], co) > 0.0f)
-   if (plane_point_side_v3(clip[3], co) > 0.0f)
-  

[Bf-blender-cvs] [9ff73e61b1a] master: Fix T60778: Grease pencil Hook modifieronly affects strokes with more than 2 points

2019-01-23 Thread Antonioya
Commit: 9ff73e61b1a3c825fec5c2daffbe017c6cd7377d
Author: Antonioya
Date:   Wed Jan 23 10:36:52 2019 +0100
Branches: master
https://developer.blender.org/rB9ff73e61b1a3c825fec5c2daffbe017c6cd7377d

Fix T60778: Grease pencil Hook modifieronly affects strokes with more than 2 
points

Also fixed Lattice and Noise modifier.

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index 97f260f307f..06cdbfcbbce 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -210,7 +210,7 @@ static void deformStroke(
 
if (!is_stroke_affected_by_modifier(
ob,
-   mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, 
gps,
+   mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, 
gps,
mmd->flag & GP_HOOK_INVERT_LAYER, mmd->flag & 
GP_HOOK_INVERT_PASS,
mmd->flag & GP_HOOK_INVERT_LAYERPASS))
{
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 1d8f2c20b59..c938446a623 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -83,7 +83,7 @@ static void deformStroke(
 
if (!is_stroke_affected_by_modifier(
ob,
-   mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, 
gps,
+   mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, 
gps,
mmd->flag & GP_LATTICE_INVERT_LAYER, mmd->flag & 
GP_LATTICE_INVERT_PASS,
mmd->flag & GP_LATTICE_INVERT_LAYERPASS))
{
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index e25908d2d01..94f83f10fb5 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -96,8 +96,8 @@ static bool dependsOnTime(GpencilModifierData *md)
 
 /* aply noise effect based on stroke direction */
 static void deformStroke(
-GpencilModifierData *md, Depsgraph *depsgraph,
-Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
+   GpencilModifierData *md, Depsgraph *depsgraph,
+   Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
 {
NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
bGPDspoint *pt0, *pt1;
@@ -108,6 +108,7 @@ static void deformStroke(
int sc_frame = 0;
int sc_diff = 0;
const int def_nr = defgroup_name_index(ob, mmd->vgname);
+   const float unit_v3[3] = { 1.0f, 1.0f, 1.0f };
 
/* Random generator, only init once. */
if (mmd->rng == NULL) {
@@ -117,10 +118,10 @@ static void deformStroke(
}
 
if (!is_stroke_affected_by_modifier(
-   ob,
-   mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, 
gps,
-   mmd->flag & GP_NOISE_INVERT_LAYER, mmd->flag & 
GP_NOISE_INVERT_PASS,
-   mmd->flag & GP_NOISE_INVERT_LAYERPASS))
+   ob,
+   mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps,
+   mmd->flag & GP_NOISE_INVERT_LAYER, mmd->flag & 
GP_NOISE_INVERT_PASS,
+   mmd->flag & GP_NOISE_INVERT_LAYERPASS))
{
return;
}
@@ -130,7 +131,12 @@ static void deformStroke(
zero_v3(vec2);
 
/* calculate stroke normal*/
-   BKE_gpencil_stroke_normal(gps, normal);
+   if (gps->totpoints > 2) {
+   BKE_gpencil_stroke_normal(gps, normal);
+   }
+   else {
+   copy_v3_v3(normal, unit_v3);
+   }
 
/* move points */
for (int i = 0; i < gps->totpoints; i++) {
@@ -143,7 +149,7 @@ static void deformStroke(
if (gps->dvert) {
dvert = &gps->dvert[0];
}
-   pt0 = &gps->points[1];
+   pt0 = (gps->totpoints > 1) ? &gps->points[1] : 
&gps->points[0];
pt1 = &gps->points[0];
}
else {
@@ -174,7 +180,7 @@ static void deformStroke(
sc_diff = abs(mmd->scene_frame - sc_frame);
/* only recalc if the gp frame change or the number of 
scene frames is bigger than step */
if ((!gpl->actframe) || (mmd->gp_frame != 
gpl->actframe->fr

[Bf-blender-cvs] [baa5fe1bfcd] master: Cleanup: Spelling in comment

2019-01-23 Thread Sergey Sharybin
Commit: baa5fe1bfcdecc6a2697c2629dae6ff24e217877
Author: Sergey Sharybin
Date:   Wed Jan 23 10:27:55 2019 +0100
Branches: master
https://developer.blender.org/rBbaa5fe1bfcdecc6a2697c2629dae6ff24e217877

Cleanup: Spelling in comment

===

M   intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc

===

diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc 
b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
index c74e05eca0f..9a8729ccda4 100644
--- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
+++ b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
@@ -130,7 +130,7 @@ template 
 class StackAllocatedBuffer {
  public:
   static PatchCoordBuffer* Create(int /*size*/) {
-// TODO(sergey): Validate that requested dize is smaller than static
+// TODO(sergey): Validate that requested size is smaller than static
 // stack memory size.
 return new StackAllocatedBuffer();
   }

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