[Bf-blender-cvs] [f4b7d575510] master: Fix T72175: DrawManager Crash Large Objects

2019-12-04 Thread Jeroen Bakker
Commit: f4b7d57551061350216048d5d30b9b674f741c28
Author: Jeroen Bakker
Date:   Thu Dec 5 08:14:32 2019 +0100
Branches: master
https://developer.blender.org/rBf4b7d57551061350216048d5d30b9b674f741c28

Fix T72175: DrawManager Crash Large Objects

Introduced by 9c337fcfe2a4 mistaken that `MeshExtract.use_threading` set
to false means that no threading is used at all. This is not the case it
will still perform threading for large objects, it will only run the
different subtasks in serial.

Fixed by scheduling the `lines_loose` in the task_pool after the rest
have been executed. This is cleaner than the previous implementation as
it sticks more to the actual design.

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c 
b/source/blender/draw/intern/draw_cache_extract_mesh.c
index 06c2bfc301a..7d0cb7c7076 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -4483,20 +4483,22 @@ void mesh_buffer_cache_create_requested(MeshBatchCache 
*cache,
   EXTRACT(ibo, edituv_points);
   EXTRACT(ibo, edituv_fdots);
 
-#undef EXTRACT
-
   /* TODO(fclem) Ideally, we should have one global pool for all
* objects and wait for finish only before drawing when buffers
* need to be ready. */
   BLI_task_pool_work_and_wait(task_pool);
-  BLI_task_pool_free(task_pool);
+
+  /* The next task(s) rely on the result of the tasks above. */
 
   /* The `lines_loose` is a sub buffer from `ibo.lines`.
-   * We don't use the extract mechanism due to potential synchronization 
issues.*/
-  if (mbc.ibo.lines_loose) {
-extract_task_create(NULL, mr, _lines_loose, mbc.ibo.lines_loose, 
task_counters);
-  }
+   * We schedule it here due to potential synchronization issues.*/
+  EXTRACT(ibo, lines_loose);
 
+  BLI_task_pool_work_and_wait(task_pool);
+
+#undef EXTRACT
+
+  BLI_task_pool_free(task_pool);
   MEM_freeN(task_counters);
 
   mesh_render_data_free(mr);

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


[Bf-blender-cvs] [722b8e46928] master: Industry Compat keymap: Use consistent shortcuts for sculpt mode masking

2019-12-04 Thread William Reynish
Commit: 722b8e4692829b11b9ae150cb9daccd52d25a2e7
Author: William Reynish
Date:   Thu Dec 5 15:30:43 2019 +0900
Branches: master
https://developer.blender.org/rB722b8e4692829b11b9ae150cb9daccd52d25a2e7

Industry Compat keymap: Use consistent shortcuts for sculpt mode masking

Use Ctrl-A and Ctrl-Shift-A for 'selecting' and 'deselecting' via the masking 
operators.

===

M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py

===

diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index dfe65f64cd0..6c2d89233ce 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3006,8 +3006,10 @@ def km_sculpt(params):
 ("object.subdivision_set", {"type": 'PAGE_DOWN', "value": 'PRESS'},
  {"properties": [("level", -1), ("relative", True)]}),
 # Mask
-("paint.mask_flood_fill", {"type": 'M', "value": 'PRESS', "alt": True},
+("paint.mask_flood_fill", {"type": 'A', "value": 'PRESS', "ctrl": 
True},
  {"properties": [("mode", 'VALUE'), ("value", 0.0)]}),
+("paint.mask_flood_fill", {"type": 'A', "value": 'PRESS', "ctrl": 
True, "shift": True},
+ {"properties": [("mode", 'VALUE'), ("value", 1.0)]}),
 ("paint.mask_flood_fill", {"type": 'I', "value": 'PRESS', "ctrl": 
True},
  {"properties": [("mode", 'INVERT')]}),
 ("paint.mask_lasso_gesture", {"type": 'LEFTMOUSE', "value": 'PRESS', 
"shift": True, "ctrl": True}, None),

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


[Bf-blender-cvs] [de7622b4b6c] master: Industry Compat keymap: Support scroll wheel zooming also while Alt is held

2019-12-04 Thread William Reynish
Commit: de7622b4b6c90675faba77694bde53517cd29150
Author: William Reynish
Date:   Thu Dec 5 15:22:49 2019 +0900
Branches: master
https://developer.blender.org/rBde7622b4b6c90675faba77694bde53517cd29150

Industry Compat keymap: Support scroll wheel zooming also while Alt is held

Users are sometimes holding Alt to do view manipulation, in which case zooming 
with the scroll wheel would fail.

===

M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py

===

diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 8e03d57f69c..dfe65f64cd0 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -325,6 +325,8 @@ def km_view2d(params):
 # Zoom with single step
 ("view2d.zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS'}, None),
 ("view2d.zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS'}, None),
+("view2d.zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS', "alt": 
True}, None),
+("view2d.zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS', "alt": 
True}, None),
 ("view2d.zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, None),
 ("view2d.zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS'}, None),
 ("view2d.zoom", {"type": 'TRACKPADPAN', "value": 'ANY', "ctrl": True}, 
None),
@@ -634,6 +636,10 @@ def km_view3d(params):
  {"properties": [("delta", 1)]}),
 ("view3d.zoom", {"type": 'WHEELOUTMOUSE', "value": 'PRESS'},
  {"properties": [("delta", -1)]}),
+("view3d.zoom", {"type": 'WHEELINMOUSE', "value": 'PRESS', "alt": 
True},
+ {"properties": [("delta", 1)]}),
+("view3d.zoom", {"type": 'WHEELOUTMOUSE', "value": 'PRESS', "alt": 
True},
+ {"properties": [("delta", -1)]}),
 ("view3d.dolly", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": 
True},
  {"properties": [("delta", 1)]}),
 ("view3d.dolly", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": 
True},
@@ -954,6 +960,8 @@ def km_image(params):
 ("image.view_ndof", {"type": 'NDOF_MOTION', "value": 'ANY'}, None),
 ("image.view_zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS'}, 
None),
 ("image.view_zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS'}, 
None),
+("image.view_zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS', 
"alt": True}, None),
+("image.view_zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS', 
"alt": True}, None),
 ("image.view_zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS'}, 
None),
 ("image.view_zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, 
None),
 ("image.view_zoom", {"type": 'RIGHTMOUSE', "value": 'PRESS', "alt": 
True}, None),
@@ -1942,6 +1950,8 @@ def km_clip_editor(params):
 ("clip.view_zoom", {"type": 'TRACKPADPAN', "value": 'ANY', "ctrl": 
True}, None),
 ("clip.view_zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS'}, 
None),
 ("clip.view_zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS'}, 
None),
+("clip.view_zoom_in", {"type": 'WHEELINMOUSE', "value": 'PRESS', 
"alt": True}, None),
+("clip.view_zoom_out", {"type": 'WHEELOUTMOUSE', "value": 'PRESS', 
"alt": True}, None),
 ("clip.view_zoom_in", {"type": 'NUMPAD_PLUS', "value": 'PRESS'}, None),
 ("clip.view_zoom_out", {"type": 'NUMPAD_MINUS', "value": 'PRESS'}, 
None),
 ("clip.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS', 
"ctrl": True},

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


[Bf-blender-cvs] [51bec2e5fef] master: Industry Compat keymap: Fix Tweak tool in UV Editor (Unreported)

2019-12-04 Thread William Reynish
Commit: 51bec2e5fef7986f71820b835b38897e5efbbc20
Author: William Reynish
Date:   Thu Dec 5 15:00:56 2019 +0900
Branches: master
https://developer.blender.org/rB51bec2e5fef7986f71820b835b38897e5efbbc20

Industry Compat keymap: Fix Tweak tool in UV Editor (Unreported)

The Tweak tool wasn't working - it would start to box select instead.

===

M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py

===

diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 473fbb902dc..8e03d57f69c 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -542,7 +542,7 @@ def km_uv_editor(params):
  {"properties": [("extend", False), ("deselect_all", True)]}),
 ("uv.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},
  {"properties": [("extend", True), ("deselect_all", False)]}),
-("uv.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
+("transform.translate", {"type": "EVT_TWEAK_L", "value": 'ANY'}, None),
 ("uv.select_loop", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK', 
"shift": True},
  {"properties": [("extend", True)]}),
 ("uv.select_loop", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'},
@@ -559,7 +559,6 @@ def km_uv_editor(params):
  {"properties": [("unselected", True)]}),
 ("uv.reveal", {"type": 'H', "value": 'PRESS', "alt": True}, None),
 op_menu_pie("IMAGE_MT_uvs_snap_pie", {"type": 'X', "value": 'PRESS', 
"shift": True}),
-op_menu("IMAGE_MT_uvs_select_mode", {"type": 'TAB', "value": 'PRESS', 
"ctrl": True}),
 op_menu("IMAGE_MT_uvs_context_menu", {"type": 'RIGHTMOUSE', "value": 
'PRESS'}),
 ("wm.context_toggle", {"type": 'B', "value": 'PRESS'},
  {"properties": [("data_path", 
'tool_settings.use_proportional_edit')]}),

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


[Bf-blender-cvs] [a16a56e7d9f] master: Industry Compat keymap: Support 1-4 keys for switching selection modes in the UV Editor

2019-12-04 Thread William Reynish
Commit: a16a56e7d9ff91b7f0b208ad3868ecea7de352da
Author: William Reynish
Date:   Thu Dec 5 14:38:19 2019 +0900
Branches: master
https://developer.blender.org/rBa16a56e7d9ff91b7f0b208ad3868ecea7de352da

Industry Compat keymap: Support 1-4 keys for switching selection modes in the 
UV Editor

This is consistent with the 3d View. Oversight pointed out by users on the 
forums.

===

M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py

===

diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index 6bf9a60a3d7..473fbb902dc 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -529,6 +529,15 @@ def km_uv_editor(params):
 op_panel("TOPBAR_PT_name", {"type": 'RET', "value": 'PRESS'}, 
[("keep_open", False)]),
 ("wm.search_menu", {"type": 'TAB', "value": 'PRESS'}, None),
 # Selection modes.
+("wm.context_set_enum", {"type": 'ONE', "value": 'PRESS'},
+ {"properties": [("data_path", 'tool_settings.uv_select_mode'), 
("value", 'VERTEX')]}),
+("wm.context_set_enum", {"type": 'TWO', "value": 'PRESS'},
+ {"properties": [("data_path", 'tool_settings.uv_select_mode'), 
("value", 'EDGE')]}),
+("wm.context_set_enum", {"type": 'THREE', "value": 'PRESS'},
+ {"properties": [("data_path", 'tool_settings.uv_select_mode'), 
("value", 'FACE')]}),
+("wm.context_set_enum", {"type": 'FOUR', "value": 'PRESS'},
+ {"properties": [("data_path", 'tool_settings.uv_select_mode'), 
("value", 'ISLAND')]}),
+  
 ("uv.select", {"type": 'LEFTMOUSE', "value": 'CLICK'},
  {"properties": [("extend", False), ("deselect_all", True)]}),
 ("uv.select", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True},

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


[Bf-blender-cvs] [4949a62d4d7] master: Overlay Engine: Add back selectability of planar lightprobe data plane

2019-12-04 Thread Clément Foucault
Commit: 4949a62d4d73d3185576a33a893701c0bf02dcfb
Author: Clément Foucault
Date:   Wed Dec 4 22:32:08 2019 +0100
Branches: master
https://developer.blender.org/rB4949a62d4d73d3185576a33a893701c0bf02dcfb

Overlay Engine: Add back selectability of planar lightprobe data plane

===

M   source/blender/draw/engines/overlay/overlay_extra.c
M   source/blender/draw/engines/overlay/overlay_private.h

===

diff --git a/source/blender/draw/engines/overlay/overlay_extra.c 
b/source/blender/draw/engines/overlay/overlay_extra.c
index 500e40b08e5..53a743eb124 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -143,6 +143,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
   cb->probe_cube = BUF_INSTANCE(grp_sub, format, 
DRW_cache_lightprobe_planar_get());
   cb->probe_grid = BUF_INSTANCE(grp_sub, format, 
DRW_cache_lightprobe_grid_get());
   cb->probe_planar = BUF_INSTANCE(grp_sub, format, 
DRW_cache_lightprobe_planar_get());
+  cb->solid_quad = BUF_INSTANCE(grp_sub, format, DRW_cache_quad_get());
   cb->speaker = BUF_INSTANCE(grp_sub, format, DRW_cache_speaker_get());
 
   grp_sub = DRW_shgroup_create_sub(grp);
@@ -759,6 +760,10 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data 
*vedata, Object *ob)
 case LIGHTPROBE_TYPE_PLANAR:
   DRW_buffer_add_entry(cb->probe_planar, color_p, );
 
+  if (DRW_state_is_select() && (prb->flag & LIGHTPROBE_FLAG_SHOW_DATA)) {
+DRW_buffer_add_entry(cb->solid_quad, color_p, );
+  }
+
   if (show_influence) {
 normalize_v3_length(instdata.mat[2], prb->distinf);
 DRW_buffer_add_entry(cb->empty_cube, color_p, );
diff --git a/source/blender/draw/engines/overlay/overlay_private.h 
b/source/blender/draw/engines/overlay/overlay_private.h
index b2399daebe2..fb30b9535cd 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -166,6 +166,8 @@ typedef struct OVERLAY_ExtraCallBuffers {
   DRWCallBuffer *probe_cube;
   DRWCallBuffer *probe_grid;
 
+  DRWCallBuffer *solid_quad;
+
   DRWCallBuffer *speaker;
 
   DRWShadingGroup *extra_wire;

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


[Bf-blender-cvs] [a77fe7eb5c3] master: Overlay Engine: Outline: Simplify drawing code

2019-12-04 Thread Clément Foucault
Commit: a77fe7eb5c34d859cc18fc942a1167116b7a8c9e
Author: Clément Foucault
Date:   Wed Dec 4 20:57:55 2019 +0100
Branches: master
https://developer.blender.org/rBa77fe7eb5c34d859cc18fc942a1167116b7a8c9e

Overlay Engine: Outline: Simplify drawing code

Use obinfo ubo to compute outline color id.

Note this commit removes the planar probe outline on purpose.

===

M   source/blender/draw/engines/overlay/overlay_outline.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/overlay_shader.c
M   
source/blender/draw/engines/overlay/shaders/outline_lightprobe_grid_vert.glsl
M   source/blender/draw/engines/overlay/shaders/outline_prepass_frag.glsl
M   source/blender/draw/engines/overlay/shaders/outline_prepass_vert.glsl

===

diff --git a/source/blender/draw/engines/overlay/overlay_outline.c 
b/source/blender/draw/engines/overlay/overlay_outline.c
index 706dcc95288..7eb942c64e4 100644
--- a/source/blender/draw/engines/overlay/overlay_outline.c
+++ b/source/blender/draw/engines/overlay/overlay_outline.c
@@ -22,6 +22,8 @@
 
 #include "DRW_render.h"
 
+#include "BKE_global.h"
+
 #include "DNA_lightprobe_types.h"
 
 #include "UI_resources.h"
@@ -58,77 +60,6 @@ void OVERLAY_outline_init(OVERLAY_Data *vedata)
   }
 }
 
-static int shgroup_theme_id_to_outline_id(int theme_id, const int base_flag)
-{
-  if (UNLIKELY(base_flag & BASE_FROM_DUPLI)) {
-switch (theme_id) {
-  case TH_ACTIVE:
-  case TH_SELECT:
-return 2;
-  case TH_TRANSFORM:
-return 0;
-  default:
-return -1;
-}
-  }
-
-  switch (theme_id) {
-case TH_ACTIVE:
-  return 3;
-case TH_SELECT:
-  return 1;
-case TH_TRANSFORM:
-  return 0;
-default:
-  return -1;
-  }
-}
-
-static DRWShadingGroup 
*shgroup_theme_id_to_outline_or_null(OVERLAY_PrivateData *pd,
-int theme_id,
-const int 
base_flag)
-{
-  int outline_id = shgroup_theme_id_to_outline_id(theme_id, base_flag);
-  switch (outline_id) {
-case 3: /* TH_ACTIVE */
-  return pd->outlines_active_grp;
-case 2: /* Duplis */
-  return pd->outlines_select_dupli_grp;
-case 1: /* TH_SELECT */
-  return pd->outlines_select_grp;
-case 0: /* TH_TRANSFORM */
-  return pd->outlines_transform_grp;
-default:
-  return NULL;
-  }
-}
-
-static DRWShadingGroup 
*shgroup_theme_id_to_probe_outline_or_null(OVERLAY_PrivateData *pd,
-  int theme_id,
-  const int 
base_flag)
-{
-  int outline_id = shgroup_theme_id_to_outline_id(theme_id, base_flag);
-  switch (outline_id) {
-case 3: /* TH_ACTIVE */
-  return pd->outlines_probe_active_grp;
-case 2: /* Duplis */
-  return pd->outlines_probe_select_dupli_grp;
-case 1: /* TH_SELECT */
-  return pd->outlines_probe_select_grp;
-case 0: /* TH_TRANSFORM */
-  return pd->outlines_probe_transform_grp;
-default:
-  return NULL;
-  }
-}
-
-static DRWShadingGroup *outline_shgroup(DRWPass *pass, int outline_id, 
GPUShader *sh)
-{
-  DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
-  DRW_shgroup_uniform_int_copy(grp, "outlineId", outline_id);
-  return grp;
-}
-
 void OVERLAY_outline_cache_init(OVERLAY_Data *vedata)
 {
   OVERLAY_PassList *psl = vedata->psl;
@@ -146,20 +77,13 @@ void OVERLAY_outline_cache_init(OVERLAY_Data *vedata)
 
 GPUShader *sh_grid = OVERLAY_shader_outline_prepass_grid();
 GPUShader *sh_geom = 
OVERLAY_shader_outline_prepass(pd->xray_enabled_and_not_wire);
-GPUShader *sh = OVERLAY_shader_outline_prepass(false);
 
-pd->outlines_transform_grp = outline_shgroup(psl->outlines_prepass_ps, 0, 
sh_geom);
-pd->outlines_select_grp = outline_shgroup(psl->outlines_prepass_ps, 1, 
sh_geom);
-pd->outlines_select_dupli_grp = outline_shgroup(psl->outlines_prepass_ps, 
2, sh_geom);
-pd->outlines_active_grp = outline_shgroup(psl->outlines_prepass_ps, 3, 
sh_geom);
+pd->outlines_grp = grp = DRW_shgroup_create(sh_geom, 
psl->outlines_prepass_ps);
+DRW_shgroup_uniform_bool_copy(grp, "isTransform", (G.moving & 
G_TRANSFORM_OBJ) != 0);
 
-pd->outlines_probe_transform_grp = 
outline_shgroup(psl->outlines_prepass_ps, 0, sh);
-pd->outlines_probe_select_grp = outline_shgroup(psl->outlines_prepass_ps, 
1, sh);
-pd->outlines_probe_select_dupli_grp = 
outline_shgroup(psl->outlines_prepass_ps, 2, sh);
-pd->outlines_probe_active_grp = outline_shgroup(psl->outlines_prepass_ps, 
3, sh);
-
-pd->outlines_probe_grid_grp = grp = DRW_shgroup_create(sh_grid, 
psl->outlines_prepass_ps);
+pd->outlines_grid_grp = grp = DRW_shgroup_create(sh_grid, 

[Bf-blender-cvs] [1b33e1f9ae7] master: Overlay Engine: Cleanup & enable line AA on in front passes

2019-12-04 Thread Clément Foucault
Commit: 1b33e1f9ae77ab5faeee96a89f7c040b026e647b
Author: Clément Foucault
Date:   Thu Dec 5 00:32:21 2019 +0100
Branches: master
https://developer.blender.org/rB1b33e1f9ae77ab5faeee96a89f7c040b026e647b

Overlay Engine: Cleanup & enable line AA on in front passes

- Remove pd->view_default, was a leftover from TAA implementation
- Sanitize active_view switches.
- Sanitize framebuffers switches.

===

M   source/blender/draw/engines/overlay/overlay_antialiasing.c
M   source/blender/draw/engines/overlay/overlay_armature.c
M   source/blender/draw/engines/overlay/overlay_edit_curve.c
M   source/blender/draw/engines/overlay/overlay_edit_mesh.c
M   source/blender/draw/engines/overlay/overlay_edit_text.c
M   source/blender/draw/engines/overlay/overlay_engine.c
M   source/blender/draw/engines/overlay/overlay_extra.c
M   source/blender/draw/engines/overlay/overlay_facing.c
M   source/blender/draw/engines/overlay/overlay_grid.c
M   source/blender/draw/engines/overlay/overlay_image.c
M   source/blender/draw/engines/overlay/overlay_lattice.c
M   source/blender/draw/engines/overlay/overlay_paint.c
M   source/blender/draw/engines/overlay/overlay_particle.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/overlay_sculpt.c
M   source/blender/draw/engines/overlay/overlay_wireframe.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.c 
b/source/blender/draw/engines/overlay/overlay_antialiasing.c
index 5b633bb0883..54bcd91441c 100644
--- a/source/blender/draw/engines/overlay/overlay_antialiasing.c
+++ b/source/blender/draw/engines/overlay/overlay_antialiasing.c
@@ -71,8 +71,6 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
   DRW_texture_ensure_2d(>dummy_depth_tx, 1, 1, GPU_DEPTH_COMPONENT24, 0);
 
   if (!DRW_state_is_fbo()) {
-/* Use default view */
-pd->view_default = (DRWView *)DRW_view_default_get();
 pd->antialiasing.enabled = false;
 return;
   }
@@ -81,35 +79,37 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
   /* TODO Get real userpref option and remove MSAA buffer. */
   pd->antialiasing.enabled = (dtxl->multisample_color != NULL) || 
need_wire_expansion;
 
-  /* Use default view */
-  pd->view_default = (DRWView *)DRW_view_default_get();
+  GPUTexture *color_tex = NULL;
+  GPUTexture *line_tex = NULL;
 
   if (pd->antialiasing.enabled) {
 DRW_texture_ensure_fullscreen_2d(>overlay_color_tx, GPU_RGBA8, 
DRW_TEX_FILTER);
 DRW_texture_ensure_fullscreen_2d(>overlay_line_tx, GPU_RGBA8, 0);
 
-GPU_framebuffer_ensure_config(
->overlay_color_only_fb,
-{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->overlay_color_tx)});
-GPU_framebuffer_ensure_config(
->overlay_default_fb,
-{GPU_ATTACHMENT_TEXTURE(dtxl->depth), 
GPU_ATTACHMENT_TEXTURE(txl->overlay_color_tx)});
-GPU_framebuffer_ensure_config(>overlay_line_fb,
-  {GPU_ATTACHMENT_TEXTURE(dtxl->depth),
-   
GPU_ATTACHMENT_TEXTURE(txl->overlay_color_tx),
-   
GPU_ATTACHMENT_TEXTURE(txl->overlay_line_tx)});
+color_tex = txl->overlay_color_tx;
+line_tex = txl->overlay_line_tx;
   }
   else {
 /* Just a copy of the defaults framebuffers. */
-GPU_framebuffer_ensure_config(>overlay_color_only_fb,
-  {GPU_ATTACHMENT_NONE, 
GPU_ATTACHMENT_TEXTURE(dtxl->color)});
-GPU_framebuffer_ensure_config(
->overlay_default_fb,
-{GPU_ATTACHMENT_TEXTURE(dtxl->depth), 
GPU_ATTACHMENT_TEXTURE(dtxl->color)});
-GPU_framebuffer_ensure_config(
->overlay_line_fb,
-{GPU_ATTACHMENT_TEXTURE(dtxl->depth), 
GPU_ATTACHMENT_TEXTURE(dtxl->color)});
+color_tex = dtxl->color;
   }
+
+  GPU_framebuffer_ensure_config(>overlay_color_only_fb,
+{
+GPU_ATTACHMENT_NONE,
+GPU_ATTACHMENT_TEXTURE(color_tex),
+});
+  GPU_framebuffer_ensure_config(>overlay_default_fb,
+{
+GPU_ATTACHMENT_TEXTURE(dtxl->depth),
+GPU_ATTACHMENT_TEXTURE(color_tex),
+});
+  GPU_framebuffer_ensure_config(>overlay_line_fb,
+{
+GPU_ATTACHMENT_TEXTURE(dtxl->depth),
+GPU_ATTACHMENT_TEXTURE(color_tex),
+GPU_ATTACHMENT_TEXTURE(line_tex),
+});
 }
 
 void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata)
@@ -149,11 +149,21 @@ void OVERLAY_antialiasing_cache_finish(OVERLAY_Data 
*vedata)
  

[Bf-blender-cvs] [4705aa4fe51] master: Overlay Engine: LightProbe: Simplify drawing of irradiance grid data

2019-12-04 Thread Clément Foucault
Commit: 4705aa4fe518ce33a9dff59a3ae1707ff28bdd08
Author: Clément Foucault
Date:   Wed Dec 4 22:24:34 2019 +0100
Branches: master
https://developer.blender.org/rB4705aa4fe518ce33a9dff59a3ae1707ff28bdd08

Overlay Engine: LightProbe: Simplify drawing of irradiance grid data

This separates it from the outline pass and fix a visibility bug
when extras were off.

===

M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/overlay/overlay_antialiasing.c
M   source/blender/draw/engines/overlay/overlay_edit_mesh.c
M   source/blender/draw/engines/overlay/overlay_engine.c
M   source/blender/draw/engines/overlay/overlay_extra.c
M   source/blender/draw/engines/overlay/overlay_outline.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/overlay_shader.c
A   
source/blender/draw/engines/overlay/shaders/extra_lightprobe_grid_vert.glsl
D   
source/blender/draw/engines/overlay/shaders/outline_lightprobe_grid_vert.glsl

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 88caafb0c00..931d8c058ce 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -345,6 +345,7 @@ 
data_to_c_simple(engines/overlay/shaders/edit_particle_point_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/extra_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/extra_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/extra_groundline_vert.glsl SRC)
+data_to_c_simple(engines/overlay/shaders/extra_lightprobe_grid_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/extra_loose_point_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/extra_loose_point_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/extra_point_vert.glsl SRC)
@@ -363,7 +364,6 @@ 
data_to_c_simple(engines/overlay/shaders/outline_detect_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_prepass_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_prepass_geom.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_prepass_vert.glsl SRC)
-data_to_c_simple(engines/overlay/shaders/outline_lightprobe_grid_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/paint_face_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/paint_point_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/paint_texture_frag.glsl SRC)
diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.c 
b/source/blender/draw/engines/overlay/overlay_antialiasing.c
index 8f357d37768..5b633bb0883 100644
--- a/source/blender/draw/engines/overlay/overlay_antialiasing.c
+++ b/source/blender/draw/engines/overlay/overlay_antialiasing.c
@@ -67,6 +67,9 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
   OVERLAY_PrivateData *pd = vedata->stl->pd;
   DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
 
+  /* Small texture which will have very small impact on rendertime. */
+  DRW_texture_ensure_2d(>dummy_depth_tx, 1, 1, GPU_DEPTH_COMPONENT24, 0);
+
   if (!DRW_state_is_fbo()) {
 /* Use default view */
 pd->view_default = (DRWView *)DRW_view_default_get();
diff --git a/source/blender/draw/engines/overlay/overlay_edit_mesh.c 
b/source/blender/draw/engines/overlay/overlay_edit_mesh.c
index e03ed7f2d00..a0ebcacec75 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_mesh.c
+++ b/source/blender/draw/engines/overlay/overlay_edit_mesh.c
@@ -39,17 +39,11 @@
 
 void OVERLAY_edit_mesh_init(OVERLAY_Data *vedata)
 {
-  OVERLAY_TextureList *txl = vedata->txl;
   OVERLAY_PrivateData *pd = vedata->stl->pd;
   const DRWContextState *draw_ctx = DRW_context_state_get();
 
   pd->edit_mesh.do_zbufclip = XRAY_FLAG_ENABLED(draw_ctx->v3d);
 
-  if (!pd->edit_mesh.do_zbufclip) {
-/* Small texture which will have very small impact on rendertime. */
-DRW_texture_ensure_2d(>dummy_depth_tx, 1, 1, GPU_DEPTH_COMPONENT24, 
0);
-  }
-
   /* Create view with depth offset */
   DRWView *default_view = (DRWView *)DRW_view_default_get();
   /* Don't use AA view (pd->view_default) because edit mode already has 
anti-aliasing. */
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c 
b/source/blender/draw/engines/overlay/overlay_engine.c
index 24e2c4441e3..561e146045c 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -196,10 +196,9 @@ static void OVERLAY_cache_populate(void *vedata, Object 
*ob)
   const bool draw_bones = (pd->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0;
   const bool draw_wires = draw_surface && has_surface &&
   (pd->wireframe_mode || !pd->hide_overlays);
-  const bool draw_outlines = !in_edit_mode && !in_paint_mode && renderable &&
+  const bool draw_outlines = !in_edit_mode && !in_paint_mode && 

[Bf-blender-cvs] [6d3eb85f66a] master: Overlay Engine: Simplify outline rendering by using the antialiasing pass

2019-12-04 Thread Clément Foucault
Commit: 6d3eb85f66ae93d9d4859ef3264f1a1b2ae4fa36
Author: Clément Foucault
Date:   Wed Dec 4 01:31:36 2019 +0100
Branches: master
https://developer.blender.org/rB6d3eb85f66ae93d9d4859ef3264f1a1b2ae4fa36

Overlay Engine: Simplify outline rendering by using the antialiasing pass

This use the overlay AA pass to antialias the selection outlines.

This also do all search and expand in one pass and reduce the computation
time and memory used (2 x 32bit/pixel buffer less).

Note that the aliasing is a bit worse than the old FXAA that we used to have.

===

M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/overlay/overlay_antialiasing.c
M   source/blender/draw/engines/overlay/overlay_engine.c
M   source/blender/draw/engines/overlay/overlay_outline.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/overlay_shader.c
M   source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl
M   source/blender/draw/engines/overlay/shaders/outline_detect_frag.glsl
D   source/blender/draw/engines/overlay/shaders/outline_expand_frag.glsl
D   source/blender/draw/engines/overlay/shaders/outline_resolve_frag.glsl

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index ea52d8e8f1f..88caafb0c00 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -360,12 +360,10 @@ 
data_to_c_simple(engines/overlay/shaders/motion_path_line_geom.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/motion_path_line_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/motion_path_point_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_detect_frag.glsl SRC)
-data_to_c_simple(engines/overlay/shaders/outline_expand_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_prepass_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_prepass_geom.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_prepass_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/outline_lightprobe_grid_vert.glsl SRC)
-data_to_c_simple(engines/overlay/shaders/outline_resolve_frag.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/paint_face_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/paint_point_vert.glsl SRC)
 data_to_c_simple(engines/overlay/shaders/paint_texture_frag.glsl SRC)
diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.c 
b/source/blender/draw/engines/overlay/overlay_antialiasing.c
index 569d47bf3a2..8f357d37768 100644
--- a/source/blender/draw/engines/overlay/overlay_antialiasing.c
+++ b/source/blender/draw/engines/overlay/overlay_antialiasing.c
@@ -60,12 +60,6 @@
 
 #include "overlay_private.h"
 
-void OVERLAY_antialiasing_reset(OVERLAY_Data *vedata)
-{
-  OVERLAY_PrivateData *pd = vedata->stl->pd;
-  pd->antialiasing.sample = 0;
-}
-
 void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
 {
   OVERLAY_FramebufferList *fbl = vedata->fbl;
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c 
b/source/blender/draw/engines/overlay/overlay_engine.c
index e83a5c04eaf..24e2c4441e3 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -50,37 +50,27 @@ static void OVERLAY_engine_init(void *vedata)
   }
 
   OVERLAY_PrivateData *pd = stl->pd;
-  View3DOverlay overlay;
-  short v3d_flag, v3d_gridflag;
 
   pd->hide_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) != 0;
   pd->ctx_mode = CTX_data_mode_enum_ex(
   draw_ctx->object_edit, draw_ctx->obact, draw_ctx->object_mode);
 
   if (!pd->hide_overlays) {
-overlay = v3d->overlay;
-v3d_flag = v3d->flag;
-v3d_gridflag = v3d->gridflag;
+pd->overlay = v3d->overlay;
+pd->v3d_flag = v3d->flag;
+pd->v3d_gridflag = v3d->gridflag;
   }
   else {
-memset(, 0, sizeof(overlay));
-v3d_flag = 0;
-v3d_gridflag = 0;
-overlay.flag = V3D_OVERLAY_HIDE_TEXT | V3D_OVERLAY_HIDE_MOTION_PATHS | 
V3D_OVERLAY_HIDE_BONES |
-   V3D_OVERLAY_HIDE_OBJECT_XTRAS | 
V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
+memset(>overlay, 0, sizeof(pd->overlay));
+pd->v3d_flag = 0;
+pd->v3d_gridflag = 0;
+pd->overlay.flag = V3D_OVERLAY_HIDE_TEXT | V3D_OVERLAY_HIDE_MOTION_PATHS |
+   V3D_OVERLAY_HIDE_BONES | V3D_OVERLAY_HIDE_OBJECT_XTRAS |
+   V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
   }
 
   if (v3d->shading.type == OB_WIRE) {
-overlay.flag |= V3D_OVERLAY_WIREFRAMES;
-  }
-
-  /* Check if anything changed, and if so, reset AA. */
-  if (v3d_flag != pd->v3d_flag || pd->v3d_gridflag != v3d_gridflag ||
-  memcmp(>overlay, , sizeof(overlay))) {
-pd->overlay = overlay;
-pd->v3d_flag = v3d_flag;
-pd->v3d_gridflag = v3d_gridflag;
-OVERLAY_antialiasing_reset(vedata);
+

[Bf-blender-cvs] [e203f69bc3e] master: Fix macOS bundling error with latest release, increase DMG disk space a little

2019-12-04 Thread Brecht Van Lommel
Commit: e203f69bc3eb0c3c77820d54821c2e71469f36d1
Author: Brecht Van Lommel
Date:   Wed Dec 4 16:27:16 2019 +0100
Branches: master
https://developer.blender.org/rBe203f69bc3eb0c3c77820d54821c2e71469f36d1

Fix macOS bundling error with latest release, increase DMG disk space a little

Also adds more verbose output when notarization fails.

===

M   release/darwin/bundle.sh

===

diff --git a/release/darwin/bundle.sh b/release/darwin/bundle.sh
index 91ce4f61d37..d1ef7a180e3 100755
--- a/release/darwin/bundle.sh
+++ b/release/darwin/bundle.sh
@@ -99,7 +99,7 @@ echo
 
 # Create the disk image.
 _directory_size=$(du -sh ${_tmp_dir} | awk -F'[^0-9]*' '$0=$1')
-_image_size=$(echo "${_directory_size}" + 200 | bc) # extra 200 need for 
codesign to work (why on earth?)
+_image_size=$(echo "${_directory_size}" + 400 | bc) # extra 400 need for 
codesign to work (why on earth?)
 
 echo
 echo -n "Creating disk image of size ${_image_size}M.."
@@ -174,10 +174,10 @@ rm "${_tmp_dmg}"
 # Notarize
 if [ ! -z "${N_USERNAME}" ] && [ ! -z "${N_PASSWORD}" ] && [ ! -z 
"${N_BUNDLE_ID}" ]; then
 # Send to Apple
-echo -n "Sending ${DEST_DMG} for notarization..."
+echo "Sending ${DEST_DMG} for notarization..."
 _tmpout=$(mktemp)
-echo xcrun altool --notarize-app -f "${DEST_DMG}" --primary-bundle-id 
"${N_BUNDLE_ID}" --username "${N_USERNAME}" --password "${N_PASSWORD}"
-xcrun altool --notarize-app -f "${DEST_DMG}" --primary-bundle-id 
"${N_BUNDLE_ID}" --username "${N_USERNAME}" --password "${N_PASSWORD}" 
>${_tmpout} 2>&1
+echo xcrun altool --notarize-app --verbose -f "${DEST_DMG}" 
--primary-bundle-id "${N_BUNDLE_ID}" --username "${N_USERNAME}" --password 
"${N_PASSWORD}"
+xcrun altool --notarize-app --verbose -f "${DEST_DMG}" --primary-bundle-id 
"${N_BUNDLE_ID}" --username "${N_USERNAME}" --password "${N_PASSWORD}" 
>${_tmpout} 2>&1
 
 # Parse request uuid
 _requuid=$(cat "${_tmpout}" | grep "RequestUUID" | awk '{ print $3 }')
@@ -202,6 +202,7 @@ if [ ! -z "${N_USERNAME}" ] && [ ! -z "${N_PASSWORD}" ] && 
[ ! -z "${N_BUNDLE_ID
 echo "Notarization in progress, waiting..."
 done
 else
+cat ${_tmpout}
 echo "Error getting RequestUUID, notarization unsuccessful"
 fi
 else

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


[Bf-blender-cvs] [8b308479520] master: Fix T72076: Edit mode circle selection inconsistency with animation

2019-12-04 Thread mano-wii
Commit: 8b30847952080ebc2d36d347de2e6a1f814959f8
Author: mano-wii
Date:   Wed Dec 4 15:07:09 2019 -0300
Branches: master
https://developer.blender.org/rB8b30847952080ebc2d36d347de2e6a1f814959f8

Fix T72076: Edit mode circle selection inconsistency with animation

The solution is to check for updates on `data->recalc`.

===

M   source/blender/draw/engines/select/select_engine.c

===

diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index f6e54eef4ed..23399056582 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -223,6 +223,19 @@ static void select_cache_init(void *vedata)
   /* Check if the viewport has changed. */
   float(*persmat)[4] = draw_ctx->rv3d->persmat;
   e_data.context.is_dirty = !compare_m4m4(e_data.context.persmat, persmat, 
FLT_EPSILON);
+
+  if (!e_data.context.is_dirty) {
+/* Check if any of the drawn objects have been transformed. */
+Object **ob = _data.context.objects_drawn[0];
+for (uint i = e_data.context.objects_drawn_len; i--; ob++) {
+  DrawData *data = DRW_drawdata_get(&(*ob)->id, _engine_select_type);
+  if (data && (data->recalc & ID_RECALC_TRANSFORM) != 0) {
+data->recalc &= ~ID_RECALC_TRANSFORM;
+e_data.context.is_dirty = true;
+  }
+}
+  }
+
   if (e_data.context.is_dirty) {
 /* Remove all tags from drawn or culled objects. */
 copy_m4_m4(e_data.context.persmat, persmat);
@@ -280,6 +293,7 @@ static void select_cache_populate(void *vedata, Object *ob)
   sel_data = (SELECTID_ObjectData *)DRW_drawdata_ensure(
   >id, _engine_select_type, sizeof(SELECTID_ObjectData), 
NULL, NULL);
 }
+sel_data->dd.recalc = 0;
 sel_data->drawn_index = e_data.context.objects_drawn_len;
 sel_data->is_drawn = true;

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


[Bf-blender-cvs] [d5ec476e365] functions: simplify influence generation from xnodes

2019-12-04 Thread Jacques Lucke
Commit: d5ec476e36531fced66eda3dde89cbdd6ab729fe
Author: Jacques Lucke
Date:   Wed Dec 4 16:42:04 2019 +0100
Branches: functions
https://developer.blender.org/rBd5ec476e36531fced66eda3dde89cbdd6ab729fe

simplify influence generation from xnodes

===

M   source/blender/simulations/bparticles/integrator.cpp
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/simulations/bparticles/integrator.cpp 
b/source/blender/simulations/bparticles/integrator.cpp
index ad8543932c5..b479c3f7cac 100644
--- a/source/blender/simulations/bparticles/integrator.cpp
+++ b/source/blender/simulations/bparticles/integrator.cpp
@@ -37,9 +37,6 @@ EulerIntegrator::EulerIntegrator(ArrayRef forces) : 
m_forces(forces)
 
 EulerIntegrator::~EulerIntegrator()
 {
-  for (Force *force : m_forces) {
-delete force;
-  }
 }
 
 const AttributesInfo ::offset_attributes_info()
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp 
b/source/blender/simulations/bparticles/node_frontend.cpp
index 6f75fa56df2..021026d9717 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -481,42 +481,145 @@ BLI_LAZY_INIT(StringMap, 
get_action_parsers)
   return map;
 }
 
-using ParseNodeCallback = std::function;
-
-static void PARSE_point_emitter(InfluencesCollector ,
-InlinedTreeData _tree_data,
-WorldTransition _transition,
-const XNode )
+class XNodeInfluencesBuilder {
+ private:
+  InfluencesCollector _influences_collector;
+  InlinedTreeData _inlined_tree_data;
+  WorldTransition _world_transition;
+  const XNode _xnode;
+
+ public:
+  XNodeInfluencesBuilder(InfluencesCollector _collector,
+ InlinedTreeData _tree_data,
+ WorldTransition _transition,
+ const XNode )
+  : m_influences_collector(influences_collector),
+m_inlined_tree_data(inlined_tree_data),
+m_world_transition(world_transition),
+m_xnode(xnode)
+  {
+  }
+
+  Optional compute_all_data_inputs()
+  {
+return m_inlined_tree_data.compute_all_data_inputs(m_xnode);
+  }
+
+  Optional compute_inputs(ArrayRef input_indices)
+  {
+return m_inlined_tree_data.compute_inputs(m_xnode, input_indices);
+  }
+
+  Action _action_list(StringRef name)
+  {
+return m_inlined_tree_data.build_action_list(m_influences_collector, 
m_xnode, name);
+  }
+
+  ArrayRef find_target_system_names(uint output_index, StringRef 
expected_name)
+  {
+return m_inlined_tree_data.find_target_system_names(
+m_xnode.output(output_index, expected_name));
+  }
+
+  WorldTransition _transition()
+  {
+return m_world_transition;
+  }
+
+  template T (Args &&... args)
+  {
+return m_inlined_tree_data.construct(__func__, 
std::forward(args)...);
+  }
+
+  void add_emitter(Emitter )
+  {
+m_influences_collector.m_emitters.append();
+  }
+
+  void add_force(ArrayRef system_names, Force )
+  {
+for (StringRef system_name : system_names) {
+  m_influences_collector.m_forces.add(system_name, );
+}
+  }
+
+  void add_event(ArrayRef system_names, Event )
+  {
+for (StringRef system_name : system_names) {
+  m_influences_collector.m_events.add(system_name, );
+}
+  }
+
+  void add_offset_handler(ArrayRef system_names, OffsetHandler 
_handler)
+  {
+for (StringRef system_name : system_names) {
+  m_influences_collector.m_offset_handlers.add(system_name, 
_handler);
+}
+  }
+
+  std::string node_identifier()
+  {
+/* TODO: mix parent names into the identifier */
+return m_xnode.name();
+  }
+
+  IDHandleLookup _handle_lookup()
+  {
+return m_inlined_tree_data.id_handle_lookup();
+  }
+
+  PointerRNA *node_rna()
+  {
+return m_xnode.rna();
+  }
+
+  ParticleFunction *particle_function_for_all_inputs()
+  {
+return m_inlined_tree_data.particle_function_for_all_inputs(m_xnode);
+  }
+
+  template
+  void add_attribute(ArrayRef system_names, StringRef 
attribute_name, T default_value)
+  {
+for (StringRef system_name : system_names) {
+  m_influences_collector.m_attributes.lookup(system_name)
+  ->add(attribute_name, default_value);
+}
+  }
+};
+
+using ParseNodeCallback = std::function;
+
+static void PARSE_point_emitter(XNodeInfluencesBuilder )
 {
-  Optional inputs = 
inlined_tree_data.compute_all_data_inputs(xnode);
+  Optional inputs = builder.compute_all_data_inputs();
   if (!inputs.has_value()) {
 return;
   }
 
-  Action  = inlined_tree_data.build_action_list(collector, xnode, 
"Execute on Birth");
+  Action  = builder.build_action_list("Execute on Birth");
 
-  ArrayRef system_names = 
inlined_tree_data.find_target_system_names(
-  xnode.output(0, 

[Bf-blender-cvs] [f101aa6c4bc] functions: fix naming after recent refactor

2019-12-04 Thread Jacques Lucke
Commit: f101aa6c4bc6981f8f343a33502cad263b1b5314
Author: Jacques Lucke
Date:   Wed Dec 4 15:32:30 2019 +0100
Branches: functions
https://developer.blender.org/rBf101aa6c4bc6981f8f343a33502cad263b1b5314

fix naming after recent refactor

===

M   source/blender/functions/FN_inlined_tree_multi_function_network.h
M   
source/blender/functions/FN_inlined_tree_multi_function_network_generation.h
M   
source/blender/functions/intern/inlined_tree_multi_function_network/builder.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/builder.h
M   
source/blender/functions/intern/inlined_tree_multi_function_network/generate.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings.h
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/functions/FN_inlined_tree_multi_function_network.h 
b/source/blender/functions/FN_inlined_tree_multi_function_network.h
index 80a86127a66..34bb9e23c44 100644
--- a/source/blender/functions/FN_inlined_tree_multi_function_network.h
+++ b/source/blender/functions/FN_inlined_tree_multi_function_network.h
@@ -16,10 +16,10 @@ using BKE::XOutputSocket;
 using BKE::XSocket;
 using BLI::MultiMap;
 
-#define VTreeMFSocketMap_UNMAPPED UINT_MAX
-#define VTreeMFSocketMap_MULTIMAPPED (UINT_MAX - 1)
+#define InlinedTreeMFSocketMap_UNMAPPED UINT_MAX
+#define InlinedTreeMFSocketMap_MULTIMAPPED (UINT_MAX - 1)
 
-class VTreeMFSocketMap {
+class InlinedTreeMFSocketMap {
  private:
   /* An input xsocket can be mapped to multiple sockets.
* An output xsocket can be mapped to at most one socket.
@@ -31,11 +31,11 @@ class VTreeMFSocketMap {
   Array m_xsocket_by_socket;
 
  public:
-  VTreeMFSocketMap(const InlinedNodeTree _tree,
-   const MFNetwork ,
-   Array single_socket_by_xsocket,
-   MultiMap multiple_inputs_by_xsocket,
-   Array xsocket_by_socket)
+  InlinedTreeMFSocketMap(const InlinedNodeTree _tree,
+ const MFNetwork ,
+ Array single_socket_by_xsocket,
+ MultiMap multiple_inputs_by_xsocket,
+ Array xsocket_by_socket)
   : m_inlined_tree(_tree),
 m_network(),
 m_single_socket_by_xsocket(std::move(single_socket_by_xsocket)),
@@ -46,12 +46,12 @@ class VTreeMFSocketMap {
 
   bool is_mapped(const XSocket ) const
   {
-return m_single_socket_by_xsocket[xsocket.id()] < 
VTreeMFSocketMap_MULTIMAPPED;
+return m_single_socket_by_xsocket[xsocket.id()] < 
InlinedTreeMFSocketMap_MULTIMAPPED;
   }
 
   bool is_mapped(const MFSocket ) const
   {
-return m_xsocket_by_socket[socket.id()] != VTreeMFSocketMap_UNMAPPED;
+return m_xsocket_by_socket[socket.id()] != InlinedTreeMFSocketMap_UNMAPPED;
   }
 
   const MFInputSocket _singly_mapped_input_socket(const XInputSocket 
) const
@@ -66,10 +66,10 @@ class VTreeMFSocketMap {
 uint id = xsocket.id();
 uint mapped_value = m_single_socket_by_xsocket[id];
 switch (mapped_value) {
-  case VTreeMFSocketMap_UNMAPPED: {
+  case InlinedTreeMFSocketMap_UNMAPPED: {
 return {};
   }
-  case VTreeMFSocketMap_MULTIMAPPED: {
+  case InlinedTreeMFSocketMap_MULTIMAPPED: {
 Vector sockets;
 for (uint mapped_id : m_multiple_inputs_by_xsocket.lookup(id)) {
   sockets.append(_network->socket_by_id(mapped_id).as_input());
@@ -103,16 +103,16 @@ class VTreeMFSocketMap {
   }
 };
 
-class VTreeMFNetwork {
+class InlinedTreeMFNetwork {
  private:
   const InlinedNodeTree _inlined_tree;
   std::unique_ptr m_network;
-  VTreeMFSocketMap m_socket_map;
+  InlinedTreeMFSocketMap m_socket_map;
 
  public:
-  VTreeMFNetwork(const InlinedNodeTree _tree,
- std::unique_ptr network,
- VTreeMFSocketMap socket_map)
+  InlinedTreeMFNetwork(const InlinedNodeTree _tree,
+   std::unique_ptr network,
+   InlinedTreeMFSocketMap socket_map)
   : m_inlined_tree(inlined_tree),
 m_network(std::move(network)),
 m_socket_map(std::move(socket_map))
diff --git 
a/source/blender/functions/FN_inlined_tree_multi_function_network_generation.h 
b/source/blender/functions/FN_inlined_tree_multi_function_network_generation.h
index 459b0960e3f..1c9f612719b 100644
--- 
a/source/blender/functions/FN_inlined_tree_multi_function_network_generation.h
+++ 
b/source/blender/functions/FN_inlined_tree_multi_function_network_generation.h
@@ -9,7 +9,7 @@ namespace FN {
 
 using BLI::ResourceCollector;
 
-std::unique_ptr 

[Bf-blender-cvs] [985e3e8ddc1] functions: simplify action building code

2019-12-04 Thread Jacques Lucke
Commit: 985e3e8ddc1fdfc209b17abba9053d124a745d6c
Author: Jacques Lucke
Date:   Wed Dec 4 16:03:15 2019 +0100
Branches: functions
https://developer.blender.org/rB985e3e8ddc1fdfc209b17abba9053d124a745d6c

simplify action building code

===

M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/simulations/bparticles/node_frontend.cpp 
b/source/blender/simulations/bparticles/node_frontend.cpp
index 74cfcdb1819..6f75fa56df2 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -50,11 +50,9 @@ static StringRef combine_influences_idname = 
"fn_CombineInfluencesNode";
 
 class InlinedTreeData;
 class InfluencesCollector;
+class XSocketActionBuilder;
 
-using ActionParserCallback =
-std::function(InfluencesCollector ,
-  InlinedTreeData _tree_data,
-  const XSocket _xsocket)>;
+using ActionParserCallback = std::function;
 StringMap _action_parsers();
 
 class InfluencesCollector {
@@ -194,27 +192,7 @@ class InlinedTreeData {
 return system_names;
   }
 
-  Action *build_action(InfluencesCollector , const XInputSocket 
)
-  {
-if (start.linked_sockets().size() != 1) {
-  return nullptr;
-}
-
-const XSocket _socket = *start.linked_sockets()[0];
-if (execute_socket.idname() != "fn_ExecuteSocket") {
-  return nullptr;
-}
-
-StringMap  = get_action_parsers();
-ActionParserCallback  = 
parsers.lookup(execute_socket.node().idname());
-std::unique_ptr action = parser(collector, *this, execute_socket);
-Action *action_ptr = action.get();
-if (action_ptr == nullptr) {
-  return nullptr;
-}
-m_resources.add(std::move(action), __func__);
-return action_ptr;
-  }
+  Action *build_action(InfluencesCollector , const XInputSocket 
);
 
   Action _action_list(InfluencesCollector ,
 const XNode _xnode,
@@ -293,155 +271,199 @@ class InlinedTreeData {
 UNUSED_VARS_NDEBUG(found_name);
 return execute_sockets;
   }
-};
+};  // namespace BParticles
 
-static std::unique_ptr ACTION_kill(InfluencesCollector 
(collector),
-   InlinedTreeData 
(inlined_tree_data),
-   const XSocket 
(execute_xsocket))
-{
-  return std::unique_ptr(new KillAction());
-}
+class XSocketActionBuilder {
+ private:
+  InfluencesCollector _influences_collector;
+  InlinedTreeData _inlined_tree_data;
+  const XSocket _execute_xsocket;
+  Action *m_built_action = nullptr;
 
-static std::unique_ptr ACTION_change_velocity(InfluencesCollector 
(collector),
-  InlinedTreeData 
_tree_data,
-  const XSocket 
_xsocket)
-{
-  const XNode  = execute_xsocket.node();
-  ParticleFunction *inputs_fn = 
inlined_tree_data.particle_function_for_all_inputs(xnode);
+ public:
+  XSocketActionBuilder(InfluencesCollector _collector,
+   InlinedTreeData _tree_data,
+   const XSocket _xsocket)
+  : m_influences_collector(influences_collector),
+m_inlined_tree_data(inlined_tree_data),
+m_execute_xsocket(execute_xsocket)
+  {
+  }
 
-  if (inputs_fn == nullptr) {
-return {};
+  Action *built_action()
+  {
+return m_built_action;
   }
 
-  int mode = RNA_enum_get(xnode.rna(), "mode");
+  template T (Args &&... args)
+  {
+return m_inlined_tree_data.construct("construct action", 
std::forward(args)...);
+  }
+
+  template T _constructed(Args &&... args)
+  {
+BLI_STATIC_ASSERT((std::is_base_of::value), "");
+T  = this->construct(std::forward(args)...);
+m_built_action = 
+return action;
+  }
 
-  Action *action = nullptr;
-  if (mode == 0) {
-action = new SetVelocityAction(inputs_fn);
+  ParticleFunction *particle_function_for_inputs()
+  {
+return 
m_inlined_tree_data.particle_function_for_all_inputs(m_execute_xsocket.node());
   }
-  else if (mode == 1) {
-action = new RandomizeVelocityAction(inputs_fn);
+
+  PointerRNA *node_rna()
+  {
+return m_execute_xsocket.node().rna();
   }
 
-  return std::unique_ptr(action);
-}
+  Action _input_action_list(StringRef name)
+  {
+return m_inlined_tree_data.build_action_list(
+m_influences_collector, m_execute_xsocket.node(), name);
+  }
+
+  ArrayRef find_system_target_names(uint output_index, StringRef 
expected_name)
+  {
+const XOutputSocket  = 
m_execute_xsocket.node().output(output_index, expected_name);
+return m_inlined_tree_data.find_target_system_names(xsocket);
+  }
+
+  Optional compute_all_data_inputs()
+  {
+return 
m_inlined_tree_data.compute_all_data_inputs(m_execute_xsocket.node());
+  }
+
+  

[Bf-blender-cvs] [c44fdcfab2d] functions: fix node identifier when node is in a group

2019-12-04 Thread Jacques Lucke
Commit: c44fdcfab2dbeb00e116c94bf3d2c38fe1179a13
Author: Jacques Lucke
Date:   Wed Dec 4 17:10:31 2019 +0100
Branches: functions
https://developer.blender.org/rBc44fdcfab2dbeb00e116c94bf3d2c38fe1179a13

fix node identifier when node is in a group

===

M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/simulations/bparticles/node_frontend.cpp 
b/source/blender/simulations/bparticles/node_frontend.cpp
index 021026d9717..20cfce2d073 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -559,8 +559,14 @@ class XNodeInfluencesBuilder {
 
   std::string node_identifier()
   {
-/* TODO: mix parent names into the identifier */
-return m_xnode.name();
+std::stringstream ss;
+for (const BKE::XParentNode *parent = m_xnode.parent(); parent; parent = 
parent->parent()) {
+  ss << "/" << parent->vnode().name();
+}
+ss << "/" << m_xnode.name();
+
+std::string identifier = ss.str();
+return identifier;
   }
 
   IDHandleLookup _handle_lookup()

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


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

2019-12-04 Thread Antonio Vazquez
Commit: f2985489c2dd723c23320d4429718eb3d66f0246
Author: Antonio Vazquez
Date:   Wed Dec 4 16:08:32 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf2985489c2dd723c23320d4429718eb3d66f0246

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] [7868db9343d] master: Make curve decimation only take into account the selected curve points

2019-12-04 Thread Sebastian Parborg
Commit: 7868db9343d577784aa754418f2b888793a01d25
Author: Sebastian Parborg
Date:   Wed Dec 4 16:00:03 2019 +0100
Branches: master
https://developer.blender.org/rB7868db9343d577784aa754418f2b888793a01d25

Make curve decimation only take into account the selected curve points

Previously the decimation would take the whole curve into account when
decimating and not just the selected part.

This also contains various smaller bug fixes for the fcurve decimation.

Reviewed By: Sybren

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

===

M   release/scripts/startup/bl_ui/space_graph.py
M   source/blender/blenkernel/intern/curve_decimate.c
M   source/blender/editors/animation/keyframes_general.c
M   source/blender/editors/include/ED_keyframes_edit.h
M   source/blender/editors/include/UI_view2d.h
M   source/blender/editors/interface/interface_region_hud.c
M   source/blender/editors/interface/view2d.c
M   source/blender/editors/screen/area.c
M   source/blender/editors/space_graph/graph_edit.c
M   source/blender/editors/space_graph/space_graph.c
M   source/blender/makesdna/DNA_screen_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_graph.py 
b/release/scripts/startup/bl_ui/space_graph.py
index 188741956ab..752e1741984 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -113,6 +113,7 @@ class GRAPH_MT_view(Menu):
 st = context.space_data
 
 layout.prop(st, "show_region_ui")
+layout.prop(st, "show_region_hud")
 layout.separator()
 
 layout.prop(st, "use_realtime_update")
@@ -290,7 +291,14 @@ class GRAPH_MT_key(Menu):
 layout.operator_menu_enum("graph.easing_type", "type", text="Easing 
Type")
 
 layout.separator()
-layout.operator("graph.decimate")
+operator_context = layout.operator_context
+
+layout.operator("graph.decimate", text="Decimate (Ratio)").mode = 
'RATIO'
+# Using the modal operation doesn't make sense for this variant as we 
do not have a modal mode for it, so just execute it.
+layout.operator_context = 'EXEC_DEFAULT'
+layout.operator("graph.decimate", text="Decimate (Allowed 
Change)").mode = 'ERROR'
+layout.operator_context = operator_context
+
 layout.operator("graph.clean").channels = False
 layout.operator("graph.clean", text="Clean Channels").channels = True
 layout.operator("graph.smooth")
diff --git a/source/blender/blenkernel/intern/curve_decimate.c 
b/source/blender/blenkernel/intern/curve_decimate.c
index cccdf830854..d569684d55c 100644
--- a/source/blender/blenkernel/intern/curve_decimate.c
+++ b/source/blender/blenkernel/intern/curve_decimate.c
@@ -269,11 +269,11 @@ uint BKE_curve_decimate_bezt_array(BezTriple *bezt_array,
 if (a == HD_VECT) { \
   a = HD_FREE; \
 } \
-else if (a == HD_AUTO) { \
+else if (a == HD_AUTO || a == HD_AUTO_ANIM) { \
   a = HD_ALIGN; \
 } \
 /* opposite handle */ \
-if (b == HD_AUTO) { \
+if (b == HD_AUTO || b == HD_AUTO_ANIM) { \
   b = HD_ALIGN; \
 } \
   } \
diff --git a/source/blender/editors/animation/keyframes_general.c 
b/source/blender/editors/animation/keyframes_general.c
index ffae402989c..ed5cb65c42e 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -328,34 +328,135 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem 
*ale, float thresh, boo
 
 /*  */
 
+/* Check if the keyframe interpolation type is supported */
+static bool prepare_for_decimate(FCurve *fcu, int i)
+{
+  switch (fcu->bezt[i].ipo) {
+case BEZT_IPO_BEZ:
+  /* We do not need to do anything here as the keyframe already has the 
required setting.
+   */
+  return true;
+case BEZT_IPO_LIN:
+  /* Convert to a linear bezt curve to be able to use the decimation 
algorithm. */
+  fcu->bezt[i].ipo = BEZT_IPO_BEZ;
+  fcu->bezt[i].h1 = HD_FREE;
+  fcu->bezt[i].h2 = HD_FREE;
+
+  if (i != 0) {
+float h1[3];
+sub_v3_v3v3(h1, fcu->bezt[i - 1].vec[1], fcu->bezt[i].vec[1]);
+mul_v3_fl(h1, 1.0f / 3.0f);
+add_v3_v3(h1, fcu->bezt[i].vec[1]);
+copy_v3_v3(fcu->bezt[i].vec[0], h1);
+  }
+
+  if (i + 1 != fcu->totvert) {
+float h2[3];
+sub_v3_v3v3(h2, fcu->bezt[i + 1].vec[1], fcu->bezt[i].vec[1]);
+mul_v3_fl(h2, 1.0f / 3.0f);
+add_v3_v3(h2, fcu->bezt[i].vec[1]);
+copy_v3_v3(fcu->bezt[i].vec[2], h2);
+  }
+  return true;
+default:
+  /* These are unsupported. */
+  return false;
+  }
+}
+
+/* Decimate the given curve segment. */
+static void decimate_fcurve_segment(FCurve *fcu,
+ 

[Bf-blender-cvs] [824c2659382] master: Fix T72157: Overlay Hide Bone Relationship Lines

2019-12-04 Thread Jeroen Bakker
Commit: 824c2659382b2c76c3e6ec53ca598647af104446
Author: Jeroen Bakker
Date:   Wed Dec 4 08:31:26 2019 +0100
Branches: master
https://developer.blender.org/rB824c2659382b2c76c3e6ec53ca598647af104446

Fix T72157: Overlay Hide Bone Relationship Lines

Bone relationship lines needs to be hidden in:

* object mode
* or when relationship lines are turned off

Reviewed By: fclem

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

===

M   source/blender/draw/engines/overlay/overlay_armature.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_armature.c 
b/source/blender/draw/engines/overlay/overlay_armature.c
index a45397e9d81..23cdfdb89ad 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -147,9 +147,11 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
   OVERLAY_PrivateData *pd = vedata->stl->pd;
 
   const DRWContextState *draw_ctx = DRW_context_state_get();
+  const bool is_select_mode = DRW_state_is_select();
   pd->armature.transparent = (draw_ctx->v3d->shading.type == OB_WIRE) ||
  XRAY_FLAG_ENABLED(draw_ctx->v3d);
-  pd->armature.show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 
0);
+  pd->armature.show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 
0) &&
+!is_select_mode;
   pd->armature.do_pose_fade_geom = (pd->overlay.flag & 
V3D_OVERLAY_BONE_SELECT) &&
((draw_ctx->object_mode & 
OB_MODE_WEIGHT_PAINT) == 0) &&
draw_ctx->object_pose != NULL;
@@ -2159,6 +2161,7 @@ static void armature_context_setup(ArmatureDrawContext 
*ctx,
OVERLAY_PrivateData *pd,
Object *ob,
const bool do_envelope_dist,
+   const bool is_edit_mode,
const bool is_pose_mode,
float *const_color)
 {
@@ -2203,6 +2206,8 @@ static void armature_context_setup(ArmatureDrawContext 
*ctx,
   ctx->custom_shapes_ghash = cb->custom_shapes_ghash;
   ctx->transparent = pd->armature.transparent;
   ctx->show_relations = pd->armature.show_relations;
+  ctx->do_relations = !DRW_state_is_select() && pd->armature.show_relations &&
+  (is_edit_mode | is_pose_mode);
   ctx->const_color = DRW_state_is_select() ? select_const_color : const_color;
   ctx->const_wire = (((ob->base_flag & BASE_SELECTED) || (arm->drawtype == 
ARM_WIRE)) ?
  1.5f :
@@ -2235,7 +2240,7 @@ void OVERLAY_edit_armature_cache_populate(OVERLAY_Data 
*vedata, Object *ob)
 {
   OVERLAY_PrivateData *pd = vedata->stl->pd;
   ArmatureDrawContext arm_ctx;
-  armature_context_setup(_ctx, pd, ob, true, false, NULL);
+  armature_context_setup(_ctx, pd, ob, true, true, false, NULL);
   draw_armature_edit(_ctx);
 }
 
@@ -2243,7 +2248,7 @@ void OVERLAY_pose_armature_cache_populate(OVERLAY_Data 
*vedata, Object *ob)
 {
   OVERLAY_PrivateData *pd = vedata->stl->pd;
   ArmatureDrawContext arm_ctx;
-  armature_context_setup(_ctx, pd, ob, true, true, NULL);
+  armature_context_setup(_ctx, pd, ob, true, false, true, NULL);
   draw_armature_pose(_ctx);
 }
 
@@ -2254,7 +2259,7 @@ void OVERLAY_armature_cache_populate(OVERLAY_Data 
*vedata, Object *ob)
   ArmatureDrawContext arm_ctx;
   float *color;
   DRW_object_wire_theme_get(ob, draw_ctx->view_layer, );
-  armature_context_setup(_ctx, pd, ob, false, false, color);
+  armature_context_setup(_ctx, pd, ob, false, false, false, color);
   draw_armature_pose(_ctx);
 }

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


[Bf-blender-cvs] [9c337fcfe2a] master: Fix T72130: Wireframe Visible After Disabling

2019-12-04 Thread Jeroen Bakker
Commit: 9c337fcfe2a46b2ccfb8a4960b7af0eac5c615de
Author: Jeroen Bakker
Date:   Tue Dec 3 08:27:55 2019 +0100
Branches: master
https://developer.blender.org/rB9c337fcfe2a46b2ccfb8a4960b7af0eac5c615de

Fix T72130: Wireframe Visible After Disabling

The lines index buffer can contain all edges (edit mode) or only loose
edges (object mode). When switching between these modes the wrong
content of the index buffer can be used.

This patch will clear the lines index buffer when a `loose_edges` is requested. 
Making sure it is always up to date.

Note that this is supporting an exising hack where the IBO is truncated
during the creation. We should find a different way how to solve these
kind of issues.

Reviewed By: fclem

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

===

M   source/blender/draw/intern/draw_cache_extract.h
M   source/blender/draw/intern/draw_cache_extract_mesh.c
M   source/blender/draw/intern/draw_cache_impl_mesh.c
M   source/blender/draw/intern/draw_cache_inline.h
M   source/blender/gpu/GPU_element.h
M   source/blender/gpu/intern/gpu_element.c

===

diff --git a/source/blender/draw/intern/draw_cache_extract.h 
b/source/blender/draw/intern/draw_cache_extract.h
index b1eab3c73ae..7ee02c3c556 100644
--- a/source/blender/draw/intern/draw_cache_extract.h
+++ b/source/blender/draw/intern/draw_cache_extract.h
@@ -115,8 +115,9 @@ typedef struct MeshBufferCache {
* Only need to be updated when topology changes. */
   struct {
 /* Indices to vloops. */
-GPUIndexBuf *tris;  /* Ordered per material. */
-GPUIndexBuf *lines; /* Loose edges last. */
+GPUIndexBuf *tris;/* Ordered per material. */
+GPUIndexBuf *lines;   /* Loose edges last. */
+GPUIndexBuf *lines_loose; /* sub buffer of `lines` only containing the 
loose edges. */
 GPUIndexBuf *points;
 GPUIndexBuf *fdots;
 /* 3D overlays. */
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c 
b/source/blender/draw/intern/draw_cache_extract_mesh.c
index 2c6eb7e0b1d..06c2bfc301a 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -634,21 +634,10 @@ static void extract_lines_ledge_mesh(const MeshRenderData 
*mr,
   GPU_indexbuf_set_line_restart(elb, edge_idx);
 }
 
-static void extract_lines_finish(const MeshRenderData *mr, void *ibo, void 
*elb)
+static void extract_lines_finish(const MeshRenderData *UNUSED(mr), void *ibo, 
void *elb)
 {
   GPU_indexbuf_build_in_place(elb, ibo);
   MEM_freeN(elb);
-  /* HACK Create ibo subranges and assign them to GPUBatch. */
-  if (mr->use_final_mesh && mr->cache->batch.loose_edges) {
-BLI_assert(mr->cache->batch.loose_edges->elem == ibo);
-/* Multiply by 2 because these are edges indices. */
-int start = mr->edge_len * 2;
-int len = mr->edge_loose_len * 2;
-GPUIndexBuf *sub_ibo = GPU_indexbuf_create_subrange(ibo, start, len);
-/* WARNING: We modify the GPUBatch here! */
-GPU_batch_elembuf_set(mr->cache->batch.loose_edges, sub_ibo, true);
-mr->cache->no_loose_wire = (len == 0);
-  }
 }
 
 static const MeshExtract extract_lines = {
@@ -668,6 +657,56 @@ static const MeshExtract extract_lines = {
 
 /** \} */
 
+/* -- */
+/** \name Extract Loose Edges Indices
+ * \{ */
+
+static void *extract_lines_loose_init(const MeshRenderData *UNUSED(mr), void 
*UNUSED(buf))
+{
+  return NULL;
+}
+
+static void extract_lines_loose_ledge_mesh(const MeshRenderData *UNUSED(mr),
+   int UNUSED(e),
+   const MEdge *UNUSED(medge),
+   void *UNUSED(elb))
+{
+  /* This function is intentionally empty. The existence of this functions 
ensures that
+   * `iter_type` `MR_ITER_LVERT` is set when initializing the `MeshRenderData` 
(See
+   * `mesh_extract_iter_type`). This flag ensures that `mr->edge_loose_len` 
field is filled. This
+   * field we use in the `extract_lines_loose_finish` function to create a 
subrange from the
+   * `ibo.lines`. */
+}
+
+static void extract_lines_loose_finish(const MeshRenderData *mr,
+   void *UNUSED(ibo),
+   void *UNUSED(elb))
+{
+  /* Multiply by 2 because these are edges indices. */
+  const int start = mr->edge_len * 2;
+  const int len = mr->edge_loose_len * 2;
+  GPU_indexbuf_create_subrange_in_place(
+  mr->cache->final.ibo.lines_loose, mr->cache->final.ibo.lines, start, 
len);
+  mr->cache->no_loose_wire = (len == 0);
+}
+
+static const MeshExtract extract_lines_loose = {
+extract_lines_loose_init,
+NULL,
+NULL,
+NULL,
+NULL,
+NULL,
+extract_lines_loose_ledge_mesh,
+NULL,
+NULL,
+

[Bf-blender-cvs] [186d74020e5] master: Fix T72156: Render Viewport Animation Meta Data

2019-12-04 Thread Jeroen Bakker
Commit: 186d74020e50f894982fb678434716dc2646171b
Author: Jeroen Bakker
Date:   Wed Dec 4 15:02:31 2019 +0100
Branches: master
https://developer.blender.org/rB186d74020e50f894982fb678434716dc2646171b

Fix T72156: Render Viewport Animation Meta Data

When using Render Viewport Animation the meta data
was only stamped when a float buffer was used. In recent changes it was
possible to use a char buffer for the result.

This commit will also support stamping of metadata using a char buffer.

===

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

===

diff --git a/source/blender/editors/render/render_opengl.c 
b/source/blender/editors/render/render_opengl.c
index 0d0e183e480..ad5f8ba6834 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -286,6 +286,7 @@ static void screen_opengl_render_doit(const bContext *C, 
OGLRender *oglrender, R
   const short view_context = (v3d != NULL);
   bool draw_sky = (scene->r.alphamode == R_ADDSKY);
   float *rectf = NULL;
+  unsigned char *rect = NULL;
   const char *viewname = RE_GetActiveRenderView(oglrender->re);
   ImBuf *ibuf_result = NULL;
 
@@ -400,7 +401,12 @@ static void screen_opengl_render_doit(const bContext *C, 
OGLRender *oglrender, R
 
 if (ibuf_view) {
   ibuf_result = ibuf_view;
-  rectf = (float *)ibuf_view->rect_float;
+  if (ibuf_view->rect_float) {
+rectf = ibuf_view->rect_float;
+  }
+  else {
+rect = (unsigned char *)ibuf_view->rect;
+  }
 }
 else {
   fprintf(stderr, "%s: failed to get buffer, %s\n", __func__, err_out);
@@ -409,7 +415,7 @@ static void screen_opengl_render_doit(const bContext *C, 
OGLRender *oglrender, R
 
   if (ibuf_result != NULL) {
 if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) {
-  BKE_image_stamp_buf(scene, camera, NULL, NULL, rectf, rr->rectx, 
rr->recty, 4);
+  BKE_image_stamp_buf(scene, camera, NULL, rect, rectf, rr->rectx, 
rr->recty, 4);
 }
 RE_render_result_rect_from_ibuf(rr, >r, ibuf_result, 
oglrender->view_id);
 IMB_freeImBuf(ibuf_result);

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


[Bf-blender-cvs] [ee58e62f23b] functions: rename Surface Location to Surface Hook

2019-12-04 Thread Jacques Lucke
Commit: ee58e62f23b6ca4dea33618de3b5e00bbd103f99
Author: Jacques Lucke
Date:   Wed Dec 4 15:04:10 2019 +0100
Branches: functions
https://developer.blender.org/rBee58e62f23b6ca4dea33618de3b5e00bbd103f99

rename Surface Location to Surface Hook

===

M   release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
M   release/scripts/startup/nodes/function_nodes/object_mesh.py
M   release/scripts/startup/nodes/sockets.py
M   release/scripts/startup/nodes/types.py
R060source/blender/blenkernel/BKE_surface_location.h
source/blender/blenkernel/BKE_surface_hook.h
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/blenkernel/intern/shrinkwrap.c
R064source/blender/blenkernel/intern/surface_location.cc
source/blender/blenkernel/intern/surface_hook.cc
M   source/blender/functions/intern/cpp_types.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
M   source/blender/functions/intern/multi_functions/mixed.cc
M   source/blender/functions/intern/multi_functions/mixed.h
M   source/blender/simulations/bparticles/emitters.cpp
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py 
b/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
index 576eda9a488..45336819ae5 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
@@ -13,4 +13,4 @@ class ParticleInfoNode(bpy.types.Node, SimulationNode):
 builder.fixed_output("position", "Position", "Vector")
 builder.fixed_output("velocity", "Velocity", "Vector")
 builder.fixed_output("birth_time", "Birth Time", "Float")
-builder.fixed_output("emit_location", "Emit Location", "Surface 
Location")
+builder.fixed_output("emit_location", "Emit Hook", "Surface Hook")
diff --git a/release/scripts/startup/nodes/function_nodes/object_mesh.py 
b/release/scripts/startup/nodes/function_nodes/object_mesh.py
index 5b18ff87c0a..358181e656a 100644
--- a/release/scripts/startup/nodes/function_nodes/object_mesh.py
+++ b/release/scripts/startup/nodes/function_nodes/object_mesh.py
@@ -27,7 +27,7 @@ class ClosestLocationOnObjectNode(bpy.types.Node, 
FunctionNode):
 def declaration(self, builder):
 builder.fixed_input("object", "Object", "Object")
 builder.fixed_input("position", "Position", "Vector")
-builder.fixed_output("closest_point", "Closest Location", "Surface 
Location")
+builder.fixed_output("closest_hook", "Closest Hook", "Surface Hook")
 
 
 class GetPositionOnSurfaceNode(bpy.types.Node, FunctionNode):
@@ -35,7 +35,7 @@ class GetPositionOnSurfaceNode(bpy.types.Node, FunctionNode):
 bl_label = "Get Position on Surface"
 
 def declaration(self, builder):
-builder.fixed_input("location", "Location", "Surface Location")
+builder.fixed_input("surface_hook", "Surface Hook", "Surface Hook")
 builder.fixed_output("position", "Position", "Vector")
 
 
@@ -44,7 +44,7 @@ class GetNormalOnSurfaceNode(bpy.types.Node, FunctionNode):
 bl_label = "Get Normal on Surface"
 
 def declaration(self, builder):
-builder.fixed_input("location", "Location", "Surface Location")
+builder.fixed_input("surface_hook", "Surface Hook", "Surface Hook")
 builder.fixed_output("normal", "Normal", "Vector")
 
 
@@ -58,7 +58,7 @@ class GetWeightOnSurfaceNode(bpy.types.Node, FunctionNode):
 )
 
 def declaration(self, builder):
-builder.fixed_input("location", "Location", "Surface Location")
+builder.fixed_input("surface_hook", "Surface Hook", "Surface Hook")
 builder.fixed_output("weight", "Weight", "Float")
 
 def draw(self, layout):
@@ -75,7 +75,7 @@ class GetImageColorOnSurfaceNode(bpy.types.Node, 
FunctionNode):
 )
 
 def declaration(self, builder: NodeBuilder):
-builder.fixed_input("location", "Location", "Surface Location")
+builder.fixed_input("surface_hook", "Surface Hook", "Surface Hook")
 builder.fixed_output("color", "Color", "Color")
 
 def draw(self, layout):
diff --git a/release/scripts/startup/nodes/sockets.py 
b/release/scripts/startup/nodes/sockets.py
index cae9fa23c61..3e6e06f3553 100644
--- a/release/scripts/startup/nodes/sockets.py
+++ b/release/scripts/startup/nodes/sockets.py
@@ -177,10 +177,10 @@ ColorListSocket = create_simple_data_socket(
 "fn_ColorListSocket", "Color List", (0.8, 0.8, 0.2, 0.5))
 TextListSocket = create_simple_data_socket(
 "fn_TextListSocket", "Text List", (0.8, 0.8, 0.8, 0.5))
-SurfaceLocationSocket = create_simple_data_socket(

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

2019-12-04 Thread Antonio Vazquez
Commit: f3e0287ca87bdfe47d300ccce98f929cc8f1fd86
Author: Antonio Vazquez
Date:   Wed Dec 4 14:35:09 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf3e0287ca87bdfe47d300ccce98f929cc8f1fd86

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] [b50a7272f6d] greasepencil-object: Merge branch 'master' into greasepencil-object

2019-12-04 Thread Antonio Vazquez
Commit: b50a7272f6d9216c35f02110131b55d5d16a8274
Author: Antonio Vazquez
Date:   Wed Dec 4 14:30:08 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb50a7272f6d9216c35f02110131b55d5d16a8274

Merge branch 'master' into greasepencil-object

 Conflicts:
release/scripts/startup/bl_ui/properties_grease_pencil_common.py
release/scripts/startup/bl_ui/space_dopesheet.py
source/blender/blenloader/intern/versioning_defaults.c
source/blender/editors/animation/anim_channels_defines.c

===



===



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


[Bf-blender-cvs] [10ab0d66e81] master: GPencil: Fix error in previous patch

2019-12-04 Thread Antonio Vazquez
Commit: 10ab0d66e8112213884dd750869bba7a77299fe2
Author: Antonio Vazquez
Date:   Wed Dec 4 14:34:44 2019 +0100
Branches: master
https://developer.blender.org/rB10ab0d66e8112213884dd750869bba7a77299fe2

GPencil: Fix error in previous patch

By error, a previous version of the patch was used and there was a small change 
in the order of the columns in dopesheet.

===

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

===

diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index a2b9913ba14..a3d8695d186 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -5069,17 +5069,6 @@ void ANIM_channel_draw_widgets(const bContext *C,
   RNA_id_pointer_create(ale->id, _ptr);
   int icon;
 
-  /* Mask Layer. */
-  UI_block_emboss_set(block, UI_EMBOSS_NONE);
-  prop = RNA_struct_find_property(, "mask_layer");
-  gp_rna_path = RNA_path_from_ID_to_property(, prop);
-  if (RNA_path_resolve_property(_ptr, gp_rna_path, , )) {
-icon = (gpl->flag & GP_LAYER_USE_MASK) ? ICON_MOD_MASK : 
ICON_LAYER_ACTIVE;
-uiDefAutoButR(
-block, , prop, array_index, "", icon, offset, ymid, width, 
channel_height);
-  }
-  MEM_freeN(gp_rna_path);
-
   /* Layer opacity. */
   UI_block_emboss_set(block, UI_EMBOSS);
   prop = RNA_struct_find_property(, "opacity");
@@ -5091,15 +5080,33 @@ void ANIM_channel_draw_widgets(const bContext *C,
   array_index,
   "",
   ICON_NONE,
-  offset + width,
+  offset,
   ymid,
   width * 3,
   channel_height);
   }
   MEM_freeN(gp_rna_path);
 
-  /* Layer onion skinning switch. */
+  /* Mask Layer. */
   UI_block_emboss_set(block, UI_EMBOSS_NONE);
+  prop = RNA_struct_find_property(, "mask_layer");
+  gp_rna_path = RNA_path_from_ID_to_property(, prop);
+  if (RNA_path_resolve_property(_ptr, gp_rna_path, , )) {
+icon = (gpl->flag & GP_LAYER_USE_MASK) ? ICON_MOD_MASK : 
ICON_LAYER_ACTIVE;
+uiDefAutoButR(block,
+  ,
+  prop,
+  array_index,
+  "",
+  icon,
+  offset + (width * 3),
+  ymid,
+  width,
+  channel_height);
+  }
+  MEM_freeN(gp_rna_path);
+
+  /* Layer onion skinning switch. */
   prop = RNA_struct_find_property(, "use_onion_skinning");
   gp_rna_path = RNA_path_from_ID_to_property(, prop);
   if (RNA_path_resolve_property(_ptr, gp_rna_path, , )) {

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


[Bf-blender-cvs] [c6a00f46adc] functions: pass around Object handles instead of pointers

2019-12-04 Thread Jacques Lucke
Commit: c6a00f46adcacc1c494bbffe926c2356fb2a0506
Author: Jacques Lucke
Date:   Wed Dec 4 13:33:49 2019 +0100
Branches: functions
https://developer.blender.org/rBc6a00f46adcacc1c494bbffe926c2356fb2a0506

pass around Object handles instead of pointers

===

M   source/blender/functions/intern/cpp_types.cc
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
M   source/blender/functions/intern/multi_functions/mixed.cc
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/functions/intern/cpp_types.cc 
b/source/blender/functions/intern/cpp_types.cc
index 95f13090e23..3c748db5172 100644
--- a/source/blender/functions/intern/cpp_types.cc
+++ b/source/blender/functions/intern/cpp_types.cc
@@ -1,8 +1,6 @@
 #include "FN_cpp_type.h"
 #include "cpp_types.h"
 
-#include "DNA_object_types.h"
-
 #include "BLI_math_cxx.h"
 
 #include "BKE_surface_location.h"
@@ -96,7 +94,8 @@ MAKE_CPP_TYPE(float, float)
 MAKE_CPP_TYPE(uint32_t, uint32_t)
 MAKE_CPP_TYPE(uint8_t, uint8_t)
 MAKE_CPP_TYPE(bool, bool)
-MAKE_CPP_TYPE(ObjectPtr, Object *)
+MAKE_CPP_TYPE(ObjectIDHandle, BKE::ObjectIDHandle)
+MAKE_CPP_TYPE(ImageIDHandle, BKE::ImageIDHandle)
 MAKE_CPP_TYPE(int32, int32_t)
 MAKE_CPP_TYPE(rgba_f, BLI::rgba_f)
 MAKE_CPP_TYPE(float3, BLI::float3)
diff --git 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
index 8f3d0c6..def570322bb 100644
--- 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
+++ 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_sockets.cc
@@ -47,7 +47,12 @@ static void INSERT_int_socket(VSocketMFNetworkBuilder 
)
 static void INSERT_object_socket(VSocketMFNetworkBuilder )
 {
   Object *value = (Object *)RNA_pointer_get(builder.rna(), "value").data;
-  builder.set_constant_value(value);
+  if (value == nullptr) {
+builder.set_constant_value(BKE::ObjectIDHandle());
+  }
+  else {
+builder.set_constant_value(BKE::ObjectIDHandle(value));
+  }
 }
 
 static void INSERT_text_socket(VSocketMFNetworkBuilder )
@@ -158,7 +163,7 @@ void 
add_inlined_tree_socket_mapping_info(VTreeMultiFunctionMappings )
   add_basic_type(mappings, "Float", INSERT_float_socket);
   add_basic_type(mappings, "Vector", INSERT_vector_socket);
   add_basic_type(mappings, "Integer", INSERT_int_socket);
-  add_basic_type(mappings, "Object", INSERT_object_socket);
+  add_basic_type(mappings, "Object", 
INSERT_object_socket);
   add_basic_type(mappings, "Text", INSERT_text_socket);
   add_basic_type(mappings, "Boolean", INSERT_bool_socket);
   add_basic_type(mappings, "Color", INSERT_color_socket);
diff --git a/source/blender/functions/intern/multi_functions/mixed.cc 
b/source/blender/functions/intern/multi_functions/mixed.cc
index 634e170aa06..afc7835feeb 100644
--- a/source/blender/functions/intern/multi_functions/mixed.cc
+++ b/source/blender/functions/intern/multi_functions/mixed.cc
@@ -248,18 +248,19 @@ void MF_FloatRange::call(MFMask mask, MFParams params, 
MFContext UNUSED(context)
 MF_ObjectVertexPositions::MF_ObjectVertexPositions()
 {
   MFSignatureBuilder signature{"Object Vertex Positions"};
-  signature.single_input("Object");
+  signature.single_input("Object");
   signature.vector_output("Positions");
   this->set_signature(signature);
 }
 
-void MF_ObjectVertexPositions::call(MFMask mask, MFParams params, MFContext 
UNUSED(context)) const
+void MF_ObjectVertexPositions::call(MFMask mask, MFParams params, MFContext 
context) const
 {
-  VirtualListRef objects = params.readonly_single_input(0, 
"Object");
+  VirtualListRef objects = 
params.readonly_single_input(0,
+   
 "Object");
   auto positions = params.vector_output(1, "Positions");
 
   for (uint i : mask.indices()) {
-Object *object = objects[i];
+Object *object = context.id_handle_lookup().lookup(objects[i]);
 if (object == nullptr || object->type != OB_MESH) {
   continue;
 }
@@ -523,19 +524,20 @@ void MF_GetImageColorOnSurface::call(MFMask mask, 
MFParams params, MFContext con
 MF_ObjectWorldLocation::MF_ObjectWorldLocation()
 {
   MFSignatureBuilder signature("Object Location");
-  signature.single_input("Object");
+  signature.single_input("Object");
   signature.single_output("Location");
   this->set_signature(signature);
 }
 
-void MF_ObjectWorldLocation::call(MFMask mask, MFParams params, MFContext 
UNUSED(context)) const
+void MF_ObjectWorldLocation::call(MFMask mask, MFParams params, MFContext 
context) const
 {
-  auto objects = params.readonly_single_input(0, "Object");
+  auto objects = params.readonly_single_input(0, "Object");
   auto 

[Bf-blender-cvs] [2012ea2e9dc] functions: add id handle lookups to function modifiers

2019-12-04 Thread Jacques Lucke
Commit: 2012ea2e9dc37ab5545f518759a1fdc8f534a1d4
Author: Jacques Lucke
Date:   Wed Dec 4 13:49:24 2019 +0100
Branches: functions
https://developer.blender.org/rB2012ea2e9dc37ab5545f518759a1fdc8f534a1d4

add id handle lookups to function modifiers

===

M   source/blender/functions/CMakeLists.txt
A   source/blender/functions/FN_multi_function_dependencies.h
M   source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
M   source/blender/modifiers/intern/MOD_functionpoints_cxx.cc
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index 3c23d7244c1..f4702536bbf 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -53,6 +53,7 @@ set(SRC
   FN_multi_function_common_contexts.h
   FN_multi_function_context.h
   FN_multi_function_data_type.h
+  FN_multi_function_dependencies.h
   FN_multi_function_mask.h
   FN_multi_function_network.h
   FN_multi_function_param_type.h
diff --git a/source/blender/functions/FN_multi_function_dependencies.h 
b/source/blender/functions/FN_multi_function_dependencies.h
new file mode 100644
index 000..2bf786f723d
--- /dev/null
+++ b/source/blender/functions/FN_multi_function_dependencies.h
@@ -0,0 +1,49 @@
+#ifndef __FN_MULTI_FUNCTION_DEPENDENCIES_H__
+#define __FN_MULTI_FUNCTION_DEPENDENCIES_H__
+
+#include "BLI_set.h"
+
+#include "DNA_object_types.h"
+
+#include "BKE_inlined_node_tree.h"
+
+namespace FN {
+
+using BKE::InlinedNodeTree;
+using BKE::XGroupInput;
+using BKE::XInputSocket;
+using BLI::Set;
+
+inline Set get_objects_used_by_inputs(const InlinedNodeTree 
_tree)
+{
+  Set objects;
+  for (const XInputSocket *xsocket : inlined_tree.all_input_sockets()) {
+if (xsocket->idname() == "fn_ObjectSocket") {
+  Object *object = (Object *)RNA_pointer_get(xsocket->rna(), "value").data;
+  if (object != nullptr) {
+objects.add(object);
+  }
+}
+  }
+  for (const XGroupInput *group_input : inlined_tree.all_group_inputs()) {
+if (group_input->vsocket().idname() == "fn_ObjectSocket") {
+  Object *object = (Object *)RNA_pointer_get(group_input->vsocket().rna(), 
"value").data;
+  if (object != nullptr) {
+objects.add(object);
+  }
+}
+  }
+  return objects;
+}
+
+inline void add_objects_used_by_inputs(IDHandleLookup _handle_lookup,
+   const InlinedNodeTree _tree)
+{
+  for (Object *object : get_objects_used_by_inputs(inlined_tree)) {
+id_handle_lookup.add(object->id);
+  }
+}
+
+}  // namespace FN
+
+#endif /* __FN_MULTI_FUNCTION_DEPENDENCIES_H__ */
\ No newline at end of file
diff --git a/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc 
b/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
index b88633c7872..2f8e3b7dcdb 100644
--- a/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
+++ b/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
@@ -3,6 +3,7 @@
 #include "FN_inlined_tree_multi_function_network_generation.h"
 #include "FN_multi_functions.h"
 #include "FN_multi_function_common_contexts.h"
+#include "FN_multi_function_dependencies.h"
 
 #include "BLI_math_cxx.h"
 
@@ -65,7 +66,10 @@ void MOD_functiondeform_do(FunctionDeformModifierData *fdmd,
   FN::VertexPositionArray vertex_positions_context;
   vertex_positions_context.positions = ArrayRef((float3 *)vertexCos, 
numVerts);
 
-  MFContextBuilder context_builder;
+  BKE::IDHandleLookup id_handle_lookup;
+  FN::add_objects_used_by_inputs(id_handle_lookup, inlined_tree);
+
+  MFContextBuilder context_builder(_handle_lookup);
   context_builder.add_element_context(time_context);
   context_builder.add_element_context(
   vertex_positions_context,
diff --git a/source/blender/modifiers/intern/MOD_functionpoints_cxx.cc 
b/source/blender/modifiers/intern/MOD_functionpoints_cxx.cc
index c610f33821b..4e0cef49a6d 100644
--- a/source/blender/modifiers/intern/MOD_functionpoints_cxx.cc
+++ b/source/blender/modifiers/intern/MOD_functionpoints_cxx.cc
@@ -10,6 +10,7 @@
 #include "FN_inlined_tree_multi_function_network_generation.h"
 #include "FN_multi_functions.h"
 #include "FN_multi_function_common_contexts.h"
+#include "FN_multi_function_dependencies.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
@@ -56,7 +57,10 @@ Mesh *MOD_functionpoints_do(FunctionPointsModifierData *fpmd,
   FN::SceneTimeContext time_context;
   time_context.time = DEG_get_ctime(ctx->depsgraph);
 
-  FN::MFContextBuilder context_builder;
+  BKE::IDHandleLookup id_handle_lookup;
+  FN::add_objects_used_by_inputs(id_handle_lookup, inlined_tree);
+
+  FN::MFContextBuilder context_builder(_handle_lookup);
   context_builder.add_element_context(time_context);
   function->call({0}, params_builder, context_builder);
 
diff 

[Bf-blender-cvs] [db26a326018] functions: store emit location in particles

2019-12-04 Thread Jacques Lucke
Commit: db26a326018926a54cc7789aa0a9a700e427622b
Author: Jacques Lucke
Date:   Wed Dec 4 14:27:11 2019 +0100
Branches: functions
https://developer.blender.org/rBdb26a326018926a54cc7789aa0a9a700e427622b

store emit location in particles

===

M   release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
M   
source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
M   source/blender/simulations/bparticles/emitters.cpp
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py 
b/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
index ea3b4237a03..576eda9a488 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/particle_inputs.py
@@ -13,3 +13,4 @@ class ParticleInfoNode(bpy.types.Node, SimulationNode):
 builder.fixed_output("position", "Position", "Vector")
 builder.fixed_output("velocity", "Velocity", "Vector")
 builder.fixed_output("birth_time", "Birth Time", "Float")
+builder.fixed_output("emit_location", "Emit Location", "Surface 
Location")
diff --git 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
index 7bed07f0424..18627164f8a 100644
--- 
a/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
+++ 
b/source/blender/functions/intern/inlined_tree_multi_function_network/mappings_nodes.cc
@@ -6,6 +6,8 @@
 
 #include "BLI_math_cxx.h"
 
+#include "BKE_surface_location.h"
+
 namespace FN {
 
 using BLI::float3;
@@ -354,6 +356,12 @@ static void INSERT_particle_info(VNodeMFNetworkBuilder 
)
 MFBuilderFunctionNode  = network_builder.add_function(fn);
 network_builder.map_sockets(xnode.output(3), node.output(0));
   }
+  {
+const MultiFunction  = 
network_builder.construct_fn(
+"Emit Location", CPP_TYPE());
+MFBuilderFunctionNode  = network_builder.add_function(fn);
+network_builder.map_sockets(xnode.output(4), node.output(0));
+  }
 }
 
 static void INSERT_closest_location_on_object(VNodeMFNetworkBuilder )
diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index eb0894ae834..3aae5d620ef 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -6,6 +6,7 @@
 #include "BKE_curve.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_deform.h"
+#include "BKE_surface_location.h"
 
 #include "BLI_math_geom.h"
 #include "BLI_vector_adaptor.h"
@@ -15,6 +16,7 @@
 
 namespace BParticles {
 
+using BKE::SurfaceLocation;
 using BLI::VectorAdaptor;
 
 static float random_float()
@@ -49,18 +51,17 @@ void PointEmitter::emit(EmitterInterface )
   }
 }
 
-static float3 random_point_in_triangle(float3 a, float3 b, float3 c)
+static float3 random_uniform_bary_coords()
 {
-  float3 dir1 = b - a;
-  float3 dir2 = c - a;
-  float rand1, rand2;
+  float rand1 = random_float();
+  float rand2 = random_float();
 
-  do {
-rand1 = random_float();
-rand2 = random_float();
-  } while (rand1 + rand2 > 1.0f);
+  if (rand1 + rand2 > 1.0f) {
+rand1 = 1.0f - rand1;
+rand2 = 1.0f - rand2;
+  }
 
-  return a + dir1 * rand1 + dir2 * rand2;
+  return float3(rand1, rand2, 1.0f - rand1 - rand2);
 }
 
 static BLI_NOINLINE void get_average_triangle_weights(const Mesh *mesh,
@@ -199,7 +200,8 @@ static BLI_NOINLINE void sample_looptris(Mesh *mesh,
  ArrayRef triangles,
  ArrayRef triangles_to_sample,
  MutableArrayRef 
r_sampled_positions,
- MutableArrayRef 
r_sampled_normals)
+ MutableArrayRef 
r_sampled_normals,
+ MutableArrayRef 
r_sampled_bary_coords)
 {
   BLI_assert(triangles_to_sample.size() == r_sampled_positions.size());
 
@@ -214,12 +216,17 @@ static BLI_NOINLINE void sample_looptris(Mesh *mesh,
 float3 v2 = verts[loops[triangle.tri[1]].v].co;
 float3 v3 = verts[loops[triangle.tri[2]].v].co;
 
-float3 position = random_point_in_triangle(v1, v2, v3);
+float3 bary_coords = random_uniform_bary_coords();
+
+float3 position;
+interp_v3_v3v3v3(position, v1, v2, v3, bary_coords);
+
 float3 normal;
 normal_tri_v3(normal, v1, v2, v3);
 
 r_sampled_positions[i] = position;
 r_sampled_normals[i] = normal;
+r_sampled_bary_coords[i] = bary_coords;
   }
 }
 
@@ -270,7 +277,9 @@ void SurfaceEmitter::emit(EmitterInterface )
 
   TemporaryArray 

[Bf-blender-cvs] [182a56e3b00] functions: improve SurfaceLocations members

2019-12-04 Thread Jacques Lucke
Commit: 182a56e3b002406b42e1031cded6dcbb2bf6aacf
Author: Jacques Lucke
Date:   Wed Dec 4 12:17:22 2019 +0100
Branches: functions
https://developer.blender.org/rB182a56e3b002406b42e1031cded6dcbb2bf6aacf

improve SurfaceLocations members

===

M   source/blender/blenkernel/BKE_surface_location.h
M   source/blender/functions/FN_multi_function_common_contexts.h
M   source/blender/functions/intern/multi_functions/mixed.cc
M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/blenkernel/BKE_surface_location.h 
b/source/blender/blenkernel/BKE_surface_location.h
index 53d69fdf79f..217c8579f1e 100644
--- a/source/blender/blenkernel/BKE_surface_location.h
+++ b/source/blender/blenkernel/BKE_surface_location.h
@@ -12,6 +12,13 @@ namespace BKE {
 
 using BLI::float3;
 
+namespace SurfaceLocationType {
+enum Enum {
+  None,
+  MeshObject,
+};
+}
+
 /**
  * References a point on a surface. If the surface moves, the point moves with 
it. The surface is
  * identified by an integer.
@@ -20,11 +27,13 @@ using BLI::float3;
  */
 class SurfaceLocation {
  private:
+  SurfaceLocationType::Enum m_type;
+
   /**
-   * Identifies the surface that is being referenced. This is usually a hash 
of the name of an
-   * object. The location is invalid, if this id is negative.
+   * Identifies the surface that is being referenced. This can e.g. be a hash 
of the name of an
+   * object.
*/
-  int32_t m_surface_id;
+  uint32_t m_surface_id;
 
   /* Index of the triangle that contains the referenced location. */
   uint32_t m_triangle_index;
@@ -33,41 +42,51 @@ class SurfaceLocation {
   float3 m_bary_coords;
 
  public:
-  SurfaceLocation() : m_surface_id(-1)
+  SurfaceLocation() : m_type(SurfaceLocationType::None)
+  {
+  }
+
+  SurfaceLocation(uint32_t surface_id, uint32_t triangle_index, float3 
bary_coords)
+  : m_type(SurfaceLocationType::MeshObject),
+m_surface_id(surface_id),
+m_triangle_index(triangle_index),
+m_bary_coords(bary_coords)
+  {
+  }
+
+  SurfaceLocationType::Enum type() const
   {
+return m_type;
   }
 
-  SurfaceLocation(int32_t surface_id, uint32_t triangle_index, float3 
bary_coords)
-  : m_surface_id(surface_id), m_triangle_index(triangle_index), 
m_bary_coords(bary_coords)
+  bool is_valid() const
   {
+return m_type != SurfaceLocationType::None;
   }
 
-  int32_t surface_id() const
+  uint32_t surface_id() const
   {
+BLI_assert(this->is_valid());
 return m_surface_id;
   }
 
   uint32_t triangle_index() const
   {
+BLI_assert(m_type == SurfaceLocationType::MeshObject);
 return m_triangle_index;
   }
 
   float3 bary_coords() const
   {
+BLI_assert(m_type == SurfaceLocationType::MeshObject);
 return m_bary_coords;
   }
 
-  bool is_valid() const
-  {
-return m_surface_id >= 0;
-  }
-
-  static int32_t ComputeObjectSurfaceID(const Object *ob)
+  static uint32_t ComputeObjectSurfaceID(const Object *ob)
   {
 BLI_assert(ob != nullptr);
 
-/* Set the highest bit to zero, to make the number positive. */
-return BLI_hash_string(ob->id.name) & ~(1 << 31);
+return BLI_hash_string(ob->id.name);
   }
 };
 
diff --git a/source/blender/functions/FN_multi_function_common_contexts.h 
b/source/blender/functions/FN_multi_function_common_contexts.h
index 963d43b849f..b2a749867b5 100644
--- a/source/blender/functions/FN_multi_function_common_contexts.h
+++ b/source/blender/functions/FN_multi_function_common_contexts.h
@@ -42,15 +42,15 @@ class ParticleAttributesContext : public MFElementContext {
 
 class PersistentSurfacesLookupContext : public MFElementContext {
  private:
-  Map m_object_by_id;
+  Map m_object_by_id;
 
  public:
-  PersistentSurfacesLookupContext(Map object_by_id)
+  PersistentSurfacesLookupContext(Map object_by_id)
   : m_object_by_id(object_by_id)
   {
   }
 
-  Object *lookup(int32_t id) const
+  Object *lookup(uint32_t id) const
   {
 return m_object_by_id.lookup_default(id, nullptr);
   }
diff --git a/source/blender/functions/intern/multi_functions/mixed.cc 
b/source/blender/functions/intern/multi_functions/mixed.cc
index 5d89ff100d3..c63fa8aeaab 100644
--- a/source/blender/functions/intern/multi_functions/mixed.cc
+++ b/source/blender/functions/intern/multi_functions/mixed.cc
@@ -297,12 +297,12 @@ void MF_GetPositionOnSurface::call(MFMask mask, MFParams 
params, MFContext conte
 
   for (uint i : mask.indices()) {
 SurfaceLocation location = locations[i];
-if (!location.is_valid()) {
+if (location.type() != BKE::SurfaceLocationType::MeshObject) {
   r_positions[i] = {0, 0, 0};
   continue;
 }
 
-Object *object = 
persistent_surfaces_opt->data->lookup((uint32_t)location.surface_id());
+Object *object = 
persistent_surfaces_opt->data->lookup(location.surface_id());
 if (object == nullptr) {
  

[Bf-blender-cvs] [907f72d4bc7] functions: initial IDHandle implementation

2019-12-04 Thread Jacques Lucke
Commit: 907f72d4bc7743991187a48b405f9f1ea67621e3
Author: Jacques Lucke
Date:   Wed Dec 4 13:21:05 2019 +0100
Branches: functions
https://developer.blender.org/rB907f72d4bc7743991187a48b405f9f1ea67621e3

initial IDHandle implementation

===

A   source/blender/blenkernel/BKE_id_handle.h
M   source/blender/blenkernel/BKE_surface_location.h
M   source/blender/blenkernel/CMakeLists.txt
A   source/blender/blenkernel/intern/id_handle.cc
M   source/blender/functions/FN_multi_function_common_contexts.h
M   source/blender/functions/FN_multi_function_context.h
M   source/blender/functions/intern/multi_functions/mixed.cc
M   source/blender/simulations/bparticles/node_frontend.cpp
M   source/blender/simulations/bparticles/particle_function.cpp
M   source/blender/simulations/bparticles/particle_function.hpp

===

diff --git a/source/blender/blenkernel/BKE_id_handle.h 
b/source/blender/blenkernel/BKE_id_handle.h
new file mode 100644
index 000..ce45ccb1eb3
--- /dev/null
+++ b/source/blender/blenkernel/BKE_id_handle.h
@@ -0,0 +1,108 @@
+#ifndef __BKE_ID_HANDLE_H__
+#define __BKE_ID_HANDLE_H__
+
+#include "BLI_utildefines.h"
+
+#include "BLI_map.h"
+
+extern "C" {
+struct ID;
+struct Object;
+struct Image;
+}
+
+namespace BKE {
+
+using BLI::Map;
+
+/**
+ * This is a weak reference to an ID data-block. It does not contain a pointer 
to the actual data.
+ * It can happen that the IDHandle references data, that does not exist 
anymore. The handle does
+ * not know that.
+ */
+class IDHandle {
+ private:
+  uint32_t m_identifier;
+
+ public:
+  IDHandle() : m_identifier((uint32_t)-1)
+  {
+  }
+
+  IDHandle(struct ID *id);
+
+  friend bool operator==(IDHandle a, IDHandle b)
+  {
+return a.m_identifier == b.m_identifier;
+  }
+
+  friend bool operator!=(IDHandle a, IDHandle b)
+  {
+return !(a == b);
+  }
+
+  uint32_t internal_identifier() const
+  {
+return m_identifier;
+  }
+};
+
+class ObjectIDHandle : public IDHandle {
+ public:
+  ObjectIDHandle() : IDHandle()
+  {
+  }
+
+  ObjectIDHandle(struct Object *object);
+};
+
+class ImageIDHandle : public IDHandle {
+ public:
+  ImageIDHandle() : IDHandle()
+  {
+  }
+
+  ImageIDHandle(struct Image *image);
+};
+
+class IDHandleLookup {
+ private:
+  Map m_handle_to_id_map;
+
+ public:
+  void add(ID )
+  {
+IDHandle handle();
+m_handle_to_id_map.add(handle, );
+  }
+
+  ID *lookup(IDHandle handle) const
+  {
+return m_handle_to_id_map.lookup_default(handle, nullptr);
+  }
+
+  struct Object *lookup(ObjectIDHandle handle) const
+  {
+return reinterpret_cast(this->lookup((IDHandle)handle));
+  }
+
+  struct Image *lookup(ImageIDHandle handle) const
+  {
+return reinterpret_cast(this->lookup((IDHandle)handle));
+  }
+
+  static const IDHandleLookup ();
+};
+
+}  // namespace BKE
+
+namespace BLI {
+template<> struct DefaultHash {
+  uint32_t operator()(const BKE::IDHandle ) const
+  {
+return value.internal_identifier();
+  }
+};
+}  // namespace BLI
+
+#endif /* __BKE_ID_HANDLE_H__ */
\ No newline at end of file
diff --git a/source/blender/blenkernel/BKE_surface_location.h 
b/source/blender/blenkernel/BKE_surface_location.h
index 217c8579f1e..8d55f0e2216 100644
--- a/source/blender/blenkernel/BKE_surface_location.h
+++ b/source/blender/blenkernel/BKE_surface_location.h
@@ -4,9 +4,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_math_cxx.h"
 
-#include "DNA_object_types.h"
-
-#include "BLI_hash.h"
+#include "BKE_id_handle.h"
 
 namespace BKE {
 
@@ -20,20 +18,16 @@ enum Enum {
 }
 
 /**
- * References a point on a surface. If the surface moves, the point moves with 
it. The surface is
- * identified by an integer.
- *
- * For now, only points on triangle meshes are supported, support for curves 
could be added too.
+ * References a point on a surface. If the surface moves, the point moves with 
it.
  */
 class SurfaceLocation {
  private:
   SurfaceLocationType::Enum m_type;
 
   /**
-   * Identifies the surface that is being referenced. This can e.g. be a hash 
of the name of an
-   * object.
+   * Used to identify the object if m_type is MeshObject.
*/
-  uint32_t m_surface_id;
+  ObjectIDHandle m_object_handle;
 
   /* Index of the triangle that contains the referenced location. */
   uint32_t m_triangle_index;
@@ -46,9 +40,9 @@ class SurfaceLocation {
   {
   }
 
-  SurfaceLocation(uint32_t surface_id, uint32_t triangle_index, float3 
bary_coords)
+  SurfaceLocation(ObjectIDHandle object_handle, uint32_t triangle_index, 
float3 bary_coords)
   : m_type(SurfaceLocationType::MeshObject),
-m_surface_id(surface_id),
+m_object_handle(object_handle),
 m_triangle_index(triangle_index),
 m_bary_coords(bary_coords)
   {
@@ -64,10 +58,10 @@ class SurfaceLocation {
 return m_type != SurfaceLocationType::None;
   }
 
-  uint32_t 

[Bf-blender-cvs] [fff50bb3b49] master: GPencil: Cleanup duplicate Panel settings definition in previous commit

2019-12-04 Thread Antonio Vazquez
Commit: fff50bb3b496690df0c6905d39c66ef2fcd1cc7e
Author: Antonio Vazquez
Date:   Wed Dec 4 14:23:07 2019 +0100
Branches: master
https://developer.blender.org/rBfff50bb3b496690df0c6905d39c66ef2fcd1cc7e

GPencil: Cleanup duplicate Panel settings definition in previous commit

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index c2fb697337d..5082400db73 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -982,9 +982,6 @@ class GreasePencilSimplifyPanel:
 
 
 class GreasePencilLayerAdjustmentsPanel:
-bl_label = "Adjustments"
-bl_parent_id = 'DOPESHEET_PT_gpencil_mode'
-bl_options = {'DEFAULT_CLOSED'}
 
 def draw(self, context):
 layout = self.layout
@@ -1018,9 +1015,6 @@ class GreasePencilLayerAdjustmentsPanel:
 
 
 class GreasePencilLayerRelationsPanel:
-bl_label = "Relations"
-bl_parent_id = 'DOPESHEET_PT_gpencil_mode'
-bl_options = {'DEFAULT_CLOSED'}
 
 def draw(self, context):
 layout = self.layout
@@ -1042,9 +1036,6 @@ class GreasePencilLayerRelationsPanel:
 
 
 class GreasePencilLayerDisplayPanel:
-bl_label = "Display"
-bl_parent_id = 'DOPESHEET_PT_gpencil_mode'
-bl_options = {'DEFAULT_CLOSED'}
 
 def draw(self, context):
 layout = self.layout

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


[Bf-blender-cvs] [98ff6cfa575] master: GPencil: Add Opacity y Onion switch to Dopesheet

2019-12-04 Thread Antonio Vazquez
Commit: 98ff6cfa575bbe9680e5a0abf176a9d748ecc2b8
Author: Antonio  Vazquez
Date:   Wed Dec 4 14:13:21 2019 +0100
Branches: master
https://developer.blender.org/rB98ff6cfa575bbe9680e5a0abf176a9d748ecc2b8

GPencil: Add Opacity y Onion switch to Dopesheet

Add new icons and panels Grease Pencil Dopesheet to manage layers without 
having the properties panel visible.

Also, the icons are in the same order in Dopesheet, Layers and Material list to 
keep consistency.

As the number of columns for icons is limited to 3 and we also need use a 
factor, I have impleted the change using slider area. Also, the slider option 
is enabled by default for 2D Template.

See T72026 for more info.

Reviewed By: mendio, pepeland, billreynish

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

===

M   release/scripts/startup/bl_ui/properties_data_gpencil.py
M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   release/scripts/startup/bl_ui/space_dopesheet.py
M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/animation/anim_channels_defines.c
M   source/blender/editors/gpencil/gpencil_utils.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index e0a43a5fccc..883673ffd7a 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -21,6 +21,12 @@ import bpy
 from bpy.types import Menu, Panel, UIList
 from rna_prop_ui import PropertyPanel
 
+from bl_ui.properties_grease_pencil_common import (
+GreasePencilLayerAdjustmentsPanel,
+GreasePencilLayerRelationsPanel,
+GreasePencilLayerDisplayPanel,
+)
+
 ###
 # Base-Classes (for shared stuff - e.g. poll, attributes, etc.)
 
@@ -152,8 +158,8 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
 col.separator()
 
 sub = col.column(align=True)
-sub.operator("gpencil.layer_isolate", icon='LOCKED', 
text="").affect_visibility = False
 sub.operator("gpencil.layer_isolate", icon='RESTRICT_VIEW_ON', 
text="").affect_visibility = True
+sub.operator("gpencil.layer_isolate", icon='LOCKED', 
text="").affect_visibility = False
 
 # Layer main properties
 row = layout.row()
@@ -173,83 +179,23 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
 col.prop(gpl, "opacity", text="Opacity", slider=True)
 
 
-class DATA_PT_gpencil_layer_adjustments(LayerDataButtonsPanel, Panel):
+class DATA_PT_gpencil_layer_adjustments(LayerDataButtonsPanel, 
GreasePencilLayerAdjustmentsPanel, Panel):
 bl_label = "Adjustments"
 bl_parent_id = 'DATA_PT_gpencil_layers'
 bl_options = {'DEFAULT_CLOSED'}
 
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-scene = context.scene
-
-gpd = context.gpencil
-gpl = gpd.layers.active
-layout.active = not gpl.lock
 
-# Layer options
-# Offsets - Color Tint
-layout.enabled = not gpl.lock
-col = layout.column(align=True)
-col.prop(gpl, "tint_color")
-col.prop(gpl, "tint_factor", text="Factor", slider=True)
-
-# Offsets - Thickness
-col = layout.row(align=True)
-col.prop(gpl, "line_change", text="Stroke Thickness")
-
-col = layout.row(align=True)
-col.prop(gpl, "pass_index")
-
-col = layout.row(align=True)
-col.prop_search(gpl, "viewlayer_render", scene, "view_layers", 
text="View Layer")
-
-col = layout.row(align=True)
-col.prop(gpl, "lock_material")
-
-
-class DATA_PT_gpencil_layer_relations(LayerDataButtonsPanel, Panel):
+class DATA_PT_gpencil_layer_relations(LayerDataButtonsPanel, 
GreasePencilLayerRelationsPanel, Panel):
 bl_label = "Relations"
 bl_parent_id = 'DATA_PT_gpencil_layers'
 bl_options = {'DEFAULT_CLOSED'}
 
-def draw(self, context):
-layout = self.layout
-layout.use_property_split = True
-layout.use_property_decorate = False
-
-gpd = context.gpencil
-gpl = gpd.layers.active
-
-col = layout.column()
-col.active = not gpl.lock
-col.prop(gpl, "parent")
-col.prop(gpl, "parent_type", text="Type")
-parent = gpl.parent
-
-if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE':
-col.prop_search(gpl, "parent_bone", parent.data, "bones", 
text="Bone")
 
-
-class DATA_PT_gpencil_layer_display(LayerDataButtonsPanel, Panel):
+class DATA_PT_gpencil_layer_display(LayerDataButtonsPanel, 

[Bf-blender-cvs] [f83f168c928] temp-lanpr-review: LANPR: Typo "identity".

2019-12-04 Thread YimingWu
Commit: f83f168c92892c4f581df9724bade48cf25b90e3
Author: YimingWu
Date:   Wed Dec 4 20:47:39 2019 +0800
Branches: temp-lanpr-review
https://developer.blender.org/rBf83f168c92892c4f581df9724bade48cf25b90e3

LANPR: Typo "identity".

===

M   source/blender/draw/engines/lanpr/lanpr_cpu.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index eb56b7b7b1c..721eee04054 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -222,7 +222,7 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, const int is_r
   Scene *scene = DEG_get_evaluated_scene(draw_ctx->depsgraph);
   SceneLANPR *lanpr = >lanpr;
   View3D *v3d = draw_ctx->v3d;
-  float indentity_mat[4][4], win_mat[4][4];
+  float identity_mat[4][4], win_mat[4][4];
   static float normal_object_direction[3] = {0, 0, 1};
   float use_background_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
   static float camdx, camdy, camzoom;
@@ -259,12 +259,12 @@ void lanpr_software_draw_scene(void *vedata, 
GPUFrameBuffer *dfb, const int is_r
   pd->output_viewport[3] = texh;
 }
 
-unit_m4(indentity_mat);
+unit_m4(identity_mat);
 
 const DRWView *default_view = DRW_view_default_get();
 DRW_view_winmat_get(default_view, win_mat, false);
 
-DRWView *view = DRW_view_create(indentity_mat, win_mat, NULL, NULL, NULL);
+DRWView *view = DRW_view_create(identity_mat, win_mat, NULL, NULL, NULL);
 if (is_render) {
   DRW_view_set_active(view);
 }

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


[Bf-blender-cvs] [7804323e330] temp-lanpr-review: LANPR: CPU mode win_mat fix attempt.

2019-12-04 Thread YimingWu
Commit: 7804323e33054723d5b510c9e51edc5a7322daad
Author: YimingWu
Date:   Wed Dec 4 20:15:45 2019 +0800
Branches: temp-lanpr-review
https://developer.blender.org/rB7804323e33054723d5b510c9e51edc5a7322daad

LANPR: CPU mode win_mat fix attempt.

===

M   source/blender/draw/engines/lanpr/lanpr_cpu.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index a084e1f1351..eb56b7b7b1c 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -260,9 +260,9 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, const int is_r
 }
 
 unit_m4(indentity_mat);
-copy_m4_m4(win_mat, indentity_mat);
-/* win_mat needs to be negative */
-swap_v3_v3(win_mat[0], win_mat[1]);
+
+const DRWView *default_view = DRW_view_default_get();
+DRW_view_winmat_get(default_view, win_mat, false);
 
 DRWView *view = DRW_view_create(indentity_mat, win_mat, NULL, NULL, NULL);
 if (is_render) {

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


[Bf-blender-cvs] [89e01395a82] temp-lanpr-review: Merge remote-tracking branch 'origin/master' into temp-lanpr-review

2019-12-04 Thread YimingWu
Commit: 89e01395a822c837099738ed6c1fd39f36acb656
Author: YimingWu
Date:   Wed Dec 4 20:15:33 2019 +0800
Branches: temp-lanpr-review
https://developer.blender.org/rB89e01395a822c837099738ed6c1fd39f36acb656

Merge remote-tracking branch 'origin/master' into temp-lanpr-review

===



===



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


[Bf-blender-cvs] [f1aa4d18d49] blender-v2.81-release: Blender 2.81a: Update submodule for addons

2019-12-04 Thread Sergey Sharybin
Commit: f1aa4d18d49daf483c54f35e3e2e629f7b3a925c
Author: Sergey Sharybin
Date:   Wed Dec 4 12:32:27 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBf1aa4d18d49daf483c54f35e3e2e629f7b3a925c

Blender 2.81a: Update submodule for addons

===

M   release/scripts/addons

===

diff --git a/release/scripts/addons b/release/scripts/addons
index 64dcfc8dc1c..2d192b40050 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 64dcfc8dc1c43a77f16c848219cac5e396368093
+Subproject commit 2d192b40050e63b198c3287d9a7ada5f3352c589

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


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

2019-12-04 Thread Jacques Lucke
Commit: 672b085264a484b7d5ef80bf5504804e725a3a38
Author: Jacques Lucke
Date:   Wed Dec 4 11:33:48 2019 +0100
Branches: functions
https://developer.blender.org/rB672b085264a484b7d5ef80bf5504804e725a3a38

Merge branch 'master' into functions

===



===



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


[Bf-blender-cvs] [e5e295beeda] functions: fix when having emitter in node group

2019-12-04 Thread Jacques Lucke
Commit: e5e295beedae29193c8e5f607f677dd2c5c612d5
Author: Jacques Lucke
Date:   Wed Dec 4 11:53:15 2019 +0100
Branches: functions
https://developer.blender.org/rBe5e295beedae29193c8e5f607f677dd2c5c612d5

fix when having emitter in node group

===

M   source/blender/simulations/bparticles/node_frontend.cpp

===

diff --git a/source/blender/simulations/bparticles/node_frontend.cpp 
b/source/blender/simulations/bparticles/node_frontend.cpp
index 558a1669adb..c42213fe3ae 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -563,7 +563,7 @@ static void PARSE_mesh_emitter(InfluencesCollector 
,
   auto vertex_weights = compute_emitter_vertex_weights(xnode, *inputs, object);
 
   VaryingFloat4x4 transform = world_transition.update_float4x4(
-  xnode.name(), "Transform", object->obmat);
+  object->id.name, "obmat", object->obmat);
   ArrayRef system_names = 
inlined_tree_data.find_target_system_names(
   xnode.output(0, "Emitter"));
   Emitter *emitter = new SurfaceEmitter(system_names,

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


[Bf-blender-cvs] [541d0fdba61] master: Add cloth pressure vertex group and unlock cloth shrink values range

2019-12-04 Thread Sebastian Parborg
Commit: 541d0fdba61a9c99612f7532207d5ce704f10b43
Author: Sebastian Parborg
Date:   Wed Dec 4 11:24:46 2019 +0100
Branches: master
https://developer.blender.org/rB541d0fdba61a9c99612f7532207d5ce704f10b43

Add cloth pressure vertex group and unlock cloth shrink values range

Introduced a way to specify cloth pressure force influence with a vertex
group. This will allow users to only have pressure affect certain parts
of the mesh.

In addition to this, the "shrink factor" is now also unlocked to allow
negative values and thus allowing the cloth mesh to grow as well.

Reviewed By: Jaques Lucke

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

===

M   release/scripts/startup/bl_ui/properties_physics_cloth.py
M   source/blender/blenkernel/BKE_cloth.h
M   source/blender/blenkernel/intern/cloth.c
M   source/blender/makesdna/DNA_cloth_types.h
M   source/blender/makesrna/intern/rna_cloth.c
M   source/blender/physics/intern/BPH_mass_spring.cpp
M   source/blender/physics/intern/implicit.h
M   source/blender/physics/intern/implicit_blender.c

===

diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py 
b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index 1921521669e..d5ac140dc98 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -178,6 +178,7 @@ class PHYSICS_PT_cloth_pressure(PhysicButtonsPanel, Panel):
 
 cloth = context.cloth.settings
 md = context.cloth
+ob = context.object
 
 layout.active = cloth.use_pressure and cloth_panel_enabled(md)
 
@@ -196,6 +197,9 @@ class PHYSICS_PT_cloth_pressure(PhysicButtonsPanel, Panel):
 col = flow.column()
 col.prop(cloth, "pressure_factor", text="Factor")
 
+col = flow.column()
+col.prop_search(cloth, "vertex_group_pressure", ob, "vertex_groups", 
text="Vertex Group")
+
 
 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
 bl_label = "Cache"
diff --git a/source/blender/blenkernel/BKE_cloth.h 
b/source/blender/blenkernel/BKE_cloth.h
index 0543021afef..d59a81c1baf 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -113,8 +113,9 @@ typedef struct ClothVertex {
   float struct_stiff;
   float bend_stiff;
   float shear_stiff;
-  int spring_count;/* how many springs attached? */
-  float shrink_factor; /* how much to shrink this cloth */
+  int spring_count;  /* how many springs attached? */
+  float shrink_factor;   /* how much to shrink this cloth */
+  float pressure_factor; /* how much pressure should affect this vertex */
 } ClothVertex;
 
 /**
diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 2be312bc4d9..d26dca4a252 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -134,6 +134,7 @@ void cloth_init(ClothModifierData *clmd)
   clmd->sim_parms->uniform_pressure_force = 0.0f;
   clmd->sim_parms->target_volume = 0.0f;
   clmd->sim_parms->pressure_factor = 1.0f;
+  clmd->sim_parms->vgroup_pressure = 0;
 
   // also from softbodies
   clmd->sim_parms->maxgoal = 1.0f;
@@ -651,8 +652,9 @@ int cloth_uses_vgroup(ClothModifierData *clmd)
 {
   return (((clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF) &&
(clmd->coll_parms->vgroup_selfcol > 0)) ||
-  (clmd->sim_parms->vgroup_struct > 0) || 
(clmd->sim_parms->vgroup_bend > 0) ||
-  (clmd->sim_parms->vgroup_shrink > 0) || 
(clmd->sim_parms->vgroup_mass > 0));
+  (clmd->sim_parms->vgroup_pressure > 0) || 
(clmd->sim_parms->vgroup_struct > 0) ||
+  (clmd->sim_parms->vgroup_bend > 0) || 
(clmd->sim_parms->vgroup_shrink > 0) ||
+  (clmd->sim_parms->vgroup_mass > 0));
 }
 
 /**
@@ -660,27 +662,16 @@ int cloth_uses_vgroup(ClothModifierData *clmd)
  */
 static void cloth_apply_vgroup(ClothModifierData *clmd, Mesh *mesh)
 {
-  /* Can be optimized to do all groups in one loop. */
-  int i = 0;
-  int j = 0;
-  MDeformVert *dvert = NULL;
-  Cloth *clothObj = NULL;
-  int mvert_num;
-  /* float goalfac = 0; */ /* UNUSED */
-  ClothVertex *verts = NULL;
-
   if (!clmd || !mesh) {
 return;
   }
 
-  clothObj = clmd->clothObject;
+  int mvert_num = mesh->totvert;
 
-  mvert_num = mesh->totvert;
-
-  verts = clothObj->verts;
+  ClothVertex *verts = clmd->clothObject->verts;
 
   if (cloth_uses_vgroup(clmd)) {
-for (i = 0; i < mvert_num; i++, verts++) {
+for (int i = 0; i < mvert_num; i++, verts++) {
 
   /* Reset Goal values to standard */
   if (clmd->sim_parms->vgroup_mass > 0) {
@@ -697,9 +688,9 @@ static void cloth_apply_vgroup(ClothModifierData *clmd, 
Mesh *mesh)
   verts->flags &= ~CLOTH_VERT_FLAG_PINNED;
   verts->flags &= 

[Bf-blender-cvs] [96f6520734c] blender-v2.81-release: Fix crash exiting edit-mode with an active basis shape key

2019-12-04 Thread Campbell Barton
Commit: 96f6520734c5fa9cd0c4d04071128faef31abed4
Author: Campbell Barton
Date:   Thu Nov 28 04:16:38 2019 +1100
Branches: blender-v2.81-release
https://developer.blender.org/rB96f6520734c5fa9cd0c4d04071128faef31abed4

Fix crash exiting edit-mode with an active basis shape key

Exposed by T71865, while the bug remains this resolves the crash.

===

M   source/blender/bmesh/intern/bmesh_mesh_conv.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c 
b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 9bab959f0a2..5f0c673b379 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -879,7 +879,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, 
const struct BMeshToMesh
 BM_ITER_MESH_INDEX (eve, , bm, BM_VERTS_OF_MESH, i) {
   const int keyi = BM_ELEM_CD_GET_INT(eve, cd_shape_keyindex_offset);
 
-  if (keyi != ORIGINDEX_NONE) {
+  if (keyi != ORIGINDEX_NONE && keyi < actkey->totelem) {
 sub_v3_v3v3(ofs[i], mvert->co, fp[keyi]);
   }
   else {

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


[Bf-blender-cvs] [b3f388dca9e] master: UI: support Copy To Selected and Alt-Click for PropertyGroup members.

2019-12-04 Thread Alexander Gavrilov
Commit: b3f388dca9e547c12db277b8422c620ca3b64eaa
Author: Alexander Gavrilov
Date:   Sat Nov 16 20:50:59 2019 +0300
Branches: master
https://developer.blender.org/rBb3f388dca9e547c12db277b8422c620ca3b64eaa

UI: support Copy To Selected and Alt-Click for PropertyGroup members.

Rigify uses a property group to contain options of its rigs, so
currently it is impossible to use Alt-Click or Copy To Selected
to change a setting for multiple rigs at the same time.

The main problem here is that there is no efficient way to find
which bone the property group belongs to. To maintain performance,
implement this by checking the active bone if it is known. Copy
Data Path and related features still don't work, as data path
calculation can't use context.

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

===

M   source/blender/blenkernel/BKE_context.h
M   source/blender/blenkernel/intern/context.c
M   source/blender/editors/interface/interface_ops.c
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_access.c

===

diff --git a/source/blender/blenkernel/BKE_context.h 
b/source/blender/blenkernel/BKE_context.h
index 105f8e82343..88a27b67963 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -198,6 +198,9 @@ enum {
 
 PointerRNA CTX_data_pointer_get(const bContext *C, const char *member);
 PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, 
StructRNA *type);
+PointerRNA CTX_data_pointer_get_type_silent(const bContext *C,
+const char *member,
+StructRNA *type);
 ListBase CTX_data_collection_get(const bContext *C, const char *member);
 ListBase CTX_data_dir_get_ex(const bContext *C,
  const bool use_store,
diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index 2e4f756ce68..e3d95bb660f 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -466,6 +466,18 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, 
const char *member, Stru
   return PointerRNA_NULL;
 }
 
+PointerRNA CTX_data_pointer_get_type_silent(const bContext *C, const char 
*member, StructRNA *type)
+{
+  PointerRNA ptr = CTX_data_pointer_get(C, member);
+
+  if (ptr.data && RNA_struct_is_a(ptr.type, type)) {
+return ptr;
+  }
+  else {
+return PointerRNA_NULL;
+  }
+}
+
 ListBase CTX_data_collection_get(const bContext *C, const char *member)
 {
   bContextDataResult result;
diff --git a/source/blender/editors/interface/interface_ops.c 
b/source/blender/editors/interface/interface_ops.c
index 8af82864b03..2a9ebdfaea9 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -707,6 +707,25 @@ static void UI_OT_override_remove_button(wmOperatorType 
*ot)
 /** \name Copy To Selected Operator
  * \{ */
 
+#define NOT_NULL(assignment) ((assignment) != NULL)
+#define NOT_RNA_NULL(assignment) ((assignment).data != NULL)
+
+static void ui_context_selected_bones_via_pose(bContext *C, ListBase *r_lb)
+{
+  ListBase lb;
+  lb = CTX_data_collection_get(C, "selected_pose_bones");
+
+  if (!BLI_listbase_is_empty()) {
+CollectionPointerLink *link;
+for (link = lb.first; link; link = link->next) {
+  bPoseChannel *pchan = link->ptr.data;
+  RNA_pointer_create(link->ptr.owner_id, _Bone, pchan->bone, 
>ptr);
+}
+  }
+
+  *r_lb = lb;
+}
+
 bool UI_context_copy_to_selected_list(bContext *C,
   PointerRNA *ptr,
   PropertyRNA *prop,
@@ -717,6 +736,52 @@ bool UI_context_copy_to_selected_list(bContext *C,
   *r_use_path_from_id = false;
   *r_path = NULL;
 
+  /* PropertyGroup objects don't have a reference to the struct that actually 
owns
+   * them, so it is normally necessary to do a brute force search to find it. 
This
+   * handles the search for non-ID owners by using the 'active' reference as a 
hint
+   * to preserve efficiency. Only properties defined through RNA are handled, 
as
+   * custom properties cannot be assumed to be valid for all instances.
+   *
+   * Properties owned by the ID are handled by the 'if (ptr->owner_id)' case 
below.
+   */
+  if (!RNA_property_is_idprop(prop) && RNA_struct_is_a(ptr->type, 
_PropertyGroup)) {
+PointerRNA owner_ptr;
+char *idpath = NULL;
+
+/* First, check the active PoseBone and PoseBone->Bone. */
+if (NOT_RNA_NULL(
+owner_ptr = CTX_data_pointer_get_type(C, "active_pose_bone", 
_PoseBone))) {
+  if (NOT_NULL(idpath = RNA_path_from_struct_to_idproperty(_ptr, 
ptr->data))) {
+*r_lb = CTX_data_collection_get(C, "selected_pose_bones");
+  }
+  else 

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

2019-12-04 Thread Antonio Vazquez
Commit: 3b6d39cc8f4607bd55f8b02fc926e13c4716f447
Author: Antonio Vazquez
Date:   Wed Dec 4 10:06:52 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB3b6d39cc8f4607bd55f8b02fc926e13c4716f447

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