[Bf-blender-cvs] [c216cb6a695] soc-2019-npr: Merge branch 'master' into soc-2019-npr

2019-07-01 Thread YimingWu
Commit: c216cb6a695d1444cb34b5672b49cec0503b632a
Author: YimingWu
Date:   Tue Jul 2 13:11:58 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBc216cb6a695d1444cb34b5672b49cec0503b632a

Merge branch 'master' into soc-2019-npr

===



===



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


[Bf-blender-cvs] [f4948d2ce7f] soc-2019-outliner: Outliner: Sync selection from outliner to sequencer

2019-07-01 Thread Nathan Craddock
Commit: f4948d2ce7fa5df84e51d4b07e3eb906843ea508
Author: Nathan Craddock
Date:   Mon Jul 1 21:40:03 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBf4948d2ce7fa5df84e51d4b07e3eb906843ea508

Outliner: Sync selection from outliner to sequencer

Outliner selection events now sync to the sequencer. Still need
to support active strips

===

M   source/blender/editors/space_outliner/outliner_sync.c

===

diff --git a/source/blender/editors/space_outliner/outliner_sync.c 
b/source/blender/editors/space_outliner/outliner_sync.c
index 83f5b5e473f..1390d6b921e 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -156,11 +156,39 @@ static void 
outliner_sync_selection_from_sequencer(ListBase *tree)
   }
 }
 
+static void outliner_sync_selection_to_sequencer(bContext *C, ListBase *tree)
+{
+  Scene *scene = CTX_data_scene(C);
+
+  for (TreeElement *te = tree->first; te; te = te->next) {
+TreeStoreElem *tselem = TREESTORE(te);
+
+if (tselem->type == TSE_SEQUENCE) {
+  printf("\t\tSyncing a sequence: %s\n", te->name);
+
+  Sequence *seq = (Sequence *)tselem->id;
+
+  if (tselem->flag & TSE_SELECTED) {
+seq->flag |= SELECT;
+  }
+  else {
+seq->flag &= ~SELECT;
+  }
+}
+
+outliner_sync_selection_to_sequencer(C, >subtree);
+  }
+
+  // DEG_id_tag_update(>id, ID_RECALC_SELECT);
+  WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
+}
+
 /* Set clean outliner and mark other outliners for syncing */
 void outliner_select_sync(bContext *C, SpaceOutliner *soops)
 {
   puts("Outliner select... Mark other outliners as dirty for syncing");
   outliner_sync_selection_to_view_layer(C, >tree);
+  outliner_sync_selection_to_sequencer(C, >tree);
   sync_select_dirty_flag = SYNC_SELECT_NONE;
 
   /* Don't need to mark self as dirty here... */

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


[Bf-blender-cvs] [c8aed23a1c2] soc-2019-outliner: Outliner: Draw correct scene icon

2019-07-01 Thread Nathan Craddock
Commit: c8aed23a1c291bfd048efefac7b2c2f08b7f4ea6
Author: Nathan Craddock
Date:   Mon Jul 1 21:13:34 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBc8aed23a1c291bfd048efefac7b2c2f08b7f4ea6

Outliner: Draw correct scene icon

Was drawing incorrect icon for scene

===

M   source/blender/editors/space_outliner/outliner_draw.c

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.c 
b/source/blender/editors/space_outliner/outliner_draw.c
index 2a52f501b9a..663d3926981 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2239,7 +2239,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem 
*tselem, TreeElement *te)
   case TSE_SEQUENCE:
 switch (te->idcode) {
   case SEQ_TYPE_SCENE:
-data.icon = ICON_SCENE;
+data.icon = ICON_SCENE_DATA;
 break;
   case SEQ_TYPE_MOVIECLIP:
 data.icon = ICON_TRACKER;

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


[Bf-blender-cvs] [5992e6c3e61] soc-2019-outliner: Merge branch 'master' into soc-2019-outliner

2019-07-01 Thread Nathan Craddock
Commit: 5992e6c3e6164bf0ae8bdd92104c4aa1ec371586
Author: Nathan Craddock
Date:   Mon Jul 1 20:35:31 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB5992e6c3e6164bf0ae8bdd92104c4aa1ec371586

Merge branch 'master' into soc-2019-outliner

===



===



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


[Bf-blender-cvs] [35b5395f2a0] soc-2019-outliner: Outliner: Draw more sequencer icons

2019-07-01 Thread Nathan Craddock
Commit: 35b5395f2a03da95cc7cefcc18724205f1cf5cdc
Author: Nathan Craddock
Date:   Mon Jul 1 20:48:15 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB35b5395f2a03da95cc7cefcc18724205f1cf5cdc

Outliner: Draw more sequencer icons

Not all of the sequencer icons had been added to the outliner.
Some are still drawing with editor/modifier colors so they will
need their own icons. Or some other code workaround.

===

M   source/blender/editors/space_outliner/outliner_draw.c

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.c 
b/source/blender/editors/space_outliner/outliner_draw.c
index d1666b62b79..2a52f501b9a 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2237,23 +2237,57 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem 
*tselem, TreeElement *te)
 data.icon = ICON_GROUP_BONE;
 break;
   case TSE_SEQUENCE:
-if (te->idcode == SEQ_TYPE_MOVIE) {
-  data.icon = ICON_SEQUENCE;
-}
-else if (te->idcode == SEQ_TYPE_META) {
-  data.icon = ICON_DOT;
-}
-else if (te->idcode == SEQ_TYPE_SCENE) {
-  data.icon = ICON_SCENE;
-}
-else if (te->idcode == SEQ_TYPE_SOUND_RAM) {
-  data.icon = ICON_SOUND;
-}
-else if (te->idcode == SEQ_TYPE_IMAGE) {
-  data.icon = ICON_IMAGE;
-}
-else {
-  data.icon = ICON_PARTICLES;
+switch (te->idcode) {
+  case SEQ_TYPE_SCENE:
+data.icon = ICON_SCENE;
+break;
+  case SEQ_TYPE_MOVIECLIP:
+data.icon = ICON_TRACKER;
+break;
+  case SEQ_TYPE_MASK:
+data.icon = ICON_MOD_MASK;
+break;
+  case SEQ_TYPE_MOVIE:
+data.icon = ICON_FILE_MOVIE;
+break;
+  case SEQ_TYPE_SOUND_RAM:
+data.icon = ICON_SOUND;
+break;
+  case SEQ_TYPE_IMAGE:
+data.icon = ICON_FILE_IMAGE;
+break;
+  case SEQ_TYPE_COLOR:
+  case SEQ_TYPE_ADJUSTMENT:
+data.icon = ICON_COLOR;
+break;
+  case SEQ_TYPE_TEXT:
+data.icon = ICON_FONT_DATA;
+break;
+  case SEQ_TYPE_ADD:
+  case SEQ_TYPE_SUB:
+  case SEQ_TYPE_MUL:
+  case SEQ_TYPE_OVERDROP:
+  case SEQ_TYPE_ALPHAOVER:
+  case SEQ_TYPE_ALPHAUNDER:
+  case SEQ_TYPE_COLORMIX:
+  case SEQ_TYPE_MULTICAM:
+  case SEQ_TYPE_TRANSFORM:
+  case SEQ_TYPE_SPEED:
+  case SEQ_TYPE_GLOW:
+  case SEQ_TYPE_GAUSSIAN_BLUR:
+data.icon = ICON_SHADERFX;
+break;
+  case SEQ_TYPE_CROSS:
+  case SEQ_TYPE_GAMCROSS:
+  case SEQ_TYPE_WIPE:
+data.icon = ICON_ARROW_LEFTRIGHT;
+break;
+  case SEQ_TYPE_META:
+data.icon = ICON_DOT;
+break;
+  default:
+data.icon = ICON_DOT;
+break;
 }
 break;
   case TSE_SEQ_STRIP:

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


[Bf-blender-cvs] [9605cebdd23] soc-2019-outliner: Outliner: Sync selection from sequencer

2019-07-01 Thread Nathan Craddock
Commit: 9605cebdd238c653a7c2c151fcde0116bbfd35bd
Author: Nathan Craddock
Date:   Mon Jul 1 20:49:39 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB9605cebdd238c653a7c2c151fcde0116bbfd35bd

Outliner: Sync selection from sequencer

Sequencer selection operators now sync to outliners. Still needs
to sync the other direction

===

M   source/blender/editors/space_outliner/outliner_intern.h
M   source/blender/editors/space_outliner/outliner_sync.c
M   source/blender/editors/space_sequencer/sequencer_select.c

===

diff --git a/source/blender/editors/space_outliner/outliner_intern.h 
b/source/blender/editors/space_outliner/outliner_intern.h
index 818424cc13f..424f96d9bd3 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -470,10 +470,7 @@ bool outliner_is_element_visible(const TreeElement *te);
 
 /* outliner_sync.c -- */
 
-void outliners_mark_dirty(const struct bContext *C);
 void outliner_select_sync(struct bContext *C, struct SpaceOutliner *soops);
 void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner 
*soops);
-void outliner_sync_selection_from_view_layer(struct ViewLayer *view_layer, 
struct ListBase *tree);
-void outliner_sync_selection_to_view_layer(struct bContext *C, struct ListBase 
*tree);
 
 #endif /* __OUTLINER_INTERN_H__ */
diff --git a/source/blender/editors/space_outliner/outliner_sync.c 
b/source/blender/editors/space_outliner/outliner_sync.c
index 09e3ac06e06..83f5b5e473f 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -26,6 +26,7 @@
 #include "DNA_layer_types.h"
 #include "DNA_outliner_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_sequence_types.h"
 #include "DNA_space_types.h"
 
 #include "BKE_context.h"
@@ -45,19 +46,7 @@
 /* Default value for sync selection state */
 short sync_select_dirty_flag = SYNC_SELECT_NONE;
 
-/* Set clean outliner and mark other outliners for syncing */
-void outliner_select_sync(bContext *C, SpaceOutliner *soops)
-{
-  puts("Outliner select... Mark other outliners as dirty for syncing");
-  outliner_sync_selection_to_view_layer(C, >tree);
-  sync_select_dirty_flag = SYNC_SELECT_NONE;
-
-  /* Don't need to mark self as dirty here... */
-  outliners_mark_dirty(C);
-  soops->flag &= ~SO_IS_DIRTY;
-}
-
-void outliners_mark_dirty(const bContext *C)
+static void outliners_mark_dirty(const bContext *C)
 {
   Main *bmain = CTX_data_main(C);
   for (bScreen *screen = bmain->screens.first; screen; screen = 
screen->id.next) {
@@ -75,7 +64,7 @@ void outliners_mark_dirty(const bContext *C)
 }
 
 /* Sync selection flags to active view layer */
-void outliner_sync_selection_to_view_layer(bContext *C, ListBase *tree)
+static void outliner_sync_selection_to_view_layer(bContext *C, ListBase *tree)
 {
   Scene *scene = CTX_data_scene(C);
   ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -111,7 +100,7 @@ void outliner_sync_selection_to_view_layer(bContext *C, 
ListBase *tree)
 }
 
 /* Sync selection flags from active view layer */
-void outliner_sync_selection_from_view_layer(ViewLayer *view_layer, ListBase 
*tree)
+static void outliner_sync_selection_from_view_layer(ViewLayer *view_layer, 
ListBase *tree)
 {
   for (TreeElement *te = tree->first; te; te = te->next) {
 TreeStoreElem *tselem = TREESTORE(te);
@@ -143,6 +132,42 @@ void outliner_sync_selection_from_view_layer(ViewLayer 
*view_layer, ListBase *tr
   }
 }
 
+static void outliner_sync_selection_from_sequencer(ListBase *tree)
+{
+  for (TreeElement *te = tree->first; te; te = te->next) {
+TreeStoreElem *tselem = TREESTORE(te);
+
+tselem->flag &= ~TSE_ACTIVE;
+
+if (tselem->type == TSE_SEQUENCE) {
+  printf("\t\tSyncing a sequence: %s\n", te->name);
+
+  Sequence *seq = (Sequence *)tselem->id;
+
+  if (seq->flag & SELECT) {
+tselem->flag |= TSE_SELECTED;
+  }
+  else {
+tselem->flag &= ~TSE_SELECTED;
+  }
+}
+
+outliner_sync_selection_from_sequencer(>subtree);
+  }
+}
+
+/* Set clean outliner and mark other outliners for syncing */
+void outliner_select_sync(bContext *C, SpaceOutliner *soops)
+{
+  puts("Outliner select... Mark other outliners as dirty for syncing");
+  outliner_sync_selection_to_view_layer(C, >tree);
+  sync_select_dirty_flag = SYNC_SELECT_NONE;
+
+  /* Don't need to mark self as dirty here... */
+  outliners_mark_dirty(C);
+  soops->flag &= ~SO_IS_DIRTY;
+}
+
 void outliner_sync_selection(const bContext *C, SpaceOutliner *soops)
 {
   ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -162,6 +187,9 @@ void outliner_sync_selection(const bContext *C, 
SpaceOutliner *soops)
 
 outliner_sync_selection_from_view_layer(view_layer, >tree);
 
+ 

[Bf-blender-cvs] [a9635c63842] master: Cleanup: rename set_inverted_drawing, move to GPU_state

2019-07-01 Thread Campbell Barton
Commit: a9635c63842d47009cbb9b9de7ca8afa112254bf
Author: Campbell Barton
Date:   Tue Jul 2 12:30:55 2019 +1000
Branches: master
https://developer.blender.org/rBa9635c63842d47009cbb9b9de7ca8afa112254bf

Cleanup: rename set_inverted_drawing, move to GPU_state

===

M   source/blender/draw/modes/edit_text_mode.c
M   source/blender/editors/include/BIF_glutil.h
M   source/blender/editors/screen/glutil.c
M   source/blender/editors/transform/transform_constraints.c
M   source/blender/gpu/GPU_state.h
M   source/blender/gpu/intern/gpu_state.c

===

diff --git a/source/blender/draw/modes/edit_text_mode.c 
b/source/blender/draw/modes/edit_text_mode.c
index 03f26e8ce63..448dc33077e 100644
--- a/source/blender/draw/modes/edit_text_mode.c
+++ b/source/blender/draw/modes/edit_text_mode.c
@@ -383,10 +383,10 @@ static void EDIT_TEXT_draw_scene(void *vedata)
 DRW_draw_pass(psl->text_box_pass);
   }
 
-  set_inverted_drawing(1);
+  GPU_logic_op_invert_set(true);
   DRW_draw_pass(psl->overlay_select_pass);
   DRW_draw_pass(psl->overlay_cursor_pass);
-  set_inverted_drawing(0);
+  GPU_logic_op_invert_set(false);
 
   /* If you changed framebuffer, double check you rebind
* the default one with its textures attached before finishing */
diff --git a/source/blender/editors/include/BIF_glutil.h 
b/source/blender/editors/include/BIF_glutil.h
index 7d4b6dbeea2..101a65d151a 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -172,8 +172,6 @@ int ED_draw_imbuf_method(struct ImBuf *ibuf);
 /* OpenGL drawing utility functions. Do not use these in new code, these
  * are intended to be moved or removed in the future. */
 
-void set_inverted_drawing(int enable);
-
 /* own working polygon offset */
 float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist);
 void bglPolygonOffset(float viewdist, float dist);
diff --git a/source/blender/editors/screen/glutil.c 
b/source/blender/editors/screen/glutil.c
index fc771e0db77..db44723fdb7 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -47,17 +47,6 @@
 
 /*  */
 
-/* Invert line handling */
-
-#define GL_TOGGLE(mode, onoff) (((onoff) ? glEnable : glDisable)(mode))
-
-void set_inverted_drawing(int enable)
-{
-  glLogicOp(enable ? GL_INVERT : GL_COPY);
-  GL_TOGGLE(GL_COLOR_LOGIC_OP, enable);
-  GL_TOGGLE(GL_DITHER, !enable);
-}
-
 static int get_cached_work_texture(int *r_w, int *r_h)
 {
   static GLint texid = -1;
diff --git a/source/blender/editors/transform/transform_constraints.c 
b/source/blender/editors/transform/transform_constraints.c
index 06851451461..cb539c8d1a5 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -863,9 +863,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
 immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
 immUniformThemeColor(TH_GRID);
 
-set_inverted_drawing(1);
+GPU_logic_op_invert_set(true);
 imm_drawcircball(t->center_global, t->prop_size, imat, pos);
-set_inverted_drawing(0);
+GPU_logic_op_invert_set(false);
 
 immUnbindProgram();
 
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
index 7b970786e5e..efea02eb5a4 100644
--- a/source/blender/gpu/GPU_state.h
+++ b/source/blender/gpu/GPU_state.h
@@ -59,4 +59,6 @@ void GPU_viewport_size_get_i(int coords[4]);
 void GPU_flush(void);
 void GPU_finish(void);
 
+void GPU_logic_op_invert_set(bool enable);
+
 #endif /* __GPU_STATE_H__ */
diff --git a/source/blender/gpu/intern/gpu_state.c 
b/source/blender/gpu/intern/gpu_state.c
index 7a27fea2f0d..caf97a620ab 100644
--- a/source/blender/gpu/intern/gpu_state.c
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -175,3 +175,17 @@ void GPU_finish(void)
 {
   glFinish();
 }
+
+void GPU_logic_op_invert_set(bool enable)
+{
+  if (enable) {
+glLogicOp(GL_INVERT);
+glEnable(GL_COLOR_LOGIC_OP);
+glDisable(GL_DITHER);
+  }
+  else {
+glLogicOp(GL_COPY);
+glDisable(GL_COLOR_LOGIC_OP);
+glEnable(GL_DITHER);
+  }
+}

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


[Bf-blender-cvs] [12788538496] master: Fix T61360: Smooth Weights affects all objects

2019-07-01 Thread mano-wii
Commit: 12788538496a6c63f876926f27a99cf8b0ad9c97
Author: mano-wii
Date:   Tue Jul 2 08:59:40 2019 +1000
Branches: master
https://developer.blender.org/rB12788538496a6c63f876926f27a99cf8b0ad9c97

Fix T61360: Smooth Weights affects all objects

===

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

===

diff --git a/source/blender/editors/object/object_vgroup.c 
b/source/blender/editors/object/object_vgroup.c
index 678f6f50096..4f61443ac54 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -3278,9 +3278,18 @@ static int vertex_group_smooth_exec(bContext *C, 
wmOperator *op)
   ViewLayer *view_layer = CTX_data_view_layer(C);
   Object *ob_ctx = ED_object_context(C);
 
-  uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-  view_layer, CTX_wm_view3d(C), _len, ob_ctx->mode);
+  uint objects_len;
+  Object **objects;
+  if (ob_ctx->mode == OB_MODE_WEIGHT_PAINT) {
+/* Until weight paint supports multi-edit, use only the active. */
+objects_len = 1;
+objects = _ctx;
+  }
+  else {
+objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
+view_layer, CTX_wm_view3d(C), _len, ob_ctx->mode);
+  }
+
   for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
 Object *ob = objects[ob_index];
 
@@ -3296,7 +3305,9 @@ static int vertex_group_smooth_exec(bContext *C, 
wmOperator *op)
 WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
 WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
   }
-  MEM_freeN(objects);
+  if (objects != _ctx) {
+MEM_freeN(objects);
+  }
 
   return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [4f321a33739] master: Fix crash unlinking non-ID types in the outliner

2019-07-01 Thread Campbell Barton
Commit: 4f321a33739cdb43c3325696d5853cb251e45b1c
Author: Campbell Barton
Date:   Tue Jul 2 08:44:03 2019 +1000
Branches: master
https://developer.blender.org/rB4f321a33739cdb43c3325696d5853cb251e45b1c

Fix crash unlinking non-ID types in the outliner

===

M   source/blender/editors/space_outliner/outliner_tools.c

===

diff --git a/source/blender/editors/space_outliner/outliner_tools.c 
b/source/blender/editors/space_outliner/outliner_tools.c
index e1e7bf49606..a618f8ef4c2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -288,31 +288,33 @@ static void unlink_object_cb(bContext *C,
  TreeStoreElem *tselem,
  void *UNUSED(user_data))
 {
-  Main *bmain = CTX_data_main(C);
-  Object *ob = (Object *)tselem->id;
+  if (tsep && tsep->id) {
+Main *bmain = CTX_data_main(C);
+Object *ob = (Object *)tselem->id;
 
-  if (GS(tsep->id->name) == ID_OB) {
-/* Parented objects need to find which collection to unlink from. */
-TreeElement *te_parent = te->parent;
-while (tsep && GS(tsep->id->name) == ID_OB) {
-  te_parent = te_parent->parent;
-  tsep = te_parent ? TREESTORE(te_parent) : NULL;
+if (GS(tsep->id->name) == ID_OB) {
+  /* Parented objects need to find which collection to unlink from. */
+  TreeElement *te_parent = te->parent;
+  while (tsep && GS(tsep->id->name) == ID_OB) {
+te_parent = te_parent->parent;
+tsep = te_parent ? TREESTORE(te_parent) : NULL;
+  }
 }
-  }
 
-  if (tsep) {
-if (GS(tsep->id->name) == ID_GR) {
-  Collection *parent = (Collection *)tsep->id;
-  BKE_collection_object_remove(bmain, parent, ob, true);
-  DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
-  DEG_relations_tag_update(bmain);
-}
-else if (GS(tsep->id->name) == ID_SCE) {
-  Scene *scene = (Scene *)tsep->id;
-  Collection *parent = BKE_collection_master(scene);
-  BKE_collection_object_remove(bmain, parent, ob, true);
-  DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
-  DEG_relations_tag_update(bmain);
+if (tsep && tsep->id) {
+  if (GS(tsep->id->name) == ID_GR) {
+Collection *parent = (Collection *)tsep->id;
+BKE_collection_object_remove(bmain, parent, ob, true);
+DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+DEG_relations_tag_update(bmain);
+  }
+  else if (GS(tsep->id->name) == ID_SCE) {
+Scene *scene = (Scene *)tsep->id;
+Collection *parent = BKE_collection_master(scene);
+BKE_collection_object_remove(bmain, parent, ob, true);
+DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+DEG_relations_tag_update(bmain);
+  }
 }
   }
 }

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


[Bf-blender-cvs] [5892233319b] master: Fix submodules hash in previous commit

2019-07-01 Thread Sergey Sharybin
Commit: 5892233319baf07cc37430dce4014b1394f57f66
Author: Sergey Sharybin
Date:   Mon Jul 1 23:50:50 2019 +0200
Branches: master
https://developer.blender.org/rB5892233319baf07cc37430dce4014b1394f57f66

Fix submodules hash in previous commit

===

M   release/scripts/addons

===

diff --git a/release/scripts/addons b/release/scripts/addons
index 16040b3f21b..5819abebf40 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 16040b3f21b285dbe98847636cafd5eddfd0c71a
+Subproject commit 5819abebf40d5f09543bfe2af3aa4dfa698b3114

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


[Bf-blender-cvs] [983ca12d822] master: Fix T65468 Nurbs: Broken display when hiding control points

2019-07-01 Thread Clément Foucault
Commit: 983ca12d822a260364f9222ea24122d1831cd873
Author: Clément Foucault
Date:   Mon Jul 1 23:14:02 2019 +0200
Branches: master
https://developer.blender.org/rB983ca12d822a260364f9222ea24122d1831cd873

Fix T65468 Nurbs: Broken display when hiding control points

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c 
b/source/blender/draw/intern/draw_cache_impl_curve.c
index 1d6f2aaa070..75c498dfd88 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -791,7 +791,7 @@ static void 
curve_create_edit_data_and_handles(CurveRenderData *rdata,
 }
 else if (bp) {
   int pt_len = nu->pntsu * nu->pntsv;
-  for (int a = 0; a < pt_len; a++, bp++) {
+  for (int a = 0; a < pt_len; a++, bp++, vbo_len_used += 1) {
 if (bp->hide == true) {
   continue;
 }
@@ -819,7 +819,6 @@ static void 
curve_create_edit_data_and_handles(CurveRenderData *rdata,
 if (vbo_pos) {
   GPU_vertbuf_attr_set(vbo_pos, attr_id.pos, vbo_len_used, bp->vec);
 }
-vbo_len_used += 1;
   }
 }
   }

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


[Bf-blender-cvs] [9fbfa218e0c] master: Updated tooltips for operators 'Transfer Mix' and 'Join Shapes'. Fixes typo

2019-07-01 Thread Ines Almeida
Commit: 9fbfa218e0cb484ea03ef0dbf3230e40a340fdc8
Author: Ines Almeida
Date:   Mon Jul 1 23:06:32 2019 +0200
Branches: master
https://developer.blender.org/rB9fbfa218e0cb484ea03ef0dbf3230e40a340fdc8

Updated tooltips for operators 'Transfer Mix' and 'Join Shapes'. Fixes typo

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   release/scripts/startup/bl_operators/object.py
M   source/blender/editors/object/object_add.c

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index d1f85e37b7f..6a6b84fd505 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit d1f85e37b7fa2574243a112670fd36fbebc61d4c
+Subproject commit 6a6b84fd50538a65276c729b5d396be615bc79f2
diff --git a/release/scripts/addons b/release/scripts/addons
index ae3237c4c5e..16040b3f21b 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit ae3237c4c5e6ba05c44fad5edd5fcd7e0b34b1a8
+Subproject commit 16040b3f21b285dbe98847636cafd5eddfd0c71a
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index e83541d42c7..f00d4fbe848 16
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit e83541d42c71bfb689acf9a53a6eb66b0c190451
+Subproject commit f00d4fbe84852e40af281267c06dc21bafb5df49
diff --git a/release/scripts/startup/bl_operators/object.py 
b/release/scripts/startup/bl_operators/object.py
index 481b101eaee..e4f8daa9c4b 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -312,8 +312,7 @@ class SubdivisionSet(Operator):
 
 
 class ShapeTransfer(Operator):
-"""Copy another selected objects active shape to this one by """ \
-"""applying the relative offsets"""
+"""Copy the active shape key of another selected object to this one"""
 
 bl_idname = "object.shape_key_transfer"
 bl_label = "Transfer Shape Key"
diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/editors/object/object_add.c
index 0fdb1cec16f..a3e3196bb13 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2826,7 +2826,7 @@ void OBJECT_OT_join_shapes(wmOperatorType *ot)
 {
   /* identifiers */
   ot->name = "Join as Shapes";
-  ot->description = "Merge selected objects to shapes of active object";
+  ot->description = "Copy the current resulting shape of another selected 
object to this one";
   ot->idname = "OBJECT_OT_join_shapes";
 
   /* api callbacks */

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


[Bf-blender-cvs] [fcc567b7974] master: GPencil: New python API for closing strokes with geometry

2019-07-01 Thread Antonioya
Commit: fcc567b7974dbf4b41e7bfa0420126fd6909727c
Author: Antonioya
Date:   Mon Jul 1 23:03:03 2019 +0200
Branches: master
https://developer.blender.org/rBfcc567b7974dbf4b41e7bfa0420126fd6909727c

GPencil: New python API for closing strokes with geometry

Adds to API the last function created to close strokes in a previous commit.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index 7ce66d49051..2671246b589 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -685,6 +685,24 @@ static void rna_GPencil_stroke_remove(bGPDframe *frame,
   WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 }
 
+static void rna_GPencil_stroke_close(ID *id,
+ bGPDframe *frame,
+ ReportList *reports,
+ PointerRNA *stroke_ptr)
+{
+  bGPdata *gpd = (bGPdata *)id;
+  bGPDstroke *stroke = stroke_ptr->data;
+  if (BLI_findindex(>strokes, stroke) == -1) {
+BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame");
+return;
+  }
+
+  BKE_gpencil_close_stroke(stroke);
+
+  DEG_id_tag_update(>id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | 
ID_RECALC_COPY_ON_WRITE);
+  WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+}
+
 static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value)
 {
   bGPDstroke *gps = ptr->data;
@@ -1159,6 +1177,13 @@ static void rna_def_gpencil_strokes_api(BlenderRNA 
*brna, PropertyRNA *cprop)
   parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The 
stroke to remove");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
   RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+  func = RNA_def_function(srna, "close", "rna_GPencil_stroke_close");
+  RNA_def_function_ui_description(func, "Close a grease pencil stroke adding 
geometry");
+  RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+  parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The 
stroke to close");
+  RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+  RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
 }
 
 static void rna_def_gpencil_frame(BlenderRNA *brna)

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


[Bf-blender-cvs] [05a54beb884] master: GPencil: Add new parameter to python API for activating the new created frame

2019-07-01 Thread Antonioya
Commit: 05a54beb8841ce1c042d8de8206fe049cb02da09
Author: Antonioya
Date:   Mon Jul 1 22:48:31 2019 +0200
Branches: master
https://developer.blender.org/rB05a54beb8841ce1c042d8de8206fe049cb02da09

GPencil: Add new parameter to python API for activating the new created frame

Sometimes is required to enable the frame created and new "active" parameter 
allows to do that.

Use: `gpl.frames.new(5, active=True)`

===

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

===

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index b59e97f1991..7ce66d49051 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -710,7 +710,10 @@ static void rna_GPencil_stroke_select_set(PointerRNA *ptr, 
const bool value)
   }
 }
 
-static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, ReportList *reports, 
int frame_number)
+static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer,
+ReportList *reports,
+int frame_number,
+bool active)
 {
   bGPDframe *frame;
 
@@ -720,7 +723,9 @@ static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, 
ReportList *reports, i
   }
 
   frame = BKE_gpencil_frame_addnew(layer, frame_number);
-
+  if (active) {
+layer->actframe = BKE_gpencil_layer_getframe(layer, frame_number, 
GP_GETFRAME_USE_PREV);
+  }
   WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
 
   return frame;
@@ -1222,6 +1227,7 @@ static void rna_def_gpencil_frames_api(BlenderRNA *brna, 
PropertyRNA *cprop)
  MINAFRAME,
  MAXFRAME);
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+  RNA_def_boolean(func, "active", 0, "Active", "");
   parm = RNA_def_pointer(func, "frame", "GPencilFrame", "", "The newly created 
frame");
   RNA_def_function_return(func, parm);

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


[Bf-blender-cvs] [2002b29ecd2] master: Workbench: Combine Xray Alpha with object/material alpha ...

2019-07-01 Thread Clément Foucault
Commit: 2002b29ecd2b8fff6f1320fa194f8d7525bf9b2e
Author: Clément Foucault
Date:   Mon Jul 1 22:29:16 2019 +0200
Branches: master
https://developer.blender.org/rB2002b29ecd2b8fff6f1320fa194f8d7525bf9b2e

Workbench: Combine Xray Alpha with object/material alpha ...

... instead of overiding it (previous behavior).

In practice it's not really noticeable.
This means an object with alpha will never be more opaque when enabling
xray.

===

M   source/blender/draw/engines/workbench/workbench_data.c
M   source/blender/draw/engines/workbench/workbench_deferred.c
M   source/blender/draw/engines/workbench/workbench_forward.c
M   source/blender/draw/engines/workbench/workbench_materials.c
M   source/blender/draw/engines/workbench/workbench_private.h

===

diff --git a/source/blender/draw/engines/workbench/workbench_data.c 
b/source/blender/draw/engines/workbench/workbench_data.c
index 04e1255521f..4b4bd74ae76 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -24,6 +24,8 @@
 
 #include "DNA_userdef_types.h"
 
+#include "ED_view3d.h"
+
 #include "UI_resources.h"
 
 #include "GPU_batch.h"
@@ -55,6 +57,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
 wpd->shading = v3d->shading;
 wpd->use_color_render_settings = false;
   }
+  wpd->shading.xray_alpha = XRAY_ALPHA(v3d);
 
   wpd->use_color_management = BKE_scene_check_color_management_enabled(scene);
 
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index 49b84b41744..31549c6f752 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -451,6 +451,8 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
   WORKBENCH_PrivateData *wpd = stl->g_data;
   workbench_private_data_init(wpd);
 
+  wpd->shading.xray_alpha = 1.0f;
+
   workbench_dof_engine_init(vedata, camera);
 
   if (OIT_ENABLED(wpd)) {
@@ -987,8 +989,6 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data 
*vedata, Object *ob)
   int color_type = workbench_material_determine_color_type(
   wpd, image, ob, use_sculpt_pbvh);
   if (color_type == V3D_SHADING_MATERIAL_COLOR && mat && mat->a < 1.0) 
{
-/* Hack */
-wpd->shading.xray_alpha = mat->a;
 material = workbench_forward_get_or_create_material_data(
 vedata, ob, mat, image, iuser, color_type, 0, use_sculpt_pbvh);
 has_transp_mat = true;
@@ -1009,8 +1009,6 @@ void 
workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
   int color_type = workbench_material_determine_color_type(wpd, NULL, ob, 
use_sculpt_pbvh);
 
   if ((ob->color[3] < 1.0f) && (color_type == V3D_SHADING_OBJECT_COLOR)) {
-/* Hack */
-wpd->shading.xray_alpha = ob->color[3];
 material = workbench_forward_get_or_create_material_data(
 vedata, ob, NULL, NULL, NULL, color_type, 0, use_sculpt_pbvh);
 has_transp_mat = true;
@@ -1046,8 +1044,6 @@ void 
workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
 for (int i = 0; i < materials_len; ++i) {
   struct Material *mat = give_current_material(ob, i + 1);
   if (mat != NULL && mat->a < 1.0f) {
-/* Hack */
-wpd->shading.xray_alpha = mat->a;
 material = workbench_forward_get_or_create_material_data(
 vedata, ob, mat, NULL, NULL, V3D_SHADING_MATERIAL_COLOR, 0, 
use_sculpt_pbvh);
 has_transp_mat = true;
@@ -1071,8 +1067,6 @@ void 
workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
   if (geoms != NULL && geoms[i] != NULL) {
 Material *mat = give_current_material(ob, i + 1);
 if (mat != NULL && mat->a < 1.0f) {
-  /* Hack */
-  wpd->shading.xray_alpha = mat->a;
   material = workbench_forward_get_or_create_material_data(
   vedata, ob, mat, NULL, NULL, V3D_SHADING_MATERIAL_COLOR, 0, 
use_sculpt_pbvh);
   has_transp_mat = true;
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c 
b/source/blender/draw/engines/workbench/workbench_forward.c
index 612a3901ca0..9245d13eab0 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -178,7 +178,7 @@ WORKBENCH_MaterialData 
*workbench_forward_get_or_create_material_data(WORKBENCH_
  wpd->transparent_accum_uniform_sh,
  psl->transparent_accum_pass);
 DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
-

[Bf-blender-cvs] [cbc0ad07b3c] master: Fix T65974 Workbench: transparency rendering broken

2019-07-01 Thread Clément Foucault
Commit: cbc0ad07b3c8143439305d54f3f36e0180351ac1
Author: Clément Foucault
Date:   Mon Jul 1 22:32:25 2019 +0200
Branches: master
https://developer.blender.org/rBcbc0ad07b3c8143439305d54f3f36e0180351ac1

Fix T65974 Workbench: transparency rendering broken

===

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

===

diff --git a/source/blender/draw/engines/workbench/workbench_materials.c 
b/source/blender/draw/engines/workbench/workbench_materials.c
index 0bbe7c978be..76f035562e5 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -172,6 +172,7 @@ uint workbench_material_get_hash(WORKBENCH_MaterialData 
*material_template, bool
   input[3] = (uint)(material_template->roughness * 512);
   result += BLI_ghashutil_uinthash_v4_murmur(input);
 
+  result += BLI_ghashutil_uinthash((uint)(material_template->alpha * 512));
   result += BLI_ghashutil_uinthash((uint)is_ghost);
   result += BLI_ghashutil_uinthash(material_template->color_type);

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


[Bf-blender-cvs] [c2a762c8e6e] master: Fix T65771 Eevee: Volume Emission not working if density is zero

2019-07-01 Thread Clément Foucault
Commit: c2a762c8e6e529a36b0e8cff5ac9339e084829b4
Author: Clément Foucault
Date:   Mon Jul 1 19:24:25 2019 +0200
Branches: master
https://developer.blender.org/rBc2a762c8e6e529a36b0e8cff5ac9339e084829b4

Fix T65771 Eevee: Volume Emission not working if density is zero

===

M   
source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl

===

diff --git 
a/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl 
b/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
index e756cafba52..acd1e58ff97 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
@@ -48,6 +48,10 @@ void main()
 float cell_depth = volume_z_to_view_z((float(i) + 1.0) / tex_size.z);
 float ray_len = orig_ray_len * cell_depth;
 
+/* Emission does not work of there is no extinction because
+ * Tr evaluates to 1.0 leading to Lscat = 0.0. (See T65771) */
+s_extinction = max(vec3(1e-7) * step(1e-5, Lscat), s_extinction);
+
 /* Evaluate Scattering */
 float s_len = abs(ray_len - prev_ray_len);
 prev_ray_len = ray_len;

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


[Bf-blender-cvs] [7b7772e1809] soc-2019-outliner: Outliner: Fix range select sometimes leaving hidden elements selected

2019-07-01 Thread Nathan Craddock
Commit: 7b7772e18090ae10b7e1f3145a801081d8c4b37d
Author: Nathan Craddock
Date:   Mon Jul 1 11:05:56 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB7b7772e18090ae10b7e1f3145a801081d8c4b37d

Outliner: Fix range select sometimes leaving hidden elements selected

The range select opearator sometimes would leave other elements
selected when changing the active element. This is fixed by
clearing the selection each time the operator runs.

===

M   source/blender/editors/space_outliner/outliner_select.c

===

diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index cbcd58b89a4..b87d517adf1 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1279,11 +1279,19 @@ static void do_outliner_range_select(SpaceOutliner 
*soops, TreeElement *cursor)
 {
   TreeElement *active = outliner_find_active_element(>tree);
   TreeStoreElem *tselem = TREESTORE(active);
+  const bool active_selected = (tselem->flag & TSE_SELECTED);
 
-  /* Select element under cursor if active element not visible or if the 
cursor element is the
-   * active element */
-  if (!(tselem->flag & TSE_SELECTED) || !outliner_is_element_visible(active) ||
-  (active == cursor)) {
+  outliner_flag_set(>tree, TSE_SELECTED, false);
+
+  /* Only select active if under cursor */
+  if (active == cursor) {
+TREESTORE(cursor)->flag |= TSE_SELECTED | TSE_ACTIVE;
+return;
+  }
+
+  /* If active is not selected, just select the element under the cursor */
+  if (!active_selected || !outliner_is_element_visible(active)) {
+tselem->flag &= ~TSE_ACTIVE;
 TREESTORE(cursor)->flag |= TSE_SELECTED | TSE_ACTIVE;
 return;
   }

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


[Bf-blender-cvs] [5891e86420d] soc-2019-openxr: Cleanup GHOST_Xr types and functions

2019-07-01 Thread Julian Eisel
Commit: 5891e86420d9718670841f0282bac499c225ccd8
Author: Julian Eisel
Date:   Mon Jul 1 18:56:26 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB5891e86420d9718670841f0282bac499c225ccd8

Cleanup GHOST_Xr types and functions

* Move GHOST_Xr types to GHOST_Types.h
* Add GHOST_XrPose. We'll have to pass around pose data at multiple
  places.
* Don't require extra call to prepare session rendering, handle
everything through GHOST_XrSessionStart
* Naming

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_Types.h
M   intern/ghost/intern/GHOST_XrSession.cpp
M   source/blender/windowmanager/intern/wm_xr.c

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index d9f9cf93bd3..e0d951885b5 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -30,21 +30,6 @@
 extern "C" {
 #endif
 
-/**
- * Creates a "handle" for a C++ GHOST object.
- * A handle is just an opaque pointer to an empty struct.
- * In the API the pointer is cast to the actual C++ class.
- * The 'name' argument to the macro is the name of the handle to create.
- */
-
-GHOST_DECLARE_HANDLE(GHOST_SystemHandle);
-GHOST_DECLARE_HANDLE(GHOST_TimerTaskHandle);
-GHOST_DECLARE_HANDLE(GHOST_WindowHandle);
-GHOST_DECLARE_HANDLE(GHOST_EventHandle);
-GHOST_DECLARE_HANDLE(GHOST_RectangleHandle);
-GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
-GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
-
 /**
  * Definition of a callback routine that receives events.
  * \param event The event received.
@@ -990,58 +975,10 @@ extern void GHOST_EndIME(GHOST_WindowHandle windowhandle);
 
 #ifdef WITH_OPENXR
 
-/**
- * The XR view (i.e. the OpenXR runtime) may require a different graphics 
library than OpenGL. An
- * offscreen texture of the viewport will then be drawn into using OpenGL, but 
the final texture
- * draw call will happen through another lib (say DirectX).
- *
- * This enum defines the possible graphics bindings to attempt to enable.
- */
-typedef enum {
-  GHOST_kXrGraphicsUnknown = 0,
-  GHOST_kXrGraphicsOpenGL,
-#  ifdef WIN32
-  GHOST_kXrGraphicsD3D11,
-#  endif
-  /* For later */
-  //  GHOST_kXrGraphicsVulkan,
-} GHOST_TXrGraphicsBinding;
-/* An array of GHOST_TXrGraphicsBinding items defining the candidate bindings 
to use. The first
- * available candidate will be chosen, so order defines priority. */
-typedef const GHOST_TXrGraphicsBinding *GHOST_XrGraphicsBindingCandidates;
-
-typedef struct {
-  const GHOST_XrGraphicsBindingCandidates gpu_binding_candidates;
-  unsigned int gpu_binding_candidates_count;
-} GHOST_XrContextCreateInfo;
-
-typedef struct {
-  int ofsx, ofsy;
-  int width, height;
-
-  struct {
-float position[3];
-float quat[4];
-  } pose;
-
-  struct {
-float angle_left, angle_right;
-float angle_up, angle_down;
-  } fov;
-} GHOST_XrDrawViewInfo;
-
 /* xr-context */
 struct GHOST_XrContext *GHOST_XrContextCreate(const GHOST_XrContextCreateInfo 
*create_info);
 void GHOST_XrContextDestroy(struct GHOST_XrContext *xr_context);
 
-typedef void *(*GHOST_XrGraphicsContextBindFn)(GHOST_TXrGraphicsBinding 
graphics_lib);
-typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_TXrGraphicsBinding 
graphics_lib,
-void *graphics_context);
-/* XXX hacky: returns GHOST_ContextHandle so DirectX binding can get a handle 
to the OpenGL
- * offscreen context. */
-typedef GHOST_ContextHandle (*GHOST_XrDrawViewFn)(const GHOST_XrDrawViewInfo 
*draw_view,
-  void *customdata);
-
 void GHOST_XrGraphicsContextBindFuncs(struct GHOST_XrContext *xr_context,
   GHOST_XrGraphicsContextBindFn bind_fn,
   GHOST_XrGraphicsContextUnbindFn 
unbind_fn);
@@ -1052,7 +989,6 @@ void GHOST_XrDrawViewFunc(struct GHOST_XrContext 
*xr_context, GHOST_XrDrawViewFn
 GHOST_TSuccess GHOST_XrSessionIsRunning(const struct GHOST_XrContext 
*xr_context);
 void GHOST_XrSessionStart(struct GHOST_XrContext *xr_context);
 void GHOST_XrSessionEnd(struct GHOST_XrContext *xr_context);
-void GHOST_XrSessionRenderingPrepare(struct GHOST_XrContext *xr_context);
 void GHOST_XrSessionDrawViews(struct GHOST_XrContext *xr_context, void 
*customdata);
 
 /* events */
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index dfefd7cc474..89bab0987a7 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -41,6 +41,21 @@
 } * name
 #endif
 
+/**
+ * Creates a "handle" for a C++ GHOST object.
+ * A handle is just an opaque pointer to an empty struct.
+ * In the API the pointer is cast to the actual C++ class.
+ * The 'name' argument to the macro is the name of the handle to create.
+ */
+
+GHOST_DECLARE_HANDLE(GHOST_SystemHandle);
+GHOST_DECLARE_HANDLE(GHOST_TimerTaskHandle);

[Bf-blender-cvs] [3f0a43db2d6] soc-2019-embree-gpu: Code refactor & Performance improvement

2019-07-01 Thread MATILLAT Quentin
Commit: 3f0a43db2d65a9f7550374ca3931172c2783d3f0
Author: MATILLAT Quentin
Date:   Mon Jul 1 18:57:41 2019 +0200
Branches: soc-2019-embree-gpu
https://developer.blender.org/rB3f0a43db2d65a9f7550374ca3931172c2783d3f0

Code refactor & Performance improvement

===

M   intern/cycles/bvh/CMakeLists.txt
M   intern/cycles/bvh/bvh_embree.cpp
A   intern/cycles/bvh/bvh_embree_converter.cpp
A   intern/cycles/bvh/bvh_embree_converter.h
M   intern/cycles/bvh/bvh_embree_gpu.cpp

===

diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt
index 3952b307096..f85a484a194 100644
--- a/intern/cycles/bvh/CMakeLists.txt
+++ b/intern/cycles/bvh/CMakeLists.txt
@@ -19,6 +19,7 @@ set(SRC
   bvh_sort.cpp
   bvh_split.cpp
   bvh_unaligned.cpp
+  bvh_embree_converter.cpp
 )
 
 set(SRC_HEADERS
@@ -35,6 +36,7 @@ set(SRC_HEADERS
   bvh_sort.h
   bvh_split.h
   bvh_unaligned.h
+  bvh_embree_converter.h
 )
 
 set(LIB
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 5519c746fd1..9e6f6a07294 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -35,9 +35,6 @@
 
 #ifdef WITH_EMBREE
 
-#include 
-#include 
-
 #  include 
 #  include 
 #  include 
@@ -57,260 +54,11 @@
 #  include "util/util_foreach.h"
 #  include "util/util_logging.h"
 #  include "util/util_progress.h"
-
-#define TASKING_INTERNAL
-#define RTC_NAMESPACE_BEGIN
-#define RTC_NAMESPACE_OPEN
-#define RTC_NAMESPACE_END
-
-#include "embree/kernels/common/scene.h"
-#include "embree/kernels/bvh/bvh.h"
-#include "embree/kernels/geometry/trianglev.h"
-#include "embree/kernels/geometry/instance.h"
-#include "bvh_node.h"
+#  include "bvh_embree_converter.h"
 CCL_NAMESPACE_BEGIN
 
 #  define IS_HAIR(x) (x & 1)
 
-std::stack groupByRange(std::vector ids, BoundBox bb) {
-std::sort(ids.begin(), ids.end());
-std::stack groups;
-
-for(uint id : ids) {
-if(!groups.empty() && groups.top()->hi == id) {
-groups.top()->hi = id + 1;
-} else {
-groups.push(new LeafNode(bb, 4294967295, id, id + 1));
-}
-}
-
-return groups;
-}
-
-
-ccl::BoundBox RTCBoundBoxToCCL(const embree::BBox3fa ) {
-return ccl::BoundBox(
-make_float3(bound.lower.x, bound.lower.y, bound.lower.z),
-make_float3(bound.upper.x, bound.upper.y, bound.upper.z));
-
-}
-
-template
-BVHNode* nodeEmbreeToCcl(embree::BVH4::NodeRef node, ccl::BoundBox bb, 
embree::Scene *s, vector objects) {
-if(node.isLeaf()) {
-size_t nb;
-Primitive *prims = reinterpret_cast(node.leaf(nb));
-
-std::vector ids; ids.reserve(nb * 4);
-
-for(size_t i = 0; i < nb; i++) {
-for(size_t j = 0; j < prims[i].size(); j++) {
-const auto geom_id = prims[i].geomID(j);
-const auto prim_id = prims[i].primID(j);
-
-embree::Geometry *g = s->get(geom_id);
-
-size_t prim_offset = 
reinterpret_cast(g->getUserData());
-
-ids.push_back(prim_offset + prim_id);
-}
-}
-
-if(ids.empty()) return new LeafNode(BoundBox::empty, 0, 0, 0);
-
-BVHNode *ret = nullptr;
-std::stack leafs = groupByRange(ids, bb);
-std::deque nodes;
-
-while(!leafs.empty()) {
-nodes.push_back(leafs.top());
-leafs.pop();
-}
-
-while(!nodes.empty()) {
-if(ret == nullptr) {
-ret = nodes.front();
-nodes.pop_front();
-continue;
-}
-
-if(ret->is_leaf() || ret->num_children()) {
-ret = new InnerNode(bb, , 1);
-}
-
-InnerNode *innerNode = dynamic_cast(ret);
-innerNode->children[innerNode->num_children_++] = nodes.front();
-nodes.pop_front();
-
-if(ret->num_children() == 4) {
-nodes.push_back(ret);
-ret = nullptr;
-}
-}
-
-return ret;
-} else {
-InnerNode *ret = nullptr;
-
-if(node.isAlignedNode()) {
-embree::BVH4::AlignedNode *anode = node.alignedNode();
-
-BVHNode *children[4];
-for(uint i = 0; i < 4; i++) {
-children[i] = nodeEmbreeToCcl(
-anode->children[i],
-RTCBoundBoxToCCL(anode->bounds(i)),
-s,
-objects);
-}
-
-ret = new InnerNode(
-bb,
-children,
-4);
-} else {
-std::cout << "Unknown node" << std::endl;
-}
-
-return ret;
-}
-}
-
-template<>
-BVHNode* nodeEmbreeToCcl(embree::BVH4::NodeRef 
node, 

[Bf-blender-cvs] [dcf520cdad7] master: UI: increase size of scale gizmo circle

2019-07-01 Thread Campbell Barton
Commit: dcf520cdad7903acb911a3da2cd62064a79208b5
Author: Campbell Barton
Date:   Tue Jul 2 01:10:55 2019 +1000
Branches: master
https://developer.blender.org/rBdcf520cdad7903acb911a3da2cd62064a79208b5

UI: increase size of scale gizmo circle

The scale gizmo wasn't working usefully for uniform scale.

===

M   source/blender/editors/transform/transform_gizmo_3d.c

===

diff --git a/source/blender/editors/transform/transform_gizmo_3d.c 
b/source/blender/editors/transform/transform_gizmo_3d.c
index 530abe6faff..2ad938e1d05 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1489,7 +1489,12 @@ static GizmoGroup *gizmogroup_init(wmGizmoGroup *gzgroup)
   ggd->gizmos[MAN_AXIS_ROT_T]->flag |= WM_GIZMO_SELECT_BACKGROUND;
 
   /* Prevent axis gizmos overlapping the center point, see: T63744. */
-  ggd->gizmos[MAN_AXIS_SCALE_C]->select_bias = 
ggd->gizmos[MAN_AXIS_TRANS_C]->select_bias = 2.0f;
+  ggd->gizmos[MAN_AXIS_TRANS_C]->select_bias = 2.0f;
+
+  ggd->gizmos[MAN_AXIS_SCALE_C]->select_bias = -2.0f;
+
+  /* Use 1/6 since this is '0.2' if the main scale is 1.2. */
+  RNA_float_set(ggd->gizmos[MAN_AXIS_SCALE_C]->ptr, "arc_inner_factor", 1.0 / 
6.0);
 
   return ggd;
 }
@@ -1591,6 +1596,9 @@ static void 
gizmogroup_init_properties_from_twtype(wmGizmoGroup *gzgroup)
   WM_gizmo_set_flag(axis, WM_GIZMO_DRAW_VALUE, true);
   WM_gizmo_set_scale(axis, 1.2f);
 }
+else if (axis_idx == MAN_AXIS_SCALE_C) {
+  WM_gizmo_set_scale(axis, 1.2f);
+}
 else {
   WM_gizmo_set_scale(axis, 0.2f);
 }

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


[Bf-blender-cvs] [016d5cf9194] master: Gizmo: support for filled circle with inner non-zero radius

2019-07-01 Thread Campbell Barton
Commit: 016d5cf919481b18917656a774c015fd645a35bb
Author: Campbell Barton
Date:   Tue Jul 2 01:47:51 2019 +1000
Branches: master
https://developer.blender.org/rB016d5cf919481b18917656a774c015fd645a35bb

Gizmo: support for filled circle with inner non-zero radius

Needed for changes to the scale gizmo.

===

M   source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c

===

diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c 
b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index 31e30a0dd1a..6d8ab096a26 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -129,7 +129,26 @@ static void dial_geom_draw(const float color[4],
   immUniformColor4fv(color);
 
   if (filled) {
-imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
+if (arc_partial_angle == 0.0f) {
+  if (arc_inner_factor == 0.0f) {
+imm_draw_circle_fill_2d(pos, 0, 0, 1.0, DIAL_RESOLUTION);
+  }
+  else {
+imm_draw_disk_partial_fill_2d(
+pos, 0, 0, arc_inner_factor, 1.0f, DIAL_RESOLUTION, 0, 
RAD2DEGF(M_PI * 2));
+  }
+}
+else {
+  float arc_partial_deg = RAD2DEGF((M_PI * 2) - arc_partial_angle);
+  imm_draw_disk_partial_fill_2d(pos,
+0,
+0,
+arc_inner_factor,
+1.0f,
+DIAL_RESOLUTION,
+-arc_partial_deg / 2,
+arc_partial_deg);
+}
   }
   else {
 if (arc_partial_angle == 0.0f) {

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


[Bf-blender-cvs] [2e2fab2f3b9] functions: cleanup

2019-07-01 Thread Jacques Lucke
Commit: 2e2fab2f3b9d3100048c65c8fc55648953eba232
Author: Jacques Lucke
Date:   Mon Jul 1 17:12:10 2019 +0200
Branches: functions
https://developer.blender.org/rB2e2fab2f3b9d3100048c65c8fc55648953eba232

cleanup

===

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

===

diff --git a/source/blender/simulations/bparticles/events.cpp 
b/source/blender/simulations/bparticles/events.cpp
index 2404829bbea..9f9182a2556 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -48,6 +48,13 @@ class MeshBounceEvent : public Event {
 float3 normal;
   };
 
+  struct RayCastResult {
+bool success;
+int index;
+float3 normal;
+float distance;
+  };
+
  public:
   MeshBounceEvent(BVHTreeFromMesh *treedata, float4x4 transform)
   : m_treedata(treedata),
@@ -70,29 +77,25 @@ class MeshBounceEvent : public Event {
 for (uint i : particles.range()) {
   uint pindex = particles.get_particle_index(i);
 
-  float3 start_position = 
m_ray_transform.transform_position(positions[pindex]);
-  float3 direction = 
m_ray_transform.transform_direction(position_offsets[i]);
-  float length = direction.normalize_and_get_length();
+  float3 ray_start = m_ray_transform.transform_position(positions[pindex]);
+  float3 ray_direction = 
m_ray_transform.transform_direction(position_offsets[i]);
+  float length = ray_direction.normalize_and_get_length();
 
-  float3 hit_normal;
-  float hit_distance;
-  if (this->ray_cast(start_position, direction, length, hit_distance, 
hit_normal)) {
-float time_factor = hit_distance / length;
+  auto result = this->ray_cast(ray_start, ray_direction, length);
+  if (result.success) {
+float time_factor = result.distance / length;
 auto  = interface.trigger_particle(i, time_factor);
 
-if (float3::dot(hit_normal, direction) > 0) {
-  hit_normal.invert();
+float3 normal = result.normal;
+if (float3::dot(normal, ray_direction) > 0) {
+  normal.invert();
 }
-data.normal = 
m_normal_transform.transform_direction(hit_normal).normalized();
+data.normal = 
m_normal_transform.transform_direction(normal).normalized();
   }
 }
   }
 
-  bool ray_cast(float3 start,
-float3 normalized_direction,
-float max_distance,
-float _hit_distance,
-float3 _hit_normal)
+  RayCastResult ray_cast(float3 start, float3 normalized_direction, float 
max_distance)
   {
 BVHTreeRayHit hit;
 hit.dist = max_distance;
@@ -105,9 +108,7 @@ class MeshBounceEvent : public Event {
  m_treedata->raycast_callback,
  (void *)m_treedata);
 
-r_hit_distance = hit.dist;
-r_hit_normal = hit.no;
-return hit.index >= 0;
+return {hit.index >= 0, hit.index, float3(hit.no), hit.dist};
   }
 
   void execute(EventExecuteInterface ) override

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


[Bf-blender-cvs] [59d9310b28a] functions: initial point randomization accross surface

2019-07-01 Thread Jacques Lucke
Commit: 59d9310b28a4b709d6a5741e078858e3a974dd88
Author: Jacques Lucke
Date:   Mon Jul 1 17:45:21 2019 +0200
Branches: functions
https://developer.blender.org/rB59d9310b28a4b709d6a5741e078858e3a974dd88

initial point randomization accross surface

===

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

===

diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index a275092c430..2aae2a282e0 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -69,7 +69,7 @@ class SurfaceEmitter : public Emitter {
   float3 v1 = verts[loops[triangle.tri[0]].v].co;
   float3 v2 = verts[loops[triangle.tri[1]].v].co;
   float3 v3 = verts[loops[triangle.tri[2]].v].co;
-  float3 pos = (v1 + v2 + v3) / 3.0f;
+  float3 pos = random_point_in_triangle(v1, v2, v3);
 
   float3 normal;
   normal_tri_v3(normal, v1, v2, v3);
@@ -86,6 +86,20 @@ class SurfaceEmitter : public Emitter {
 target.set_float3("Velocity", velocities);
 target.set_birth_moments(birth_moments);
   }
+
+  float3 random_point_in_triangle(float3 a, float3 b, float3 c)
+  {
+float3 dir1 = b - a;
+float3 dir2 = c - a;
+float rand1, rand2;
+
+do {
+  rand1 = (rand() % 1000) / 1000.0f;
+  rand2 = (rand() % 1000) / 1000.0f;
+} while (rand1 + rand2 > 1.0f);
+
+return a + dir1 * rand1 + dir2 * rand2;
+  }
 };
 
 class PathEmitter : public Emitter {

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


[Bf-blender-cvs] [77d8f118efb] functions: avoid stepping when the emitter is moving quickly

2019-07-01 Thread Jacques Lucke
Commit: 77d8f118efb3eb3418bbf21fcf42846fd86fc930
Author: Jacques Lucke
Date:   Mon Jul 1 17:29:14 2019 +0200
Branches: functions
https://developer.blender.org/rB77d8f118efb3eb3418bbf21fcf42846fd86fc930

avoid stepping when the emitter is moving quickly

===

M   source/blender/blenlib/BLI_math.hpp
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/emitters.cpp
M   source/blender/simulations/bparticles/emitters.hpp

===

diff --git a/source/blender/blenlib/BLI_math.hpp 
b/source/blender/blenlib/BLI_math.hpp
index 47e0d88cd03..5eab8c94cbe 100644
--- a/source/blender/blenlib/BLI_math.hpp
+++ b/source/blender/blenlib/BLI_math.hpp
@@ -129,11 +129,11 @@ struct float3 {
 };
 
 struct float4x4 {
-  float v[4][4];
+  float values[4][4];
 
   float4x4(float *matrix)
   {
-memcpy(v, matrix, sizeof(float) * 16);
+memcpy(values, matrix, sizeof(float) * 16);
   }
 
   float4x4(float matrix[4][4]) : float4x4((float *)matrix)
@@ -148,7 +148,7 @@ struct float4x4 {
   float4x4 inverted() const
   {
 float result[4][4];
-invert_m4_m4(result, (float(*)[4])this);
+invert_m4_m4(result, values);
 return result;
   }
 
@@ -159,15 +159,22 @@ struct float4x4 {
 
   float3 transform_position(float3 position)
   {
-mul_m4_v3((float(*)[4])this, position);
+mul_m4_v3(values, position);
 return position;
   }
 
   float3 transform_direction(float3 direction)
   {
-mul_mat3_m4_v3((float(*)[4])this, direction);
+mul_mat3_m4_v3(values, direction);
 return direction;
   }
+
+  static float4x4 interpolate(float4x4 a, float4x4 b, float t)
+  {
+float result[4][4];
+interp_m4_m4m4(result, a.values, b.values, t);
+return result;
+  }
 };
 
 }  // namespace BLI
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 84a52a3fdf1..a0a06feea49 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1969,6 +1969,7 @@ typedef struct NodeParticlesModifierData {
   float control1, control2;
   struct Object *emitter_object;
   struct Object *collision_object;
+  float last_emitter_transforms[4][4];
 } NodeParticlesModifierData;
 
 #endif /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 3d517e6b416..0ff9c7f5412 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -234,8 +234,12 @@ void 
BParticles_simulate_modifier(NodeParticlesModifierData *npmd,
   type0->m_integrator->m_forces.append(FORCE_directional({0, 0, -2}));
 
   if (npmd->emitter_object) {
-description.m_emitters.append(EMITTER_mesh_surface(
-0, (Mesh *)npmd->emitter_object->data, npmd->emitter_object->obmat, 
npmd->control1));
+description.m_emitters.append(EMITTER_mesh_surface(0,
+   (Mesh 
*)npmd->emitter_object->data,
+   
npmd->last_emitter_transforms,
+   
npmd->emitter_object->obmat,
+   npmd->control1));
+copy_m4_m4(npmd->last_emitter_transforms, npmd->emitter_object->obmat);
   }
   BVHTreeFromMesh treedata = {0};
   if (npmd->collision_object) {
diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index c80d6ddc76f..f5831ee5372 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -304,6 +304,16 @@ void TimeSpanEmitTarget::set_randomized_birth_moments()
   this->set_float("Birth Time", birth_times);
 }
 
+void TimeSpanEmitTarget::set_birth_moments(ArrayRef time_factors)
+{
+  BLI_assert(time_factors.size() == m_size);
+  SmallVector birth_times(time_factors.size());
+  for (uint i = 0; i < m_size; i++) {
+birth_times[i] = m_time_span.interpolate(time_factors[i]);
+  }
+  this->set_float("Birth Time", birth_times);
+}
+
 /* EventFilterInterface
  */
 
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index e7f909e215c..9e1a6932b3b 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -349,6 +349,11 @@ class TimeSpanEmitTarget : public EmitTargetBase {
* Randomize the birth times within a time span.
*/
   void set_randomized_birth_moments();
+
+  /**
+   * Set custom bith 

[Bf-blender-cvs] [145e061bce6] functions: minor cleanup

2019-07-01 Thread Jacques Lucke
Commit: 145e061bce65a7132fefe7dfe77ab1e8fc10d941
Author: Jacques Lucke
Date:   Mon Jul 1 17:02:26 2019 +0200
Branches: functions
https://developer.blender.org/rB145e061bce65a7132fefe7dfe77ab1e8fc10d941

minor cleanup

===

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

===

diff --git a/source/blender/simulations/bparticles/events.cpp 
b/source/blender/simulations/bparticles/events.cpp
index a8639e4f51f..2404829bbea 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -74,30 +74,42 @@ class MeshBounceEvent : public Event {
   float3 direction = 
m_ray_transform.transform_direction(position_offsets[i]);
   float length = direction.normalize_and_get_length();
 
-  BVHTreeRayHit hit;
-  hit.dist = length;
-  hit.index = -1;
-  BLI_bvhtree_ray_cast(m_treedata->tree,
-   start_position,
-   direction,
-   0.0f,
-   ,
-   m_treedata->raycast_callback,
-   (void *)m_treedata);
-
-  if (hit.index != -1) {
-float time_factor = hit.dist / length;
+  float3 hit_normal;
+  float hit_distance;
+  if (this->ray_cast(start_position, direction, length, hit_distance, 
hit_normal)) {
+float time_factor = hit_distance / length;
 auto  = interface.trigger_particle(i, time_factor);
 
-float3 normal = hit.no;
-if (float3::dot(hit.no, direction) > 0) {
-  normal.invert();
+if (float3::dot(hit_normal, direction) > 0) {
+  hit_normal.invert();
 }
-data.normal = 
m_normal_transform.transform_direction(normal).normalized();
+data.normal = 
m_normal_transform.transform_direction(hit_normal).normalized();
   }
 }
   }
 
+  bool ray_cast(float3 start,
+float3 normalized_direction,
+float max_distance,
+float _hit_distance,
+float3 _hit_normal)
+  {
+BVHTreeRayHit hit;
+hit.dist = max_distance;
+hit.index = -1;
+BLI_bvhtree_ray_cast(m_treedata->tree,
+ start,
+ normalized_direction,
+ 0.0f,
+ ,
+ m_treedata->raycast_callback,
+ (void *)m_treedata);
+
+r_hit_distance = hit.dist;
+r_hit_normal = hit.no;
+return hit.index >= 0;
+  }
+
   void execute(EventExecuteInterface ) override
   {
 ParticleSet  = interface.particles();

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


[Bf-blender-cvs] [05027c4d41b] functions: cleanup bounce code a little

2019-07-01 Thread Jacques Lucke
Commit: 05027c4d41bb623c5c6b81ef19fea878dcab9b00
Author: Jacques Lucke
Date:   Mon Jul 1 16:57:43 2019 +0200
Branches: functions
https://developer.blender.org/rB05027c4d41bb623c5c6b81ef19fea878dcab9b00

cleanup bounce code a little

===

M   source/blender/blenlib/BLI_math.hpp
M   source/blender/simulations/bparticles/events.cpp

===

diff --git a/source/blender/blenlib/BLI_math.hpp 
b/source/blender/blenlib/BLI_math.hpp
index 9ba7ea815ca..47e0d88cd03 100644
--- a/source/blender/blenlib/BLI_math.hpp
+++ b/source/blender/blenlib/BLI_math.hpp
@@ -46,10 +46,22 @@ struct float3 {
   }
 
   void reflect(float3 normal)
+  {
+*this = this->reflected(normal);
+  }
+
+  float3 reflected(float3 normal)
   {
 float3 result;
 reflect_v3_v3v3(result, *this, normal);
-*this = result;
+return result;
+  }
+
+  void invert()
+  {
+x = -x;
+y = -y;
+z = -z;
   }
 
   friend float3 operator+(float3 a, float3 b)
@@ -64,6 +76,18 @@ struct float3 {
 this->z += b.z;
   }
 
+  friend float3 operator-(float3 a, float3 b)
+  {
+return {a.x - b.x, a.y - b.y, a.z - b.z};
+  }
+
+  void operator-=(float3 b)
+  {
+this->x -= b.x;
+this->y -= b.y;
+this->z -= b.z;
+  }
+
   void operator*=(float scalar)
   {
 this->x *= scalar;
@@ -97,6 +121,11 @@ struct float3 {
 stream << "(" << v.x << ", " << v.y << ", " << v.z << ")";
 return stream;
   }
+
+  static float dot(float3 a, float3 b)
+  {
+return a.x * b.x + a.y * b.y + a.z * b.z;
+  }
 };
 
 struct float4x4 {
diff --git a/source/blender/simulations/bparticles/events.cpp 
b/source/blender/simulations/bparticles/events.cpp
index 456387fbeea..a8639e4f51f 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -88,7 +88,12 @@ class MeshBounceEvent : public Event {
   if (hit.index != -1) {
 float time_factor = hit.dist / length;
 auto  = interface.trigger_particle(i, time_factor);
-data.normal = 
m_normal_transform.transform_direction(hit.no).normalized();
+
+float3 normal = hit.no;
+if (float3::dot(hit.no, direction) > 0) {
+  normal.invert();
+}
+data.normal = 
m_normal_transform.transform_direction(normal).normalized();
   }
 }
   }
@@ -104,13 +109,24 @@ class MeshBounceEvent : public Event {
 for (uint pindex : particles.indices()) {
   auto  = interface.get_storage(pindex);
 
-  velocities[pindex].reflect(data.normal);
-  position_offsets[pindex].reflect(data.normal);
+  /* Move particle back a little bit to avoid double collision. */
+  positions[pindex] += data.normal * 0.001f;
 
-  /* Temporary solution to avoid double collision. */
-  positions[pindex] += velocities[pindex] * 0.0001f;
+  velocities[pindex] = this->bounce_direction(velocities[pindex], 
data.normal);
+  position_offsets[pindex] = 
this->bounce_direction(position_offsets[pindex], data.normal);
 }
   }
+
+  float3 bounce_direction(float3 direction, float3 normal)
+  {
+direction = direction.reflected(normal);
+
+float normal_part = float3::dot(direction, normal);
+float3 direction_normal = normal * normal_part;
+float3 direction_tangent = direction - direction_normal;
+
+return direction_normal * 0.5 + direction_tangent * 0.99;
+  }
 };
 
 EventFilter *EVENT_age_reached(float age)

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


[Bf-blender-cvs] [ad516eda2fe] functions: cleanup event handling code

2019-07-01 Thread Jacques Lucke
Commit: ad516eda2fe099bed2e1d19ebbffc9aa5dc67ddc
Author: Jacques Lucke
Date:   Mon Jul 1 15:47:56 2019 +0200
Branches: functions
https://developer.blender.org/rBad516eda2fe099bed2e1d19ebbffc9aa5dc67ddc

cleanup event handling code

===

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

===

diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 4a9045c63b7..ef477d2f67d 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -38,15 +38,26 @@ static ArrayRef static_number_range_ref(Range 
range)
 /* Events
  **/
 
-BLI_NOINLINE static void find_next_event_per_particle(ParticleSet particles,
-  AttributeArrays 
_offsets,
-  ArrayRef 
durations,
-  float end_time,
-  ArrayRef events,
-  EventStorage 
_event_storage,
-  ArrayRef 
r_next_event_indices,
-  ArrayRef 
r_time_factors_to_next_event,
-  VectorAdaptor 
_indices_with_event)
+static uint get_max_event_storage_size(ArrayRef events)
+{
+  uint max_size = 0;
+  for (Event *event : events) {
+max_size = std::max(max_size, event->storage_size());
+  }
+  return max_size;
+}
+
+BLI_NOINLINE static void find_next_event_per_particle(
+ParticleSet particles,
+AttributeArrays _offsets,
+ArrayRef durations,
+float end_time,
+ArrayRef events,
+EventStorage _event_storage,
+ArrayRef r_next_event_indices,
+ArrayRef r_time_factors_to_next_event,
+VectorAdaptor _indices_with_event,
+VectorAdaptor _particle_indices_with_event)
 {
   r_next_event_indices.fill(-1);
   r_time_factors_to_next_event.fill(1.0f);
@@ -79,6 +90,7 @@ BLI_NOINLINE static void 
find_next_event_per_particle(ParticleSet particles,
   for (uint i = 0; i < r_next_event_indices.size(); i++) {
 if (r_next_event_indices[i] != -1) {
   r_indices_with_event.append(i);
+  r_particle_indices_with_event.append(particles.get_particle_index(i));
 }
   }
 }
@@ -230,16 +242,15 @@ BLI_NOINLINE static void 
simulate_to_next_event(FixedArrayAllocator _alloc
   int *next_event_indices_array = array_allocator.allocate_array();
   float *time_factors_to_next_event_array = 
array_allocator.allocate_array();
   uint *indices_with_event_array = array_allocator.allocate_array();
+  uint *particle_indices_with_event_array = 
array_allocator.allocate_array();
 
   VectorAdaptor next_event_indices(next_event_indices_array, amount, 
amount);
   VectorAdaptor time_factors_to_next_event(
   time_factors_to_next_event_array, amount, amount);
   VectorAdaptor indices_with_event(indices_with_event_array, amount);
+  VectorAdaptor 
particle_indices_with_event(particle_indices_with_event_array, amount);
 
-  uint max_event_storage_size = 1;
-  for (Event *event : events) {
-max_event_storage_size = std::max(max_event_storage_size, 
event->storage_size());
-  }
+  uint max_event_storage_size = std::max(get_max_event_storage_size(events), 
1u);
   void *event_storage_array = 
array_allocator.allocate_array(max_event_storage_size);
   EventStorage event_storage(event_storage_array, max_event_storage_size);
 
@@ -251,19 +262,11 @@ BLI_NOINLINE static void 
simulate_to_next_event(FixedArrayAllocator _alloc
event_storage,
next_event_indices,
time_factors_to_next_event,
-   indices_with_event);
-  uint filtered_particles_amount = indices_with_event.size();
+   indices_with_event,
+   particle_indices_with_event);
 
   forward_particles_to_next_event_or_end(particles, attribute_offsets, 
time_factors_to_next_event);
 
-  uint *particle_indices_with_event_array = 
array_allocator.allocate_array();
-  VectorAdaptor particle_indices_with_event(
-  particle_indices_with_event_array, filtered_particles_amount, 
filtered_particles_amount);
-
-  for (uint i = 0; i < filtered_particles_amount; i++) {
-particle_indices_with_event[i] = 
particles.get_particle_index(indices_with_event[i]);
-  }
-
   update_remaining_attribute_offsets(indices_with_event,
  particle_indices_with_event,
  time_factors_to_next_event,

___
Bf-blender-cvs mailing list

[Bf-blender-cvs] [6ae9324ada5] functions: comment on time span

2019-07-01 Thread Jacques Lucke
Commit: 6ae9324ada597aeb896ad0daf6ec30bd431c5846
Author: Jacques Lucke
Date:   Mon Jul 1 15:40:22 2019 +0200
Branches: functions
https://developer.blender.org/rB6ae9324ada597aeb896ad0daf6ec30bd431c5846

comment on time span

===

M   source/blender/simulations/bparticles/time_span.hpp

===

diff --git a/source/blender/simulations/bparticles/time_span.hpp 
b/source/blender/simulations/bparticles/time_span.hpp
index e5c6d90a6d4..14d73ca6739 100644
--- a/source/blender/simulations/bparticles/time_span.hpp
+++ b/source/blender/simulations/bparticles/time_span.hpp
@@ -2,6 +2,10 @@
 
 namespace BParticles {
 
+/**
+ * Contains a time range defined by a start time and non-zero duration. The 
times are measured in
+ * seconds.
+ */
 struct TimeSpan {
  private:
   float m_start, m_duration;
@@ -11,26 +15,42 @@ struct TimeSpan {
   {
   }
 
+  /**
+   * Get the beginning of the time span.
+   */
   float start() const
   {
 return m_start;
   }
 
+  /**
+   * Get the duration of the time span.
+   */
   float duration() const
   {
 return m_duration;
   }
 
+  /**
+   * Get the end of the time span.
+   */
   float end() const
   {
 return m_start + m_duration;
   }
 
+  /**
+   * Compute a point in time within this time step. Usually 0 <= t <= 1.
+   */
   float interpolate(float t) const
   {
 return m_start + t * m_duration;
   }
 
+  /**
+   * The reverse of interpolate.
+   * Asserts when the duration is 0.
+   */
   float get_factor(float time) const
   {
 BLI_assert(m_duration > 0.0f);

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


[Bf-blender-cvs] [d7e2e5f99d5] functions: remove comments that are more confusing than helpful

2019-07-01 Thread Jacques Lucke
Commit: d7e2e5f99d5700a4364b11afc9606e9b29698044
Author: Jacques Lucke
Date:   Mon Jul 1 15:53:46 2019 +0200
Branches: functions
https://developer.blender.org/rBd7e2e5f99d5700a4364b11afc9606e9b29698044

remove comments that are more confusing than helpful

===

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

===

diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index ef477d2f67d..011814b8b88 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -14,9 +14,6 @@ namespace BParticles {
 
 using BLI::VectorAdaptor;
 
-/* Static Data
- **/
-
 BLI_LAZY_INIT_STATIC(SmallVector, static_number_range_vector)
 {
   return Range(0, 1).to_small_vector();
@@ -35,9 +32,6 @@ static ArrayRef static_number_range_ref(Range 
range)
   return static_number_range_ref(range.first(), range.size());
 }
 
-/* Events
- **/
-
 static uint get_max_event_storage_size(ArrayRef events)
 {
   uint max_size = 0;
@@ -223,9 +217,6 @@ BLI_NOINLINE static void execute_events(BlockAllocator 
_allocator,
   }
 }
 
-/* Step individual particles.
- **/
-
 BLI_NOINLINE static void simulate_to_next_event(FixedArrayAllocator 
_allocator,
 BlockAllocator 
_allocator,
 ParticleSet particles,
@@ -600,9 +591,6 @@ BLI_NOINLINE static void 
simulate_blocks_from_birth_to_current_time(
   USE_THREADING);
 }
 
-/* Delete particles.
- **/
-
 BLI_NOINLINE static SmallVector 
get_all_blocks(ParticlesState )
 {
   SmallVector blocks;
@@ -640,9 +628,6 @@ BLI_NOINLINE static void 
delete_tagged_particles(ParticlesState )
   USE_THREADING);
 }
 
-/* Compress particle blocks.
- **/
-
 BLI_NOINLINE static void compress_all_blocks(ParticlesContainer )
 {
   SmallVector blocks = 
particles.active_blocks().to_small_vector();
@@ -662,9 +647,6 @@ BLI_NOINLINE static void 
compress_all_containers(ParticlesState )
   }
 }
 
-/* Fix state based on description.
- */
-
 BLI_NOINLINE static void ensure_required_containers_exist(ParticlesState 
,
   StepDescription 
)
 {
@@ -721,9 +703,6 @@ BLI_NOINLINE static void 
ensure_required_attributes_exist(ParticlesState ,
   }
 }
 
-/* Main Entry Point
- **/
-
 BLI_NOINLINE static void simulate_all_existing_blocks(ParticlesState ,
   StepDescription 
_description,
   BlockAllocators 
_allocators,

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


[Bf-blender-cvs] [2cedad990a9] soc-2019-openxr: Initial HMD viewport rendering (DirectX only first)

2019-07-01 Thread Julian Eisel
Commit: 2cedad990a975185fc8a24efbd827c7fd93f650d
Author: Julian Eisel
Date:   Mon Jul 1 15:57:32 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB2cedad990a975185fc8a24efbd827c7fd93f650d

Initial HMD viewport rendering (DirectX only first)

Finally: This makes it possible to render a viewport to an HMD via
OpenXR. Pure OpenGL rendering will need some more tweaks to work.
To my great delight, performance is quite good for reasonably sized
scenes.

Had to do some hacks and marked some TODOs. Nothing too bad though.

Here are a couple of notes:
* Current initial pose is pretty useless, think it just looks downwards
  from world origin. Will change that soon.
* The rendered viewport has some issues: Too dark (bad lighting?), grid
  doesn't show up even though I told it to, lighting seems to change with
  view position/rotation, etc. Needs some polish.
* Ideally we'd just use the D3D11 Texture given to us via the OpenXR
  swapchain and blit the OpenGL framebuffer into that. However the
  NV_DX_interop extension fails doing this. Seems like this is a NVidia
  Optimus only issue, but I'm missing the hardware to confirm.
  So instead, we blit into the D3D11 back buffer first and then into the
  Texture.
* The draw-manager uses its own offscreen context so we have to get the
  render result from the draw-manager context to the VR session's
  context first. Luckily I've already added code to support blitting from
  one OpenGL context into another. But it requires blitting twice.
  Blitting should be very cheap, but still...
  Draw-manager could get a context to use passed instead.

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_IContext.h
M   intern/ghost/intern/GHOST_C-api.cpp
M   intern/ghost/intern/GHOST_Context.cpp
M   intern/ghost/intern/GHOST_Context.h
M   intern/ghost/intern/GHOST_ContextD3D.cpp
M   intern/ghost/intern/GHOST_ContextD3D.h
M   intern/ghost/intern/GHOST_ContextWGL.cpp
M   intern/ghost/intern/GHOST_IXrGraphicsBinding.h
M   intern/ghost/intern/GHOST_SystemWin32.cpp
M   intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
M   intern/ghost/intern/GHOST_XrSession.cpp
M   source/blender/draw/DRW_engine.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/windowmanager/intern/wm_draw.c
M   source/blender/windowmanager/intern/wm_surface.c
M   source/blender/windowmanager/intern/wm_xr.c
M   source/blender/windowmanager/wm_surface.h

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 3f3c25eca43..d9f9cf93bd3 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -215,6 +215,12 @@ GHOST_TSuccess 
GHOST_DisposeDirectXContext(GHOST_SystemHandle systemhandle,
 GHOST_TSuccess GHOST_BlitOpenGLOffscreenContext(GHOST_WindowHandle 
windowhandle,
 GHOST_ContextHandle 
offscreen_contexthandle);
 
+extern GHOST_TSuccess GHOST_ContextBlitOpenGLOffscreenContext(
+GHOST_ContextHandle onscreen_contexthandle,
+GHOST_ContextHandle offscreen_contexthandle,
+GHOST_TInt32 width,
+GHOST_TInt32 height);
+
 extern GHOST_ContextHandle GHOST_GetWindowContext(GHOST_WindowHandle 
windowhandle);
 
 /**
@@ -1010,6 +1016,7 @@ typedef struct {
 } GHOST_XrContextCreateInfo;
 
 typedef struct {
+  int ofsx, ofsy;
   int width, height;
 
   struct {
@@ -1030,7 +1037,10 @@ void GHOST_XrContextDestroy(struct GHOST_XrContext 
*xr_context);
 typedef void *(*GHOST_XrGraphicsContextBindFn)(GHOST_TXrGraphicsBinding 
graphics_lib);
 typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_TXrGraphicsBinding 
graphics_lib,
 void *graphics_context);
-typedef void (*GHOST_XrDrawViewFn)(const GHOST_XrDrawViewInfo *draw_view, void 
*customdata);
+/* XXX hacky: returns GHOST_ContextHandle so DirectX binding can get a handle 
to the OpenGL
+ * offscreen context. */
+typedef GHOST_ContextHandle (*GHOST_XrDrawViewFn)(const GHOST_XrDrawViewInfo 
*draw_view,
+  void *customdata);
 
 void GHOST_XrGraphicsContextBindFuncs(struct GHOST_XrContext *xr_context,
   GHOST_XrGraphicsContextBindFn bind_fn,
diff --git a/intern/ghost/GHOST_IContext.h b/intern/ghost/GHOST_IContext.h
index b83cea95404..cb6eb5fc76b 100644
--- a/intern/ghost/GHOST_IContext.h
+++ b/intern/ghost/GHOST_IContext.h
@@ -56,6 +56,10 @@ class GHOST_IContext {
*/
   virtual GHOST_TSuccess releaseDrawingContext() = 0;
 
+  virtual GHOST_TSuccess blitOpenGLOffscreenContext(class GHOST_Context 
*offscreen,
+GHOST_TInt32 width,
+  

[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [62255] trunk/lib/tests_data/: Tests: Remove tests_data folder

2019-07-01 Thread Sergey Sharybin
Revision: 62255
  https://developer.blender.org/rBL62255
Author:   sergey
Date: 2019-07-01 17:20:21 +0200 (Mon, 01 Jul 2019)
Log Message:
---
Tests: Remove tests_data folder

Initial fear of the folder growing to gigabytes didn't happen to be
so much of a truth.

For the simplicity ffmpeg tests data was moved to a regular tests
folder.

Removed Paths:
-
trunk/lib/tests_data/

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


[Bf-blender-cvs] [4749edccdda] master: Tests: Point ffmpeg data to a new folder

2019-07-01 Thread Sergey Sharybin
Commit: 4749edccddaeffdac47c9dee004b9a5a5a37e48d
Author: Sergey Sharybin
Date:   Mon Jul 1 17:18:43 2019 +0200
Branches: master
https://developer.blender.org/rB4749edccddaeffdac47c9dee004b9a5a5a37e48d

Tests: Point ffmpeg data to a new folder

===

M   tests/python/CMakeLists.txt

===

diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 52ff57c2b7e..fc59f7f2a2c 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -22,7 +22,6 @@
 set(USE_EXPERIMENTAL_TESTS FALSE)
 
 set(TEST_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests)
-set(TEST_DATA_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests_data)
 set(TEST_OUT_DIR ${CMAKE_BINARY_DIR}/tests)
 
 # ugh, any better way to do this on testing only?
@@ -648,7 +647,7 @@ if(WITH_CODEC_FFMPEG)
 ffmpeg
 ${CMAKE_CURRENT_LIST_DIR}/ffmpeg_tests.py
 --blender "$"
---testdir "${TEST_DATA_SRC_DIR}/ffmpeg"
+--testdir "${TEST_SRC_DIR}/ffmpeg"
   )
 endif()

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


[Bf-blender-cvs] [c6d073f6a4e] master: Revert "Rename operator 'Join Shapes' to 'Transfer Mix'."

2019-07-01 Thread Brecht Van Lommel
Commit: c6d073f6a4e7e455b5891359e65fdffbb74a0887
Author: Brecht Van Lommel
Date:   Mon Jul 1 16:51:00 2019 +0200
Branches: master
https://developer.blender.org/rBc6d073f6a4e7e455b5891359e65fdffbb74a0887

Revert "Rename operator 'Join Shapes' to 'Transfer Mix'."

This reverts commit 741967079c393a9eb6babd60c92a716fafa5d3e9.
We are in UI and API freeze, and this changes both.

===

M   release/scripts/startup/bl_operators/object.py
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   source/blender/editors/object/object_add.c
M   source/blender/editors/object/object_intern.h
M   source/blender/editors/object/object_ops.c

===

diff --git a/release/scripts/startup/bl_operators/object.py 
b/release/scripts/startup/bl_operators/object.py
index 3c8fb1a4274..481b101eaee 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -312,9 +312,10 @@ class SubdivisionSet(Operator):
 
 
 class ShapeTransfer(Operator):
-"""Copy the active shape key of another selected object to this one"""
+"""Copy another selected objects active shape to this one by """ \
+"""applying the relative offsets"""
 
-bl_idname = "object.shape_key_transfer_active"
+bl_idname = "object.shape_key_transfer"
 bl_label = "Transfer Shape Key"
 bl_options = {'REGISTER', 'UNDO'}
 
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 5be0a5dba37..e4fd09bb5ff 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -67,8 +67,8 @@ class MESH_MT_shape_key_context_menu(Menu):
 layout.operator("object.shape_key_mirror", 
icon='ARROW_LEFTRIGHT').use_topology = False
 layout.operator("object.shape_key_mirror", text="Mirror Shape Key 
(Topology)").use_topology = True
 layout.separator()
-layout.operator("object.shape_key_transfer_mix")
-layout.operator("object.shape_key_transfer_active")
+layout.operator("object.join_shapes")
+layout.operator("object.shape_key_transfer")
 layout.separator()
 layout.operator("object.shape_key_remove", icon='X', text="Delete All 
Shape Keys").all = True
 layout.separator()
diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/editors/object/object_add.c
index 468efc0c9d9..0fdb1cec16f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2782,10 +2782,10 @@ void OBJECT_OT_join(wmOperatorType *ot)
 /** \} */
 
 /*  */
-/** \name Transfer Mix Operator for Shape Keys
+/** \name Join as Shape Key Operator
  * \{ */
 
-static bool shape_key_transfer_mix_poll(bContext *C)
+static bool join_shapes_poll(bContext *C)
 {
   Object *ob = CTX_data_active_object(C);
 
@@ -2802,12 +2802,12 @@ static bool shape_key_transfer_mix_poll(bContext *C)
   }
 }
 
-static int shape_key_transfer_mix_exec(bContext *C, wmOperator *op)
+static int join_shapes_exec(bContext *C, wmOperator *op)
 {
   Object *ob = CTX_data_active_object(C);
 
   if (ob->mode & OB_MODE_EDIT) {
-BKE_report(op->reports, RPT_ERROR, "Shape Keys cannot be transfered in 
edit mode");
+BKE_report(op->reports, RPT_ERROR, "This data does not support joining in 
edit mode");
 return OPERATOR_CANCELLED;
   }
   else if (BKE_object_obdata_is_libdata(ob)) {
@@ -2822,16 +2822,16 @@ static int shape_key_transfer_mix_exec(bContext *C, 
wmOperator *op)
   return OPERATOR_CANCELLED;
 }
 
-void OBJECT_OT_shape_key_transfer_mix(wmOperatorType *ot)
+void OBJECT_OT_join_shapes(wmOperatorType *ot)
 {
   /* identifiers */
-  ot->name = "Transfer Mix";
-  ot->description = "Copy the current resulting shape of another selected 
object to this one";
-  ot->idname = "OBJECT_OT_shape_key_transfer_mix";
+  ot->name = "Join as Shapes";
+  ot->description = "Merge selected objects to shapes of active object";
+  ot->idname = "OBJECT_OT_join_shapes";
 
   /* api callbacks */
-  ot->exec = shape_key_transfer_mix_exec;
-  ot->poll = shape_key_transfer_mix_poll;
+  ot->exec = join_shapes_exec;
+  ot->poll = join_shapes_poll;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_intern.h 
b/source/blender/editors/object/object_intern.h
index f97a9c1b5b8..b9350052093 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -117,7 +117,7 @@ void OBJECT_OT_duplicates_make_real(struct wmOperatorType 
*ot);
 void OBJECT_OT_duplicate(struct wmOperatorType *ot);
 void OBJECT_OT_delete(struct wmOperatorType *ot);
 void OBJECT_OT_join(struct wmOperatorType *ot);
-void 

[Bf-blender-cvs] [510daea5455] master: Linux: add initial 2.80 release information in appdata

2019-07-01 Thread Brecht Van Lommel
Commit: 510daea5455ad752ba2d9c97836bbcb54c8054ce
Author: Brecht Van Lommel
Date:   Mon Jul 1 16:47:01 2019 +0200
Branches: master
https://developer.blender.org/rB510daea5455ad752ba2d9c97836bbcb54c8054ce

Linux: add initial 2.80 release information in appdata

===

M   release/freedesktop/org.blender.Blender.appdata.xml

===

diff --git a/release/freedesktop/org.blender.Blender.appdata.xml 
b/release/freedesktop/org.blender.Blender.appdata.xml
index 936d1cdf074..635d08b937d 100644
--- a/release/freedesktop/org.blender.Blender.appdata.xml
+++ b/release/freedesktop/org.blender.Blender.appdata.xml
@@ -40,6 +40,30 @@
 
 
 
+
+
+New features:
+
+Revamped user interface
+Toolbar with tools and gizmos
+Eevee - physically based realtime renderer
+Modern 3D viewport
+Full 2D animation and drawing system
+New shaders for hair, sss, volumes, bevel and AO
+Cryptomatte compositing
+Collections system for organizing objects
+glTF import and export
+
+Enhancements:
+
+Multi-object editing
+Animation and rigging improvements
+Cloth simulation improvements
+More powerful unit system
+...And many more!
+
+
+
 
 
 New features:
@@ -50,7 +74,6 @@
 Shadow catcher
 Surface Deform modifier
 More bundled add-ons
-...And many more!
 
 Enhancements:
 

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


[Bf-blender-cvs] [69b5a06823f] master: Docs: for release builds, link to specific manual version

2019-07-01 Thread Brecht Van Lommel
Commit: 69b5a06823ff00c57af8c6b5c3eeafd5fdd5f02a
Author: Brecht Van Lommel
Date:   Mon Jul 1 16:34:10 2019 +0200
Branches: master
https://developer.blender.org/rB69b5a06823ff00c57af8c6b5c3eeafd5fdd5f02a

Docs: for release builds, link to specific manual version

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_topbar.py 
b/release/scripts/startup/bl_ui/space_topbar.py
index 7afb417792c..cd0ef52e981 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -570,9 +570,14 @@ class TOPBAR_MT_help(Menu):
 
 show_developer = context.preferences.view.show_developer_ui
 
+if bpy.app.version_cycle in {'rc', 'release'}:
+manual_version = '%d.%d' % bpy.app.version[:2]
+else:
+manual_version = 'dev'
+
 layout.operator(
 "wm.url_open", text="Manual", icon='HELP',
-).url = "https://docs.blender.org/manual/en/dev/;
+).url = "https://docs.blender.org/manual/en/; + manual_version + "/"
 layout.operator(
 "wm.url_open", text="Tutorials", icon='URL',
 ).url = "https://www.blender.org/tutorials;

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


[Bf-blender-cvs] [9197462e07a] master: Revert "Fix T65798: Incorrect auto-tex space for Curves"

2019-07-01 Thread Sergey Sharybin
Commit: 9197462e07a816f9cd3d99643c4b5fbbf07063c4
Author: Sergey Sharybin
Date:   Mon Jul 1 16:45:32 2019 +0200
Branches: master
https://developer.blender.org/rB9197462e07a816f9cd3d99643c4b5fbbf07063c4

Revert "Fix T65798: Incorrect auto-tex space for Curves"

The fix broke a lot of Cycles regression tests. Reverting for now.

This reverts commit 6b9c41719bdf7514b9f9ca88e8fb09d3270cf1f2.

===

M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/mesh.c
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index 0fb6b8005d4..5945fa4bf33 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -54,7 +54,6 @@
 #include "BKE_material.h"
 
 #include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
 
 #include "CLG_log.h"
 
@@ -5432,18 +5431,8 @@ void BKE_curve_rect_from_textbox(const struct Curve *cu,
 void BKE_curve_eval_geometry(Depsgraph *depsgraph, Curve *curve)
 {
   DEG_debug_print_eval(depsgraph, __func__, curve->id.name, curve);
-  BKE_curve_texspace_calc(curve);
-  if (DEG_is_active(depsgraph)) {
-Curve *curve_orig = (Curve *)DEG_get_original_id(>id);
-BoundBox *bb = curve->bb;
-if (bb != NULL) {
-  if (curve_orig->bb == NULL) {
-curve_orig->bb = MEM_mallocN(sizeof(*curve_orig->bb), __func__);
-  }
-  *curve_orig->bb = *bb;
-  copy_v3_v3(curve_orig->loc, curve->loc);
-  copy_v3_v3(curve_orig->size, curve->size);
-}
+  if (curve->bb == NULL || (curve->bb->flag & BOUNDBOX_DIRTY)) {
+BKE_curve_texspace_calc(curve);
   }
 }
 
diff --git a/source/blender/blenkernel/intern/mesh.c 
b/source/blender/blenkernel/intern/mesh.c
index 35f96e50e3a..755a8036e8e 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -50,7 +50,6 @@
 #include "BKE_editmesh.h"
 
 #include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
 
 enum {
   MESHCMP_DVERT_WEIGHTMISMATCH = 1,
@@ -1996,7 +1995,9 @@ void BKE_mesh_split_faces(Mesh *mesh, bool 
free_loop_normals)
 void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh)
 {
   DEG_debug_print_eval(depsgraph, __func__, mesh->id.name, mesh);
-  BKE_mesh_texspace_calc(mesh);
+  if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) {
+BKE_mesh_texspace_calc(mesh);
+  }
   /* Clear autospace flag in evaluated mesh, so that texspace does not get 
recomputed when bbox is
* (e.g. after modifiers, etc.) */
   mesh->texflag &= ~ME_AUTOSPACE;
@@ -2008,16 +2009,4 @@ void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh 
*mesh)
 BKE_id_free(NULL, mesh->runtime.mesh_eval);
 mesh->runtime.mesh_eval = NULL;
   }
-  if (DEG_is_active(depsgraph)) {
-Mesh *mesh_orig = (Mesh *)DEG_get_original_id(>id);
-BoundBox *bb = mesh->bb;
-if (bb != NULL) {
-  if (mesh_orig->bb == NULL) {
-mesh_orig->bb = MEM_mallocN(sizeof(*mesh_orig->bb), __func__);
-  }
-  *mesh_orig->bb = *bb;
-  copy_v3_v3(mesh_orig->loc, mesh->loc);
-  copy_v3_v3(mesh_orig->size, mesh->size);
-}
-  }
 }
diff --git a/source/blender/makesrna/intern/rna_mesh.c 
b/source/blender/makesrna/intern/rna_mesh.c
index ba4f3c53692..c51097fc8c3 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -496,12 +496,22 @@ static int rna_Mesh_texspace_editable(PointerRNA *ptr, 
const char **UNUSED(r_inf
 static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float values[3])
 {
   Mesh *me = (Mesh *)ptr->data;
+
+  if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
+BKE_mesh_texspace_calc(me);
+  }
+
   copy_v3_v3(values, me->size);
 }
 
 static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float values[3])
 {
   Mesh *me = (Mesh *)ptr->data;
+
+  if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
+BKE_mesh_texspace_calc(me);
+  }
+
   copy_v3_v3(values, me->loc);
 }

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


[Bf-blender-cvs] [6b3e709febd] master: Theme: minor tweaks to state colors

2019-07-01 Thread Campbell Barton
Commit: 6b3e709febdffea05f139bd6fe4a54e5a351e8cc
Author: Campbell Barton
Date:   Tue Jul 2 00:35:27 2019 +1000
Branches: master
https://developer.blender.org/rB6b3e709febdffea05f139bd6fe4a54e5a351e8cc

Theme: minor tweaks to state colors

Use full saturation (since some intensity is lost when blending),
Set blend back to 0.5, made color look dull which isn't good when
some of the colors are similar (faded orange/yellow).

===

M   release/datafiles/userdef/userdef_default_theme.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 3dc0367b2f4..8611a9ae881 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -223,16 +223,16 @@ const bTheme U_theme_default = {
 },
 .wcol_state = {
   .inner_anim = RGBA(0x53992eff),
-  .inner_anim_sel = RGBA(0x5aa633ff),
+  .inner_anim_sel = RGBA(0x38a600ff),
   .inner_key = RGBA(0xb3ae36ff),
-  .inner_key_sel = RGBA(0xB29700ff),
+  .inner_key_sel = RGBA(0xb29700ff),
   .inner_driven = RGBA(0x9000ccff),
   .inner_driven_sel = RGBA(0x9900e6ff),
-  .inner_overridden = RGBA(0x19c3c300),
+  .inner_overridden = RGBA(0x00c3c300),
   .inner_overridden_sel = RGBA(0x118f8f00),
   .inner_changed = RGBA(0xcc7529ff),
-  .inner_changed_sel = RGBA(0xD26400ff),
-  .blend = 0.4f,
+  .inner_changed_sel = RGBA(0xd26400ff),
+  .blend = 0.5f,
 },
 .widget_emboss = RGBA(0x0005),
 .menu_shadow_fac = 0.3f,

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


[Bf-blender-cvs] SVN commit: /data/svn/repos/bf-blender [62254] trunk/lib/tests/ffmpeg: Add ffmpeg test data to tests

2019-07-01 Thread Sergey Sharybin
Revision: 62254
  https://developer.blender.org/rBL62254
Author:   sergey
Date: 2019-07-01 16:34:55 +0200 (Mon, 01 Jul 2019)
Log Message:
---
Add ffmpeg test data to tests

Added Paths:
---
trunk/lib/tests/ffmpeg/
trunk/lib/tests/ffmpeg/T51153_bad_clip_2.mts
trunk/lib/tests/ffmpeg/T53857_2018-01-22_15-30-49.mkv
trunk/lib/tests/ffmpeg/T54148_magn_0.mkv
trunk/lib/tests/ffmpeg/T54834.ogg

Added: trunk/lib/tests/ffmpeg/T51153_bad_clip_2.mts
===
(Binary files differ)

Index: trunk/lib/tests/ffmpeg/T51153_bad_clip_2.mts
===
--- trunk/lib/tests/ffmpeg/T51153_bad_clip_2.mts2019-06-27 17:50:57 UTC 
(rev 62253)
+++ trunk/lib/tests/ffmpeg/T51153_bad_clip_2.mts2019-07-01 14:34:55 UTC 
(rev 62254)

Property changes on: trunk/lib/tests/ffmpeg/T51153_bad_clip_2.mts
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/ffmpeg/T53857_2018-01-22_15-30-49.mkv
===
(Binary files differ)

Index: trunk/lib/tests/ffmpeg/T53857_2018-01-22_15-30-49.mkv
===
--- trunk/lib/tests/ffmpeg/T53857_2018-01-22_15-30-49.mkv   2019-06-27 
17:50:57 UTC (rev 62253)
+++ trunk/lib/tests/ffmpeg/T53857_2018-01-22_15-30-49.mkv   2019-07-01 
14:34:55 UTC (rev 62254)

Property changes on: trunk/lib/tests/ffmpeg/T53857_2018-01-22_15-30-49.mkv
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/ffmpeg/T54148_magn_0.mkv
===
(Binary files differ)

Index: trunk/lib/tests/ffmpeg/T54148_magn_0.mkv
===
--- trunk/lib/tests/ffmpeg/T54148_magn_0.mkv2019-06-27 17:50:57 UTC (rev 
62253)
+++ trunk/lib/tests/ffmpeg/T54148_magn_0.mkv2019-07-01 14:34:55 UTC (rev 
62254)

Property changes on: trunk/lib/tests/ffmpeg/T54148_magn_0.mkv
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/lib/tests/ffmpeg/T54834.ogg
===
(Binary files differ)

Index: trunk/lib/tests/ffmpeg/T54834.ogg
===
--- trunk/lib/tests/ffmpeg/T54834.ogg   2019-06-27 17:50:57 UTC (rev 62253)
+++ trunk/lib/tests/ffmpeg/T54834.ogg   2019-07-01 14:34:55 UTC (rev 62254)

Property changes on: trunk/lib/tests/ffmpeg/T54834.ogg
___
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [32d3bce1ea2] master: DRW: replace edge hash with an edge aligned bitmap

2019-07-01 Thread Campbell Barton
Commit: 32d3bce1ea27c834e56a3805ef02c733ce182077
Author: Campbell Barton
Date:   Mon Jul 1 23:20:36 2019 +1000
Branches: master
https://developer.blender.org/rB32d3bce1ea27c834e56a3805ef02c733ce182077

DRW: replace edge hash with an edge aligned bitmap

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 2490a2c8529..37bc46bc734 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -25,6 +25,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_bitmap.h"
 #include "BLI_buffer.h"
 #include "BLI_utildefines.h"
 #include "BLI_math_vector.h"
@@ -3798,6 +3799,7 @@ static void 
mesh_create_loops_lines_paint_mask(MeshRenderData *rdata, GPUIndexBu
 {
   const int loop_len = mesh_render_data_loops_len_get(rdata);
   const int poly_len = mesh_render_data_polys_len_get(rdata);
+  const int edge_len = mesh_render_data_edges_len_get(rdata);
 
   GPUIndexBufBuilder elb;
   GPU_indexbuf_init(, GPU_PRIM_LINES, loop_len, loop_len);
@@ -3807,8 +3809,8 @@ static void 
mesh_create_loops_lines_paint_mask(MeshRenderData *rdata, GPUIndexBu
 BLI_assert(0);
   }
   else {
-/* contains all edges where at least one face has been selected */
-EdgeHash *edge_hash = BLI_edgehash_new(__func__);
+/* Each edge has two bits used to count selected edges as 0, 1, 2+. */
+BLI_bitmap *edges_used = BLI_BITMAP_NEW(edge_len * 2, __func__);
 
 /* Fill the EdgeHash tables. */
 for (int poly = 0; poly < poly_len; poly++) {
@@ -3819,19 +3821,17 @@ static void 
mesh_create_loops_lines_paint_mask(MeshRenderData *rdata, GPUIndexBu
 continue;
   }
 
-  for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) {
-const MLoop *mloop = >mloop[mpoly->loopstart + loop_index];
-const MEdge *edge = (MEdge *)rdata->medge + mloop->e;
-const int v1 = edge->v1;
-const int v2 = edge->v2;
-
-void **edge_value;
-
-if (BLI_edgehash_ensure_p(edge_hash, v1, v2, _value)) {
-  *edge_value = POINTER_FROM_INT(POINTER_AS_INT(*edge_value) + 1);
+  for (int loop_index = mpoly->loopstart, loop_index_end = 
mpoly->loopstart + mpoly->totloop;
+   loop_index < loop_index_end;
+   loop_index++) {
+const MLoop *mloop = >mloop[loop_index];
+const int e_a = mloop->e * 2;
+const int e_b = e_a + 1;
+if (!BLI_BITMAP_TEST(edges_used, e_a)) {
+  BLI_BITMAP_ENABLE(edges_used, e_a);
 }
 else {
-  *edge_value = POINTER_FROM_INT(1);
+  BLI_BITMAP_ENABLE(edges_used, e_b);
 }
   }
 }
@@ -3839,21 +3839,23 @@ static void 
mesh_create_loops_lines_paint_mask(MeshRenderData *rdata, GPUIndexBu
 for (int poly = 0; poly < poly_len; poly++) {
   const MPoly *mpoly = >mpoly[poly];
   if (!(mpoly->flag & ME_HIDE)) {
-for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) {
-  const MLoop *mloop = >mloop[mpoly->loopstart + loop_index];
-  const MEdge *edge = (MEdge *)rdata->medge + mloop->e;
-  int v1 = mpoly->loopstart + loop_index;
-  int v2 = mpoly->loopstart + (loop_index + 1) % mpoly->totloop;
-
-  void *edge_value = BLI_edgehash_lookup(edge_hash, edge->v1, 
edge->v2);
-  if (edge_value == NULL || POINTER_AS_INT(edge_value) == 1) {
-GPU_indexbuf_add_line_verts(, v1, v2);
+
+for (int loop_index_next = mpoly->loopstart,
+ loop_index_end = mpoly->loopstart + mpoly->totloop,
+ loop_index_curr = loop_index_end - 1;
+ loop_index_next < loop_index_end;
+ loop_index_curr = loop_index_next++) {
+  const MLoop *mloop = >mloop[loop_index_curr];
+  const int e_a = mloop->e * 2;
+  const int e_b = e_a + 1;
+  if (BLI_BITMAP_TEST(edges_used, e_a) && !BLI_BITMAP_TEST(edges_used, 
e_b)) {
+GPU_indexbuf_add_line_verts(, loop_index_curr, 
loop_index_next);
   }
 }
   }
 }
 
-BLI_edgehash_free(edge_hash, NULL);
+MEM_freeN(edges_used);
   }
 
   GPU_indexbuf_build_in_place(, ibo);

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


[Bf-blender-cvs] [a6fe4d112ff] master: Fix: widget states had too low contrast

2019-07-01 Thread William Reynish
Commit: a6fe4d112ff48481a596cf8f8e95dad45416df8a
Author: William Reynish
Date:   Mon Jul 1 16:26:06 2019 +0200
Branches: master
https://developer.blender.org/rBa6fe4d112ff48481a596cf8f8e95dad45416df8a

Fix: widget states had too low contrast

It was very hard to read the sliders when they had states such as animated or 
changed.
Slightly increase contrast to alleviate this.

===

M   release/datafiles/userdef/userdef_default_theme.c
M   source/blender/editors/interface/interface_widgets.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index 95d27e41440..3dc0367b2f4 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -225,14 +225,14 @@ const bTheme U_theme_default = {
   .inner_anim = RGBA(0x53992eff),
   .inner_anim_sel = RGBA(0x5aa633ff),
   .inner_key = RGBA(0xb3ae36ff),
-  .inner_key_sel = RGBA(0xd7d34bff),
+  .inner_key_sel = RGBA(0xB29700ff),
   .inner_driven = RGBA(0x9000ccff),
   .inner_driven_sel = RGBA(0x9900e6ff),
   .inner_overridden = RGBA(0x19c3c300),
   .inner_overridden_sel = RGBA(0x118f8f00),
   .inner_changed = RGBA(0xcc7529ff),
-  .inner_changed_sel = RGBA(0xe6852dff),
-  .blend = 0.5f,
+  .inner_changed_sel = RGBA(0xD26400ff),
+  .blend = 0.4f,
 },
 .widget_emboss = RGBA(0x0005),
 .menu_shadow_fac = 0.3f,
diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index ec0b01d4341..0bf8247dc17 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2636,7 +2636,7 @@ static void widget_state_numslider(uiWidgetType *wt, int 
state, int drawflag)
 wt->wcol.item[0] = wt->wcol.item[1] = wt->wcol.item[2] = 
rgb_to_grayscale_byte(
 (const uchar *)wt->wcol.item);
 widget_state_blend(wt->wcol.item, color_blend, wcol_state->blend);
-rgb_ensure_contrast(wt->wcol.item, wt->wcol.inner, 20);
+rgb_ensure_contrast(wt->wcol.item, wt->wcol.inner, 30);
   }
 
   if (state & UI_SELECT) {

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


[Bf-blender-cvs] [31b2c4c10a4] master: Fix T60289: changing gizmo properties causes excessive redraws

2019-07-01 Thread Brecht Van Lommel
Commit: 31b2c4c10a413b93551ba313fd93c77698207216
Author: Brecht Van Lommel
Date:   Mon Jul 1 15:23:42 2019 +0200
Branches: master
https://developer.blender.org/rB31b2c4c10a413b93551ba313fd93c77698207216

Fix T60289: changing gizmo properties causes excessive redraws

===

M   source/blender/makesrna/intern/rna_wm_gizmo.c
M   source/blender/windowmanager/gizmo/WM_gizmo_types.h
M   source/blender/windowmanager/intern/wm_draw.c

===

diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c 
b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 41e499471ea..38b6ac9ac52 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -243,6 +243,12 @@ static void rna_Gizmo_bl_idname_set(PointerRNA *ptr, const 
char *value)
   }
 }
 
+static void rna_Gizmo_update_redraw(Main *UNUSED(bmain), Scene *UNUSED(scene), 
PointerRNA *ptr)
+{
+  wmGizmo *gizmo = ptr->data;
+  gizmo->do_draw = true;
+}
+
 static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr)
 {
 #  if 0
@@ -1123,7 +1129,7 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA 
*cprop)
   RNA_def_property_ui_text(prop, "Alpha", "");
   RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_get", 
"rna_Gizmo_alpha_set", NULL);
   RNA_def_property_range(prop, 0.0f, 1.0f);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   /* Color & Alpha (highlight) */
   prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR);
@@ -1134,28 +1140,28 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA 
*cprop)
   RNA_def_property_ui_text(prop, "Alpha", "");
   RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_hi_get", 
"rna_Gizmo_alpha_hi_set", NULL);
   RNA_def_property_range(prop, 0.0f, 1.0f);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   prop = RNA_def_property(srna, "matrix_space", PROP_FLOAT, PROP_MATRIX);
   RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_ui_text(prop, "Space Matrix", "");
   RNA_def_property_float_funcs(
   prop, "rna_Gizmo_matrix_space_get", "rna_Gizmo_matrix_space_set", NULL);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
   RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_ui_text(prop, "Basis Matrix", "");
   RNA_def_property_float_funcs(
   prop, "rna_Gizmo_matrix_basis_get", "rna_Gizmo_matrix_basis_set", NULL);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   prop = RNA_def_property(srna, "matrix_offset", PROP_FLOAT, PROP_MATRIX);
   RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_ui_text(prop, "Offset Matrix", "");
   RNA_def_property_float_funcs(
   prop, "rna_Gizmo_matrix_offset_get", "rna_Gizmo_matrix_offset_set", 
NULL);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1168,13 +1174,13 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA 
*cprop)
   RNA_def_property_float_funcs(
   prop, "rna_Gizmo_scale_basis_get", "rna_Gizmo_scale_basis_set", NULL);
   RNA_def_property_range(prop, 0.0f, FLT_MAX);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL);
   RNA_def_property_ui_text(prop, "Line Width", "");
   RNA_def_property_float_funcs(prop, "rna_Gizmo_line_width_get", 
"rna_Gizmo_line_width_set", NULL);
   RNA_def_property_range(prop, 0.0f, FLT_MAX);
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
 
   prop = RNA_def_property(srna, "select_bias", PROP_FLOAT, PROP_NONE);
   RNA_def_property_ui_text(prop, "Select Bias", "Depth bias used for 
selection");
@@ -1187,39 +1193,39 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA 
*cprop)
   prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_funcs(prop, "rna_Gizmo_flag_hide_get", 
"rna_Gizmo_flag_hide_set");
   RNA_def_property_ui_text(prop, "Hide", "");
-  RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+  RNA_def_property_update(prop, 0, "rna_Gizmo_update_redraw");
   /* WM_GIZMO_HIDDEN_SELECT */
   prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, 

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

2019-07-01 Thread Antonioya
Commit: 98e744c54990a7727c5bb41608931ff78ce08201
Author: Antonioya
Date:   Mon Jul 1 15:50:53 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB98e744c54990a7727c5bb41608931ff78ce08201

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] [bbbb5cad319] master: Fix T66277: Pinning Fluid Domain properties causes bake error

2019-07-01 Thread Philipp Oeser
Commit: 5cad319e0e2c853b089cd3e1cbb83b447f67
Author: Philipp Oeser
Date:   Mon Jul 1 15:22:50 2019 +0200
Branches: master
https://developer.blender.org/rB5cad319e0e2c853b089cd3e1cbb83b447f67

Fix T66277: Pinning Fluid Domain properties causes bake error

Reviewers: brecht

Maniphest Tasks: T66277

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

===

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

===

diff --git a/source/blender/editors/physics/physics_fluid.c 
b/source/blender/editors/physics/physics_fluid.c
index dc4ce138d9d..dc3673c972f 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -46,6 +46,7 @@
 #include "DEG_depsgraph.h"
 
 #include "ED_screen.h"
+#include "ED_object.h"
 
 #include "WM_types.h"
 #include "WM_api.h"
@@ -1216,7 +1217,7 @@ static int fluid_bake_invoke(bContext *C, wmOperator *op, 
const wmEvent *UNUSED(
 return OPERATOR_CANCELLED;
   }
 
-  if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), true)) {
+  if (!fluidsimBake(C, op->reports, ED_object_context(C), true)) {
 return OPERATOR_CANCELLED;
   }

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


[Bf-blender-cvs] [28fee762ae7] master: DRW: Fix Crash in DRW_draw_depth_object when object batch cache is not init

2019-07-01 Thread Clément Foucault
Commit: 28fee762ae7c430d60fde9eea0c7bb2dbdb3a239
Author: Clément Foucault
Date:   Mon Jul 1 15:45:16 2019 +0200
Branches: master
https://developer.blender.org/rB28fee762ae7c430d60fde9eea0c7bb2dbdb3a239

DRW: Fix Crash in DRW_draw_depth_object when object batch cache is not init

This can happen if the viewport is not redrawn before calling an operator
(frequent in python scripting).

Related to T64805

===

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

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index c4e3bd5cf91..f8672a2da37 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2590,6 +2590,8 @@ void DRW_draw_depth_object(ARegion *ar, GPUViewport 
*viewport, Object *object)
 world_clip_planes = rv3d->clip_local;
   }
 
+  drw_batch_cache_validate(object);
+
   switch (object->type) {
 case OB_MESH: {
   GPUBatch *batch;

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


[Bf-blender-cvs] [8a6a59d99ee] functions: comment on particle block

2019-07-01 Thread Jacques Lucke
Commit: 8a6a59d99ee9e2240b1061bd80c078076e71284c
Author: Jacques Lucke
Date:   Mon Jul 1 15:36:15 2019 +0200
Branches: functions
https://developer.blender.org/rB8a6a59d99ee9e2240b1061bd80c078076e71284c

comment on particle block

===

M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index 3d4c0194e9b..cb34db0e4c8 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -96,27 +96,92 @@ class ParticlesBlock {
  public:
   ParticlesBlock(ParticlesContainer , AttributeArraysCore 
_core);
 
+  /**
+   * Get the range of attribute indices that contain active particles.
+   * This will always start at 0.
+   */
   Range active_range();
+
+  /**
+   * Get the number of active particles in this block.
+   * This is also a reference, so it allows changing the number of active 
particles.
+   */
   uint _amount();
+
+  /**
+   * Get the number of inactive attribute "slots" in this block.
+   */
   uint unused_amount();
+
+  /**
+   * Return true when all attribute arrays are used entirely, otherwise false.
+   */
   bool is_full();
+
+  /**
+   * Return true when this block contains no particles currently, otherwise 
false.
+   */
   bool is_empty();
+
+  /**
+   * Return the first index that is not used currently.
+   * Asserts when the block is full.
+   */
   uint first_unused_index();
+
+  /**
+   * Return the maximum amount of particles in this block.
+   */
   uint capacity();
 
+  /**
+   * Get the container that owns this block.
+   */
   ParticlesContainer ();
 
+  /**
+   * Set the number of active particles in this block to zero.
+   */
   void clear();
 
-  AttributeArraysCore _core();
-  AttributeArrays attributes_slice(Range range);
-  AttributeArrays attributes_slice(uint start, uint length);
-  AttributeArrays attributes_all();
+  /**
+   * Get the attributes of all active particles.
+   */
   AttributeArrays attributes();
 
+  /**
+   * Get the attribute arrays owned by this block. The arrays might be longer 
than there are active
+   * particles currently.
+   */
+  AttributeArrays attributes_all();
+
+  /**
+   * Get a slice of the attribute arrays.
+   */
+  AttributeArrays attributes_slice(uint start, uint length);
+  AttributeArrays attributes_slice(Range range);
+
+  /**
+   * Get the attributes core owned by this block.
+   */
+  AttributeArraysCore _core();
+
+  /**
+   * Copy the attributes of one particle to another index in the same block.
+   */
   void move(uint old_index, uint new_index);
 
+  /**
+   * Move as many particles from the end of `from` to the end of `to` as 
possible. Either `from` is
+   * empty first, or `to` is full. Both blocks have to be owned by the same 
container.
+   */
   static void MoveUntilFull(ParticlesBlock , ParticlesBlock );
+
+  /**
+   * Try to fit all particle data into as few blocks as possible, leaving some 
empty.
+   * Afterwards there will be at most on block the is not full and not empty. 
Empty blocks are not
+   * freed by this function.
+   */
   static void Compress(ArrayRef blocks);
 };

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


[Bf-blender-cvs] [7e2418a877c] functions: rename block.size() to block.capacity()

2019-07-01 Thread Jacques Lucke
Commit: 7e2418a877ced87eb7dc9e403dddec9dfae9fc1c
Author: Jacques Lucke
Date:   Mon Jul 1 15:26:28 2019 +0200
Branches: functions
https://developer.blender.org/rB7e2418a877ced87eb7dc9e403dddec9dfae9fc1c

rename block.size() to block.capacity()

===

M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index a7bcac3144b..3d4c0194e9b 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -102,7 +102,7 @@ class ParticlesBlock {
   bool is_full();
   bool is_empty();
   uint first_unused_index();
-  uint size();
+  uint capacity();
 
   ParticlesContainer ();
 
@@ -167,12 +167,12 @@ inline uint ::active_amount()
 
 inline uint ParticlesBlock::unused_amount()
 {
-  return this->size() - m_active_amount;
+  return this->capacity() - m_active_amount;
 }
 
 inline bool ParticlesBlock::is_full()
 {
-  return m_active_amount == this->size();
+  return m_active_amount == this->capacity();
 }
 
 inline bool ParticlesBlock::is_empty()
@@ -186,7 +186,7 @@ inline uint ParticlesBlock::first_unused_index()
   return m_active_amount;
 }
 
-inline uint ParticlesBlock::size()
+inline uint ParticlesBlock::capacity()
 {
   return m_container.block_size();
 }

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


[Bf-blender-cvs] [2698544db2a] master: Fix T66262: slow preview icon loading

2019-07-01 Thread Brecht Van Lommel
Commit: 2698544db2a19436155191608e4ef13c001b8209
Author: Brecht Van Lommel
Date:   Mon Jul 1 15:23:42 2019 +0200
Branches: master
https://developer.blender.org/rB2698544db2a19436155191608e4ef13c001b8209

Fix T66262: slow preview icon loading

===

M   source/blender/draw/intern/draw_manager_shader.c
M   source/blender/editors/include/ED_render.h
M   source/blender/editors/interface/interface_icons.c
M   source/blender/editors/render/render_internal.c
M   source/blender/editors/render/render_preview.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_jobs.c

===

diff --git a/source/blender/draw/intern/draw_manager_shader.c 
b/source/blender/draw/intern/draw_manager_shader.c
index 5c3b5aa8a8e..d0aa6d55c03 100644
--- a/source/blender/draw/intern/draw_manager_shader.c
+++ b/source/blender/draw/intern/draw_manager_shader.c
@@ -202,12 +202,8 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool 
deferred)
 
   /* Get the running job or a new one if none is running. Can only have one 
job per type & owner.
*/
-  wmJob *wm_job = WM_jobs_get(wm,
-  win,
-  scene,
-  "Shaders Compilation",
-  WM_JOB_PROGRESS | WM_JOB_SUSPEND,
-  WM_JOB_TYPE_SHADER_COMPILATION);
+  wmJob *wm_job = WM_jobs_get(
+  wm, win, scene, "Shaders Compilation", WM_JOB_PROGRESS, 
WM_JOB_TYPE_SHADER_COMPILATION);
 
   DRWShaderCompiler *old_comp = (DRWShaderCompiler 
*)WM_jobs_customdata_get(wm_job);
 
@@ -238,6 +234,7 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool 
deferred)
 
   WM_jobs_customdata_set(wm_job, comp, drw_deferred_shader_compilation_free);
   WM_jobs_timer(wm_job, 0.1, NC_MATERIAL | ND_SHADING_DRAW, 0);
+  WM_jobs_delay_start(wm_job, 0.1);
   WM_jobs_callbacks(wm_job, drw_deferred_shader_compilation_exec, NULL, NULL, 
NULL);
   WM_jobs_start(wm, wm_job);
 }
@@ -252,12 +249,8 @@ void DRW_deferred_shader_remove(GPUMaterial *mat)
   continue;
 }
 for (wmWindow *win = wm->windows.first; win; win = win->next) {
-  wmJob *wm_job = WM_jobs_get(wm,
-  win,
-  scene,
-  "Shaders Compilation",
-  WM_JOB_PROGRESS | WM_JOB_SUSPEND,
-  WM_JOB_TYPE_SHADER_COMPILATION);
+  wmJob *wm_job = WM_jobs_get(
+  wm, win, scene, "Shaders Compilation", WM_JOB_PROGRESS, 
WM_JOB_TYPE_SHADER_COMPILATION);
 
   DRWShaderCompiler *comp = (DRWShaderCompiler 
*)WM_jobs_customdata_get(wm_job);
   if (comp != NULL) {
diff --git a/source/blender/editors/include/ED_render.h 
b/source/blender/editors/include/ED_render.h
index 7689a9f97cd..d36d2559f26 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -93,7 +93,8 @@ void ED_preview_icon_job(const struct bContext *C,
  struct ID *id,
  unsigned int *rect,
  int sizex,
- int sizey);
+ int sizey,
+ const bool delay);
 void ED_preview_kill_jobs(struct wmWindowManager *wm, struct Main *bmain);
 
 void ED_preview_draw(const struct bContext *C, void *idp, void *parentp, void 
*slot, rcti *rect);
diff --git a/source/blender/editors/interface/interface_icons.c 
b/source/blender/editors/interface/interface_icons.c
index 6f1f4dde1ab..59889e74230 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1417,11 +1417,13 @@ static void icon_set_image(const bContext *C,
 return;
   }
 
+  const bool delay = prv_img->rect[size] != NULL;
   icon_create_rect(prv_img, size);
 
   if (use_job) {
 /* Job (background) version */
-ED_preview_icon_job(C, prv_img, id, prv_img->rect[size], prv_img->w[size], 
prv_img->h[size]);
+ED_preview_icon_job(
+C, prv_img, id, prv_img->rect[size], prv_img->w[size], 
prv_img->h[size], delay);
   }
   else {
 if (!scene) {
diff --git a/source/blender/editors/render/render_internal.c 
b/source/blender/editors/render/render_internal.c
index 352593a15ad..9ac93f07300 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -914,7 +914,6 @@ static int screen_render_invoke(bContext *C, wmOperator 
*op, const wmEvent *even
   wmJob *wm_job;
   RenderJob *rj;
   Image *ima;
-  int jobflag;
   const bool is_animation = RNA_boolean_get(op->ptr, "animation");
   const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
   const bool use_viewport = RNA_boolean_get(op->ptr, "use_viewport");
@@ -973,12 +972,6 

[Bf-blender-cvs] [7afeb9775a1] functions: rename inactive to unused to avoid confusion

2019-07-01 Thread Jacques Lucke
Commit: 7afeb9775a18cd81bc730c6c8a3d71c039f87850
Author: Jacques Lucke
Date:   Mon Jul 1 15:25:09 2019 +0200
Branches: functions
https://developer.blender.org/rB7afeb9775a18cd81bc730c6c8a3d71c039f87850

rename inactive to unused to avoid confusion

===

M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/particles_container.cpp
M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index 758d21ed679..c80d6ddc76f 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -42,7 +42,7 @@ ParticlesBlock ::get_non_full_block(uint 
particle_type_id)
 
   uint index = 0;
   while (index < m_non_full_cache.size()) {
-if (m_non_full_cache[index]->inactive_amount() == 0) {
+if (m_non_full_cache[index]->unused_amount() == 0) {
   m_non_full_cache.remove_and_reorder(index);
   continue;
 }
@@ -68,7 +68,7 @@ void BlockAllocator::allocate_block_ranges(uint 
particle_type_id,
   while (remaining_size > 0) {
 ParticlesBlock  = this->get_non_full_block(particle_type_id);
 
-uint size_to_use = std::min(block.inactive_amount(), remaining_size);
+uint size_to_use = std::min(block.unused_amount(), remaining_size);
 Range range(block.active_amount(), block.active_amount() + 
size_to_use);
 block.active_amount() += size_to_use;
 
diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index fda84001b1e..54d2d45e70d 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -138,14 +138,15 @@ void ParticlesContainer::flatten_attribute_data(StringRef 
attribute_name, void *
 void ParticlesBlock::MoveUntilFull(ParticlesBlock , ParticlesBlock )
 {
   BLI_assert(() == ());
-  uint move_amount = MIN2(from.active_amount(), to.inactive_amount());
-  uint src_start = from.active_amount() - move_amount;
-  uint dst_start = to.next_inactive_index();
+  uint move_amount = MIN2(from.active_amount(), to.unused_amount());
 
   if (move_amount == 0) {
 return;
   }
 
+  uint src_start = from.active_amount() - move_amount;
+  uint dst_start = to.first_unused_index();
+
   uint attribute_amount = from.container().attributes_info().amount();
   for (uint i = 0; i < attribute_amount; i++) {
 void *from_buffer = from.attributes_core().get_ptr(i);
diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index 863b3244905..a7bcac3144b 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -98,10 +98,10 @@ class ParticlesBlock {
 
   Range active_range();
   uint _amount();
-  uint inactive_amount();
+  uint unused_amount();
   bool is_full();
   bool is_empty();
-  uint next_inactive_index();
+  uint first_unused_index();
   uint size();
 
   ParticlesContainer ();
@@ -165,7 +165,7 @@ inline uint ::active_amount()
   return m_active_amount;
 }
 
-inline uint ParticlesBlock::inactive_amount()
+inline uint ParticlesBlock::unused_amount()
 {
   return this->size() - m_active_amount;
 }
@@ -180,8 +180,9 @@ inline bool ParticlesBlock::is_empty()
   return m_active_amount == 0;
 }
 
-inline uint ParticlesBlock::next_inactive_index()
+inline uint ParticlesBlock::first_unused_index()
 {
+  BLI_assert(!this->is_full());
   return m_active_amount;
 }

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


[Bf-blender-cvs] [b9baffc59d3] functions: Comment on AttributeArraysCore and AttributeArrays

2019-07-01 Thread Jacques Lucke
Commit: b9baffc59d3f334940abad547c51fa91228b2c3f
Author: Jacques Lucke
Date:   Mon Jul 1 15:02:39 2019 +0200
Branches: functions
https://developer.blender.org/rBb9baffc59d3f334940abad547c51fa91228b2c3f

Comment on AttributeArraysCore and AttributeArrays

===

M   source/blender/simulations/bparticles/attributes.hpp

===

diff --git a/source/blender/simulations/bparticles/attributes.hpp 
b/source/blender/simulations/bparticles/attributes.hpp
index 5656d3c183f..06c47f81fcd 100644
--- a/source/blender/simulations/bparticles/attributes.hpp
+++ b/source/blender/simulations/bparticles/attributes.hpp
@@ -195,6 +195,18 @@ class AttributesInfo {
 
 class AttributeArrays;
 
+/**
+ * Contains a memory buffer for every attribute in an AttributesInfo object.
+ * All buffers have equal element-length but not necessarily equal byte-length.
+ *
+ * The pointers are not owned by this structure. They are passed on creation 
and have to be freed
+ * manually. This is necessary because in different contexts, it makes sense 
to allocate the
+ * buffers in different ways. Nevertheless, there are some utilities to 
simplify allocation and
+ * deallocation in common cases.
+ *
+ * Most code does not use this class directly. Instead it uses 
AttributeArrays, which is just a
+ * slice of this.
+ */
 class AttributeArraysCore {
  private:
   AttributesInfo *m_info;
@@ -205,21 +217,63 @@ class AttributeArraysCore {
   AttributeArraysCore(AttributesInfo , ArrayRef arrays, uint 
size);
   ~AttributeArraysCore();
 
+  /**
+   * Create a new instance in which the pointers are all separately allocated 
using MEM_mallocN.
+   */
   static AttributeArraysCore NewWithSeparateAllocations(AttributesInfo , 
uint size);
+  /**
+   * Free all buffers separately using MEM_freeN.
+   */
   void free_buffers();
 
+  /**
+   * Create a new instance in which all pointers are separately allocated from 
a
+   * fixed-array-allocator. No separate length has to be provided, since the 
allocator only
+   * allocates arrays of one specific length.
+   */
   static AttributeArraysCore NewWithArrayAllocator(AttributesInfo ,
FixedArrayAllocator 
);
+
+  /**
+   * Deallocate pointers in the given fixed-array-allocator.
+   */
   void deallocate_in_array_allocator(FixedArrayAllocator );
 
+  /**
+   * Get information about the stored attributes.
+   */
   AttributesInfo ();
+
+  /**
+   * Get the raw pointer to the beginning of an attribute array identified by 
an index.
+   */
   void *get_ptr(uint index);
+
+  /**
+   * Get the type of an attribute identified by an index.
+   */
   AttributeType get_type(uint index);
+
+  /**
+   * Get a slice containing everything for further processing.
+   */
   AttributeArrays slice_all();
+
+  /**
+   * Get the number of elements stored per attribute.
+   */
   uint size() const;
+
+  /**
+   * Get all raw pointers.
+   */
   ArrayRef pointers();
 };
 
+/**
+ * The main class used to interact with attributes. It represents a continuous 
slice of an
+ * AttributeArraysCore instance. So, it is very light weight and can be passed 
by value.
+ */
 class AttributeArrays {
  private:
   AttributeArraysCore _core;
@@ -228,16 +282,35 @@ class AttributeArrays {
  public:
   AttributeArrays(AttributeArraysCore , uint start, uint size);
 
+  /**
+   * Get the number of referenced elements.
+   */
   uint size() const;
+
+  /**
+   * Get information about the referenced attributes.
+   */
   AttributesInfo ();
 
+  /**
+   * Get the index of an attributed identified by a name.
+   */
   uint attribute_index(StringRef name);
 
+  /**
+   * Get the raw pointer to the buffer that contains attribute values.
+   */
   void *get_ptr(uint index) const;
 
+  /**
+   * Initialize an attribute array using its default value.
+   */
   void init_default(uint index);
   void init_default(StringRef name);
 
+  /**
+   * Get access do the underlying attribute arrays.
+   */
   ArrayRef get_byte(uint index) const;
   ArrayRef get_byte(StringRef name);
   ArrayRef get_float(uint index) const;
@@ -245,7 +318,14 @@ class AttributeArrays {
   ArrayRef get_float3(uint index) const;
   ArrayRef get_float3(StringRef name);
 
+  /**
+   * Get a continuous slice of the attribute arrays.
+   */
   AttributeArrays slice(uint start, uint size) const;
+
+  /**
+   * Create a new slice containing only the first n elements.
+   */
   AttributeArrays take_front(uint n) const;
 };

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


[Bf-blender-cvs] [ab0c7b8485e] functions: rename block.slice_all() to block.attributes_all()

2019-07-01 Thread Jacques Lucke
Commit: ab0c7b8485ed6a1861632adc34884f055d1e7102
Author: Jacques Lucke
Date:   Mon Jul 1 15:19:24 2019 +0200
Branches: functions
https://developer.blender.org/rBab0c7b8485ed6a1861632adc34884f055d1e7102

rename block.slice_all() to block.attributes_all()

===

M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index 1d3fd648271..bb1b894d504 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -212,7 +212,8 @@ void EmitTargetBase::fill_elements(uint index, void *value)
   for (uint part = 0; part < m_ranges.size(); part++) {
 ParticlesBlock  = *m_blocks[part];
 
-void *dst = block.slice_all().get_ptr(index);
+/* TODO(jacques): Check if this is correct. */
+void *dst = block.attributes_all().get_ptr(index);
 for (uint i : m_ranges[part]) {
   memcpy(POINTER_OFFSET(dst, element_size * i), value, element_size);
 }
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index ac6e913de64..3d1a54492ca 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -745,7 +745,7 @@ inline ParticlesBlock ::block()
 
 inline AttributeArrays ParticleSet::attributes()
 {
-  return m_block->slice_all();
+  return m_block->attributes();
 }
 
 inline ArrayRef ParticleSet::indices()
diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index fbda6653be2..46d9458b153 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -111,7 +111,7 @@ class ParticlesBlock {
   AttributeArraysCore _core();
   AttributeArrays slice(Range range);
   AttributeArrays slice(uint start, uint length);
-  AttributeArrays slice_all();
+  AttributeArrays attributes_all();
   AttributeArrays attributes();
 
   void move(uint old_index, uint new_index);
@@ -213,7 +213,7 @@ inline AttributeArrays ParticlesBlock::slice(uint start, 
uint length)
   return m_attributes_core.slice_all().slice(start, length);
 }
 
-inline AttributeArrays ParticlesBlock::slice_all()
+inline AttributeArrays ParticlesBlock::attributes_all()
 {
   return m_attributes_core.slice_all();
 }
@@ -231,7 +231,7 @@ inline AttributeArraysCore 
::attributes_core()
 inline void ParticlesBlock::move(uint old_index, uint new_index)
 {
   AttributesInfo  = m_container.attributes_info();
-  AttributeArrays arrays = this->slice_all();
+  AttributeArrays arrays = this->attributes_all();
 
   for (uint i : attributes.byte_attributes()) {
 auto buffer = arrays.get_byte(i);

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


[Bf-blender-cvs] [f67bb0ad35b] functions: rename block.slice_active() to block.attributes()

2019-07-01 Thread Jacques Lucke
Commit: f67bb0ad35bcaba97b7d756740f9c2c773c5
Author: Jacques Lucke
Date:   Mon Jul 1 15:16:12 2019 +0200
Branches: functions
https://developer.blender.org/rBf67bb0ad35bcaba97b7d756740f9c2c773c5

rename block.slice_active() to block.attributes()

===

M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/forces.cpp
M   source/blender/simulations/bparticles/particles_container.cpp
M   source/blender/simulations/bparticles/particles_container.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index de724bb5560..3d517e6b416 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -89,7 +89,7 @@ class EulerIntegrator : public Integrator {
 SmallVector combined_force(amount);
 this->compute_combined_force(block, combined_force);
 
-auto last_velocities = block.slice_active().get_float3("Velocity");
+auto last_velocities = block.attributes().get_float3("Velocity");
 
 auto position_offsets = r_offsets.get_float3("Position");
 auto velocity_offsets = r_offsets.get_float3("Velocity");
@@ -332,7 +332,7 @@ Mesh *BParticles_test_mesh_from_state(BParticlesState 
state_c)
   uint type_index = 0;
   for (ParticlesContainer *container : state.particle_containers().values()) {
 for (ParticlesBlock *block : container->active_blocks()) {
-  AttributeArrays attributes = block->slice_active();
+  AttributeArrays attributes = block->attributes();
   auto positions = attributes.get_float3("Position");
 
   for (uint pindex = 0; pindex < attributes.size(); pindex++) {
diff --git a/source/blender/simulations/bparticles/forces.cpp 
b/source/blender/simulations/bparticles/forces.cpp
index c0d60dd4868..ea5fc83a79b 100644
--- a/source/blender/simulations/bparticles/forces.cpp
+++ b/source/blender/simulations/bparticles/forces.cpp
@@ -36,7 +36,7 @@ class TurbulenceForce : public BParticles::Force {
 
   void add_force(ParticlesBlock , ArrayRef r_force) override
   {
-auto positions = block.slice_active().get_float3("Position");
+auto positions = block.attributes().get_float3("Position");
 
 for (uint pindex = 0; pindex < block.active_amount(); pindex++) {
   float3 pos = positions[pindex];
diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index 0b087742eff..fda84001b1e 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -129,7 +129,7 @@ void ParticlesContainer::flatten_attribute_data(StringRef 
attribute_name, void *
   uint offset = 0;
   for (ParticlesBlock *block : m_blocks) {
 uint amount = block->active_amount();
-void *src = block->slice_active().get_ptr(attribute_index);
+void *src = block->attributes().get_ptr(attribute_index);
 memcpy(POINTER_OFFSET(dst, offset), src, amount * element_size);
 offset += amount * element_size;
   }
diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index f9e16ae3ede..fbda6653be2 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -112,7 +112,7 @@ class ParticlesBlock {
   AttributeArrays slice(Range range);
   AttributeArrays slice(uint start, uint length);
   AttributeArrays slice_all();
-  AttributeArrays slice_active();
+  AttributeArrays attributes();
 
   void move(uint old_index, uint new_index);
 
@@ -218,7 +218,7 @@ inline AttributeArrays ParticlesBlock::slice_all()
   return m_attributes_core.slice_all();
 }
 
-inline AttributeArrays ParticlesBlock::slice_active()
+inline AttributeArrays ParticlesBlock::attributes()
 {
   return this->slice(0, m_active_amount);
 }
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 3ad36b23d75..4a9045c63b7 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -577,7 +577,7 @@ BLI_NOINLINE static void 
simulate_blocks_from_birth_to_current_time(
 
 uint active_amount = block->active_amount();
 SmallVector durations(active_amount);
-auto birth_times = block->slice_active().get_float("Birth Time");
+auto birth_times = block->attributes().get_float("Birth Time");
 for (uint i = 0; i < active_amount; i++) {
   durations[i] = end_time - birth_times[i];
 }
@@ -613,7 +613,7 @@ BLI_NOINLINE static SmallVector 

[Bf-blender-cvs] [f52ff92cc39] functions: rename block.slice() to block.attributes_slice()

2019-07-01 Thread Jacques Lucke
Commit: f52ff92cc395f1c2c98cd0733be9ba6f78496bb0
Author: Jacques Lucke
Date:   Mon Jul 1 15:21:01 2019 +0200
Branches: functions
https://developer.blender.org/rBf52ff92cc395f1c2c98cd0733be9ba6f78496bb0

rename block.slice() to block.attributes_slice()

===

M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index bb1b894d504..758d21ed679 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -75,7 +75,7 @@ void BlockAllocator::allocate_block_ranges(uint 
particle_type_id,
 r_blocks.append();
 r_ranges.append(range);
 
-AttributeArrays attributes = block.slice(range);
+AttributeArrays attributes = block.attributes_slice(range);
 for (uint i : attributes.info().attribute_indices()) {
   attributes.init_default(i);
 }
@@ -195,7 +195,7 @@ void EmitTargetBase::set_elements(uint index, void *data)
 ParticlesBlock  = *m_blocks[part];
 Range range = m_ranges[part];
 
-AttributeArrays attributes = block.slice(range);
+AttributeArrays attributes = block.attributes_slice(range);
 void *dst = attributes.get_ptr(index);
 uint bytes_to_copy = element_size * attributes.size();
 memcpy(dst, remaining_data, bytes_to_copy);
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 3d1a54492ca..e7f909e215c 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -704,7 +704,7 @@ inline uint EmitTargetBase::part_amount()
 
 inline AttributeArrays EmitTargetBase::attributes(uint part)
 {
-  return m_blocks[part]->slice(m_ranges[part]);
+  return m_blocks[part]->attributes_slice(m_ranges[part]);
 }
 
 inline uint EmitTargetBase::particle_type_id()
diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index 46d9458b153..863b3244905 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -109,8 +109,8 @@ class ParticlesBlock {
   void clear();
 
   AttributeArraysCore _core();
-  AttributeArrays slice(Range range);
-  AttributeArrays slice(uint start, uint length);
+  AttributeArrays attributes_slice(Range range);
+  AttributeArrays attributes_slice(uint start, uint length);
   AttributeArrays attributes_all();
   AttributeArrays attributes();
 
@@ -200,15 +200,15 @@ inline ParticlesContainer ::container()
   return m_container;
 }
 
-inline AttributeArrays ParticlesBlock::slice(Range range)
+inline AttributeArrays ParticlesBlock::attributes_slice(Range range)
 {
   if (range.size() == 0) {
-return this->slice(0, 0);
+return this->attributes_slice(0, 0);
   }
-  return this->slice(range.first(), range.size());
+  return this->attributes_slice(range.first(), range.size());
 }
 
-inline AttributeArrays ParticlesBlock::slice(uint start, uint length)
+inline AttributeArrays ParticlesBlock::attributes_slice(uint start, uint 
length)
 {
   return m_attributes_core.slice_all().slice(start, length);
 }
@@ -220,7 +220,7 @@ inline AttributeArrays ParticlesBlock::attributes_all()
 
 inline AttributeArrays ParticlesBlock::attributes()
 {
-  return this->slice(0, m_active_amount);
+  return this->attributes_slice(0, m_active_amount);
 }
 
 inline AttributeArraysCore ::attributes_core()

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


[Bf-blender-cvs] [c74de0c2e9a] functions: comment on particles container

2019-07-01 Thread Jacques Lucke
Commit: c74de0c2e9a73253f8e9c71500983e739fcc6a8e
Author: Jacques Lucke
Date:   Mon Jul 1 15:14:39 2019 +0200
Branches: functions
https://developer.blender.org/rBc74de0c2e9a73253f8e9c71500983e739fcc6a8e

comment on particles container

===

M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index 8e9cec92ef3..f9e16ae3ede 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -2,28 +2,26 @@
 
 #include 
 
-#include "BLI_array_ref.hpp"
-#include "BLI_small_vector.hpp"
-#include "BLI_small_set_vector.hpp"
-#include "BLI_math.hpp"
-#include "BLI_string_ref.hpp"
 #include "BLI_small_map.hpp"
 
 #include "attributes.hpp"
 
 namespace BParticles {
 
-using BLI::ArrayRef;
-using BLI::float3;
 using BLI::SmallMap;
 using BLI::SmallSet;
-using BLI::SmallSetVector;
-using BLI::SmallVector;
-using BLI::StringRef;
 
 class ParticlesContainer;
 class ParticlesBlock;
 
+/**
+ * A dynamic data structure that can data for an arbitrary amount of 
particles. All particles in
+ * one container must have the same set of attributes.
+ *
+ * Particles are not stored in the container directly. Instead the container 
contains multiple
+ * blocks, each of which can contain a fixed amount of particles. The number 
of blocks can change
+ * dynamically.
+ */
 class ParticlesContainer {
  private:
   AttributesInfo m_attributes_info;
@@ -36,22 +34,58 @@ class ParticlesContainer {
 
   ~ParticlesContainer();
 
+  /**
+   * Get the maximum number of particles that can fit into the blocks.
+   */
   uint block_size() const;
+
+  /**
+   * Get the number of particles in this container. For that it is necessary 
to iterate over all
+   * blocks.
+   */
   uint count_active() const;
 
+  /**
+   * Get information about the attributes of the particles.
+   */
   AttributesInfo _info();
+
+  /**
+   * Change the set of attributes. This can involve many allocations and 
deallocations of attribute
+   * buffers.
+   */
   void update_attributes(AttributesInfo new_info);
 
+  /**
+   * Get a read-only buffer of all the blocks currently in use.
+   */
   const SmallSet _blocks();
 
+  /**
+   * Create a new block in this container. It safe to call this function from 
separate threads at
+   * the same time.
+   */
   ParticlesBlock _block();
+
+  /**
+   * Destroy a block. The block must have been created in this container 
before. It is safe to call
+   * this function separate threads at the same time.
+   */
   void release_block(ParticlesBlock );
 
+  /**
+   * Gather an attribute value from all particles in this container and write 
them into the given
+   * buffer.
+   */
   void flatten_attribute_data(StringRef attribute_name, void *dst);
 
   friend bool operator==(const ParticlesContainer , const ParticlesContainer 
);
 };
 
+/**
+ * A block can hold up to a fixed amount of particles. Every block is owned by 
exactly one
+ * particles container. All active particles are at the beginning of the block.
+ */
 class ParticlesBlock {
   ParticlesContainer _container;
   AttributeArraysCore m_attributes_core;

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


[Bf-blender-cvs] [eb3fc2c23ac] functions: comments for AttributeInfo

2019-07-01 Thread Jacques Lucke
Commit: eb3fc2c23ac283ace019c1391092b0e723deb4ce
Author: Jacques Lucke
Date:   Mon Jul 1 14:48:27 2019 +0200
Branches: functions
https://developer.blender.org/rBeb3fc2c23ac283ace019c1391092b0e723deb4ce

comments for AttributeInfo

===

M   source/blender/simulations/bparticles/attributes.hpp

===

diff --git a/source/blender/simulations/bparticles/attributes.hpp 
b/source/blender/simulations/bparticles/attributes.hpp
index ef46c3c1102..5656d3c183f 100644
--- a/source/blender/simulations/bparticles/attributes.hpp
+++ b/source/blender/simulations/bparticles/attributes.hpp
@@ -21,12 +21,21 @@ using BLI::SmallVector;
 using BLI::StringRef;
 using BLI::StringRefNull;
 
+/**
+ * Possible types of attributes. All types are expected to be POD (plain old 
data).
+ * New types can be added when necessary.
+ */
 enum AttributeType {
   Byte,
   Float,
   Float3,
 };
 
+/**
+ * Get the size of an attribute type.
+ *
+ * TODO(jacques): Figure out how to make type.size() work nicely instead.
+ */
 inline uint size_of_attribute_type(AttributeType type)
 {
   switch (type) {
@@ -42,6 +51,14 @@ inline uint size_of_attribute_type(AttributeType type)
   };
 }
 
+/**
+ * Contains information about a set of attributes. Every attribute is 
identified by a unique name
+ * and a unique index. So two attributes of different types have to have 
different names.
+ *
+ * The attributes are sorted such that attributes with the same type have 
consecutive indices.
+ *
+ * Furthermore, every attribute has a default value.
+ */
 class AttributesInfo {
  private:
   Range m_byte_attributes;
@@ -60,31 +77,54 @@ class AttributesInfo {
  ArrayRef float_names,
  ArrayRef float3_names);
 
+  /**
+   * Get the number of different attributes.
+   */
   uint amount() const
   {
 return m_indices.size();
   }
 
+  /**
+   * Get the attribute name that corresponds to an index.
+   * Asserts when the index is too large.
+   */
   StringRefNull name_of(uint index) const
   {
 return m_indices[index];
   }
 
+  /**
+   * Get the type of an attribute identified by its index.
+   * Asserts when the index is too large.
+   */
   AttributeType type_of(uint index) const
   {
 return m_types[index];
   }
 
+  /**
+   * Get the types of all attributes. The index into the array is the index of 
the corresponding
+   * attribute.
+   */
   ArrayRef types() const
   {
 return m_types;
   }
 
+  /**
+   * Get the index corresponding to an attribute name.
+   * Returns -1 when the attribute does not exist.
+   */
   int attribute_index_try(StringRef name) const
   {
 return m_indices.index(name.to_std_string());
   }
 
+  /**
+   * Get the index corresponding to an attribute name.
+   * Asserts when the attribute does not exist.
+   */
   uint attribute_index(StringRef name) const
   {
 int index = this->attribute_index_try(name);
@@ -92,26 +132,42 @@ class AttributesInfo {
 return (uint)index;
   }
 
+  /**
+   * Get a range with all attribute indices.
+   * The range will start at 0.
+   */
   Range attribute_indices() const
   {
 return Range(0, m_indices.size());
   }
 
+  /**
+   * Get a range with all byte attribute indices.
+   */
   Range byte_attributes() const
   {
 return m_byte_attributes;
   }
 
+  /**
+   * Get a range with all float attribute indices.
+   */
   Range float_attributes() const
   {
 return m_float_attributes;
   }
 
+  /**
+   * Get a range with all float3 attribute indices.
+   */
   Range float3_attributes() const
   {
 return m_float3_attributes;
   }
 
+  /**
+   * Get a pointer to the default value of an attribute.
+   */
   void *default_value_ptr(uint index) const
   {
 BLI_assert(index < m_indices.size());
@@ -128,6 +184,9 @@ class AttributesInfo {
 return nullptr;
   }
 
+  /**
+   * Don't do a deep comparison for now. This might change later.
+   */
   friend bool operator==(const AttributesInfo , const AttributesInfo )
   {
 return  == 

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


[Bf-blender-cvs] [0de90d6f882] functions: make sure event data is not overwritten by later events

2019-07-01 Thread Jacques Lucke
Commit: 0de90d6f8821091f097c59699ab36b528fdda01f
Author: Jacques Lucke
Date:   Mon Jul 1 14:01:06 2019 +0200
Branches: functions
https://developer.blender.org/rB0de90d6f8821091f097c59699ab36b528fdda01f

make sure event data is not overwritten by later events

===

M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index e6609f863bf..1d3fd648271 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -310,6 +310,7 @@ EventFilterInterface::EventFilterInterface(ParticleSet 
particles,
AttributeArrays _offsets,
ArrayRef durations,
float end_time,
+   ArrayRef 
known_min_time_factors,
EventStorage _event_storage,
SmallVector 
_filtered_indices,
SmallVector 
_filtered_time_factors)
@@ -317,6 +318,7 @@ EventFilterInterface::EventFilterInterface(ParticleSet 
particles,
   m_attribute_offsets(attribute_offsets),
   m_durations(durations),
   m_end_time(end_time),
+  m_known_min_time_factors(known_min_time_factors),
   m_event_storage(r_event_storage),
   m_filtered_indices(r_filtered_indices),
   m_filtered_time_factors(r_filtered_time_factors)
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 9e74e11016e..ac6e913de64 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -464,16 +464,21 @@ class EventFilterInterface {
   AttributeArrays _attribute_offsets;
   ArrayRef m_durations;
   float m_end_time;
+  ArrayRef m_known_min_time_factors;
 
   EventStorage _event_storage;
   SmallVector _filtered_indices;
   SmallVector _filtered_time_factors;
 
+  /* Size can be increased when necessary. */
+  char m_dummy_event_storage[64];
+
  public:
   EventFilterInterface(ParticleSet particles,
AttributeArrays _offsets,
ArrayRef durations,
float end_time,
+   ArrayRef known_min_time_factors,
EventStorage _event_storage,
SmallVector _filtered_indices,
SmallVector _filtered_time_factors);
@@ -510,8 +515,9 @@ class EventFilterInterface {
   void trigger_particle(uint index, float time_factor);
 
   /**
-   * Same as above but returns a pointer to a struct that can be used to pass 
data to the execute
-   * function.
+   * Same as above but returns a reference to a struct that can be used to 
pass data to the execute
+   * function. The reference might point to a dummy buffer when the 
time_factor is after a known
+   * other event.
*/
   template T _particle(uint index, float time_factor);
 };
@@ -822,15 +828,23 @@ inline float EventFilterInterface::end_time()
 
 inline void EventFilterInterface::trigger_particle(uint index, float 
time_factor)
 {
-  m_filtered_indices.append(index);
-  m_filtered_time_factors.append(time_factor);
+  if (time_factor <= m_known_min_time_factors[index]) {
+m_filtered_indices.append(index);
+m_filtered_time_factors.append(time_factor);
+  }
 }
 
 template
 inline T ::trigger_particle(uint index, float time_factor)
 {
-  this->trigger_particle(index, time_factor);
-  return m_event_storage.get(m_particles.get_particle_index(index));
+  BLI_assert(sizeof(T) <= sizeof(m_dummy_event_storage));
+  if (time_factor <= m_known_min_time_factors[index]) {
+this->trigger_particle(index, time_factor);
+return m_event_storage.get(m_particles.get_particle_index(index));
+  }
+  else {
+return *(T *)m_dummy_event_storage;
+  }
 }
 
 /* EventExecuteInterface inline functions
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index bdf032c0d10..3ad36b23d75 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -55,13 +55,12 @@ BLI_NOINLINE static void 
find_next_event_per_particle(ParticleSet particles,
 SmallVector triggered_indices;
 SmallVector triggered_time_factors;
 
-/* TODO: make sure that one event does not override the storage of another,
- * if it comes later. */
 Event *event = events[event_index];
 EventFilterInterface interface(particles,
attribute_offsets,
  

[Bf-blender-cvs] [468e2b8e66a] functions: cleanup extracting all particle positions

2019-07-01 Thread Jacques Lucke
Commit: 468e2b8e66a23df1f92887535d84191c532e8e31
Author: Jacques Lucke
Date:   Mon Jul 1 14:14:02 2019 +0200
Branches: functions
https://developer.blender.org/rB468e2b8e66a23df1f92887535d84191c532e8e31

cleanup extracting all particle positions

===

M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/particles_container.cpp
M   source/blender/simulations/bparticles/particles_container.hpp

===

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index b229efae25e..de724bb5560 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -222,7 +222,7 @@ void BParticles_simulate_modifier(NodeParticlesModifierData 
*npmd,
   Depsgraph *UNUSED(depsgraph),
   BParticlesState state_c)
 {
-  SCOPED_TIMER_STATS("simulate");
+  SCOPED_TIMER(__func__);
 
   ParticlesState  = *unwrap(state_c);
   ModifierStepDescription description;
@@ -276,16 +276,13 @@ uint BParticles_state_particle_count(BParticlesState 
state_c)
 
 void BParticles_state_get_positions(BParticlesState state_c, float (*dst_c)[3])
 {
+  SCOPED_TIMER(__func__);
   ParticlesState  = *unwrap(state_c);
-  float3 *dst = (float3 *)dst_c;
 
   uint index = 0;
   for (ParticlesContainer *container : state.particle_containers().values()) {
-for (auto *block : container->active_blocks()) {
-  auto positions = block->slice_active().get_float3("Position");
-  positions.copy_to(dst + index);
-  index += positions.size();
-}
+container->flatten_attribute_data("Position", dst_c + index);
+index += container->count_active();
   }
 }
 
diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index 50b78b51506..0b087742eff 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -121,6 +121,20 @@ void ParticlesContainer::update_attributes(AttributesInfo 
new_info)
   }
 }
 
+void ParticlesContainer::flatten_attribute_data(StringRef attribute_name, void 
*dst)
+{
+  uint attribute_index = m_attributes_info.attribute_index(attribute_name);
+  uint element_size = 
size_of_attribute_type(m_attributes_info.type_of(attribute_index));
+
+  uint offset = 0;
+  for (ParticlesBlock *block : m_blocks) {
+uint amount = block->active_amount();
+void *src = block->slice_active().get_ptr(attribute_index);
+memcpy(POINTER_OFFSET(dst, offset), src, amount * element_size);
+offset += amount * element_size;
+  }
+}
+
 void ParticlesBlock::MoveUntilFull(ParticlesBlock , ParticlesBlock )
 {
   BLI_assert(() == ());
diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index 2c5c7264a3b..8e9cec92ef3 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -47,6 +47,8 @@ class ParticlesContainer {
   ParticlesBlock _block();
   void release_block(ParticlesBlock );
 
+  void flatten_attribute_data(StringRef attribute_name, void *dst);
+
   friend bool operator==(const ParticlesContainer , const ParticlesContainer 
);
 };

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


[Bf-blender-cvs] [3c6260d42de] master: Fix T66301: Crash on vertex slide when the vertex is not linked to a face.

2019-07-01 Thread mano-wii
Commit: 3c6260d42de007c223c4bdb1bc8ed5431f2f2963
Author: mano-wii
Date:   Mon Jul 1 10:26:37 2019 -0300
Branches: master
https://developer.blender.org/rB3c6260d42de007c223c4bdb1bc8ed5431f2f2963

Fix T66301: Crash on vertex slide when the vertex is not linked to a face.

===

M   source/blender/editors/transform/transform.c

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 5b3f7d85b43..22900ee3787 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -6440,6 +6440,8 @@ static void slide_origdata_create_data(TransDataContainer 
*tc,
 
 layer_index_dst = 0;
 
+/* TODO: We don't need `sod->layer_math_map` when there are no loops linked
+ * to one of the sliding vertices. */
 if (CustomData_has_math(>ldata)) {
   /* over alloc, only 'math' layers are indexed */
   sod->layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), 
__func__);
@@ -6583,7 +6585,7 @@ static void slide_origdata_interp_data_vert(SlideOrigData 
*sod,
 }
   }
 
-  if (sod->layer_math_map_num) {
+  if (sod->layer_math_map_num && sv->cd_loop_groups) {
 if (do_loop_weight) {
   for (j = 0; j < sod->layer_math_map_num; j++) {
 BM_vert_loop_groups_data_layer_merge_weights(

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


[Bf-blender-cvs] [7a4c99de5a6] master: Fix T66292: Alpha Blend transparency glitches with volume

2019-07-01 Thread Clément Foucault
Commit: 7a4c99de5a637c87c03151cd671b347590140c17
Author: Clément Foucault
Date:   Mon Jul 1 14:43:44 2019 +0200
Branches: master
https://developer.blender.org/rB7a4c99de5a637c87c03151cd671b347590140c17

Fix T66292: Alpha Blend transparency glitches with volume

===

M   source/blender/draw/engines/eevee/eevee_private.h
M   source/blender/draw/engines/eevee/eevee_volumes.c
M   source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
M   source/blender/draw/engines/eevee/shaders/volumetric_resolve_frag.glsl

===

diff --git a/source/blender/draw/engines/eevee/eevee_private.h 
b/source/blender/draw/engines/eevee/eevee_private.h
index 166e8ac7473..152b8fa5d0a 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -653,11 +653,11 @@ typedef struct EEVEE_CommonUniformBuffer {
   float ao_offset, ao_bounce_fac, ao_quality, ao_settings; /* vec4 */
   /* Volumetric */
   /* -- 16 byte aligned -- */
-  int vol_tex_size[3], pad3; /* ivec3 */
-  float vol_depth_param[3], pad4;/* vec3 */
-  float vol_inv_tex_size[3], pad5;   /* vec3 */
-  float vol_jitter[3], pad6; /* vec3 */
-  float vol_coord_scale[2], pad7[2]; /* vec2 */
+  int vol_tex_size[3], pad3;   /* ivec3 */
+  float vol_depth_param[3], pad4;  /* vec3 */
+  float vol_inv_tex_size[3], pad5; /* vec3 */
+  float vol_jitter[3], pad6;   /* vec3 */
+  float vol_coord_scale[4];/* vec4 */
   /* -- 16 byte aligned -- */
   float vol_history_alpha; /* float */
   float vol_light_clamp;   /* float */
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c 
b/source/blender/draw/engines/eevee/eevee_volumes.c
index 9c8ec6e52a4..f85c30044a9 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -178,6 +178,8 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, 
EEVEE_Data *vedata)
 
   common_data->vol_coord_scale[0] = viewport_size[0] / (float)(tile_size * 
tex_size[0]);
   common_data->vol_coord_scale[1] = viewport_size[1] / (float)(tile_size * 
tex_size[1]);
+  common_data->vol_coord_scale[2] = 1.0f / viewport_size[0];
+  common_data->vol_coord_scale[3] = 1.0f / viewport_size[1];
 
   /* TODO compute snap to maxZBuffer for clustered rendering */
   if ((common_data->vol_tex_size[0] != tex_size[0]) ||
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl 
b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
index 3a31afc0224..274269846bc 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -915,8 +915,7 @@ void main()
 #endif
 
 #if defined(USE_ALPHA_BLEND)
-  /* XXX fragile, better use real viewport resolution */
-  vec2 uvs = gl_FragCoord.xy / vec2(2 * textureSize(maxzBuffer, 0).xy);
+  vec2 uvs = gl_FragCoord.xy * volCoordScale.zw;
   vec3 transmittance, scattering;
   volumetric_resolve(uvs, gl_FragCoord.z, transmittance, scattering);
   fragColor.rgb = cl.radiance * transmittance + scattering;
diff --git 
a/source/blender/draw/engines/eevee/shaders/volumetric_resolve_frag.glsl 
b/source/blender/draw/engines/eevee/shaders/volumetric_resolve_frag.glsl
index 757eb59eaa1..1ff7e848c40 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_resolve_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_resolve_frag.glsl
@@ -2,9 +2,7 @@
 /* Based on Frosbite Unified Volumetric.
  * 
https://www.ea.com/frostbite/news/physically-based-unified-volumetric-rendering-in-frostbite
 */
 
-/* Step 4 : Apply final integration on top of the scene color.
- * Note that we do the blending ourself instead of relying
- * on hardware blending which would require 2 pass. */
+/* Step 4 : Apply final integration on top of the scene color. */
 
 uniform sampler2D inSceneDepth;

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


[Bf-blender-cvs] [809f81cc3a8] master: Fix T66207: Invalid depsgraph relation when driver uses object dimension

2019-07-01 Thread Sergey Sharybin
Commit: 809f81cc3a821cb708b918e84e856cb6ae765e38
Author: Sergey Sharybin
Date:   Mon Jul 1 14:33:49 2019 +0200
Branches: master
https://developer.blender.org/rB809f81cc3a821cb708b918e84e856cb6ae765e38

Fix T66207: Invalid depsgraph relation when driver uses object dimension

Would be nice to find a more proper and generic solution instead of name
based comparison, but can not really think a nice way to go currently.

===

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

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
index a8d357cd5bd..5bb3ebf40c4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -314,6 +314,10 @@ RNANodeIdentifier 
RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
 node_identifier.type = NodeType::OBJECT_FROM_LAYER;
 return node_identifier;
   }
+  else if (STREQ(prop_identifier, "dimensions")) {
+node_identifier.type = NodeType::GEOMETRY;
+return node_identifier;
+  }
 }
   }
   else if (ptr->type == _ShapeKey) {

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


[Bf-blender-cvs] [aa111b0b919] soc-2019-npr: Gpencil: Stroke stretch function use copy instead of directly assign.

2019-07-01 Thread YimingWu
Commit: aa111b0b9196141dab369a3b582ca439d157357c
Author: YimingWu
Date:   Mon Jul 1 19:51:58 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBaa111b0b9196141dab369a3b582ca439d157357c

Gpencil: Stroke stretch function use copy instead of directly assign.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 43eee8ec2de..cccd21a0696 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1708,8 +1708,13 @@ bool BKE_gpencil_stretch_stroke(bGPDstroke *gps, float 
dist)
   float len2 = len_v3v3(_pt->x, _last->x);
   float extend2 = (len2 + dist) / len2;
 
-  interp_v3_v3v3(>x, _pt->x, >x, extend1);
-  interp_v3_v3v3(_pt->x, _last->x, _pt->x, extend2);
+  float result1[3],result2[3];
+
+  interp_v3_v3v3(result1, _pt->x, >x, extend1);
+  interp_v3_v3v3(result2, _last->x, _pt->x, extend2);
+
+  copy_v3_v3(>x,result1);
+  copy_v3_v3(_pt->x,result2);
 
   return true;
 }

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


[Bf-blender-cvs] [8d8200c173f] soc-2019-npr: Gpencil: Stretch function now handles short segments and double points.

2019-07-01 Thread YimingWu
Commit: 8d8200c173ff2dabc0ab5a5b69cb33d1d98a9714
Author: YimingWu
Date:   Mon Jul 1 20:21:20 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB8d8200c173ff2dabc0ab5a5b69cb33d1d98a9714

Gpencil: Stretch function now handles short segments and double points.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index cccd21a0696..ac806dfabd2 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1693,6 +1693,7 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float 
dist)
 bool BKE_gpencil_stretch_stroke(bGPDstroke *gps, float dist)
 {
   bGPDspoint *pt = gps->points, *last_pt, *second_last, *next_pt;
+  int i;
 
   if (gps->totpoints < 2 || dist < FLT_EPSILON) {
 return false;
@@ -1703,18 +1704,33 @@ bool BKE_gpencil_stretch_stroke(bGPDstroke *gps, float 
dist)
   second_last = [gps->totpoints - 2];
   next_pt = [1];
 
-  float len1 = len_v3v3(_pt->x, >x);
+  float len1 = 0;
+  float len2 = 0;
+
+  i = 1;
+  while (len1 < 0.001 && gps->totpoints > i) {
+next_pt = [i];
+len1 = len_v3v3(_pt->x, >x);
+i++;
+  }
+
+  i = 2;
+  while (len2 < 0.001 && gps->totpoints >= i) {
+second_last = [gps->totpoints - i];
+len2 = len_v3v3(_pt->x, _last->x);
+i++;
+  }
+
   float extend1 = (len1 + dist) / len1;
-  float len2 = len_v3v3(_pt->x, _last->x);
   float extend2 = (len2 + dist) / len2;
 
-  float result1[3],result2[3];
+  float result1[3], result2[3];
 
   interp_v3_v3v3(result1, _pt->x, >x, extend1);
   interp_v3_v3v3(result2, _last->x, _pt->x, extend2);
 
-  copy_v3_v3(>x,result1);
-  copy_v3_v3(_pt->x,result2);
+  copy_v3_v3(>x, result1);
+  copy_v3_v3(_pt->x, result2);
 
   return true;
 }

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


[Bf-blender-cvs] [50802c0e6c1] functions: comment remaining api functions

2019-07-01 Thread Jacques Lucke
Commit: 50802c0e6c15bfbd07c555e4545f0ba9171919c8
Author: Jacques Lucke
Date:   Mon Jul 1 13:43:22 2019 +0200
Branches: functions
https://developer.blender.org/rB50802c0e6c15bfbd07c555e4545f0ba9171919c8

comment remaining api functions

===

M   source/blender/simulations/bparticles/core.hpp

===

diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index c5d89f3a42b..9e74e11016e 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -351,6 +351,9 @@ class TimeSpanEmitTarget : public EmitTargetBase {
   void set_randomized_birth_moments();
 };
 
+/**
+ * The interface between the simulation core and individual emitters.
+ */
 class EmitterInterface {
  private:
   BlockAllocator _block_allocator;
@@ -361,13 +364,30 @@ class EmitterInterface {
   EmitterInterface(BlockAllocator , TimeSpan time_span);
   ~EmitterInterface();
 
+  /**
+   * Access emit targets created by the emitter.
+   */
   ArrayRef targets();
 
+  /**
+   * Get a new emit target with the given size and particle type.
+   */
   TimeSpanEmitTarget (uint particle_type_id, uint size);
+
+  /**
+   * Time span that new particles should be emitted in.
+   */
   TimeSpan time_span();
+
+  /**
+   * True when this is the first time step in a simulation, otherwise false.
+   */
   bool is_first_step();
 };
 
+/**
+ * A set of particles all of which are in the same block.
+ */
 struct ParticleSet {
  private:
   ParticlesBlock *m_block;
@@ -381,11 +401,36 @@ struct ParticleSet {
  public:
   ParticleSet(ParticlesBlock , ArrayRef particle_indices);
 
+  /**
+   * Return the block that contains the particles of this set.
+   */
   ParticlesBlock ();
+
+  /**
+   * Access the attributes of particles in the block on this set.
+   */
   AttributeArrays attributes();
+
+  /**
+   * Access particle indices in the block that are part of the set.
+   * Every value in this array is an index into the attribute arrays.
+   */
   ArrayRef indices();
+
+  /**
+   * Get the particle index of an index in this set. E.g. the 4th element in 
this set could be the
+   * 350th element in the block.
+   */
   uint get_particle_index(uint i);
+
+  /**
+   * Utility to get [0, 1, ..., size() - 1].
+   */
   Range range();
+
+  /**
+   * Number of particles in this set.
+   */
   uint size();
 
   /**
@@ -394,6 +439,9 @@ struct ParticleSet {
   bool indices_are_trivial();
 };
 
+/**
+ * Utility array wrapper that can hold different kinds of plain-old-data 
values.
+ */
 class EventStorage {
  private:
   void *m_array;
@@ -407,6 +455,9 @@ class EventStorage {
   template T (uint index);
 };
 
+/**
+ * Interface between the Event->filter() function and the core simulation code.
+ */
 class EventFilterInterface {
  private:
   ParticleSet m_particles;
@@ -427,16 +478,47 @@ class EventFilterInterface {
SmallVector _filtered_indices,
SmallVector _filtered_time_factors);
 
+  /**
+   * Return the particle set that should be checked.
+   */
   ParticleSet ();
+
+  /**
+   * Return the durations that should be checked for every particle.
+   */
   ArrayRef durations();
-  TimeSpan time_span(uint index);
+
+  /**
+   * Return the offsets that every particle will experience when no event is 
triggered.
+   */
   AttributeArrays attribute_offsets();
+
+  /**
+   * Get the time span that should be checked for a specific particle.
+   */
+  TimeSpan time_span(uint index);
+
+  /**
+   * Get the end time of the current time step.
+   */
   float end_time();
 
+  /**
+   * Mark a particle as triggered by the event at a specific point in time.
+   * Note: The index must increase between consecutive calls to this function.
+   */
   void trigger_particle(uint index, float time_factor);
+
+  /**
+   * Same as above but returns a pointer to a struct that can be used to pass 
data to the execute
+   * function.
+   */
   template T _particle(uint index, float time_factor);
 };
 
+/**
+ * Interface between the Event->execute() function and the core simulation 
code.
+ */
 class EventExecuteInterface {
  private:
   ParticleSet m_particles;
@@ -456,17 +538,54 @@ class EventExecuteInterface {
 
   ~EventExecuteInterface();
 
+  /**
+   * Access the set of particles that should be modified by this event.
+   */
+  ParticleSet ();
+
+  /**
+   * Get the time at which every particle is modified by this event.
+   */
+  ArrayRef current_times();
+
+  /**
+   * Get the data stored in the Event->filter() function for a particle index.
+   */
+  template T _storage(uint pindex);
+
+  /**
+   * Access the offsets that are applied to every particle in the remaining 
time step.
+   * The event is allowed to modify the arrays.
+   */
+  AttributeArrays attribute_offsets();
+
+  /**
+   * Get a new emit target 

[Bf-blender-cvs] [eb2da8bc5ab] functions: improve attribute interface

2019-07-01 Thread Jacques Lucke
Commit: eb2da8bc5ab72e4c895097a7c75c6fffb3991048
Author: Jacques Lucke
Date:   Mon Jul 1 12:39:02 2019 +0200
Branches: functions
https://developer.blender.org/rBeb2da8bc5ab72e4c895097a7c75c6fffb3991048

improve attribute interface

===

M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 45d22955a66..b229efae25e 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -174,10 +174,10 @@ class ModifierParticleType : public ParticleType {
 return *m_integrator;
   }
 
-  ArrayRef float3_attributes() override
+  void attributes(TypeAttributeInterface ) override
   {
-static std::array attributes = {"Position", "Velocity"};
-return attributes;
+interface.use(AttributeType::Float3, "Position");
+interface.use(AttributeType::Float3, "Velocity");
   }
 };
 
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index d9ca1a9ac29..c29945d090c 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -21,6 +21,7 @@ class EventFilterInterface;
 class EventExecuteInterface;
 class EmitterInterface;
 class IntegratorInterface;
+class TypeAttributeInterface;
 
 /* Main API for the particle simulation. These classes have to be subclassed 
to define how the
  * particles should behave.
@@ -126,20 +127,11 @@ class ParticleType {
*/
   virtual ArrayRef events() = 0;
 
-  virtual ArrayRef byte_attributes()
-  {
-return {};
-  }
-
-  virtual ArrayRef float_attributes()
-  {
-return {};
-  }
-
-  virtual ArrayRef float3_attributes()
-  {
-return {};
-  }
+  /**
+   * Determines which attributes have to be stored for particles of this type. 
The actual number of
+   * attributes might be larger.
+   */
+  virtual void attributes(TypeAttributeInterface ) = 0;
 };
 
 /**
@@ -414,6 +406,17 @@ class IntegratorInterface {
   AttributeArrays offset_targets();
 };
 
+class TypeAttributeInterface {
+  SmallVector m_names;
+  SmallVector m_types;
+
+ public:
+  void use(AttributeType type, StringRef attribute_name);
+
+  ArrayRef names();
+  ArrayRef types();
+};
+
 /* ParticlesState inline functions
  /
 
@@ -664,4 +667,23 @@ inline AttributeArrays 
IntegratorInterface::offset_targets()
   return m_offsets;
 }
 
+/* TypeAttributeInterface
+ /
+
+inline void TypeAttributeInterface::use(AttributeType type, StringRef 
attribute_name)
+{
+  m_types.append(type);
+  m_names.append(attribute_name.to_std_string());
+}
+
+inline ArrayRef TypeAttributeInterface::names()
+{
+  return m_names;
+}
+
+inline ArrayRef TypeAttributeInterface::types()
+{
+  return m_types;
+}
+
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index d3228752907..6e8572e8d48 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -679,13 +679,27 @@ BLI_NOINLINE static void 
ensure_required_containers_exist(ParticlesState ,
 BLI_NOINLINE static AttributesInfo build_attribute_info_for_type(ParticleType 
,
  
AttributesInfo (last_info))
 {
+  TypeAttributeInterface interface;
+  type.attributes(interface);
+
   SmallSetVector byte_attributes = {"Kill State"};
   SmallSetVector float_attributes = {"Birth Time"};
   SmallSetVector float3_attributes = {};
 
-  byte_attributes.add_multiple(type.byte_attributes());
-  float_attributes.add_multiple(type.float_attributes());
-  float3_attributes.add_multiple(type.float3_attributes());
+  for (uint i = 0; i < interface.names().size(); i++) {
+std::string  = interface.names()[i];
+switch (interface.types()[i]) {
+  case AttributeType::Byte:
+byte_attributes.add(name);
+break;
+  case AttributeType::Float:
+float_attributes.add(name);
+break;
+  case AttributeType::Float3:
+float3_attributes.add(name);
+break;
+}
+  }
 
   return AttributesInfo(byte_attributes, float_attributes, float3_attributes);
 }

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


[Bf-blender-cvs] [00bde8527d9] functions: more comments on api

2019-07-01 Thread Jacques Lucke
Commit: 00bde8527d99b2e4377b8224ea4322202ba9ceed
Author: Jacques Lucke
Date:   Mon Jul 1 12:59:59 2019 +0200
Branches: functions
https://developer.blender.org/rB00bde8527d99b2e4377b8224ea4322202ba9ceed

more comments on api

===

M   source/blender/simulations/bparticles/core.hpp

===

diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index ec94cd79ee2..c5d89f3a42b 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -165,6 +165,13 @@ class StepDescription {
 /* Classes used by the interface
  ***/
 
+/**
+ * This holds the current state of an entire particle particle system. It only 
knows about the
+ * particles and the current time, not how the system got there.
+ *
+ * The state can also be created independent of any particle system. It gets 
"fixed up" when it is
+ * used in a simulation.
+ */
 class ParticlesState {
  private:
   SmallMap m_container_by_id;
@@ -175,11 +182,25 @@ class ParticlesState {
   ParticlesState(ParticlesState ) = delete;
   ~ParticlesState();
 
+  /**
+   * Access the time since the simulation started.
+   */
   float _time();
 
+  /**
+   * Access the mapping from particle type ids to their corresponding 
containers.
+   */
   SmallMap _containers();
 
+  /**
+   * Get the container corresponding to a particle type id.
+   * Asserts when the container does not exist.
+   */
   ParticlesContainer _container(uint type_id);
+
+  /**
+   * Get the id of a container in the context of this particle state.
+   */
   uint particle_container_id(ParticlesContainer );
 };
 
@@ -199,7 +220,16 @@ class BlockAllocator {
   BlockAllocator(ParticlesState );
   BlockAllocator(BlockAllocator ) = delete;
 
+  /**
+   * Return a block that can hold new particles. It might create an entirely 
new one or use a
+   * cached block.
+   */
   ParticlesBlock _non_full_block(uint particle_type_id);
+
+  /**
+   * Allocate space for a given number of new particles. The attribute buffers 
might be distributed
+   * over multiple blocks.
+   */
   void allocate_block_ranges(uint particle_type_id,
  uint size,
  SmallVector _blocks,
@@ -207,9 +237,17 @@ class BlockAllocator {
 
   AttributesInfo _info(uint particle_type_id);
   ParticlesState _state();
+
+  /**
+   * Access all blocks that have been allocated by this allocator.
+   */
   ArrayRef allocated_blocks();
 };
 
+/**
+ * Base class for different kinds of emitters. It's main purpose is to make it 
easy to initialize
+ * particle attributes.
+ */
 class EmitTargetBase {
  protected:
   uint m_particle_type_id;
@@ -227,6 +265,9 @@ class EmitTargetBase {
 
   EmitTargetBase(EmitTargetBase ) = delete;
 
+  /**
+   * Copy attributes from an array into the particle block ranges referenced 
by this target.
+   */
   void set_byte(uint index, ArrayRef data);
   void set_byte(StringRef name, ArrayRef data);
   void set_float(uint index, ArrayRef data);
@@ -234,6 +275,9 @@ class EmitTargetBase {
   void set_float3(uint index, ArrayRef data);
   void set_float3(StringRef name, ArrayRef data);
 
+  /**
+   * Set an attribute type to a constant for all referenced particle block 
ranges.
+   */
   void fill_byte(uint index, uint8_t value);
   void fill_byte(StringRef name, uint8_t value);
   void fill_float(uint index, float value);
@@ -241,10 +285,29 @@ class EmitTargetBase {
   void fill_float3(uint index, float3 value);
   void fill_float3(StringRef name, float3 value);
 
+  /**
+   * Access the particle blocks referenced by this emit target.
+   */
   ArrayRef blocks();
+
+  /**
+   * Access the referenced ranges in the blocks.
+   */
   ArrayRef> ranges();
+
+  /**
+   * Return the amount of different parts this emit target is made up of.
+   */
   uint part_amount();
+
+  /**
+   * Get the attribute arrays for a specific part.
+   */
   AttributeArrays attributes(uint part);
+
+  /**
+   * Get the particle type id in the context of the current simulation step.
+   */
   uint particle_type_id();
 
  private:
@@ -252,6 +315,9 @@ class EmitTargetBase {
   void fill_elements(uint index, void *value);
 };
 
+/**
+ * A specialized emit target for the case when the birth time of all particles 
is known beforehand.
+ */
 class InstantEmitTarget : public EmitTargetBase {
  public:
   InstantEmitTarget(uint particle_type_id,
@@ -260,6 +326,9 @@ class InstantEmitTarget : public EmitTargetBase {
 ArrayRef> ranges);
 };
 
+/**
+ * A specialized emit target for the case when the emitter can create 
particles within a time span.
+ */
 class TimeSpanEmitTarget : public EmitTargetBase {
  private:
   TimeSpan m_time_span;
@@ -271,7 +340,14 @@ class TimeSpanEmitTarget : public EmitTargetBase {
  

[Bf-blender-cvs] [ac57332ddfd] functions: access current simulation time through accessor

2019-07-01 Thread Jacques Lucke
Commit: ac57332ddfd8660eeab994e3ada960b56140eee1
Author: Jacques Lucke
Date:   Mon Jul 1 12:42:08 2019 +0200
Branches: functions
https://developer.blender.org/rBac57332ddfd8660eeab994e3ada960b56140eee1

access current simulation time through accessor

===

M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index c29945d090c..ec94cd79ee2 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -168,14 +168,15 @@ class StepDescription {
 class ParticlesState {
  private:
   SmallMap m_container_by_id;
-
- public:
   float m_current_time = 0.0f;
 
+ public:
   ParticlesState() = default;
   ParticlesState(ParticlesState ) = delete;
   ~ParticlesState();
 
+  float _time();
+
   SmallMap _containers();
 
   ParticlesContainer _container(uint type_id);
@@ -441,6 +442,11 @@ inline uint 
ParticlesState::particle_container_id(ParticlesContainer )
   return 0;
 }
 
+inline float ::current_time()
+{
+  return m_current_time;
+}
+
 /* BlockAllocator inline functions
  /
 
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 6e8572e8d48..bdf032c0d10 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -764,8 +764,8 @@ BLI_NOINLINE static void 
emit_and_simulate_particles(ParticlesState ,
 
 void simulate_step(ParticlesState , StepDescription _description)
 {
-  TimeSpan time_span(state.m_current_time, step_description.step_duration());
-  state.m_current_time = time_span.end();
+  TimeSpan time_span(state.current_time(), step_description.step_duration());
+  state.current_time() = time_span.end();
 
   ensure_required_containers_exist(state, step_description);
   ensure_required_attributes_exist(state, step_description);

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


[Bf-blender-cvs] [6f069a03d1a] functions: new integrator interface

2019-07-01 Thread Jacques Lucke
Commit: 6f069a03d1aec3b233d6eacf6c5550864a75a29b
Author: Jacques Lucke
Date:   Mon Jul 1 12:20:55 2019 +0200
Branches: functions
https://developer.blender.org/rB6f069a03d1aec3b233d6eacf6c5550864a75a29b

new integrator interface

===

M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp 
b/source/blender/simulations/bparticles/c_wrapper.cpp
index 4415ca7c4e6..45d22955a66 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -77,10 +77,12 @@ class EulerIntegrator : public Integrator {
 return m_offset_attributes_info;
   }
 
-  void integrate(ParticlesBlock ,
- ArrayRef durations,
- AttributeArrays r_offsets) override
+  void integrate(IntegratorInterface ) override
   {
+ParticlesBlock  = interface.block();
+AttributeArrays r_offsets = interface.offset_targets();
+ArrayRef durations = interface.durations();
+
 uint amount = block.active_amount();
 BLI_assert(amount == r_offsets.size());
 
diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index 886d12e276d..e6609f863bf 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -340,4 +340,14 @@ EventExecuteInterface::EventExecuteInterface(ParticleSet 
particles,
 {
 }
 
+/* IntegratorInterface
+ ***/
+
+IntegratorInterface::IntegratorInterface(ParticlesBlock ,
+ ArrayRef durations,
+ AttributeArrays r_offsets)
+: m_block(block), m_durations(durations), m_offsets(r_offsets)
+{
+}
+
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 073289b4fab..d9ca1a9ac29 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -20,6 +20,7 @@ namespace BParticles {
 class EventFilterInterface;
 class EventExecuteInterface;
 class EmitterInterface;
+class IntegratorInterface;
 
 /* Main API for the particle simulation. These classes have to be subclassed 
to define how the
  * particles should behave.
@@ -105,9 +106,7 @@ class Integrator {
* Compute the offsets for all integrated attributes. Those are not applied 
immediately, because
* there might be events that modify the attributes within a time step.
*/
-  virtual void integrate(ParticlesBlock ,
- ArrayRef durations,
- AttributeArrays r_offsets) = 0;
+  virtual void integrate(IntegratorInterface ) = 0;
 };
 
 /**
@@ -399,6 +398,22 @@ class EventExecuteInterface {
   AttributeArrays attribute_offsets();
 };
 
+class IntegratorInterface {
+ private:
+  ParticlesBlock _block;
+  ArrayRef m_durations;
+
+  AttributeArrays m_offsets;
+
+ public:
+  IntegratorInterface(ParticlesBlock , ArrayRef durations, 
AttributeArrays r_offsets);
+
+  ParticlesBlock ();
+  ArrayRef durations();
+
+  AttributeArrays offset_targets();
+};
+
 /* ParticlesState inline functions
  /
 
@@ -631,4 +646,22 @@ inline AttributeArrays 
EventExecuteInterface::attribute_offsets()
   return m_attribute_offsets;
 }
 
+/* IntegratorInterface inline functions
+ */
+
+inline ParticlesBlock ::block()
+{
+  return m_block;
+}
+
+inline ArrayRef IntegratorInterface::durations()
+{
+  return m_durations;
+}
+
+inline AttributeArrays IntegratorInterface::offset_targets()
+{
+  return m_offsets;
+}
+
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 2e22373084f..d3228752907 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -437,7 +437,8 @@ BLI_NOINLINE static void simulate_block(FixedArrayAllocator 
_allocator,
   offsets_info, array_allocator);
   AttributeArrays attribute_offsets = 
attribute_offsets_core.slice_all().slice(0, amount);
 
-  integrator.integrate(block, durations, attribute_offsets);
+  IntegratorInterface interface(block, durations, attribute_offsets);
+  integrator.integrate(interface);
 
   ArrayRef events = particle_type.events();

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


[Bf-blender-cvs] [e1cb15c5d6d] master: Fix T66300: GPencil layer context menu not working in topbar layer popover

2019-07-01 Thread Antonioya
Commit: e1cb15c5d6dd4e58c88634a75985c25a7a66dcd7
Author: Antonioya
Date:   Mon Jul 1 13:24:27 2019 +0200
Branches: master
https://developer.blender.org/rBe1cb15c5d6dd4e58c88634a75985c25a7a66dcd7

Fix T66300: GPencil layer context menu not working in topbar layer popover

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py 
b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index de438050b69..7d3c61af34c 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -81,7 +81,8 @@ class GPENCIL_MT_layer_context_menu(Menu):
 
 def draw(self, context):
 layout = self.layout
-gpd = context.gpencil
+ob = context.object
+gpd = ob.data
 
 layout.operator("gpencil.layer_duplicate", icon='ADD')  # XXX: needs a 
dedicated icon

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


[Bf-blender-cvs] [76aff66301b] master: PaintingModes: Facemask Wireframe Drawing

2019-07-01 Thread Jeroen Bakker
Commit: 76aff66301b1bafb60973e556d5c547e602bdee5
Author: Jeroen Bakker
Date:   Mon Jul 1 12:43:07 2019 +0200
Branches: master
https://developer.blender.org/rB76aff66301b1bafb60973e556d5c547e602bdee5

PaintingModes: Facemask Wireframe Drawing

The wireframe drawing for face masks is intrusive as selected wires
were solid white and always drawn. This made it hard for users to see
the exact color near edges.

This patch draws only the border of the selected faces,
edges between two selected faces are not drawn at all.

Reviewed By: brecht, fclem

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

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c 
b/source/blender/draw/intern/draw_cache_impl_mesh.c
index f4acb586c5e..2490a2c8529 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1985,6 +1985,7 @@ typedef struct MeshBatchCache {
 /* Indices to vloops. */
 GPUIndexBuf *loops_tris;
 GPUIndexBuf *loops_lines;
+GPUIndexBuf *loops_lines_paint_mask;
 GPUIndexBuf *loops_line_strips;
 /* Edit mode. */
 GPUIndexBuf *edit_loops_points; /* verts */
@@ -2025,7 +2026,7 @@ typedef struct MeshBatchCache {
 GPUBatch *loose_edges;
 GPUBatch *edge_detection;
 GPUBatch *wire_edges; /* Individual edges with face normals. */
-GPUBatch *wire_loops; /* Loops around faces. */
+GPUBatch *wire_loops; /* Loops around faces. no edges between selected 
faces */
 GPUBatch *wire_loops_uvs; /* Same as wire_loops but only has uvs. */
   } batch;
 
@@ -2227,6 +2228,7 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
 case BKE_MESH_BATCH_DIRTY_SELECT_PAINT:
   /* Paint mode selection flag is packed inside the nor attrib.
* Note that it can be slow if auto smooth is enabled. (see T63946) */
+  GPU_INDEXBUF_DISCARD_SAFE(cache->ibo.loops_lines_paint_mask);
   GPU_VERTBUF_DISCARD_SAFE(cache->ordered.loop_pos_nor);
   GPU_BATCH_DISCARD_SAFE(cache->batch.surface);
   GPU_BATCH_DISCARD_SAFE(cache->batch.wire_loops);
@@ -3788,10 +3790,71 @@ static void mesh_create_loops_lines(MeshRenderData 
*rdata, GPUIndexBuf *ibo, con
   }
 }
   }
-  else {
-/* Implement ... eventually if needed. */
+
+  GPU_indexbuf_build_in_place(, ibo);
+}
+
+static void mesh_create_loops_lines_paint_mask(MeshRenderData *rdata, 
GPUIndexBuf *ibo)
+{
+  const int loop_len = mesh_render_data_loops_len_get(rdata);
+  const int poly_len = mesh_render_data_polys_len_get(rdata);
+
+  GPUIndexBufBuilder elb;
+  GPU_indexbuf_init(, GPU_PRIM_LINES, loop_len, loop_len);
+
+  if (rdata->edit_bmesh) {
+/* painting does not use the edit_bmesh */
 BLI_assert(0);
   }
+  else {
+/* contains all edges where at least one face has been selected */
+EdgeHash *edge_hash = BLI_edgehash_new(__func__);
+
+/* Fill the EdgeHash tables. */
+for (int poly = 0; poly < poly_len; poly++) {
+  const MPoly *mpoly = >mpoly[poly];
+
+  /* Do not check faces that are hidden and faces that aren't selected */
+  if (mpoly->flag & ME_HIDE || ((mpoly->flag & ME_FACE_SEL) == 0)) {
+continue;
+  }
+
+  for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) {
+const MLoop *mloop = >mloop[mpoly->loopstart + loop_index];
+const MEdge *edge = (MEdge *)rdata->medge + mloop->e;
+const int v1 = edge->v1;
+const int v2 = edge->v2;
+
+void **edge_value;
+
+if (BLI_edgehash_ensure_p(edge_hash, v1, v2, _value)) {
+  *edge_value = POINTER_FROM_INT(POINTER_AS_INT(*edge_value) + 1);
+}
+else {
+  *edge_value = POINTER_FROM_INT(1);
+}
+  }
+}
+
+for (int poly = 0; poly < poly_len; poly++) {
+  const MPoly *mpoly = >mpoly[poly];
+  if (!(mpoly->flag & ME_HIDE)) {
+for (int loop_index = 0; loop_index < mpoly->totloop; loop_index++) {
+  const MLoop *mloop = >mloop[mpoly->loopstart + loop_index];
+  const MEdge *edge = (MEdge *)rdata->medge + mloop->e;
+  int v1 = mpoly->loopstart + loop_index;
+  int v2 = mpoly->loopstart + (loop_index + 1) % mpoly->totloop;
+
+  void *edge_value = BLI_edgehash_lookup(edge_hash, edge->v1, 
edge->v2);
+  if (edge_value == NULL || POINTER_AS_INT(edge_value) == 1) {
+GPU_indexbuf_add_line_verts(, v1, v2);
+  }
+}
+  }
+}
+
+BLI_edgehash_free(edge_hash, NULL);
+  }
 
   GPU_indexbuf_build_in_place(, ibo);
 }
@@ -5053,8 +5116,8 @@ void DRW_mesh_batch_cache_create_requested(
 DRW_vbo_request(cache->batch.surface_weights, >ordered.pos_nor);
 DRW_vbo_request(cache->batch.surface_weights, >ordered.weights);
   }
-  if 

[Bf-blender-cvs] [6b9c41719bd] master: Fix T65798: Incorrect auto-tex space for Curves

2019-07-01 Thread Sergey Sharybin
Commit: 6b9c41719bdf7514b9f9ca88e8fb09d3270cf1f2
Author: Sergey Sharybin
Date:   Mon Jul 1 12:39:00 2019 +0200
Branches: master
https://developer.blender.org/rB6b9c41719bdf7514b9f9ca88e8fb09d3270cf1f2

Fix T65798: Incorrect auto-tex space for Curves

There are several aspects to the fix:

- Always calculate bounding box for meshes and curves from dependency
  graph evaluation function.

  There is a reason why mesh was tagged for geometry update, so can not
  be spare here in attempts to avoid calculation.

- Remove texture space evaluation from RNA accessor.

  Such data is to be evaluated by a dependency graph.

  Don't see a reason to be different here: we never force evaluation of
  any kind from RNA.

- Copy bounding box and texture space to original object for active
  dependency graph.

  This matches object-level bounding box and allows to remove bounding
  box evaluation from RNA.

===

M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/mesh.c
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index 5945fa4bf33..0fb6b8005d4 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -54,6 +54,7 @@
 #include "BKE_material.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
 
 #include "CLG_log.h"
 
@@ -5431,8 +5432,18 @@ void BKE_curve_rect_from_textbox(const struct Curve *cu,
 void BKE_curve_eval_geometry(Depsgraph *depsgraph, Curve *curve)
 {
   DEG_debug_print_eval(depsgraph, __func__, curve->id.name, curve);
-  if (curve->bb == NULL || (curve->bb->flag & BOUNDBOX_DIRTY)) {
-BKE_curve_texspace_calc(curve);
+  BKE_curve_texspace_calc(curve);
+  if (DEG_is_active(depsgraph)) {
+Curve *curve_orig = (Curve *)DEG_get_original_id(>id);
+BoundBox *bb = curve->bb;
+if (bb != NULL) {
+  if (curve_orig->bb == NULL) {
+curve_orig->bb = MEM_mallocN(sizeof(*curve_orig->bb), __func__);
+  }
+  *curve_orig->bb = *bb;
+  copy_v3_v3(curve_orig->loc, curve->loc);
+  copy_v3_v3(curve_orig->size, curve->size);
+}
   }
 }
 
diff --git a/source/blender/blenkernel/intern/mesh.c 
b/source/blender/blenkernel/intern/mesh.c
index 755a8036e8e..35f96e50e3a 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -50,6 +50,7 @@
 #include "BKE_editmesh.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
 
 enum {
   MESHCMP_DVERT_WEIGHTMISMATCH = 1,
@@ -1995,9 +1996,7 @@ void BKE_mesh_split_faces(Mesh *mesh, bool 
free_loop_normals)
 void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh)
 {
   DEG_debug_print_eval(depsgraph, __func__, mesh->id.name, mesh);
-  if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) {
-BKE_mesh_texspace_calc(mesh);
-  }
+  BKE_mesh_texspace_calc(mesh);
   /* Clear autospace flag in evaluated mesh, so that texspace does not get 
recomputed when bbox is
* (e.g. after modifiers, etc.) */
   mesh->texflag &= ~ME_AUTOSPACE;
@@ -2009,4 +2008,16 @@ void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh 
*mesh)
 BKE_id_free(NULL, mesh->runtime.mesh_eval);
 mesh->runtime.mesh_eval = NULL;
   }
+  if (DEG_is_active(depsgraph)) {
+Mesh *mesh_orig = (Mesh *)DEG_get_original_id(>id);
+BoundBox *bb = mesh->bb;
+if (bb != NULL) {
+  if (mesh_orig->bb == NULL) {
+mesh_orig->bb = MEM_mallocN(sizeof(*mesh_orig->bb), __func__);
+  }
+  *mesh_orig->bb = *bb;
+  copy_v3_v3(mesh_orig->loc, mesh->loc);
+  copy_v3_v3(mesh_orig->size, mesh->size);
+}
+  }
 }
diff --git a/source/blender/makesrna/intern/rna_mesh.c 
b/source/blender/makesrna/intern/rna_mesh.c
index c51097fc8c3..ba4f3c53692 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -496,22 +496,12 @@ static int rna_Mesh_texspace_editable(PointerRNA *ptr, 
const char **UNUSED(r_inf
 static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float values[3])
 {
   Mesh *me = (Mesh *)ptr->data;
-
-  if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
-BKE_mesh_texspace_calc(me);
-  }
-
   copy_v3_v3(values, me->size);
 }
 
 static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float values[3])
 {
   Mesh *me = (Mesh *)ptr->data;
-
-  if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
-BKE_mesh_texspace_calc(me);
-  }
-
   copy_v3_v3(values, me->loc);
 }

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


[Bf-blender-cvs] [67fc4f4bedd] master: Fix T66267: only add DEG cloth collision relations if collisions are enabled

2019-07-01 Thread Philipp Oeser
Commit: 67fc4f4bedded86a04d2bf98ca1642a12d9662b3
Author: Philipp Oeser
Date:   Mon Jul 1 11:32:10 2019 +0200
Branches: master
https://developer.blender.org/rB67fc4f4bedded86a04d2bf98ca1642a12d9662b3

Fix T66267: only add DEG cloth collision relations if collisions are
enabled

was detecting unneccessary dependency cycle

Reviewers: sergey, brecht

Maniphest Tasks: T66267

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

===

M   source/blender/makesrna/intern/rna_cloth.c
M   source/blender/modifiers/intern/MOD_cloth.c

===

diff --git a/source/blender/makesrna/intern/rna_cloth.c 
b/source/blender/makesrna/intern/rna_cloth.c
index c93833ef493..548ed656d7b 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -824,7 +824,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA 
*brna)
   prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flags", 
CLOTH_COLLSETTINGS_FLAG_ENABLED);
   RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with 
other objects");
-  RNA_def_property_update(prop, 0, "rna_cloth_update");
+  RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
 
   prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
   RNA_def_property_float_sdna(prop, NULL, "epsilon");
diff --git a/source/blender/modifiers/intern/MOD_cloth.c 
b/source/blender/modifiers/intern/MOD_cloth.c
index 3c4dd9f2c56..1a6d172d2f9 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -125,12 +125,14 @@ static void updateDepsgraph(ModifierData *md, const 
ModifierUpdateDepsgraphConte
 {
   ClothModifierData *clmd = (ClothModifierData *)md;
   if (clmd != NULL) {
-DEG_add_collision_relations(ctx->node,
-ctx->object,
-clmd->coll_parms->group,
-eModifierType_Collision,
-NULL,
-"Cloth Collision");
+if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED) {
+  DEG_add_collision_relations(ctx->node,
+  ctx->object,
+  clmd->coll_parms->group,
+  eModifierType_Collision,
+  NULL,
+  "Cloth Collision");
+}
 DEG_add_forcefield_relations(
 ctx->node, ctx->object, clmd->sim_parms->effector_weights, true, 0, 
"Cloth Field");
   }

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


[Bf-blender-cvs] [f64db794ee6] temp-gpencil-drw-engine: GPencil: Add monochromatic alpha estimation for blend layers

2019-07-01 Thread Clément Foucault
Commit: f64db794ee690f05905ace0a66d81d2e75549b90
Author: Clément Foucault
Date:   Mon Jul 1 12:20:41 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rBf64db794ee690f05905ace0a66d81d2e75549b90

GPencil: Add monochromatic alpha estimation for blend layers

===

M   source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
index 0596304d4b9..240d2091a51 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
@@ -39,36 +39,33 @@ void main()
* */
   src.rgb = mix(vec3(0.5), src.rgb, src.a);
   vec3 q0 = vec3(greaterThanEqual(src.rgb, vec3(0.5)));
-  vec3 q1 = ((q0 - 0.5) * 2.0);
+  vec3 q1 = q0 * 2.0 - 1.0;
   vec3 src2 = 2.0 * src.rgb;
   FragColor0.rgb = src2 * q0 - q0;
-  FragColor0.a = 0.0;
   FragColor1.rgb = 2.0 * q0 - src2 * q1;
-  FragColor1.a = 1.0;
   break;
 case MODE_ADD:
   FragColor0.rgb = src.rgb * src.a;
-  FragColor0.a = 0.0;
-  FragColor1 = vec4(1.0);
+  FragColor1.rgb = vec3(1.0);
   break;
 case MODE_SUB:
   FragColor0.rgb = -src.rgb * src.a;
-  FragColor0.a = 0.0;
-  FragColor1 = vec4(1.0);
+  FragColor1.rgb = vec3(1.0);
   break;
 case MODE_MULTIPLY:
-  FragColor0 = vec4(0.0);
+  FragColor0.rgb = vec3(0.0);
   FragColor1.rgb = mix(vec3(1.0), src.rgb, src.a);
-  FragColor1.a = 1.0;
   break;
 case MODE_DIVIDE:
-  FragColor0 = vec4(0.0);
+  FragColor0.rgb = vec3(0.0);
   FragColor1.rgb = 1.0 / mix(vec3(1.0), src.rgb, src.a);
-  FragColor1.a = 1.0;
   break;
 default:
   FragColor0 = vec4(0.0);
   FragColor1 = vec4(1.0);
   break;
   }
+
+  FragColor0.a = 1.0 - clamp(dot(vec3(1.0 / 3.0), FragColor1.rgb), 0.0, 1.0);
+  FragColor1.a = 1.0 - FragColor0.a;
 }

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


[Bf-blender-cvs] [1f79aa602eb] master: Fix T66297: Blender on macOS does not open on case-sensitive file system

2019-07-01 Thread Brecht Van Lommel
Commit: 1f79aa602eb9da2f2f0fdc6be6fa02de6ec6cace
Author: Brecht Van Lommel
Date:   Mon Jul 1 12:17:25 2019 +0200
Branches: master
https://developer.blender.org/rB1f79aa602eb9da2f2f0fdc6be6fa02de6ec6cace

Fix T66297: Blender on macOS does not open on case-sensitive file system

===

M   release/darwin/Blender.app/Contents/Info.plist

===

diff --git a/release/darwin/Blender.app/Contents/Info.plist 
b/release/darwin/Blender.app/Contents/Info.plist
index 9b09ef0f768..b8cd55d2e43 100644
--- a/release/darwin/Blender.app/Contents/Info.plist
+++ b/release/darwin/Blender.app/Contents/Info.plist
@@ -26,7 +26,7 @@


CFBundleExecutable
-   blender
+   Blender
CFBundleGetInfoString
${MACOSX_BUNDLE_LONG_VERSION_STRING}, Blender 
Foundation
CFBundleIconFile

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


[Bf-blender-cvs] [4bdc04e8fb9] functions: comment particle system api

2019-07-01 Thread Jacques Lucke
Commit: 4bdc04e8fb9bababad84b48fa9e6db27a8356e93
Author: Jacques Lucke
Date:   Mon Jul 1 12:12:05 2019 +0200
Branches: functions
https://developer.blender.org/rB4bdc04e8fb9bababad84b48fa9e6db27a8356e93

comment particle system api

===

M   source/blender/simulations/bparticles/core.hpp

===

diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index cbf30c37c99..073289b4fab 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -17,6 +17,163 @@
 
 namespace BParticles {
 
+class EventFilterInterface;
+class EventExecuteInterface;
+class EmitterInterface;
+
+/* Main API for the particle simulation. These classes have to be subclassed 
to define how the
+ * particles should behave.
+ **/
+
+/**
+ * An event consists of two parts.
+ *   1. Filter the particles that trigger the event within a specific time 
span.
+ *   2. Modify the particles that were triggered.
+ *
+ * In some cases it is necessary to pass data from the filter to the execute 
function (e.g. the
+ * normal of the surface at a collision point). So that is supported as well. 
Currently, only POD
+ * (plain-old-data / simple C structs) can be used.
+ */
+class Event {
+ public:
+  virtual ~Event();
+
+  /**
+   * Return how many bytes this event wants to pass between the filter and 
execute function.
+   */
+  virtual uint storage_size()
+  {
+return 0;
+  }
+
+  /**
+   * Gets a set of particles and checks which of those trigger the event.
+   */
+  virtual void filter(EventFilterInterface ) = 0;
+
+  /**
+   * Gets a set of particles that trigger this event and can do the following 
operations:
+   *   - Change any attribute of the particles.
+   *   - Change the remaining integrated attribute offsets of the particles.
+   *   - Kill the particles.
+   *   - Spawn new particles of any type.
+   *
+   * Currently, it is not supported to change the attributes of other 
particles, that exist
+   * already. However, the attributes of new particles can be changed.
+   */
+  virtual void execute(EventExecuteInterface ) = 0;
+};
+
+/**
+ * An emitter creates new particles of possibly different types within a 
certain time span.
+ */
+class Emitter {
+ public:
+  virtual ~Emitter();
+
+  /**
+   * Create new particles within a time span.
+   *
+   * In general it works like so:
+   *   1. Prepare vectors with attribute values for e.g. position and velocity 
of the new
+   *  particles.
+   *   2. Request an emit target that can contain a given amount of particles 
of a specific type.
+   *   3. Copy the prepared attribute arrays into the target. Other attributes 
are initialized with
+   *  some default value.
+   *   4. Specify the exact birth times of every particle within the time 
span. This will allow the
+   *  framework to simulate the new particles for partial time steps to 
avoid stepping.
+   *
+   * To create particles of different types, multiple emit targets have to be 
requested.
+   */
+  virtual void emit(EmitterInterface ) = 0;
+};
+
+/**
+ * The integrator is the core of the particle system. It's main task is to 
determine how the
+ * simulation would go if there were no events.
+ */
+class Integrator {
+ public:
+  virtual ~Integrator();
+
+  /**
+   * Specify which attributes are integrated (usually Position and Velocity).
+   */
+  virtual AttributesInfo _attributes_info() = 0;
+
+  /**
+   * Compute the offsets for all integrated attributes. Those are not applied 
immediately, because
+   * there might be events that modify the attributes within a time step.
+   */
+  virtual void integrate(ParticlesBlock ,
+ ArrayRef durations,
+ AttributeArrays r_offsets) = 0;
+};
+
+/**
+ * Describes how one type of particle behaves and which attributes it has.
+ */
+class ParticleType {
+ public:
+  virtual ~ParticleType();
+
+  /**
+   * Return the integrator to be used with particles of this type.
+   */
+  virtual Integrator () = 0;
+
+  /**
+   * Return the events that particles of this type can trigger.
+   */
+  virtual ArrayRef events() = 0;
+
+  virtual ArrayRef byte_attributes()
+  {
+return {};
+  }
+
+  virtual ArrayRef float_attributes()
+  {
+return {};
+  }
+
+  virtual ArrayRef float3_attributes()
+  {
+return {};
+  }
+};
+
+/**
+ * Describes how the current state of a particle system transitions to the 
next state.
+ */
+class StepDescription {
+ public:
+  virtual ~StepDescription();
+
+  /**
+   * Return how many seconds the this time step takes.
+   */
+  virtual float step_duration() = 0;
+
+  /**
+   * Return the emitters that might emit particles in this time step.
+   */
+  virtual ArrayRef emitters() = 0;
+
+  /**
+   * Return the particle type ids that 

[Bf-blender-cvs] [37c0e0e6e97] functions: cleanup: separate declarations from implementations

2019-07-01 Thread Jacques Lucke
Commit: 37c0e0e6e97c14a99dbf015e8ecdf58f30f6ca6e
Author: Jacques Lucke
Date:   Mon Jul 1 11:42:15 2019 +0200
Branches: functions
https://developer.blender.org/rB37c0e0e6e97c14a99dbf015e8ecdf58f30f6ca6e

cleanup: separate declarations from implementations

===

M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index f25eef3e64f..886d12e276d 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -92,6 +92,11 @@ AttributesInfo ::attributes_info(uint 
particle_type_id)
 /* Emitter Interface
  **/
 
+EmitterInterface::EmitterInterface(BlockAllocator , TimeSpan 
time_span)
+: m_block_allocator(allocator), m_time_span(time_span)
+{
+}
+
 EmitterInterface::~EmitterInterface()
 {
   for (TimeSpanEmitTarget *target : m_targets) {
@@ -147,6 +152,38 @@ InstantEmitTarget 
::request_emit_target(uint particle_type
 /* EmitTarget
  **/
 
+EmitTargetBase::EmitTargetBase(uint particle_type_id,
+   AttributesInfo _info,
+   ArrayRef blocks,
+   ArrayRef> ranges)
+: m_particle_type_id(particle_type_id),
+  m_attributes_info(attributes_info),
+  m_blocks(blocks),
+  m_ranges(ranges)
+{
+  BLI_assert(blocks.size() == ranges.size());
+  for (auto range : ranges) {
+m_size += range.size();
+  }
+}
+
+InstantEmitTarget::InstantEmitTarget(uint particle_type_id,
+ AttributesInfo _info,
+ ArrayRef blocks,
+ ArrayRef> ranges)
+: EmitTargetBase(particle_type_id, attributes_info, blocks, ranges)
+{
+}
+
+TimeSpanEmitTarget::TimeSpanEmitTarget(uint particle_type_id,
+   AttributesInfo _info,
+   ArrayRef blocks,
+   ArrayRef> ranges,
+   TimeSpan time_span)
+: EmitTargetBase(particle_type_id, attributes_info, blocks, ranges), 
m_time_span(time_span)
+{
+}
+
 void EmitTargetBase::set_elements(uint index, void *data)
 {
   AttributeType type = m_attributes_info.type_of(index);
@@ -266,4 +303,41 @@ void TimeSpanEmitTarget::set_randomized_birth_moments()
   this->set_float("Birth Time", birth_times);
 }
 
+/* EventFilterInterface
+ */
+
+EventFilterInterface::EventFilterInterface(ParticleSet particles,
+   AttributeArrays _offsets,
+   ArrayRef durations,
+   float end_time,
+   EventStorage _event_storage,
+   SmallVector 
_filtered_indices,
+   SmallVector 
_filtered_time_factors)
+: m_particles(particles),
+  m_attribute_offsets(attribute_offsets),
+  m_durations(durations),
+  m_end_time(end_time),
+  m_event_storage(r_event_storage),
+  m_filtered_indices(r_filtered_indices),
+  m_filtered_time_factors(r_filtered_time_factors)
+{
+}
+
+/* EventExecuteInterface
+ */
+
+EventExecuteInterface::EventExecuteInterface(ParticleSet particles,
+ BlockAllocator _allocator,
+ ArrayRef current_times,
+ EventStorage _storage,
+ AttributeArrays attribute_offsets)
+: m_particles(particles),
+  m_block_allocator(block_allocator),
+  m_current_times(current_times),
+  m_kill_states(m_particles.attributes().get_byte("Kill State")),
+  m_event_storage(event_storage),
+  m_attribute_offsets(attribute_offsets)
+{
+}
+
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index a61e4e21344..cbf30c37c99 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -28,26 +28,10 @@ class ParticlesState {
   ParticlesState(ParticlesState ) = delete;
   ~ParticlesState();
 
-  SmallMap _containers()
-  {
-return m_container_by_id;
-  }
-
-  ParticlesContainer _container(uint type_id)
-  {
-return *m_container_by_id.lookup(type_id);
-  }
+  SmallMap _containers();
 
-  uint particle_container_id(ParticlesContainer )
-  {
-for (auto item : m_container_by_id.items()) {
- 

[Bf-blender-cvs] [a8eb1d28dbe] functions: start cleaning up core.hpp

2019-07-01 Thread Jacques Lucke
Commit: a8eb1d28dbe6773f5257a9274b775be00b394880
Author: Jacques Lucke
Date:   Mon Jul 1 11:24:22 2019 +0200
Branches: functions
https://developer.blender.org/rBa8eb1d28dbe6773f5257a9274b775be00b394880

start cleaning up core.hpp

===

M   source/blender/simulations/bparticles/actions.cpp
M   source/blender/simulations/bparticles/actions.hpp
M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/emitters.hpp
M   source/blender/simulations/bparticles/events.cpp
M   source/blender/simulations/bparticles/events.hpp
M   source/blender/simulations/bparticles/forces.cpp
M   source/blender/simulations/bparticles/forces.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/actions.cpp 
b/source/blender/simulations/bparticles/actions.cpp
index b63049b81bb..5b48ef562f7 100644
--- a/source/blender/simulations/bparticles/actions.cpp
+++ b/source/blender/simulations/bparticles/actions.cpp
@@ -4,6 +4,10 @@
 
 namespace BParticles {
 
+Action::~Action()
+{
+}
+
 class KillAction : public Action {
   void execute(EventExecuteInterface ) override
   {
diff --git a/source/blender/simulations/bparticles/actions.hpp 
b/source/blender/simulations/bparticles/actions.hpp
index 568562f8630..92da0bf0f39 100644
--- a/source/blender/simulations/bparticles/actions.hpp
+++ b/source/blender/simulations/bparticles/actions.hpp
@@ -4,6 +4,13 @@
 
 namespace BParticles {
 
+class Action {
+ public:
+  virtual ~Action() = 0;
+
+  virtual void execute(EventExecuteInterface ) = 0;
+};
+
 Action *ACTION_kill();
 Action *ACTION_move(float3 offset);
 Action *ACTION_spawn();
diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index c35356e35a4..f25eef3e64f 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -2,10 +2,6 @@
 
 namespace BParticles {
 
-Force::~Force()
-{
-}
-
 Emitter::~Emitter()
 {
 }
@@ -14,14 +10,6 @@ Integrator::~Integrator()
 {
 }
 
-Action::~Action()
-{
-}
-
-EventFilter::~EventFilter()
-{
-}
-
 Event::~Event()
 {
 }
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 1ab0b1ec5e1..a61e4e21344 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -17,16 +17,6 @@
 
 namespace BParticles {
 
-using BLI::ArrayRef;
-using BLI::float3;
-using BLI::float4x4;
-using BLI::SmallMap;
-using BLI::SmallSetVector;
-using BLI::SmallVector;
-using BLI::StringRef;
-using BLI::VectorAdaptor;
-using std::unique_ptr;
-
 class ParticlesState {
  private:
   SmallMap m_container_by_id;
@@ -289,12 +279,6 @@ struct ParticleSet {
   }
 };
 
-class Force {
- public:
-  virtual ~Force();
-  virtual void add_force(ParticlesBlock , ArrayRef r_force) = 0;
-};
-
 class EventStorage {
  private:
   void *m_array;
@@ -386,13 +370,6 @@ class EventFilterInterface {
   }
 };
 
-class EventFilter {
- public:
-  virtual ~EventFilter();
-
-  virtual void filter(EventFilterInterface ) = 0;
-};
-
 class EventExecuteInterface {
  private:
   ParticleSet m_particles;
@@ -460,13 +437,6 @@ class EventExecuteInterface {
   }
 };
 
-class Action {
- public:
-  virtual ~Action();
-
-  virtual void execute(EventExecuteInterface ) = 0;
-};
-
 class Event {
  public:
   virtual ~Event();
diff --git a/source/blender/simulations/bparticles/emitters.hpp 
b/source/blender/simulations/bparticles/emitters.hpp
index 7a77daac899..d219bd7f064 100644
--- a/source/blender/simulations/bparticles/emitters.hpp
+++ b/source/blender/simulations/bparticles/emitters.hpp
@@ -7,6 +7,8 @@ struct Path;
 
 namespace BParticles {
 
+using BLI::float4x4;
+
 Emitter *EMITTER_point(float3 point);
 Emitter *EMITTER_mesh_surface(uint particle_type_id,
   struct Mesh *mesh,
diff --git a/source/blender/simulations/bparticles/events.cpp 
b/source/blender/simulations/bparticles/events.cpp
index 89d83fe7c2c..456387fbeea 100644
--- a/source/blender/simulations/bparticles/events.cpp
+++ b/source/blender/simulations/bparticles/events.cpp
@@ -6,6 +6,10 @@
 
 namespace BParticles {
 
+EventFilter::~EventFilter()
+{
+}
+
 class AgeReachedEvent : public EventFilter {
  private:
   float m_age;
diff --git a/source/blender/simulations/bparticles/events.hpp 
b/source/blender/simulations/bparticles/events.hpp
index 109f0b8c6e5..423ca3ba37b 100644
--- a/source/blender/simulations/bparticles/events.hpp
+++ b/source/blender/simulations/bparticles/events.hpp
@@ -6,6 +6,15 @@ struct BVHTreeFromMesh;
 
 namespace BParticles {
 
+using BLI::float4x4;
+
+class EventFilter {
+ public:
+  virtual ~EventFilter() = 0;
+
+  virtual void 

[Bf-blender-cvs] [563b784f2b2] soc-2019-npr: LANPR: make format

2019-07-01 Thread YimingWu
Commit: 563b784f2b286c6fa88d0372773425143430362f
Author: YimingWu
Date:   Mon Jul 1 17:33:00 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB563b784f2b286c6fa88d0372773425143430362f

LANPR: make format

===

M   intern/cycles/util/util_logging.cpp
M   source/blender/draw/engines/lanpr/lanpr_access.c
M   source/blender/draw/engines/lanpr/lanpr_access.h
M   source/blender/draw/engines/lanpr/lanpr_chain.c
M   source/blender/draw/engines/lanpr/lanpr_ops.c
M   source/blender/modifiers/intern/MOD_edgesplit.c

===

diff --git a/intern/cycles/util/util_logging.cpp 
b/intern/cycles/util/util_logging.cpp
index cc1e328ba6d..e41250ab1b9 100644
--- a/intern/cycles/util/util_logging.cpp
+++ b/intern/cycles/util/util_logging.cpp
@@ -29,7 +29,7 @@ CCL_NAMESPACE_BEGIN
 static bool is_verbosity_set()
 {
 #ifdef WITH_CYCLES_LOGGING
-using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption;
+  using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption;
 
   std::string verbosity;
   if (!GetCommandLineOption("v", )) {
@@ -37,7 +37,7 @@ using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption;
   }
   return verbosity != "0";
 #else
-   return false;
+  return false;
 #endif
 }
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.c 
b/source/blender/draw/engines/lanpr/lanpr_access.c
index 2bad8dcf99f..08de3ab2aa2 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.c
+++ b/source/blender/draw/engines/lanpr/lanpr_access.c
@@ -138,7 +138,8 @@ bool lanpr_dpix_shader_error()
   return lanpr_share.dpix_shader_error;
 }
 
-bool lanpr_disable_edge_splits(Scene* s){
+bool lanpr_disable_edge_splits(Scene *s)
+{
   return s->lanpr.disable_edge_splits;
 }
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.h 
b/source/blender/draw/engines/lanpr/lanpr_access.h
index b892a13ffee..16e21311040 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.h
+++ b/source/blender/draw/engines/lanpr/lanpr_access.h
@@ -32,7 +32,7 @@ void lanpr_destroy_render_data(struct LANPR_RenderBuffer *rb);
 
 bool lanpr_dpix_shader_error();
 
-bool lanpr_disable_edge_splits(struct Scene* s);
+bool lanpr_disable_edge_splits(struct Scene *s);
 
 void lanpr_copy_data(struct Scene *from, struct Scene *to);
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c 
b/source/blender/draw/engines/lanpr/lanpr_chain.c
index 7f33c467a35..a69a30c6de2 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain.c
@@ -724,7 +724,8 @@ void lanpr_connect_chains(LANPR_RenderBuffer *rb, int 
do_geometry_space)
 }
 
 /* length is in image space */
-float lanpr_compute_chain_length(LANPR_RenderLineChain *rlc){
+float lanpr_compute_chain_length(LANPR_RenderLineChain *rlc)
+{
   LANPR_RenderLineChainItem *rlci;
   float offset_accum = 0;
   float dist;
@@ -740,12 +741,13 @@ float lanpr_compute_chain_length(LANPR_RenderLineChain 
*rlc){
   return offset_accum;
 }
 
-void lanpr_discard_short_chains(LANPR_RenderBuffer* rb, float threshold){
-  LANPR_RenderLineChain *rlc,*next_rlc;
-  for(rlc = rb->chains.first;rlc;rlc=next_rlc){
+void lanpr_discard_short_chains(LANPR_RenderBuffer *rb, float threshold)
+{
+  LANPR_RenderLineChain *rlc, *next_rlc;
+  for (rlc = rb->chains.first; rlc; rlc = next_rlc) {
 next_rlc = rlc->next;
-if(lanpr_compute_chain_length(rlc)chains,rlc);
+if (lanpr_compute_chain_length(rlc) < threshold) {
+  BLI_remlink(>chains, rlc);
 }
   }
 }
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 97d52baaf50..04448ce7838 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -3641,17 +3641,17 @@ long lanpr_count_leveled_edge_segment_count(ListBase 
*LineList, LANPR_LineLayer
 }
 
 for (rls = rl->segments.first; rls; rls = rls->next) {
-  
-  if(!ll->use_multiple_levels){
+
+  if (!ll->use_multiple_levels) {
 if (rls->occlusion == ll->qi_begin) {
   Count++;
 }
-  }else{
+  }
+  else {
 if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
   Count++;
 }
   }
-  
 }
   }
   return Count;
@@ -3690,17 +3690,19 @@ void 
*lanpr_make_leveled_edge_vertex_array(LANPR_RenderBuffer *rb,
 
 for (rls = rl->segments.first; rls; rls = rls->next) {
   int use = 0;
-  if(!ll->use_multiple_levels){
+  if (!ll->use_multiple_levels) {
 if (rls->occlusion == ll->qi_begin) {
   use = 1;
 }
-  }else{
+  }
+  else {
 if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
   use = 1;
 }
   }
 
-  if(!use) continue;
+  if (!use)
+continue;
 
   if (rl->tl) {
 N[0] += rl->tl->gn[0];
@@ -3897,7 

[Bf-blender-cvs] [c64b72998cf] master: Fix T66283: Crash on redo/undo during playback

2019-07-01 Thread Sergey Sharybin
Commit: c64b72998cfaab0512de38843219d074e876a0a8
Author: Sergey Sharybin
Date:   Mon Jul 1 11:31:53 2019 +0200
Branches: master
https://developer.blender.org/rBc64b72998cfaab0512de38843219d074e876a0a8

Fix T66283: Crash on redo/undo during playback

===

M   source/blender/editors/screen/screen_ops.c

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index ef99d39f990..5fc7979a631 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4200,6 +4200,7 @@ static int match_region_with_redraws(int spacetype,
 static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const 
wmEvent *event)
 {
   bScreen *screen = CTX_wm_screen(C);
+  wmWindow *win = CTX_wm_window(C);
 
 #ifdef PROFILE_AUDIO_SYNCH
   static int old_frame = 0;
@@ -4209,8 +4210,9 @@ static int screen_animation_step(bContext *C, wmOperator 
*UNUSED(op), const wmEv
   if (screen->animtimer && screen->animtimer == event->customdata) {
 Main *bmain = CTX_data_main(C);
 Scene *scene = CTX_data_scene(C);
-Depsgraph *depsgraph = CTX_data_depsgraph(C);
-Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
+Scene *scene_eval = (depsgraph != NULL) ? 
DEG_get_evaluated_scene(depsgraph) : NULL;
 wmTimer *wt = screen->animtimer;
 ScreenAnimData *sad = wt->customdata;
 wmWindowManager *wm = CTX_wm_manager(C);
@@ -4230,7 +4232,11 @@ static int screen_animation_step(bContext *C, wmOperator 
*UNUSED(op), const wmEv
   sync = (scene->flag & SCE_FRAME_DROP);
 }
 
-if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) {
+if (scene_eval == NULL) {
+  /* Happens when undo/redo system is used during playback, nothing 
meaningful we can do here.
+   */
+}
+else if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) {
   /* Ignore seek here, the audio will be updated to the scene frame after 
jump during next
* dependency graph update. */
 }
@@ -4335,7 +4341,9 @@ static int screen_animation_step(bContext *C, wmOperator 
*UNUSED(op), const wmEv
 }
 
 /* since we follow drawflags, we can't send notifier but tag regions 
ourselves */
-ED_update_for_newframe(bmain, depsgraph);
+if (depsgraph != NULL) {
+  ED_update_for_newframe(bmain, depsgraph);
+}
 
 for (window = wm->windows.first; window; window = window->next) {
   const bScreen *win_screen = WM_window_get_active_screen(window);

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


[Bf-blender-cvs] [a083fb84d40] soc-2019-npr: LANPR: Fixed line level error in engine self rendering.

2019-07-01 Thread YimingWu
Commit: a083fb84d4082937d238c5e99430c05b3b59c627
Author: YimingWu
Date:   Mon Jul 1 17:16:03 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBa083fb84d4082937d238c5e99430c05b3b59c627

LANPR: Fixed line level error in engine self rendering.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index cfb196d783f..d7ec66008a3 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -3642,7 +3642,7 @@ long lanpr_count_leveled_edge_segment_count(ListBase 
*LineList, LANPR_LineLayer
 
 for (rls = rl->segments.first; rls; rls = rls->next) {
   
-  if(ll->use_same_style){
+  if(!ll->use_multiple_levels){
 if (rls->occlusion == ll->qi_begin) {
   Count++;
 }
@@ -3690,7 +3690,7 @@ void 
*lanpr_make_leveled_edge_vertex_array(LANPR_RenderBuffer *rb,
 
 for (rls = rl->segments.first; rls; rls = rls->next) {
   int use = 0;
-  if(ll->use_same_style){
+  if(!ll->use_multiple_levels){
 if (rls->occlusion == ll->qi_begin) {
   use = 1;
 }
@@ -3702,42 +3702,39 @@ void 
*lanpr_make_leveled_edge_vertex_array(LANPR_RenderBuffer *rb,
 
   if(!use) continue;
 
-  if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
-
-if (rl->tl) {
-  N[0] += rl->tl->gn[0];
-  N[1] += rl->tl->gn[1];
-  N[2] += rl->tl->gn[2];
-}
-if (rl->tr) {
-  N[0] += rl->tr->gn[0];
-  N[1] += rl->tr->gn[1];
-  N[2] += rl->tr->gn[2];
-}
-if (rl->tl || rl->tr) {
-  normalize_v3(N);
-  copy_v3_v3([3], N);
-}
-N += 6;
-
-CLAMP(rls->at, 0, 1);
-if (irls = rls->next) {
-  CLAMP(irls->at, 0, 1);
-}
+  if (rl->tl) {
+N[0] += rl->tl->gn[0];
+N[1] += rl->tl->gn[1];
+N[2] += rl->tl->gn[2];
+  }
+  if (rl->tr) {
+N[0] += rl->tr->gn[0];
+N[1] += rl->tr->gn[1];
+N[2] += rl->tr->gn[2];
+  }
+  if (rl->tl || rl->tr) {
+normalize_v3(N);
+copy_v3_v3([3], N);
+  }
+  N += 6;
 
-*v = tnsLinearItp(rl->l->fbcoord[0], rl->r->fbcoord[0], rls->at);
-v++;
-*v = tnsLinearItp(rl->l->fbcoord[1], rl->r->fbcoord[1], rls->at);
-v++;
-*v = componet_id;
-v++;
-*v = tnsLinearItp(rl->l->fbcoord[0], rl->r->fbcoord[0], irls ? 
irls->at : 1);
-v++;
-*v = tnsLinearItp(rl->l->fbcoord[1], rl->r->fbcoord[1], irls ? 
irls->at : 1);
-v++;
-*v = componet_id;
-v++;
+  CLAMP(rls->at, 0, 1);
+  if (irls = rls->next) {
+CLAMP(irls->at, 0, 1);
   }
+
+  *v = tnsLinearItp(rl->l->fbcoord[0], rl->r->fbcoord[0], rls->at);
+  v++;
+  *v = tnsLinearItp(rl->l->fbcoord[1], rl->r->fbcoord[1], rls->at);
+  v++;
+  *v = componet_id;
+  v++;
+  *v = tnsLinearItp(rl->l->fbcoord[0], rl->r->fbcoord[0], irls ? irls->at 
: 1);
+  v++;
+  *v = tnsLinearItp(rl->l->fbcoord[1], rl->r->fbcoord[1], irls ? irls->at 
: 1);
+  v++;
+  *v = componet_id;
+  v++;
 }
   }
   *NextNormal = N;
@@ -4073,7 +4070,7 @@ void lanpr_software_draw_scene(void *vedata, 
GPUFrameBuffer *dfb, int is_render)
 DRW_shgroup_uniform_vec3(rb->ChainShgrp, "normal_direction", 
normal_object_direction, 1);
 
 DRW_shgroup_uniform_int(rb->ChainShgrp, "occlusion_level_begin", 
>qi_begin, 1);
-DRW_shgroup_uniform_int(rb->ChainShgrp, "occlusion_level_end", 
>qi_end, 1);
+DRW_shgroup_uniform_int(rb->ChainShgrp, "occlusion_level_end", 
ll->use_multiple_levels?>qi_end:>qi_begin, 1);
 
 DRW_shgroup_uniform_vec4(
 rb->ChainShgrp, "preview_viewport", stl->g_data->dpix_viewport, 1);

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


[Bf-blender-cvs] [e3b9dfd3571] soc-2019-npr: LANPR: viewport auto update in LANPR line layer operators.

2019-07-01 Thread YimingWu
Commit: e3b9dfd3571a80aebd116e5cf0121842754c8386
Author: YimingWu
Date:   Mon Jul 1 17:02:31 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBe3b9dfd3571a80aebd116e5cf0121842754c8386

LANPR: viewport auto update in LANPR line layer operators.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 8309cd81242..cfb196d783f 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -3641,10 +3641,17 @@ long lanpr_count_leveled_edge_segment_count(ListBase 
*LineList, LANPR_LineLayer
 }
 
 for (rls = rl->segments.first; rls; rls = rls->next) {
-
-  if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
-Count++;
+  
+  if(ll->use_same_style){
+if (rls->occlusion == ll->qi_begin) {
+  Count++;
+}
+  }else{
+if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
+  Count++;
+}
   }
+  
 }
   }
   return Count;
@@ -3682,6 +3689,19 @@ void 
*lanpr_make_leveled_edge_vertex_array(LANPR_RenderBuffer *rb,
 }
 
 for (rls = rl->segments.first; rls; rls = rls->next) {
+  int use = 0;
+  if(ll->use_same_style){
+if (rls->occlusion == ll->qi_begin) {
+  use = 1;
+}
+  }else{
+if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
+  use = 1;
+}
+  }
+
+  if(!use) continue;
+
   if (rls->occlusion >= ll->qi_begin && rls->occlusion <= ll->qi_end) {
 
 if (rl->tl) {
@@ -3830,6 +3850,8 @@ void lanpr_rebuild_all_command(SceneLANPR *lanpr)
   lanpr_rebuild_render_draw_command(lanpr_share.render_buffer_shared, ll);
 }
   }
+
+  DEG_id_tag_update(_share.render_buffer_shared->scene->id, 
ID_RECALC_COPY_ON_WRITE);
 }
 
 void lanpr_viewport_draw_offline_result(LANPR_TextureList *txl,
@@ -4220,6 +4242,7 @@ static int lanpr_compute_feature_lines_exec(struct 
bContext *C, struct wmOperato
 {
   Scene *scene = CTX_data_scene(C);
   SceneLANPR *lanpr = >lanpr;
+  int result;
 
   if (!lanpr->enabled) {
 return OPERATOR_CANCELLED;
@@ -4231,7 +4254,13 @@ static int lanpr_compute_feature_lines_exec(struct 
bContext *C, struct wmOperato
 return OPERATOR_FINISHED;
   }
 
-  return lanpr_compute_feature_lines_internal(CTX_data_depsgraph(C));
+  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW , NULL); 
+
+  result = lanpr_compute_feature_lines_internal(CTX_data_depsgraph(C));
+  
+  lanpr_rebuild_all_command(lanpr);
+  
+  return result;
 }
 static void lanpr_compute_feature_lines_cancel(struct bContext *C, struct 
wmOperator *op)
 {
@@ -4311,6 +4340,10 @@ int lanpr_delete_line_layer_exec(struct bContext *C, 
struct wmOperator *op)
 
   MEM_freeN(ll);
 
+  DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+
+  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW , NULL); 
+
   return OPERATOR_FINISHED;
 }
 int lanpr_move_line_layer_exec(struct bContext *C, struct wmOperator *op)
@@ -4335,6 +4368,10 @@ int lanpr_move_line_layer_exec(struct bContext *C, 
struct wmOperator *op)
 BLI_insertlinkafter(>line_layers, ll->next, ll);
   }
 
+  DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+
+  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW , NULL); 
+
   return OPERATOR_FINISHED;
 }
 int lanpr_add_line_component_exec(struct bContext *C, struct wmOperator *op)
@@ -4380,6 +4417,11 @@ int lanpr_rebuild_all_commands_exec(struct bContext *C, 
struct wmOperator *op)
   SceneLANPR *lanpr = >lanpr;
 
   lanpr_rebuild_all_command(lanpr);
+
+  DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+
+  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW , NULL); 
+
   return OPERATOR_FINISHED;
 }
 int lanpr_enable_all_line_types_exec(struct bContext *C, struct wmOperator *op)

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


[Bf-blender-cvs] [6f090b3e37c] soc-2019-npr: LANPR: Updating GPencil will now automatically redraw.

2019-07-01 Thread YimingWu
Commit: 6f090b3e37c12c0c5ac1b399d1f5b9ff2d784863
Author: YimingWu
Date:   Mon Jul 1 16:30:14 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB6f090b3e37c12c0c5ac1b399d1f5b9ff2d784863

LANPR: Updating GPencil will now automatically redraw.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index fda2c6e8c39..8309cd81242 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -4489,6 +4489,7 @@ void lanpr_update_gp_strokes_recursive(Depsgraph *dg, 
struct Collection *col, in
 flmd->material,
 NULL,
 flmd->types);
+  DEG_id_tag_update(>id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY 
| ID_RECALC_COPY_ON_WRITE);
 }
   }
 }
@@ -4537,6 +4538,7 @@ void lanpr_update_gp_strokes_collection(Depsgraph *dg, 
struct Collection *col, i
 col->lanpr.material,
 col,
 col->lanpr.types);
+  DEG_id_tag_update(>id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | 
ID_RECALC_COPY_ON_WRITE);
 }
 int lanpr_update_gp_strokes_exec(struct bContext *C, struct wmOperator *op)
 {
@@ -4551,6 +4553,8 @@ int lanpr_update_gp_strokes_exec(struct bContext *C, 
struct wmOperator *op)
 
   lanpr_update_gp_strokes_collection(dg, scene->master_collection, frame);
 
+  WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | 
ND_SPACE_PROPERTIES, NULL); 
+
   return OPERATOR_FINISHED;
 }
 int lanpr_bake_gp_strokes_exec(struct bContext *C, struct wmOperator *op)
@@ -4575,6 +4579,8 @@ int lanpr_bake_gp_strokes_exec(struct bContext *C, struct 
wmOperator *op)
 lanpr_update_gp_strokes_collection(dg, scene->master_collection, frame);
   }
 
+  WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED | 
ND_SPACE_PROPERTIES, NULL); 
+
   return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [1074150f2a8] soc-2019-npr: LANPR: defaults in new line layers.

2019-07-01 Thread YimingWu
Commit: 1074150f2a80fe421fa0b6699124f00f138e3d36
Author: YimingWu
Date:   Mon Jul 1 17:19:46 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB1074150f2a80fe421fa0b6699124f00f138e3d36

LANPR: defaults in new line layers.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index d7ec66008a3..97d52baaf50 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -4286,6 +4286,16 @@ LANPR_LineLayer *lanpr_new_line_layer(SceneLANPR *lanpr)
   BLI_addtail(>line_layers, ll);
   lanpr->active_layer = ll;
   ll->use_same_style = 1;
+  ll->thickness = 1.0f;
+  ll->color[0] = 1.0f;
+  ll->color[1] = 1.0f;
+  ll->color[2] = 1.0f;
+  ll->color[3] = 1.0f;
+  ll->enable_contour = 1;
+  ll->enable_crease = 1;
+  ll->enable_material_seperate = 1;
+  ll->enable_edge_mark = 1;
+  ll->enable_intersection = 1;
   return ll;
 }
 LANPR_LineLayerComponent *lanpr_new_line_component(SceneLANPR *lanpr)
@@ -4308,6 +4318,10 @@ int lanpr_add_line_layer_exec(struct bContext *C, struct 
wmOperator *op)
 
   lanpr_new_line_layer(lanpr);
 
+  DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
+
+  WM_event_add_notifier(C, NC_OBJECT | ND_DRAW , NULL); 
+
   return OPERATOR_FINISHED;
 }
 int lanpr_delete_line_layer_exec(struct bContext *C, struct wmOperator *op)

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


[Bf-blender-cvs] [89946834a17] master: Fix T66279: Strip sound keeps playing after toggling to Camera

2019-07-01 Thread Sergey Sharybin
Commit: 89946834a1708db91645aac4fb950b7588035d6d
Author: Sergey Sharybin
Date:   Mon Jul 1 11:12:18 2019 +0200
Branches: master
https://developer.blender.org/rB89946834a1708db91645aac4fb950b7588035d6d

Fix T66279: Strip sound keeps playing after toggling to Camera

Before this change using Sequencer input for the scene strip would
permanently enable sound playing back for that strip. Going back to
Camera would have been still playing sound from the strip, which is
rather misleading since rest of the nested sequencer is not used.

===

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

===

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index d2d56569bff..a447b828bb1 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2445,6 +2445,21 @@ void BKE_scene_cursor_from_mat4(View3DCursor *cursor, 
const float mat[4][4], boo
 
 /* Dependency graph evaluation. */
 
+static void scene_sequencer_disable_sound_strips(Scene *scene)
+{
+  if (scene->sound_scene == NULL) {
+return;
+  }
+  Sequence *seq;
+  SEQ_BEGIN (scene->ed, seq) {
+if (seq->scene_sound != NULL) {
+  BKE_sound_remove_scene_sound(scene, seq->scene_sound);
+  seq->scene_sound = NULL;
+}
+  }
+  SEQ_END;
+}
+
 void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
 {
   DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene);
@@ -2474,6 +2489,9 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph 
*depsgraph, Scene *scene)
* then it is no longer needed to do such manual forced updates. */
   if (seq->type == SEQ_TYPE_SCENE && seq->scene != NULL) {
 BKE_sound_set_scene_volume(seq->scene, seq->scene->audio.volume);
+if ((seq->flag & SEQ_SCENE_STRIPS) == 0) {
+  scene_sequencer_disable_sound_strips(seq->scene);
+}
   }
   if (seq->sound != NULL) {
 if (scene->id.recalc & ID_RECALC_AUDIO || seq->sound->id.recalc & 
ID_RECALC_AUDIO) {

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


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

2019-07-01 Thread Antonioya
Commit: 570f2814acb2ecb4f7e81a1b620d7dcd36d77a74
Author: Antonioya
Date:   Mon Jul 1 11:13:22 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB570f2814acb2ecb4f7e81a1b620d7dcd36d77a74

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] [6335c3dee8d] functions: change threading api

2019-07-01 Thread Jacques Lucke
Commit: 6335c3dee8d31ce8fa7b665b01c634808a115ab5
Author: Jacques Lucke
Date:   Mon Jul 1 10:16:29 2019 +0200
Branches: functions
https://developer.blender.org/rB6335c3dee8d31ce8fa7b665b01c634808a115ab5

change threading api

===

M   source/blender/blenlib/BLI_task.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/blenlib/BLI_task.hpp 
b/source/blender/blenlib/BLI_task.hpp
index f5bfb60e953..87e2bb7abc4 100644
--- a/source/blender/blenlib/BLI_task.hpp
+++ b/source/blender/blenlib/BLI_task.hpp
@@ -6,9 +6,26 @@
 namespace BLI {
 namespace Task {
 
+/**
+ * Use this when the processing of individual array elements is relatively 
expensive.
+ * The function has to be a callable that takes an element of type T& as input.
+ *
+ * For debugging/profiling purposes the threading can be disabled.
+ */
 template
-static void parallel_array(ArrayRef array, Func function, 
ParallelRangeSettings )
+static void parallel_array_elements(ArrayRef array, Func function, bool 
use_threading = false)
 {
+  if (!use_threading) {
+for (T  : array) {
+  function(element);
+}
+return;
+  }
+
+  ParallelRangeSettings settings = {0};
+  BLI_parallel_range_settings_defaults();
+  settings.scheduling_mode = TASK_SCHEDULING_DYNAMIC;
+
   struct ParallelData {
 ArrayRef array;
 Func 
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 4e19160d98a..f00b79a7cdb 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -7,7 +7,7 @@
 
 #include "xmmintrin.h"
 
-#define USE_THREADING false
+#define USE_THREADING true
 #define BLOCK_SIZE 1000
 
 namespace BParticles {
@@ -693,14 +693,10 @@ BLI_NOINLINE static void 
delete_tagged_particles(ParticlesState )
 {
   SmallVector blocks = get_all_blocks(state);
 
-  ParallelRangeSettings settings;
-  BLI_parallel_range_settings_defaults();
-  settings.use_threading = USE_THREADING;
-
-  BLI::Task::parallel_array(
+  BLI::Task::parallel_array_elements(
   ArrayRef(blocks),
   [](ParticlesBlock *block) { delete_tagged_particles_and_reorder(*block); 
},
-  settings);
+  USE_THREADING);
 }
 
 /* Compress particle blocks.

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


[Bf-blender-cvs] [585d6a51c07] functions: initial api for threading with thread local data

2019-07-01 Thread Jacques Lucke
Commit: 585d6a51c0777e2c4a70a2898a173f6116f6889c
Author: Jacques Lucke
Date:   Mon Jul 1 11:08:00 2019 +0200
Branches: functions
https://developer.blender.org/rB585d6a51c0777e2c4a70a2898a173f6116f6889c

initial api for threading with thread local data

This does look quite ugly so far, but it is still better than doing it manually 
every time.

===

M   source/blender/blenlib/BLI_task.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/blenlib/BLI_task.hpp 
b/source/blender/blenlib/BLI_task.hpp
index 87e2bb7abc4..e872c237b7d 100644
--- a/source/blender/blenlib/BLI_task.hpp
+++ b/source/blender/blenlib/BLI_task.hpp
@@ -1,7 +1,10 @@
 #pragma once
 
+#include 
+
 #include "BLI_task.h"
 #include "BLI_array_ref.hpp"
+#include "BLI_small_map.hpp"
 
 namespace BLI {
 namespace Task {
@@ -12,12 +15,14 @@ namespace Task {
  *
  * For debugging/profiling purposes the threading can be disabled.
  */
-template
-static void parallel_array_elements(ArrayRef array, Func function, bool 
use_threading = false)
+template
+static void parallel_array_elements(ArrayRef array,
+ProcessElement process_element,
+bool use_threading = false)
 {
   if (!use_threading) {
 for (T  : array) {
-  function(element);
+  process_element(element);
 }
 return;
   }
@@ -28,8 +33,8 @@ static void parallel_array_elements(ArrayRef array, Func 
function, bool use_t
 
   struct ParallelData {
 ArrayRef array;
-Func 
-  } data = {array, function};
+ProcessElement _element;
+  } data = {array, process_element};
 
   BLI_task_parallel_range(0,
   array.size(),
@@ -39,10 +44,67 @@ static void parallel_array_elements(ArrayRef array, Func 
function, bool use_t
  const ParallelRangeTLS *__restrict UNUSED(tls)) {
 ParallelData  = *(ParallelData *)userdata;
 T  = data.array[index];
-data.function(element);
+data.process_element(element);
   },
   );
 }
 
+template
+static void parallel_array_elements(ArrayRef array,
+ProcessElement process_element,
+CreateThreadLocal create_thread_local,
+FreeThreadLocal free_thread_local,
+bool use_threading = false)
+{
+  using LocalData = decltype(create_thread_local());
+
+  if (!use_threading) {
+LocalData local_data = create_thread_local();
+for (T  : array) {
+  process_element(element, local_data);
+}
+free_thread_local(local_data);
+return;
+  }
+
+  ParallelRangeSettings settings = {0};
+  BLI_parallel_range_settings_defaults();
+  settings.scheduling_mode = TASK_SCHEDULING_DYNAMIC;
+
+  struct ParallelData {
+ArrayRef array;
+ProcessElement _element;
+CreateThreadLocal _thread_local;
+SmallMap thread_locals;
+std::mutex thread_locals_mutex;
+  } data = {array, process_element, create_thread_local, {}, {}};
+
+  BLI_task_parallel_range(
+  0,
+  array.size(),
+  (void *),
+  [](void *__restrict userdata, const int index, const ParallelRangeTLS 
*__restrict tls) {
+ParallelData  = *(ParallelData *)userdata;
+int thread_id = tls->thread_id;
+
+data.thread_locals_mutex.lock();
+LocalData *local_data_ptr = data.thread_locals.lookup_ptr(thread_id);
+LocalData local_data = (local_data_ptr == nullptr) ? 
data.create_thread_local() :
+ *local_data_ptr;
+if (local_data_ptr == nullptr) {
+  data.thread_locals.add_new(thread_id, local_data);
+}
+data.thread_locals_mutex.unlock();
+
+T  = data.array[index];
+data.process_element(element, local_data);
+  },
+  );
+
+  for (LocalData data : data.thread_locals.values()) {
+free_thread_local(data);
+  }
+}
+
 }  // namespace Task
 }  // namespace BLI
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index f00b79a7cdb..6a02519bd80 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -517,51 +517,6 @@ struct ThreadLocalData {
   }
 };
 
-struct SimulateTimeSpanData {
-  ArrayRef blocks;
-  ArrayRef all_durations;
-  float end_time;
-  BlockAllocators _allocators;
-  StepDescription _description;
-
-  std::mutex data_per_thread_mutex;
-  SmallMap data_per_thread;
-};
-
-BLI_NOINLINE static void simulate_block_time_span_cb(void *__restrict userdata,
- 

[Bf-blender-cvs] [6289393f7b9] functions: initial c++ api for parallel processing on top of BLI_task

2019-07-01 Thread Jacques Lucke
Commit: 6289393f7b95dccc5d02cc270003afb157bca6cb
Author: Jacques Lucke
Date:   Mon Jul 1 09:57:34 2019 +0200
Branches: functions
https://developer.blender.org/rB6289393f7b95dccc5d02cc270003afb157bca6cb

initial c++ api for parallel processing on top of BLI_task

===

A   source/blender/blenlib/BLI_task.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/blenlib/BLI_task.hpp 
b/source/blender/blenlib/BLI_task.hpp
new file mode 100644
index 000..f5bfb60e953
--- /dev/null
+++ b/source/blender/blenlib/BLI_task.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "BLI_task.h"
+#include "BLI_array_ref.hpp"
+
+namespace BLI {
+namespace Task {
+
+template
+static void parallel_array(ArrayRef array, Func function, 
ParallelRangeSettings )
+{
+  struct ParallelData {
+ArrayRef array;
+Func 
+  } data = {array, function};
+
+  BLI_task_parallel_range(0,
+  array.size(),
+  (void *),
+  [](void *__restrict userdata,
+ const int index,
+ const ParallelRangeTLS *__restrict UNUSED(tls)) {
+ParallelData  = *(ParallelData *)userdata;
+T  = data.array[index];
+data.function(element);
+  },
+  );
+}
+
+}  // namespace Task
+}  // namespace BLI
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 0f65614f6e4..4e19160d98a 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -2,7 +2,7 @@
 #include "time_span.hpp"
 
 #include "BLI_lazy_init.hpp"
-#include "BLI_task.h"
+#include "BLI_task.hpp"
 #include "BLI_timeit.hpp"
 
 #include "xmmintrin.h"
@@ -689,18 +689,6 @@ BLI_NOINLINE static void 
delete_tagged_particles_and_reorder(ParticlesBlock 
   }
 }
 
-struct DeleteTaggedParticlesData {
-  ArrayRef blocks;
-};
-
-BLI_NOINLINE static void delete_tagged_particles_in_block_cb(
-void *__restrict userdata, const int index, const ParallelRangeTLS 
*__restrict UNUSED(tls))
-{
-  DeleteTaggedParticlesData *data = (DeleteTaggedParticlesData *)userdata;
-  ParticlesBlock  = *data->blocks[index];
-  delete_tagged_particles_and_reorder(block);
-}
-
 BLI_NOINLINE static void delete_tagged_particles(ParticlesState )
 {
   SmallVector blocks = get_all_blocks(state);
@@ -709,9 +697,10 @@ BLI_NOINLINE static void 
delete_tagged_particles(ParticlesState )
   BLI_parallel_range_settings_defaults();
   settings.use_threading = USE_THREADING;
 
-  DeleteTaggedParticlesData data = {blocks};
-  BLI_task_parallel_range(
-  0, blocks.size(), (void *), delete_tagged_particles_in_block_cb, 
);
+  BLI::Task::parallel_array(
+  ArrayRef(blocks),
+  [](ParticlesBlock *block) { delete_tagged_particles_and_reorder(*block); 
},
+  settings);
 }
 
 /* Compress particle blocks.

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


[Bf-blender-cvs] [c2254194f8a] soc-2019-npr: LANPR: Chaining is force enabled for engines other than LANPR.

2019-07-01 Thread YimingWu
Commit: c2254194f8a0b282b85e7d6212bed70c9dc7433a
Author: YimingWu
Date:   Mon Jul 1 16:06:43 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBc2254194f8a0b282b85e7d6212bed70c9dc7433a

LANPR: Chaining is force enabled for engines other than LANPR.

===

M   source/blender/blenkernel/intern/scene.c
M   source/blender/draw/engines/lanpr/lanpr_ops.c

===

diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 2254a15afa9..1cae41a6693 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -107,6 +107,7 @@
 
 const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE";
 const char *RE_engine_id_BLENDER_WORKBENCH = "BLENDER_WORKBENCH";
+const char *RE_engine_id_BLENDER_LANPR = "BLENDER_LANPR";
 const char *RE_engine_id_CYCLES = "CYCLES";
 
 void free_avicodecdata(AviCodecData *acd)
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 4311831f5e4..fda2c6e8c39 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -46,6 +46,7 @@
 #include "lanpr_access.h"
 
 extern LANPR_SharedResource lanpr_share;
+extern const char *RE_engine_id_BLENDER_LANPR;
 struct Object;
 
 int lanpr_triangle_line_imagespace_intersection_v2(SpinLock *spl,
@@ -4189,7 +4190,8 @@ int lanpr_compute_feature_lines_internal(Depsgraph 
*depsgraph)
 
   lanpr_THREAD_calculate_line_occlusion_begin(rb);
 
-  if (lanpr->enable_chaining) {
+  /* When not using LANPR engine, chaining is forced in order to generate data 
for GPencil. */
+  if (lanpr->enable_chaining || strcmp(s->r.engine, 
RE_engine_id_BLENDER_LANPR)) {
 lanpr_NO_THREAD_chain_feature_lines(rb); /*  should use user_adjustable 
value */
 lanpr_split_chains_for_fixed_occlusion(rb);
 lanpr_connect_chains(rb, 1);

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


[Bf-blender-cvs] [506dbb8cff9] soc-2019-npr: LANPR: discard very short chains.

2019-07-01 Thread YimingWu
Commit: 506dbb8cff9409affb2069be8599d0141b6d7776
Author: YimingWu
Date:   Mon Jul 1 15:49:42 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB506dbb8cff9409affb2069be8599d0141b6d7776

LANPR: discard very short chains.

===

M   source/blender/draw/engines/lanpr/lanpr_chain.c
M   source/blender/draw/engines/lanpr/lanpr_ops.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c 
b/source/blender/draw/engines/lanpr/lanpr_chain.c
index eaecdc04609..7f33c467a35 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain.c
@@ -723,6 +723,33 @@ void lanpr_connect_chains(LANPR_RenderBuffer *rb, int 
do_geometry_space)
   }
 }
 
+/* length is in image space */
+float lanpr_compute_chain_length(LANPR_RenderLineChain *rlc){
+  LANPR_RenderLineChainItem *rlci;
+  float offset_accum = 0;
+  float dist;
+  float last_point[2];
+
+  rlci = rlc->chain.first;
+  copy_v2_v2(last_point, rlci->pos);
+  for (rlci = rlc->chain.first; rlci; rlci = rlci->next) {
+dist = len_v2v2(rlci->pos, last_point);
+offset_accum += dist;
+copy_v2_v2(last_point, rlci->pos);
+  }
+  return offset_accum;
+}
+
+void lanpr_discard_short_chains(LANPR_RenderBuffer* rb, float threshold){
+  LANPR_RenderLineChain *rlc,*next_rlc;
+  for(rlc = rb->chains.first;rlc;rlc=next_rlc){
+next_rlc = rlc->next;
+if(lanpr_compute_chain_length(rlc)chains,rlc);
+}
+  }
+}
+
 int lanpr_count_chain(LANPR_RenderLineChain *rlc)
 {
   LANPR_RenderLineChainItem *rlci;
@@ -733,7 +760,7 @@ int lanpr_count_chain(LANPR_RenderLineChain *rlc)
   return Count;
 }
 
-float lanpr_compute_chain_length(LANPR_RenderLineChain *rlc, float *lengths, 
int begin_index)
+float lanpr_compute_chain_length_draw(LANPR_RenderLineChain *rlc, float 
*lengths, int begin_index)
 {
   LANPR_RenderLineChainItem *rlci;
   int i = 0;
@@ -811,7 +838,7 @@ void lanpr_chain_generate_draw_command(LANPR_RenderBuffer 
*rb)
 
   for (rlc = rb->chains.first; rlc; rlc = rlc->next) {
 
-total_length = lanpr_compute_chain_length(rlc, lengths, i);
+total_length = lanpr_compute_chain_length_draw(rlc, lengths, i);
 
 for (rlci = rlc->chain.first; rlci; rlci = rlci->next) {
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index f48220af0f4..4311831f5e4 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -3877,6 +3877,7 @@ void lanpr_viewport_draw_offline_result(LANPR_TextureList 
*txl,
 void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb);
 void lanpr_split_chains_for_fixed_occlusion(LANPR_RenderBuffer *rb);
 void lanpr_connect_chains(LANPR_RenderBuffer *rb, int do_geometry_space);
+void lanpr_discard_short_chains(LANPR_RenderBuffer* rb, float threshold);
 
 void lanpr_calculate_normal_object_vector(LANPR_LineLayer *ll, float 
*normal_object_direction)
 {
@@ -4193,6 +4194,7 @@ int lanpr_compute_feature_lines_internal(Depsgraph 
*depsgraph)
 lanpr_split_chains_for_fixed_occlusion(rb);
 lanpr_connect_chains(rb, 1);
 lanpr_connect_chains(rb, 0);
+lanpr_discard_short_chains(rb, 0.01);
   }
 
   rb->cached_for_frame = rb->scene->r.cfra;

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


[Bf-blender-cvs] [65d770ffa36] master: Fix T66287: use keyword argument in freestyle text style loading

2019-07-01 Thread Philipp Oeser
Commit: 65d770ffa36df9ad52ee1015ba031ad79db5422d
Author: Philipp Oeser
Date:   Mon Jul 1 09:44:08 2019 +0200
Branches: master
https://developer.blender.org/rB65d770ffa36df9ad52ee1015ba031ad79db5422d

Fix T66287: use keyword argument in freestyle text style loading

===

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

===

diff --git a/release/scripts/startup/bl_operators/freestyle.py 
b/release/scripts/startup/bl_operators/freestyle.py
index b600df8fb84..3d619f97e6e 100644
--- a/release/scripts/startup/bl_operators/freestyle.py
+++ b/release/scripts/startup/bl_operators/freestyle.py
@@ -219,7 +219,7 @@ class SCENE_OT_freestyle_module_open(bpy.types.Operator):
 return {'RUNNING_MODAL'}
 
 def execute(self, _context):
-text = bpy.data.texts.load(self.filepath, self.make_internal)
+text = bpy.data.texts.load(self.filepath, internal=self.make_internal)
 self.freestyle_module.script = text
 return {'FINISHED'}

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


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

2019-07-01 Thread Jacques Lucke
Commit: d65427ca94e9dd36b71cfa356d5ecd34e3c9ced4
Author: Jacques Lucke
Date:   Mon Jul 1 09:37:12 2019 +0200
Branches: functions
https://developer.blender.org/rBd65427ca94e9dd36b71cfa356d5ecd34e3c9ced4

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] [5ac143dbe8e] soc-2019-npr: Modifier: EdgeSplit modifier now follows LANPR "disable_edge_splits" as well.

2019-07-01 Thread YimingWu
Commit: 5ac143dbe8ea75df0f6367846e49ea73b9bdcedf
Author: YimingWu
Date:   Mon Jul 1 15:35:14 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB5ac143dbe8ea75df0f6367846e49ea73b9bdcedf

Modifier: EdgeSplit modifier now follows LANPR "disable_edge_splits" as well.

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/draw/engines/lanpr/lanpr_access.c
M   source/blender/draw/engines/lanpr/lanpr_access.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/modifiers/intern/MOD_edgesplit.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 254472b06c3..0f167b0263c 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -737,9 +737,10 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
 
 if mode == "SOFTWARE":
 row=layout.row(align=True)
-row.prop(lanpr,'auto_update',toggle=True,text='Auto')
+row.prop(lanpr,'auto_update',toggle=True,text='Auto Update')
 if not lanpr.auto_update:
 row.operator("scene.lanpr_calculate", icon='RENDER_STILL', 
text='Update')
+layout.prop(lanpr, "disable_edge_splits")
 
 if mode == "DPIX" or mode == "SOFTWARE":
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.c 
b/source/blender/draw/engines/lanpr/lanpr_access.c
index 59e60fec076..2bad8dcf99f 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.c
+++ b/source/blender/draw/engines/lanpr/lanpr_access.c
@@ -138,6 +138,10 @@ bool lanpr_dpix_shader_error()
   return lanpr_share.dpix_shader_error;
 }
 
+bool lanpr_disable_edge_splits(Scene* s){
+  return s->lanpr.disable_edge_splits;
+}
+
 void lanpr_copy_data(Scene *from, Scene *to)
 {
   SceneLANPR *lanpr = >lanpr;
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.h 
b/source/blender/draw/engines/lanpr/lanpr_access.h
index 556f07107e6..b892a13ffee 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.h
+++ b/source/blender/draw/engines/lanpr/lanpr_access.h
@@ -30,8 +30,12 @@ int lanpr_compute_feature_lines_internal(Depsgraph 
*depsgraph);
 
 void lanpr_destroy_render_data(struct LANPR_RenderBuffer *rb);
 
-void lanpr_copy_data(Scene *from, Scene *to);
+bool lanpr_dpix_shader_error();
 
-void lanpr_free_everything(Scene *s);
+bool lanpr_disable_edge_splits(struct Scene* s);
+
+void lanpr_copy_data(struct Scene *from, struct Scene *to);
+
+void lanpr_free_everything(struct Scene *s);
 
 #endif
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index b4494b3df64..b0cda544894 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1680,6 +1680,10 @@ typedef struct SceneLANPR {
 
   int reloaded;
 
+  /* edge split modifier will cause problems in LANPR. */
+  int disable_edge_splits;
+  char _pad[4];
+
   /* offline render */
   ListBase line_layers;
   struct LANPR_LineLayer *active_layer;
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 87cb6c13dd2..ecca0a51fd6 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -7369,12 +7369,18 @@ static void rna_def_scene_lanpr(BlenderRNA *brna)
"Enable Chain Connection",
"Connect short chains in the image space into one 
longer chain");
 
+  /* should be read-only */
   prop = RNA_def_property(srna, "shader_error", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_default(prop, 0);
   RNA_def_property_boolean_funcs(prop, "rna_lanpr_shader_error_get", "");
   RNA_def_property_ui_text(
   prop, "DPIX Shader Error", "Can't compile DPIX transform shader on your 
GPU.");
 
+  prop = RNA_def_property(srna, "disable_edge_splits", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_boolean_default(prop, 0);
+  RNA_def_property_ui_text(
+  prop, "Disable Edge Splits", "Disable edge split modifiers to prevent 
errors in LANPR.");
+
   prop = RNA_def_property(srna, "chaining_geometry_threshold", PROP_FLOAT, 
PROP_NONE);
   RNA_def_property_float_default(prop, 0.1f);
   RNA_def_property_ui_text(prop,
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c 
b/source/blender/modifiers/intern/MOD_edgesplit.c
index 6565e0c7a96..d7509727972 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -41,6 +41,8 @@
 
 #include "MOD_modifiertypes.h"
 
+#include "lanpr_access.h"
+
 static Mesh *doEdgeSplit(Mesh *mesh, EdgeSplitModifierData *emd)
 {
   Mesh *result;
@@ -132,10 +134,15 @@ static bool 

[Bf-blender-cvs] [94bee8fa251] soc-2019-npr: Modifier: EdgeSplit modifier now has ignore_lanpr option.

2019-07-01 Thread YimingWu
Commit: 94bee8fa251d30e9be86a819d5e1092ae9b1d73b
Author: YimingWu
Date:   Mon Jul 1 15:15:46 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB94bee8fa251d30e9be86a819d5e1092ae9b1d73b

Modifier: EdgeSplit modifier now has ignore_lanpr option.

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/makesdna/DNA_modifier_types.h
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/modifiers/intern/MOD_edgesplit.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 200dde60849..bc8d415fb1b 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -400,6 +400,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
 split.prop(md, "use_edge_sharp", text="Sharp Edges")
 
+layout.prop(md, "ignore_lanpr")
+if md.ignore_lanpr:
+layout.label(text="Enabeling edge split may cause problems in 
LANPR.")
+
 def EXPLODE(self, layout, ob, md):
 split = layout.split()
 
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index a22ba7a9951..b0c883aebd0 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -354,6 +354,8 @@ typedef struct EdgeSplitModifierData {
   /** Angle above which edges should be split. */
   float split_angle;
   int flags;
+  int ignore_lanpr;
+  char _pad[4];
 } EdgeSplitModifierData;
 
 /* EdgeSplitModifierData->flags */
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 7b9200a6475..77910fce537 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2603,6 +2603,10 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna)
   RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
   RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are 
marked as sharp");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+  prop = RNA_def_property(srna, "ignore_lanpr", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(prop, "Ignore LANPR", "Ignore the presense of LANPR 
modifier.");
+  RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
 static void rna_def_modifier_displace(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c 
b/source/blender/modifiers/intern/MOD_edgesplit.c
index 59d560b9a4a..6565e0c7a96 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -127,6 +127,35 @@ static Mesh *applyModifier(ModifierData *md, const 
ModifierEvalContext *UNUSED(c
   return result;
 }
 
+static bool isDisabled(const struct Scene *scene, struct ModifierData *md, 
bool userRenderParams){
+  int lanpr_found=0;
+  ModifierData* imd;
+  EdgeSplitModifierData *emd = (EdgeSplitModifierData *)md;
+
+  for(imd = md->prev; imd; imd=imd->prev){
+if(imd->type == eModifierType_FeatureLine){
+  lanpr_found = 1;
+  break;
+}
+  }
+  if(!lanpr_found){
+for(imd = md->next; imd; imd=imd->next){
+  if(imd->type == eModifierType_FeatureLine){
+lanpr_found = 1;
+break;
+  }
+}
+  }
+  if(!lanpr_found){
+return false;
+  }else{
+if(emd->ignore_lanpr){
+  return false;
+}
+return true;
+  }
+}
+
 ModifierTypeInfo modifierType_EdgeSplit = {
 /* name */ "EdgeSplit",
 /* structName */ "EdgeSplitModifierData",
@@ -147,7 +176,7 @@ ModifierTypeInfo modifierType_EdgeSplit = {
 /* initData */ initData,
 /* requiredDataMask */ NULL,
 /* freeData */ NULL,
-/* isDisabled */ NULL,
+/* isDisabled */ isDisabled,
 /* updateDepsgraph */ NULL,
 /* dependsOnTime */ NULL,
 /* dependsOnNormals */ NULL,

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


[Bf-blender-cvs] [b2ca257e632] soc-2019-npr: LANPR: modified buttons and panels for non-LANPR engine display.

2019-07-01 Thread YimingWu
Commit: b2ca257e632c80f8a066bd05829255af2e34a29f
Author: YimingWu
Date:   Mon Jul 1 14:50:34 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBb2ca257e632c80f8a066bd05829255af2e34a29f

LANPR: modified buttons and panels for non-LANPR engine display.

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   release/scripts/startup/bl_ui/properties_render.py

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 2f0752a903d..200dde60849 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1673,7 +1673,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 layout.active = lanpr_enabled
 if not lanpr_enabled:
 layout.label(text="LANPR is not enabled")
-layout.operator("scene.lanpr_update_gp_strokes", icon='RENDER_STILL', 
text='Manual Update')
 layout.label(text='Enable Types:')
 row = layout.row(align=True)
 row.prop(md,'enable_contour',toggle=True)
diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index f7a039a87a9..254472b06c3 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -740,10 +740,6 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
 row.prop(lanpr,'auto_update',toggle=True,text='Auto')
 if not lanpr.auto_update:
 row.operator("scene.lanpr_calculate", icon='RENDER_STILL', 
text='Update')
-
-layout.label(text = "CAUTION: this bakes ALL frames!")
-row=layout.row()
-row.operator("scene.lanpr_bake_gp_strokes", icon='RENDER_ANIMATION', 
text='Bake GPencil Strokes')
 
 if mode == "DPIX" or mode == "SOFTWARE":
 
@@ -781,6 +777,11 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
 else:
 layout.label(text="Vectorization:")
 layout.prop(lanpr, "enable_vector_trace", expand = True)
+
+row=layout.row()
+row.operator("scene.lanpr_update_gp_strokes", icon='RENDER_STILL', 
text='Update GPencil Targets')
+row=layout.row()
+row.operator("scene.lanpr_bake_gp_strokes", icon='RENDER_ANIMATION', 
text='Bake All Frames')
 
 
 class RENDER_PT_lanpr_line_types(RenderButtonsPanel, Panel):
@@ -794,7 +795,7 @@ class RENDER_PT_lanpr_line_types(RenderButtonsPanel, Panel):
 scene = context.scene
 lanpr = scene.lanpr
 active_layer = lanpr.layers.active_layer
-return lanpr.enabled and active_layer and lanpr.master_mode != "SNAKE"
+return scene.render.engine=="BLENDER_LANPR" and lanpr.enabled and 
active_layer and lanpr.master_mode != "SNAKE"
 
 def draw(self, context):
 layout = self.layout
@@ -874,7 +875,7 @@ class RENDER_PT_lanpr_line_components(RenderButtonsPanel, 
Panel):
 scene = context.scene
 lanpr = scene.lanpr
 active_layer = lanpr.layers.active_layer
-return lanpr.enabled and active_layer and lanpr.master_mode == 
"SOFTWARE" and not lanpr.enable_chaining
+return scene.render.engine=="BLENDER_LANPR" and lanpr.enabled and 
active_layer and lanpr.master_mode == "SOFTWARE" and not lanpr.enable_chaining
 
 def draw(self, context):
 layout = self.layout
@@ -914,7 +915,7 @@ class RENDER_PT_lanpr_line_effects(RenderButtonsPanel, 
Panel):
 scene = context.scene
 lanpr = scene.lanpr
 active_layer = lanpr.layers.active_layer
-return lanpr.enabled and active_layer and (lanpr.master_mode == "DPIX" 
or lanpr.master_mode == "SOFTWARE")
+return scene.render.engine=="BLENDER_LANPR" and lanpr.enabled and 
active_layer and (lanpr.master_mode == "DPIX" or lanpr.master_mode == 
"SOFTWARE")
 
 def draw(self, context):
 layout = self.layout
@@ -955,7 +956,7 @@ class 
RENDER_PT_lanpr_snake_sobel_parameters(RenderButtonsPanel, Panel):
 def poll(cls, context):
 scene = context.scene
 lanpr = scene.lanpr
-return lanpr.enabled and lanpr.master_mode == "SNAKE"
+return scene.render.engine=="BLENDER_LANPR" and lanpr.enabled and 
lanpr.master_mode == "SNAKE"
 
 def draw(self, context):
 layout = self.layout
@@ -978,7 +979,7 @@ class RENDER_PT_lanpr_snake_settings(RenderButtonsPanel, 
Panel):
 def poll(cls, context):
 scene = context.scene
 lanpr = scene.lanpr
-return lanpr.enabled and lanpr.master_mode == "SNAKE" and 
lanpr.enable_vector_trace == "ENABLED"
+return scene.render.engine=="BLENDER_LANPR" and lanpr.enabled and 
lanpr.master_mode == "SNAKE" and lanpr.enable_vector_trace == "ENABLED"
 
 def 

[Bf-blender-cvs] [cf73569d894] master: UI: run interactive 'Point From Normal' in normal menu

2019-07-01 Thread Campbell Barton
Commit: cf73569d8942a82f5da5b99ab0e70e1929a99231
Author: Campbell Barton
Date:   Mon Jul 1 16:46:48 2019 +1000
Branches: master
https://developer.blender.org/rBcf73569d8942a82f5da5b99ab0e70e1929a99231

UI: run interactive 'Point From Normal' in normal menu

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 8630fe49696..b58df73805b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3871,10 +3871,10 @@ class VIEW3D_MT_edit_mesh_normals(Menu):
 layout.operator("mesh.set_normals_from_faces", text="Set From Faces")
 
 layout.operator_context = 'INVOKE_DEFAULT'
-layout.operator("transform.rotate_normal", text="Rotate")
+layout.operator("transform.rotate_normal", text="Rotate...")
+layout.operator("mesh.point_normals", text="Point to Target...")
 layout.operator_context = 'EXEC_DEFAULT'
 
-layout.operator("mesh.point_normals", text="Point to Target")
 layout.operator("mesh.merge_normals", text="Merge")
 layout.operator("mesh.split_normals", text="Split")
 layout.menu("VIEW3D_MT_edit_mesh_normals_average", text="Average")
@@ -6301,7 +6301,7 @@ class VIEW3D_MT_gpencil_edit_context_menu(Menu):
 op = layout.operator("gpencil.stroke_cyclical_set", text="Close")
 op.type = 'CLOSE'
 op.geometry = True
-   
+
 layout.separator()
 
 layout.menu("VIEW3D_MT_mirror")

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


[Bf-blender-cvs] [cfea0d9eb81] master: GPencil: Fix wrong title missing in previous change

2019-07-01 Thread Antonioya
Commit: cfea0d9eb81d72bc4b57982b1a701b061949757e
Author: Antonioya
Date:   Mon Jul 1 08:40:18 2019 +0200
Branches: master
https://developer.blender.org/rBcfea0d9eb81d72bc4b57982b1a701b061949757e

GPencil: Fix wrong title missing in previous change

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index b502b7933ac..b4252b1afa4 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -215,7 +215,7 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 col.template_ID(gpcolor, "fill_image", open="image.open")
 
 if gpcolor.fill_style == 'TEXTURE':
-col.prop(gpcolor, "use_fill_pattern", text="Use As Pattern")
+col.prop(gpcolor, "use_fill_pattern", text="Use As Stencil 
Mask")
 if gpcolor.use_fill_pattern is True:
 col.prop(gpcolor, "fill_color", text="Color")

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


[Bf-blender-cvs] [c74626c54fa] master: Fix keymap editing not tagging dirty

2019-07-01 Thread Campbell Barton
Commit: c74626c54fadc55c9291b12c8c354a3a978eb286
Author: Campbell Barton
Date:   Mon Jul 1 16:09:21 2019 +1000
Branches: master
https://developer.blender.org/rBc74626c54fadc55c9291b12c8c354a3a978eb286

Fix keymap editing not tagging dirty

Partial fix for T65629

===

M   release/scripts/startup/bl_operators/userpref.py
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/release/scripts/startup/bl_operators/userpref.py 
b/release/scripts/startup/bl_operators/userpref.py
index 706afc6dcf8..152dab23dcf 100644
--- a/release/scripts/startup/bl_operators/userpref.py
+++ b/release/scripts/startup/bl_operators/userpref.py
@@ -286,6 +286,7 @@ class PREFERENCES_OT_keymap_restore(Operator):
 km = context.keymap
 km.restore_to_default()
 
+context.preferences.is_dirty = True
 return {'FINISHED'}
 
 
@@ -333,6 +334,7 @@ class PREFERENCES_OT_keyitem_add(Operator):
 km.show_expanded_items = True
 km.show_expanded_children = True
 
+context.preferences.is_dirty = True
 return {'FINISHED'}
 
 
@@ -354,6 +356,8 @@ class PREFERENCES_OT_keyitem_remove(Operator):
 km = context.keymap
 kmi = km.keymap_items.from_id(self.item_id)
 km.keymap_items.remove(kmi)
+
+context.preferences.is_dirty = True
 return {'FINISHED'}
 
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index bfdb55800a2..8a9b8a14563 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -5808,8 +5808,8 @@ void RNA_def_userdef(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "runtime.is_dirty", 0);
-  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_ui_text(prop, "Dirty", "Preferences have changed");
+  RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
 
   rna_def_userdef_view(brna);
   rna_def_userdef_edit(brna);

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


[Bf-blender-cvs] [6f61b6aa445] master: Fix T66289: Default keymap conflict selecting curve/channels

2019-07-01 Thread Campbell Barton
Commit: 6f61b6aa445b5a93b7bd8f156b0d0804c6b1d2d6
Author: Campbell Barton
Date:   Mon Jul 1 16:03:13 2019 +1000
Branches: master
https://developer.blender.org/rB6f61b6aa445b5a93b7bd8f156b0d0804c6b1d2d6

Fix T66289: Default keymap conflict selecting curve/channels

The default keymap conflicted selecting by curves and channel.

Caused by 325b0ad2ed855

Revert to original keys, use click instead of press
to avoid conflicting with box-select.

===

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

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index c888ce4402a..02596e0c033 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1373,10 +1373,10 @@ def km_graph_editor(params):
 ("graph.clickselect", {"type": params.select_mouse, "value": 'PRESS', 
"shift": True, "ctrl": True, "alt": True},
  {"properties": [("extend", True), ("column", False), ("curves", 
True)]}),
 ("graph.select_leftright",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": 
not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True},
  {"properties": [("mode", 'CHECK'), ("extend", False)]}),
 ("graph.select_leftright",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, 
"shift": True, "alt": not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True, "shift": True},
  {"properties": [("mode", 'CHECK'), ("extend", True)]}),
 ("graph.select_leftright", {"type": 'LEFT_BRACKET', "value": 'PRESS'},
  {"properties": [("mode", 'LEFT'), ("extend", False)]}),
@@ -1907,10 +1907,10 @@ def km_dopesheet(params):
 ("action.clickselect", {"type": params.select_mouse, "value": 'PRESS', 
"shift": True, "ctrl": True, "alt": True},
  {"properties": [("extend", True), ("column", False), ("channel", 
True)]}),
 ("action.select_leftright",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": 
not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True},
  {"properties": [("mode", 'CHECK'), ("extend", False)]}),
 ("action.select_leftright",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, 
"shift": True, "alt": not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True, "shift": True},
  {"properties": [("mode", 'CHECK'), ("extend", True)]}),
 ("action.select_leftright", {"type": 'LEFT_BRACKET', "value": 'PRESS'},
  {"properties": [("mode", 'LEFT'), ("extend", False)]}),
@@ -2050,10 +2050,10 @@ def km_nla_editor(params):
 ("nla.click_select", {"type": params.select_mouse, "value": 'PRESS', 
"shift": True},
  {"properties": [("extend", True)]}),
 ("nla.select_leftright",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": 
not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True},
  {"properties": [("mode", 'CHECK'), ("extend", False)]}),
 ("nla.select_leftright",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, 
"shift": True, "alt": not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True, "shift": True},
  {"properties": [("mode", 'CHECK'), ("extend", True)]}),
 ("nla.select_leftright", {"type": 'LEFT_BRACKET', "value": 'PRESS'},
  {"properties": [("mode", 'LEFT'), ("extend", False)]}),
@@ -2373,10 +2373,10 @@ def km_sequencer(params):
 ("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', 
"shift": True, "alt": True},
  {"properties": [("extend", True), ("linked_handle", True), 
("left_right", 'NONE'), ("linked_time", False)]}),
 ("sequencer.select",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, "alt": 
not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True},
  {"properties": [("linked_handle", False), ("left_right", 'MOUSE'), 
("linked_time", True), ("extend", False)]}),
 ("sequencer.select",
- {"type": params.select_mouse, "value": 'PRESS', "ctrl": True, 
"shift": True, "alt": not params.legacy},
+ {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True, "shift": True},
  {"properties":