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

2019-06-27 Thread Jacques Lucke
Commit: 7326d0a3f8b1ae78c41420dd2908ea8966bd64dd
Author: Jacques Lucke
Date:   Fri Jun 28 08:56:38 2019 +0200
Branches: functions
https://developer.blender.org/rB7326d0a3f8b1ae78c41420dd2908ea8966bd64dd

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] [ec580226e84] soc-2019-npr: Gpencil: make format

2019-06-27 Thread YimingWu
Commit: ec580226e844f3ec95f15506277dce1ff1b75398
Author: YimingWu
Date:   Fri Jun 28 14:51:38 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBec580226e844f3ec95f15506277dce1ff1b75398

Gpencil: make format

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index f240695e5f7..c00a3f7e4a5 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -422,9 +422,9 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char 
name[])
   gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
 
   /* grid settings */
-  ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f);  /*  Color */
-  ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f);/*  Scale */
-  gpd->grid.lines = GP_DEFAULT_GRID_LINES; /*  Number of lines */
+  ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f); /*  Color */
+  ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f);   /*  Scale */
+  gpd->grid.lines = GP_DEFAULT_GRID_LINES;/*  Number of lines */
 
   /* onion-skinning settings (datablock level) */
   gpd->onion_flag |= (GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL);
@@ -1427,29 +1427,33 @@ void BKE_gpencil_dvert_ensure(bGPDstroke *gps)
 
 /* ** */
 
-void stroke_defvert_create_nr_list(MDeformVert* dv_list, int count, ListBase* 
result, int* totweight){
-  LinkData* ld;
-  MDeformVert* dv;
-  MDeformWeight* dw;
-  int i,j;
-  int tw=0;
-  for(i=0;itotweight;j++){
+for (j = 0; j < dv->totweight; j++) {
   int found = 0;
   dw = &dv->dw[j];
-  for(ld=result->first;ld;ld=ld->next){
-if(ld->data == (void*)dw->def_nr){
+  for (ld = result->first; ld; ld = ld->next) {
+if (ld->data == (void *)dw->def_nr) {
   found = 1;
   break;
 }
   }
-  if(!found){
-ld = MEM_callocN(sizeof(LinkData),"def_nr_item");
-ld->data = (void*)dw->def_nr;
-BLI_addtail(result,ld);
+  if (!found) {
+ld = MEM_callocN(sizeof(LinkData), "def_nr_item");
+ld->data = (void *)dw->def_nr;
+BLI_addtail(result, ld);
 tw++;
   }
 }
@@ -1458,19 +1462,19 @@ void stroke_defvert_create_nr_list(MDeformVert* 
dv_list, int count, ListBase* re
   *totweight = tw;
 }
 
-MDeformVert *stroke_defvert_new_count(int count, int totweight, ListBase* 
def_nr_list)
+MDeformVert *stroke_defvert_new_count(int count, int totweight, ListBase 
*def_nr_list)
 {
-  int i,j;
-  LinkData* ld;
+  int i, j;
+  LinkData *ld;
   MDeformVert *dst = MEM_mallocN(count * sizeof(MDeformVert), 
"new_deformVert");
 
   dst->totweight = totweight;
 
   for (i = 0; i < count; i++) {
 dst[i].dw = MEM_mallocN(sizeof(MDeformWeight) * totweight, 
"new_deformWeight");
-j=0;
+j = 0;
 /* re-assign deform groups */
-for(ld=def_nr_list->first;ld;ld=ld->next){
+for (ld = def_nr_list->first; ld; ld = ld->next) {
   dst[i].dw[j].def_nr = (int)ld->data;
   j++;
 }
@@ -1479,25 +1483,28 @@ MDeformVert *stroke_defvert_new_count(int count, int 
totweight, ListBase* def_nr
   return dst;
 }
 
-float stroke_defvert_get_nr_weight(MDeformVert* dv, int def_nr){
+float stroke_defvert_get_nr_weight(MDeformVert *dv, int def_nr)
+{
   int i;
-  for(i=0;itotweight;i++){
-if(dv->dw[i].def_nr == def_nr){
+  for (i = 0; i < dv->totweight; i++) {
+if (dv->dw[i].def_nr == def_nr) {
   return dv->dw[i].weight;
 }
   }
   return 0.0f;
 }
 
-void stroke_interpolate_deform_weights(bGPDstroke *gps, int index_from, int 
index_to, float ratio, MDeformVert* vert){
-  MDeformVert* vl = &gps->dvert[index_from];
-  MDeformVert* vr = &gps->dvert[index_to];
+void stroke_interpolate_deform_weights(
+bGPDstroke *gps, int index_from, int index_to, float ratio, MDeformVert 
*vert)
+{
+  MDeformVert *vl = &gps->dvert[index_from];
+  MDeformVert *vr = &gps->dvert[index_to];
   int i;
 
-  for(i=0;itotweight;i++){
-float wl = stroke_defvert_get_nr_weight(vl,vert->dw[i].def_nr);
-float wr = stroke_defvert_get_nr_weight(vr,vert->dw[i].def_nr);
-vert->dw[i].weight = interpf(wr,wl,ratio);
+  for (i = 0; i < vert->totweight; i++) {
+float wl = stroke_defvert_get_nr_weight(vl, vert->dw[i].def_nr);
+float wr = stroke_defvert_get_nr_weight(vr, vert->dw[i].def_nr);
+vert->dw[i].weight = interpf(wr, wl, ratio);
   }
 }
 
@@ -1562,7 +1569,7 @@ static int stroke_march_next_point(bGPDstroke *gps,
 gps->points[next_point_index].pressure, gps->points[next_point_index - 
1].pressure, ratio);
 *strength = interpf(
 gps->points[next_point_index].strength, gps->points[next_point_index - 
1].strength, ratio);
-
+
 *index_from = next_point_index - 1;
 *index_to = next_point_index;
 *ratio_r

[Bf-blender-cvs] [715458f413f] soc-2019-npr: Gpencil: New sample function which handles weights.

2019-06-27 Thread YimingWu
Commit: 715458f413f2ed3404d22e5adbccf4eec3f8cabd
Author: YimingWu
Date:   Fri Jun 28 14:49:59 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB715458f413f2ed3404d22e5adbccf4eec3f8cabd

Gpencil: New sample function which handles weights.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 28e16455727..f240695e5f7 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -422,9 +422,9 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char 
name[])
   gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
 
   /* grid settings */
-  ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f);  // Color
-  ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f);// Scale
-  gpd->grid.lines = GP_DEFAULT_GRID_LINES; // Number of lines
+  ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f);  /*  Color */
+  ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f);/*  Scale */
+  gpd->grid.lines = GP_DEFAULT_GRID_LINES; /*  Number of lines */
 
   /* onion-skinning settings (datablock level) */
   gpd->onion_flag |= (GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL);
@@ -657,7 +657,7 @@ bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd)
 }
 
 /* make a copy of a given gpencil datablock */
-// XXX: Should this be deprecated?
+/*  XXX: Should this be deprecated? */
 bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool 
internal_copy)
 {
   bGPdata *gpd_dst;
@@ -1427,19 +1427,80 @@ void BKE_gpencil_dvert_ensure(bGPDstroke *gps)
 
 /* ** */
 
-MDeformVert *stroke_defvert_new_count(int totweight, int count)
-{
-  int i;
+void stroke_defvert_create_nr_list(MDeformVert* dv_list, int count, ListBase* 
result, int* totweight){
+  LinkData* ld;
+  MDeformVert* dv;
+  MDeformWeight* dw;
+  int i,j;
+  int tw=0;
+  for(i=0;itotweight;j++){
+  int found = 0;
+  dw = &dv->dw[j];
+  for(ld=result->first;ld;ld=ld->next){
+if(ld->data == (void*)dw->def_nr){
+  found = 1;
+  break;
+}
+  }
+  if(!found){
+ld = MEM_callocN(sizeof(LinkData),"def_nr_item");
+ld->data = (void*)dw->def_nr;
+BLI_addtail(result,ld);
+tw++;
+  }
+}
+  }
+
+  *totweight = tw;
+}
 
+MDeformVert *stroke_defvert_new_count(int count, int totweight, ListBase* 
def_nr_list)
+{
+  int i,j;
+  LinkData* ld;
   MDeformVert *dst = MEM_mallocN(count * sizeof(MDeformVert), 
"new_deformVert");
 
+  dst->totweight = totweight;
+
   for (i = 0; i < count; i++) {
 dst[i].dw = MEM_mallocN(sizeof(MDeformWeight) * totweight, 
"new_deformWeight");
+j=0;
+/* re-assign deform groups */
+for(ld=def_nr_list->first;ld;ld=ld->next){
+  dst[i].dw[j].def_nr = (int)ld->data;
+  j++;
+}
   }
 
   return dst;
 }
 
+float stroke_defvert_get_nr_weight(MDeformVert* dv, int def_nr){
+  int i;
+  for(i=0;itotweight;i++){
+if(dv->dw[i].def_nr == def_nr){
+  return dv->dw[i].weight;
+}
+  }
+  return 0.0f;
+}
+
+void stroke_interpolate_deform_weights(bGPDstroke *gps, int index_from, int 
index_to, float ratio, MDeformVert* vert){
+  MDeformVert* vl = &gps->dvert[index_from];
+  MDeformVert* vr = &gps->dvert[index_to];
+  int i;
+
+  for(i=0;itotweight;i++){
+float wl = stroke_defvert_get_nr_weight(vl,vert->dw[i].def_nr);
+float wr = stroke_defvert_get_nr_weight(vr,vert->dw[i].def_nr);
+vert->dw[i].weight = interpf(wr,wl,ratio);
+  }
+}
+
 /* Can't interpolate because not every vert has the same amount of groups 
attached to it. */
 /* Future solution: add all groups to every vert and set weight to 0 for those 
are not in. */
 static int stroke_march_next_point(bGPDstroke *gps,
@@ -1449,7 +1510,9 @@ static int stroke_march_next_point(bGPDstroke *gps,
float *result,
float *pressure,
float *strength,
-   float *weights)
+   float *ratio_result,
+   int *index_from,
+   int *index_to)
 {
   float remaining_till_next = 0.0f;
   float remaining_march = dist;
@@ -1485,11 +1548,10 @@ static int stroke_march_next_point(bGPDstroke *gps,
 copy_v3_v3(result, &pt->x);
 *pressure = gps->points[next_point_index].pressure;
 *strength = gps->points[next_point_index].strength;
-/* if (weights) {
-  for (int j = 0; j < gps->dvert->totweight; j++) {
-weights[j] = gps->dvert[next_point_index].dw[j].weight;
-  }
-} */
+
+*index_from = next_point_index - 1;
+*index_to = next_point_index;
+*ratio_result = 1.0f;
 
  

[Bf-blender-cvs] [bd227d13787] master: install_deps: Bumped OSL version to 3.4.0_RC2

2019-06-27 Thread Jeroen Bakker
Commit: bd227d13787ccecabb5005d7211ce6ce04f60104
Author: Jeroen Bakker
Date:   Fri Jun 28 08:38:34 2019 +0200
Branches: master
https://developer.blender.org/rBbd227d13787ccecabb5005d7211ce6ce04f60104

install_deps: Bumped OSL version to 3.4.0_RC2

===

M   build_files/build_environment/install_deps.sh

===

diff --git a/build_files/build_environment/install_deps.sh 
b/build_files/build_environment/install_deps.sh
index c54af829b38..5cf005d60ce 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -358,7 +358,7 @@ OSL_FORCE_REBUILD=false
 OSL_SKIP=false
 
 # OpenSubdiv needs to be compiled for now
-OSD_VERSION="3.3.3"
+OSD_VERSION="3.4.0_RC2"
 OSD_VERSION_MIN=$OSD_VERSION
 OSD_FORCE_BUILD=false
 OSD_FORCE_REBUILD=false

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


[Bf-blender-cvs] [dd9579ccd43] soc-2019-npr: LANPR: Added error message for failed DPIX shaders.

2019-06-27 Thread YimingWu
Commit: dd9579ccd437876f226f334c00c75d244f25d5f5
Author: YimingWu
Date:   Fri Jun 28 14:05:11 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBdd9579ccd437876f226f334c00c75d244f25d5f5

LANPR: Added error message for failed DPIX shaders.

===

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_all.h
M   source/blender/draw/engines/lanpr/lanpr_dpix.c
M   source/blender/draw/engines/lanpr/lanpr_engine.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 5449d266b37..79d610759ad 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -731,6 +731,10 @@ class RENDER_PT_lanpr(RenderButtonsPanel, Panel):
 
 layout.prop(lanpr, "master_mode", expand=True) 
 
+if mode == "DPIX" and lanpr.shader_error:
+layout.label(text="DPIX transfor shader compile error!")
+return;
+
 if scene.render.engine!='BLENDER_LANPR':
 layout.label(text='Only Software mode result is used to generate 
GP stroke.')
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.c 
b/source/blender/draw/engines/lanpr/lanpr_access.c
index 3d3af4352e0..9d0e0a94f35 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.c
+++ b/source/blender/draw/engines/lanpr/lanpr_access.c
@@ -133,6 +133,11 @@ void lanpr_update_data_for_external(Depsgraph *depsgraph)
   }
 }
 
+bool lanpr_dpix_shader_error()
+{
+  return lanpr_share.dpix_shader_error;
+}
+
 void lanpr_copy_data(Scene *from, Scene *to)
 {
   SceneLANPR *lanpr = &from->lanpr;
diff --git a/source/blender/draw/engines/lanpr/lanpr_all.h 
b/source/blender/draw/engines/lanpr/lanpr_all.h
index e04ef61c93c..96c8e39bc93 100644
--- a/source/blender/draw/engines/lanpr/lanpr_all.h
+++ b/source/blender/draw/engines/lanpr/lanpr_all.h
@@ -93,6 +93,7 @@ typedef struct LANPR_SharedResource {
   /* DPIX */
   GPUShader *dpix_transform_shader;
   GPUShader *dpix_preview_shader;
+  int dpix_shader_error;
 
   /* Software */
   GPUShader *software_shader;
diff --git a/source/blender/draw/engines/lanpr/lanpr_dpix.c 
b/source/blender/draw/engines/lanpr/lanpr_dpix.c
index 27b2f4ef504..bda66b799fe 100644
--- a/source/blender/draw/engines/lanpr/lanpr_dpix.c
+++ b/source/blender/draw/engines/lanpr/lanpr_dpix.c
@@ -89,6 +89,10 @@ void lanpr_init_atlas_inputs(void *ved)
 NULL,
 datatoc_lanpr_dpix_project_clip_frag_glsl,
 NULL);
+if (!lanpr_share.dpix_transform_shader) {
+  lanpr_share.dpix_shader_error = 1;
+  printf("LANPR: DPIX transform shader compile error.");
+}
   }
   if (!lanpr_share.dpix_preview_shader) {
 lanpr_share.dpix_preview_shader = DRW_shader_create(
@@ -96,6 +100,10 @@ void lanpr_init_atlas_inputs(void *ved)
 datatoc_lanpr_dpix_preview_geom_glsl,
 datatoc_lanpr_dpix_preview_frag_glsl,
 NULL);
+if (!lanpr_share.dpix_transform_shader) {
+  lanpr_share.dpix_shader_error = 1;
+  printf("LANPR: DPIX transform shader compile error.");
+}
   }
 }
 void lanpr_destroy_atlas(void *ved)
diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index 51f1adf894b..780c271a7be 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -256,7 +256,8 @@ static void lanpr_cache_init(void *vedata)
 DRW_shgroup_uniform_int(stl->g_data->edge_thinning_shgrp, "stage", 
&stl->g_data->stage, 1);
 DRW_shgroup_call(stl->g_data->edge_thinning_shgrp, quad, NULL);
   }
-  else if (lanpr->master_mode == LANPR_MASTER_MODE_DPIX && 
lanpr->active_layer) {
+  else if (lanpr->master_mode == LANPR_MASTER_MODE_DPIX && lanpr->active_layer 
&&
+   !lanpr_share.dpix_shader_error) {
 LANPR_LineLayer *ll = lanpr->line_layers.first;
 psl->dpix_transform_pass = DRW_pass_create("DPIX Transform Stage", 
DRW_STATE_WRITE_COLOR);
 stl->g_data->dpix_transform_shgrp = 
DRW_shgroup_create(lanpr_share.dpix_transform_shader,
@@ -438,7 +439,8 @@ static void lanpr_cache_populate(void *vedata, Object *ob)
 DRW_shgroup_call_no_cull(stl->g_data->multipass_shgrp, geom, ob);
   }
 
-  if (lanpr->master_mode == LANPR_MASTER_MODE_DPIX && lanpr->active_layer) {
+  if (lanpr->master_mode == LANPR_MASTER_MODE_DPIX && lanpr->active_layer &&
+  !lanpr_share.dpix_shader_error) {
 int idx = pd->begin_index;
 if (lanpr->reloaded) {
   pd->begin_index = lanpr_feed_atlas_data_obj(vedata,
@@ -465,7 +467,8 @@ static void lanpr_cache_finish(void *vedata)
   float mat[4][4];
   unit_m4(mat);
 
-  if (lanpr->master_mode ==

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

2019-06-27 Thread YimingWu
Commit: 6d3e0a94f669f528e5f33cc16b97a99cb46b5a42
Author: YimingWu
Date:   Fri Jun 28 13:08:51 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB6d3e0a94f669f528e5f33cc16b97a99cb46b5a42

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] [40a9d6fb027] soc-2019-bevel-profiles: Custom profile vertex beveling: Progress on figuring out best path forward. Also includes updates to questions for discussion.

2019-06-27 Thread Hans Goudey
Commit: 40a9d6fb0277d08b4c98bafc0dc7059353956341
Author: Hans Goudey
Date:   Fri Jun 28 00:46:19 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB40a9d6fb0277d08b4c98bafc0dc7059353956341

Custom profile vertex beveling: Progress on figuring out best path forward.
Also includes updates to questions for discussion.

===

M   source/blender/blenkernel/intern/profile_path.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/bmesh/tools/bmesh_bevel.c
M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/blenkernel/intern/profile_path.c 
b/source/blender/blenkernel/intern/profile_path.c
index 13fc006f2b2..89616c37b5b 100644
--- a/source/blender/blenkernel/intern/profile_path.c
+++ b/source/blender/blenkernel/intern/profile_path.c
@@ -707,7 +707,8 @@ static void profilepath_make_table(ProfilePath *prpath, 
const rctf *clipr)
   /* HANS-TODO: Remove this case... Why did I say this? */
 }
 else {
-  /* HANS-QUESTION: What's the idea behind this factor stuff? */
+  /* HANS-QUESTION: I'm not sure of the idea behind this factor stuff. 
I'll have to look into
+   * it closer, or possible use a different method. */
   float fac1 = fp[0] - fp[-2];
   float fac2 = fp[0] - curf;
   if (fac1 > FLT_EPSILON) {
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index 68943382938..4645b2cfc08 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -958,9 +958,9 @@ static void write_curvemapping(WriteData *wd, CurveMapping 
*cumap)
 
 static void write_profilewidget(WriteData *wd, ProfileWidget *prwdgt)
 {
-  /* HANS-QUESTION: I seem to have to write the ProfilePath struct when the 
curvemapping write
-   * function doesn't have to do the analagous write. Anyway, the loading 
after a save crashes, so
-   * this can't be right. */
+  /* HANS-TODO: I seemed to have to write the ProfilePath struct when the 
curvemapping write
+   * function doesn't have to do the analagous write. Anyway, the loading 
after a save still
+   * crashes, so this can't be right. I think free is being called before copy 
somewhere. */
   writestruct(wd, DATA, ProfileWidget, 1, prwdgt);
   writestruct(wd, DATA, ProfilePath, 1, prwdgt->profile);
   writestruct(wd, DATA, ProfilePoint, prwdgt->profile->totpoint, 
prwdgt->profile->path);
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index a690bb521bd..cd32cf468ff 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -61,9 +61,10 @@
 #define DEBUG_CUSTOM_PROFILE_ORIGINAL 0
 #define DEBUG_CUSTOM_PROFILE_WELD 0
 #define DEBUG_CUSTOM_PROFILE_ADJ 1
-#define DEBUG_CUSTOM_PROFILE_ORIENTATION 1
+#define DEBUG_CUSTOM_PROFILE_ORIENTATION 0
+#define DEBUG_CUSTOM_PROFILE_ORIENTATION_DRAW DEBUG_CUSTOM_PROFILE_ORIENTATION 
| 1
 
-#if DEBUG_CUSTOM_PROFILE_ORIENTATION
+#if DEBUG_CUSTOM_PROFILE_ORIENTATION_DRAW
 extern void DRW_debug_sphere(const float center[3], const float radius, const 
float color[4]);
 #endif
 
@@ -154,12 +155,10 @@ typedef struct BoundVert {
   /** First of edges attached here: in CCW order. */
   EdgeHalf *efirst;
   EdgeHalf *elast;
-  /** The "edge between" that this is on, in offset_on_edge_between case. */
+  /** The "edge between" that this boundvert on, in offset_on_edge_between 
case. */
   EdgeHalf *eon;
-  /* HANS-QUESTION: What is the "eon edge?" I haven't been able to visualize 
where this is. */
   /** Beveled edge whose left side is attached here, if any. */
   EdgeHalf *ebev;
-  /* HANS-QUESTION: Why just store the left edge? For travelling 
counterclockwise? */
   /** Used for vmesh indexing. */
   int index;
   /** When eon set, ratio of sines of angles to eon edge. */
@@ -191,9 +190,7 @@ typedef struct VMesh {
   NewVert *mesh; /* allocated array - size and structure depends on 
kind */
   BoundVert *boundstart; /* start of boundary double-linked list */
   int count; /* number of vertices in the boundary */
-  int seg;   /* common # of segments for segmented edges */
-  /* HANS-QUESTION: How is this seg different than the global bp->seg? Is it 
the number of segments
-   * built so far? */
+  int seg;   /* common # of segments for segmented edges (same as 
bp->seg) */
   enum {
 M_NONE,/* no polygon mesh needed */
 M_POLY,/* a simple polygon */
@@ -398,6 +395,7 @@ static BoundVert *add_new_bound_vert(MemArena *mem_arena, 
VMesh *vm, const float
   ans->any_seam = false;
   ans->is_arc_start = false;
   ans->is_patch_start = false;
+  ans->is_profile_start = false;
   vm->count++;
   return ans;
 }
@@ -1270,8 +1268,6 @@ static void project_to_edge(BMEdge *e, 

[Bf-blender-cvs] [7b440e57961] soc-2019-outliner: Merge branch 'master' into soc-2019-outliner

2019-06-27 Thread Nathan Craddock
Commit: 7b440e579614f2f216a0a4191bd387e3692ead5e
Author: Nathan Craddock
Date:   Thu Jun 27 21:23:57 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB7b440e579614f2f216a0a4191bd387e3692ead5e

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] [6ee77a28a84] soc-2019-outliner: Outliner: Remove ctrl+click to rename

2019-06-27 Thread Nathan Craddock
Commit: 6ee77a28a8421485226a1b618b84ede253725644
Author: Nathan Craddock
Date:   Thu Jun 27 21:25:38 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB6ee77a28a8421485226a1b618b84ede253725644

Outliner: Remove ctrl+click to rename

This conflicts with ctrl+click to extend selection, and is not
conventional. F2 and double click still function to rename
elements in the outliner.

===

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 bedcdaf982c..5d92d00e072 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -726,7 +726,6 @@ def km_outliner(params):
  {"properties": [("all", False)]}),
 ("outliner.item_openclose", {"type": 'RET', "value": 'PRESS', "shift": 
True},
  {"properties": [("all", True)]}),
-("outliner.item_rename", {"type": 'LEFTMOUSE', "value": 'PRESS', 
"ctrl": True}, None),
 ("outliner.operation", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, None),
 ("outliner.item_drag_drop", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, 
None),
 ("outliner.item_drag_drop", {"type": 'EVT_TWEAK_L', "value": 'ANY', 
"shift": True}, None),

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


[Bf-blender-cvs] [651e574153a] master: Cleanup: unused var, sort structs

2019-06-27 Thread Campbell Barton
Commit: 651e574153ac7295c0061f1518000cc3b1b8b4ca
Author: Campbell Barton
Date:   Fri Jun 28 10:06:57 2019 +1000
Branches: master
https://developer.blender.org/rB651e574153ac7295c0061f1518000cc3b1b8b4ca

Cleanup: unused var, sort structs

===

M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/editors/gpencil/gpencil_paint.c

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 4779a27853e..79b462e749c 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -33,9 +33,9 @@ struct CCGElem;
 struct CCGKey;
 struct CustomData;
 struct DMFlagMat;
-struct IsectRayPrecalc;
 struct GPUBatch;
 struct GPU_PBVH_Buffers;
+struct IsectRayPrecalc;
 struct MLoop;
 struct MLoopTri;
 struct MPoly;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index b717751d434..f6691f4813b 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2472,6 +2472,7 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, 
const wmEvent *event)
 /* ensure that the correct cursor icon is set */
 static void gpencil_draw_cursor_set(tGPsdata *p)
 {
+  UNUSED_VARS(p);
   return;
   /* Disable while we get a better cursor handling for direct input devices 
(Cintiq/Ipad)*/
 #if 0

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


[Bf-blender-cvs] [83d92f55b81] master: Fix error for tools that share gizmo types doubling up gizmos

2019-06-27 Thread Campbell Barton
Commit: 83d92f55b81f3d2b6b20c2c39a140df30caef5e4
Author: Campbell Barton
Date:   Fri Jun 28 10:04:52 2019 +1000
Branches: master
https://developer.blender.org/rB83d92f55b81f3d2b6b20c2c39a140df30caef5e4

Fix error for tools that share gizmo types doubling up gizmos

Introduced in recent commit c93af8529dfec

===

M   source/blender/windowmanager/gizmo/WM_gizmo_api.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
M   source/blender/windowmanager/intern/wm_toolsystem.c

===

diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h 
b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
index 5025291a746..293b0cd91dc 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
@@ -34,6 +34,7 @@ struct GHashIterator;
 struct IDProperty;
 struct Main;
 struct PropertyRNA;
+struct bToolRef;
 struct wmGizmo;
 struct wmGizmoGroup;
 struct wmGizmoGroupType;
@@ -364,5 +365,9 @@ void WM_gizmo_group_type_reinit(struct Main *bmain, const 
char *idname);
 bool WM_gizmo_context_check_drawstep(const struct bContext *C, 
eWM_GizmoFlagMapDrawStep step);
 
 bool WM_gizmo_group_type_poll(const struct bContext *C, const struct 
wmGizmoGroupType *gzgt);
+void WM_gizmo_group_remove_by_tool(struct bContext *C,
+   struct Main *bmain,
+   const struct wmGizmoGroupType *gzgt,
+   const struct bToolRef *tref);
 
 #endif /* __WM_GIZMO_API_H__ */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 2ec0e4e7ec3..f996d938dd7 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -80,6 +80,11 @@ wmGizmoGroup *wm_gizmogroup_new_from_type(wmGizmoMap *gzmap, 
wmGizmoGroupType *g
   return gzgroup;
 }
 
+wmGizmoGroup *wm_gizmogroup_find_by_type(const wmGizmoMap *gzmap, const 
wmGizmoGroupType *gzgt)
+{
+  return BLI_findptr(&gzmap->groups, gzgt, offsetof(wmGizmoGroup, type));
+}
+
 void wm_gizmogroup_free(bContext *C, wmGizmoGroup *gzgroup)
 {
   wmGizmoMap *gzmap = gzgroup->parent_gzmap;
@@ -285,6 +290,34 @@ bool WM_gizmo_group_type_poll(const bContext *C, const 
struct wmGizmoGroupType *
   return (!gzgt->poll || gzgt->poll(C, (wmGizmoGroupType *)gzgt));
 }
 
+void WM_gizmo_group_remove_by_tool(bContext *C,
+   Main *bmain,
+   const wmGizmoGroupType *gzgt,
+   const bToolRef *tref)
+{
+  wmGizmoMapType *gzmap_type = WM_gizmomaptype_find(&gzgt->gzmap_params);
+  for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
+for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+  if (sa->runtime.tool == tref) {
+for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+  wmGizmoMap *gzmap = ar->gizmo_map;
+  if (gzmap && gzmap->type == gzmap_type) {
+wmGizmoGroup *gzgroup, *gzgroup_next;
+for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = 
gzgroup_next) {
+  gzgroup_next = gzgroup->next;
+  if (gzgroup->type == gzgt) {
+BLI_assert(gzgroup->parent_gzmap == gzmap);
+wm_gizmogroup_free(C, gzgroup);
+ED_region_tag_redraw(ar);
+  }
+}
+  }
+}
+  }
+}
+  }
+}
+
 bool wm_gizmogroup_is_visible_in_drawstep(const wmGizmoGroup *gzgroup,
   const eWM_GizmoFlagMapDrawStep 
drawstep)
 {
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
index 1018cc4d58b..98c3ad8295c 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
@@ -61,6 +61,8 @@ struct wmGizmoGroup *wm_gizmogroup_new_from_type(struct 
wmGizmoMap *gzmap,
  struct wmGizmoGroupType 
*gzgt);
 void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *gzgroup);
 void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *gzgroup, struct wmGizmo 
*gz);
+struct wmGizmoGroup *wm_gizmogroup_find_by_type(const struct wmGizmoMap *gzmap,
+const struct wmGizmoGroupType 
*gzgt);
 struct wmGizmo *wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm,
  const struct wmGizmoGroup 
*gzgroup,
  struct bContext *C,
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c 
b/source/

[Bf-blender-cvs] [c68dff9ff71] soc-2019-outliner: Outliner: Add extend selection to walk select

2019-06-27 Thread Nathan Craddock
Commit: c68dff9ff71ca5a8b330309b09854b90fab798cb
Author: Nathan Craddock
Date:   Thu Jun 27 17:50:21 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBc68dff9ff71ca5a8b330309b09854b90fab798cb

Outliner: Add extend selection to walk select

Walk select now extends the selection when shift is pressed.
This implementation works well, though if there are existing
selections in the tree the behavior may not work as expected.
This could be improved on in the future if that is a problem.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/editors/space_outliner/outliner_select.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 6b02d4a4564..128f97fed1b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -715,7 +715,11 @@ def km_outliner(params):
 ("outliner.select_box", {"type": 'EVT_TWEAK_L', "value": 'ANY', 
"ctrl": True},
  {"properties": [("tweak", True), ("mode", "SUB")]}),
 ("outliner.select_walk", {"type": 'UP_ARROW', "value": 'PRESS'}, 
{"properties": [("direction", 'UP')]}),
+("outliner.select_walk", {"type": 'UP_ARROW', "value": 'PRESS', 
"shift": True},
+ {"properties": [("direction", 'UP'), ("extend", True)]}),
 ("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS'}, 
{"properties": [("direction", 'DOWN')]}),
+("outliner.select_walk", {"type": 'DOWN_ARROW', "value": 'PRESS', 
"shift": True},
+ {"properties": [("direction", 'DOWN'), ("extend", True)]}),
 ("outliner.select_walk", {"type": 'LEFT_ARROW', "value": 'PRESS'}, 
{"properties": [("direction", 'LEFT')]}),
 ("outliner.select_walk", {"type": 'RIGHT_ARROW', "value": 'PRESS'}, 
{"properties": [("direction", 'RIGHT')]}),
 ("outliner.item_openclose", {"type": 'RET', "value": 'PRESS'},
diff --git a/source/blender/editors/space_outliner/outliner_select.c 
b/source/blender/editors/space_outliner/outliner_select.c
index 048a915a10b..29e5ba92cf7 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1634,11 +1634,16 @@ static TreeElement 
*do_outliner_select_walk_down(SpaceOutliner *soops, TreeEleme
   return active;
 }
 
-static void do_outliner_select_walk(SpaceOutliner *soops, TreeElement *active, 
const int direction)
+static void do_outliner_select_walk(SpaceOutliner *soops,
+TreeElement *active,
+const int direction,
+const bool extend)
 {
   TreeStoreElem *tselem = TREESTORE(active);
 
-  outliner_flag_set(&soops->tree, TSE_SELECTED, false);
+  if (!extend) {
+outliner_flag_set(&soops->tree, TSE_SELECTED, false);
+  }
   tselem->flag &= ~TSE_ACTIVE;
 
   switch (direction) {
@@ -1663,9 +1668,15 @@ static void do_outliner_select_walk(SpaceOutliner 
*soops, TreeElement *active, c
   }
   break;
   }
+  TreeStoreElem *tselem_new = TREESTORE(active);
+
+  if (extend) {
+const short new_flag = (extend && (tselem_new->flag & TSE_SELECTED)) ? 0 : 
TSE_SELECTED;
+tselem->flag &= ~(TSE_ACTIVE | TSE_SELECTED);
+tselem->flag |= new_flag;
+  }
 
-  tselem = TREESTORE(active);
-  tselem->flag |= TSE_SELECTED | TSE_ACTIVE;
+  tselem_new->flag |= TSE_SELECTED | TSE_ACTIVE;
 }
 
 static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const 
wmEvent *UNUSED(event))
@@ -1673,6 +1684,7 @@ static int outliner_walk_select_invoke(bContext *C, 
wmOperator *op, const wmEven
   SpaceOutliner *soops = CTX_wm_space_outliner(C);
   ARegion *ar = CTX_wm_region(C);
   const int direction = RNA_enum_get(op->ptr, "direction");
+  const bool extend = RNA_boolean_get(op->ptr, "extend");
 
   TreeElement *active = outliner_find_active_element(&soops->tree);
 
@@ -1698,7 +1710,7 @@ static int outliner_walk_select_invoke(bContext *C, 
wmOperator *op, const wmEven
   tselem->flag |= TSE_SELECTED;
 }
 else {
-  do_outliner_select_walk(soops, active, direction);
+  do_outliner_select_walk(soops, active, direction, extend);
 }
   }
 
@@ -1738,6 +1750,8 @@ void OUTLINER_OT_select_walk(wmOperatorType *ot)
   "Walk Direction",
   "Select file in this direction");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+  prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend 
selection on walk");
+  RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 /* ** */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.

[Bf-blender-cvs] [3de1bd9b380] soc-2019-outliner: Outliner: Fix walk selection wrapping and other issues

2019-06-27 Thread Nathan Craddock
Commit: 3de1bd9b380fb1b78dffea17bd60f6a4f3b58fad
Author: Nathan Craddock
Date:   Thu Jun 27 15:39:46 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rB3de1bd9b380fb1b78dffea17bd60f6a4f3b58fad

Outliner: Fix walk selection wrapping and other issues

This prevents walk selection from wrapping around from the last
to the first tree element. Additionally, if the active tree
element is within a closed subtree, walk select will move the
active element to the first visible parent.

The operator code is also simplified and slightly optimized.

===

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 94cb08cbad9..048a915a10b 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1576,7 +1576,7 @@ void OUTLINER_OT_select_box(wmOperatorType *ot)
 
 /*  Walk Select Tool ** */
 
-static TreeElement *outliner_find_rightmost_child(SpaceOutliner *soops, 
TreeElement *te)
+static TreeElement *outliner_find_rightmost_visible_child(SpaceOutliner 
*soops, TreeElement *te)
 {
   while (te->subtree.last) {
 if (TSELEM_OPEN(TREESTORE(te), soops)) {
@@ -1589,24 +1589,30 @@ static TreeElement 
*outliner_find_rightmost_child(SpaceOutliner *soops, TreeElem
   return te;
 }
 
-static TreeElement *do_outliner_select_walk_up(SpaceOutliner *soops, 
TreeElement *active)
+static TreeElement *outliner_element_find_successor_in_parents(TreeElement *te)
 {
-  if (active->prev) {
-TreeStoreElem *tselem = TREESTORE(active->prev);
-
-if (TSELEM_OPEN(tselem, soops)) {
-  active = outliner_find_rightmost_child(soops, active->prev);
+  TreeElement *successor = te;
+  while (successor->parent) {
+if (successor->parent->next) {
+  te = successor->parent->next;
+  break;
 }
 else {
-  active = active->prev;
+  successor = successor->parent;
 }
   }
+
+  return te;
+}
+
+static TreeElement *do_outliner_select_walk_up(SpaceOutliner *soops, 
TreeElement *active)
+{
+  if (active->prev) {
+active = outliner_find_rightmost_visible_child(soops, active->prev);
+  }
   else if (active->parent) {
 active = active->parent;
   }
-  else {
-active = outliner_find_rightmost_child(soops, active);
-  }
 
   return active;
 }
@@ -1622,15 +1628,7 @@ static TreeElement 
*do_outliner_select_walk_down(SpaceOutliner *soops, TreeEleme
 active = active->next;
   }
   else {
-while (active->parent) {
-  if (active->parent->next) {
-active = active->parent->next;
-break;
-  }
-  else {
-active = active->parent;
-  }
-}
+active = outliner_element_find_successor_in_parents(active);
   }
 
   return active;
@@ -1643,25 +1641,27 @@ static void do_outliner_select_walk(SpaceOutliner 
*soops, TreeElement *active, c
   outliner_flag_set(&soops->tree, TSE_SELECTED, false);
   tselem->flag &= ~TSE_ACTIVE;
 
-  if (direction == OUTLINER_SELECT_WALK_UP) {
-active = do_outliner_select_walk_up(soops, active);
-  }
-  else if (direction == OUTLINER_SELECT_WALK_DOWN) {
-active = do_outliner_select_walk_down(soops, active);
-  }
-  else if (direction == OUTLINER_SELECT_WALK_LEFT) {
-if (TSELEM_OPEN(tselem, soops)) {
-  tselem->flag |= TSE_CLOSED;
-}
-else {
-  /* Jummp active to parent */
-  active = active->parent;
-}
-  }
-  else if (direction == OUTLINER_SELECT_WALK_RIGHT) {
-if (!TSELEM_OPEN(tselem, soops) && active->subtree.first) {
-  tselem->flag &= ~TSE_CLOSED;
-}
+  switch (direction) {
+case OUTLINER_SELECT_WALK_UP:
+  active = do_outliner_select_walk_up(soops, active);
+  break;
+case OUTLINER_SELECT_WALK_DOWN:
+  active = do_outliner_select_walk_down(soops, active);
+  break;
+case OUTLINER_SELECT_WALK_LEFT:
+  /* Close open element or jummp active to parent */
+  if (TSELEM_OPEN(tselem, soops)) {
+tselem->flag |= TSE_CLOSED;
+  }
+  else if (active->parent) {
+active = active->parent;
+  }
+  break;
+case OUTLINER_SELECT_WALK_RIGHT:
+  if (!TSELEM_OPEN(tselem, soops) && active->subtree.first) {
+tselem->flag &= ~TSE_CLOSED;
+  }
+  break;
   }
 
   tselem = TREESTORE(active);
@@ -1676,11 +1676,20 @@ static int outliner_walk_select_invoke(bContext *C, 
wmOperator *op, const wmEven
 
   TreeElement *active = outliner_find_active_element(&soops->tree);
 
-  /* Set root to active if no active exists (may not be needed now that 
syncing works) */
+  /* Set first element to active if no active exists (may not be needed with 
synced selection) */
   if (!active) {
 active = soops->tree.first;
 TREESTORE(active)->flag |= T

[Bf-blender-cvs] [e191fb3bdab] soc-2019-outliner: Outliner: Fix tree building not setting parents properly

2019-06-27 Thread Nathan Craddock
Commit: e191fb3bdab5c8b8ca1bece0f453c488c583a801
Author: Nathan Craddock
Date:   Thu Jun 27 15:42:14 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBe191fb3bdab5c8b8ca1bece0f453c488c583a801

Outliner: Fix tree building not setting parents properly

When the scenes view tree was built, the parent for view layers
and objects were not set properly (either NULL or incorrect
parent), causing walk select to fail. Now the proper parents are
set.

Not sure if there was a reason why the wrong parent was set for
view layers before.

===

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

===

diff --git a/source/blender/editors/space_outliner/outliner_tree.c 
b/source/blender/editors/space_outliner/outliner_tree.c
index 1ea08b87e5c..2536b7a1948 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -297,7 +297,7 @@ static void outliner_add_scene_contents(SpaceOutliner 
*soops,
 
   ViewLayer *view_layer;
   for (view_layer = sce->view_layers.first; view_layer; view_layer = 
view_layer->next) {
-TreeElement *tenlay = outliner_add_element(soops, &ten->subtree, sce, te, 
TSE_R_LAYER, 0);
+TreeElement *tenlay = outliner_add_element(soops, &ten->subtree, sce, ten, 
TSE_R_LAYER, 0);
 tenlay->name = view_layer->name;
 tenlay->directdata = view_layer;
   }
@@ -314,7 +314,7 @@ static void outliner_add_scene_contents(SpaceOutliner 
*soops,
   ten = outliner_add_element(soops, lb, sce, te, TSE_SCENE_OBJECTS_BASE, 0);
   ten->name = IFACE_("Objects");
   FOREACH_SCENE_OBJECT_BEGIN (sce, ob) {
-outliner_add_element(soops, &ten->subtree, ob, NULL, 0, 0);
+outliner_add_element(soops, &ten->subtree, ob, ten, 0, 0);
   }
   FOREACH_SCENE_OBJECT_END;
   outliner_make_object_parent_hierarchy(&ten->subtree);

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


[Bf-blender-cvs] [fa916b74706] sculpt-mode-features: Merge branch 'master' into sculpt-mode-features

2019-06-27 Thread Pablo Dobarro
Commit: fa916b74706dd6c09b90848f7930567c3e1c8216
Author: Pablo Dobarro
Date:   Fri Jun 28 01:31:04 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rBfa916b74706dd6c09b90848f7930567c3e1c8216

Merge branch 'master' into sculpt-mode-features

===



===



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


[Bf-blender-cvs] [60d402d7156] temp-toolsystem-multiwindow: User count

2019-06-27 Thread Campbell Barton
Commit: 60d402d71565bdabb2d40ca7f122aca39092761c
Author: Campbell Barton
Date:   Thu Jun 27 21:28:36 2019 +1000
Branches: temp-toolsystem-multiwindow
https://developer.blender.org/rB60d402d71565bdabb2d40ca7f122aca39092761c

User count

===

M   source/blender/editors/util/gizmo_utils.c
M   source/blender/windowmanager/gizmo/WM_gizmo_api.h
M   source/blender/windowmanager/gizmo/WM_gizmo_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c

===

diff --git a/source/blender/editors/util/gizmo_utils.c 
b/source/blender/editors/util/gizmo_utils.c
index d330019c816..b856c831424 100644
--- a/source/blender/editors/util/gizmo_utils.c
+++ b/source/blender/editors/util/gizmo_utils.c
@@ -59,7 +59,12 @@ bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const 
bContext *C,
 {
   bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext 
*)C);
   if ((tref_rt == NULL) || !STREQ(gzgt_idname, tref_rt->gizmo_group)) {
-WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
+ScrArea *sa = CTX_wm_area(C);
+wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+WM_gizmo_group_unlink_delayed_ptr_from_space(gzgt, gzmap_type, sa);
+if (gzgt->users == 0) {
+  WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
+}
 return false;
   }
   return true;
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h 
b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
index 5025291a746..a85610ce31d 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
@@ -34,6 +34,7 @@ struct GHashIterator;
 struct IDProperty;
 struct Main;
 struct PropertyRNA;
+struct ScrArea;
 struct wmGizmo;
 struct wmGizmoGroup;
 struct wmGizmoGroupType;
@@ -165,6 +166,9 @@ void WM_gizmoconfig_update_tag_group_type_remove(struct 
wmGizmoMapType *gzmap_ty
  struct wmGizmoGroupType 
*gzgt);
 void WM_gizmoconfig_update(struct Main *bmain);
 
+/* XXX */
+void WM_gizmoconfig_update_tag_remove_single_group(void);
+
 /* wm_maniulator_target_props.c */
 struct wmGizmoProperty *WM_gizmo_target_property_array(struct wmGizmo *gz);
 struct wmGizmoProperty *WM_gizmo_target_property_at_index(struct wmGizmo *gz, 
int index);
@@ -353,6 +357,10 @@ void WM_gizmo_group_type_unlink_delayed_ptr_ex(struct 
wmGizmoGroupType *gzgt,
 void WM_gizmo_group_type_unlink_delayed_ptr(struct wmGizmoGroupType *gzgt);
 void WM_gizmo_group_type_unlink_delayed(const char *idname);
 
+void WM_gizmo_group_unlink_delayed_ptr_from_space(struct wmGizmoGroupType 
*gzgt,
+  struct wmGizmoMapType 
*gzmap_type,
+  struct ScrArea *sa);
+
 /* Has the result of unlinking and linking (re-initializes gizmo's). */
 void WM_gizmo_group_type_reinit_ptr_ex(struct Main *bmain,
struct wmGizmoGroupType *gzgt,
@@ -365,4 +373,6 @@ bool WM_gizmo_context_check_drawstep(const struct bContext 
*C, eWM_GizmoFlagMapD
 
 bool WM_gizmo_group_type_poll(const struct bContext *C, const struct 
wmGizmoGroupType *gzgt);
 
+void WM_gizmo_group_tag_remove(struct wmGizmoGroup *gzgroup);
+
 #endif /* __WM_GIZMO_API_H__ */
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h 
b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index 7afd2908b8e..68ecdeea936 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -417,6 +417,12 @@ typedef struct wmGizmoGroupType {
   /** Same as gizmo-maps, so registering/unregistering goes to the correct 
region. */
   struct wmGizmoMapType_Params gzmap_params;
 
+  /**
+   * Number of #wmGizmoGroup instances.
+   * Decremented when 'tag_remove' is set, or when removed.
+   */
+  int users;
+
 } wmGizmoGroupType;
 
 typedef struct wmGizmoGroup {
@@ -432,6 +438,8 @@ typedef struct wmGizmoGroup {
   /** Errors and warnings storage. */
   struct ReportList *reports;
 
+  bool tag_remove;
+
   void *customdata;
   /** For freeing customdata from above. */
   void (*customdata_free)(void *);
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 2ec0e4e7ec3..4207c3a40d3 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -70,7 +70,9 @@
 wmGizmoGroup *wm_gizmogroup_new_from_type(wmGizmoMap *gzmap, wmGizmoGroupType 
*gzgt)
 {
   wmGizmoGroup *gzgroup = MEM_callocN(sizeof(*gzgroup), "gizmo-group");
+
   gzgroup->type = gzgt;
+  gzgroup->type->users += 1;
 
   /* keep back-link */
   gzgroup->parent_gzmap = gzmap;
@@ -125,9 +127,25 @@ void wm_gizm

[Bf-blender-cvs] [5dd8c3f0cb8] master: GPencil: Cleanup commented lines from previous commit

2019-06-27 Thread Antonioya
Commit: 5dd8c3f0cb83db22e9570119ba35715a4d222a9f
Author: Antonioya
Date:   Thu Jun 27 23:28:44 2019 +0200
Branches: master
https://developer.blender.org/rB5dd8c3f0cb83db22e9570119ba35715a4d222a9f

GPencil: Cleanup commented lines from previous commit

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 03b4dd444d7..b717751d434 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1217,7 +1217,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
   BKE_gpencil_smooth_stroke(gps, i, 
brush->gpencil_settings->draw_smoothfac - reduce);
   BKE_gpencil_smooth_stroke_strength(gps, i, 
brush->gpencil_settings->draw_smoothfac);
 }
-reduce += 0.25f;  // reduce the factor
+reduce += 0.25f; /* reduce the factor */
   }
 }
 /* smooth thickness */
@@ -2393,11 +2393,6 @@ static void gpencil_draw_exit(bContext *C, wmOperator 
*op)
   WM_cursor_modal_restore(CTX_wm_window(C));
 }
 else {
-  ///* or restore paint if 3D view */
-  // if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) {
-  //  WM_cursor_modal_set(p->win, CURSOR_STD);
-  //}
-
   /* drawing batch cache is dirty now */
   bGPdata *gpd = CTX_data_gpencil_data(C);
   if (gpd) {
@@ -2410,8 +2405,6 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
 gpencil_undo_finish();
 
 /* cleanup */
-// WM_cursor_modal_set(p->win, CURSOR_STD);
-
 gp_paint_cleanup(p);
 gp_session_cleanup(p);
 ED_gpencil_toggle_brush_cursor(C, true, NULL);

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


[Bf-blender-cvs] [291247680cd] soc-2019-bevel-profiles: Custom bevel profiles: Merged calculate_profile and calculate_profile_custom.

2019-06-27 Thread Hans Goudey
Commit: 291247680cdc329ec61a3eaa98c3136382662344
Author: Hans Goudey
Date:   Thu Jun 27 17:16:16 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB291247680cdc329ec61a3eaa98c3136382662344

Custom bevel profiles: Merged calculate_profile and calculate_profile_custom.

Now that I'm using the custom profile for all bevel cases, I don't need to have
separate code that uses the custom bevel profiles, so I only need one function.

This also changes the "reversed" parameter to flip the order of the calculated
profile so it doesn't have to be done later with get_profile_point indices.

===

M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index bb1f4c31845..a690bb521bd 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -61,7 +61,7 @@
 #define DEBUG_CUSTOM_PROFILE_ORIGINAL 0
 #define DEBUG_CUSTOM_PROFILE_WELD 0
 #define DEBUG_CUSTOM_PROFILE_ADJ 1
-#define DEBUG_CUSTOM_PROFILE_ORIENTATION 0
+#define DEBUG_CUSTOM_PROFILE_ORIENTATION 1
 
 #if DEBUG_CUSTOM_PROFILE_ORIENTATION
 extern void DRW_debug_sphere(const float center[3], const float radius, const 
float color[4]);
@@ -1654,15 +1654,14 @@ static void get_profile_point(BevelParams *bp, const 
Profile *pro, int i, int n,
   }
 }
 
-/* This does the same thing as the regular calculate profile function, but it 
uses the
- * custom profile points instead of the normal ones. Eventually, when the 
custom and normal
- * profile spacings are merged, this function will be redundant, but for now, 
I will call this
- * function in certain cases where I am working on the custom profile. This 
also checks for
- * is_profile_start and flips the profile if it isn't the start of the 
boundary */
-/* HANS-TODO: Get rid of this function when all custom profile cases are 
completed */
-/* HANS-TODO: Change the reverse case so that I don't have to sample the 
points backwards in
- * get_profile_point. This would simplify the rest of the code a lot */
-static void calculate_profile_custom(BevelParams *bp, BoundVert *bndv, bool 
reversed)
+/* Calculate the actual coordinate values for bndv's profile.
+ * This is only needed if bp->seg > 1.
+ * Allocate the space for them if that hasn't been done already.
+ * If bp->seg is not a power of 2, also need to calculate
+ * the coordinate values for the power of 2 >= bp->seg,
+ * because the ADJ pattern needs power-of-2 boundaries
+ * during construction. */
+static void calculate_profile(BevelParams *bp, BoundVert *bndv, bool reversed)
 {
   int i, k, ns;
   const double *xvals, *yvals;
@@ -1711,7 +1710,7 @@ static void calculate_profile_custom(BevelParams *bp, 
BoundVert *bndv, bool reve
   xvals = bp->pro_spacing.xvals_2;
   yvals = bp->pro_spacing.yvals_2;
   prof_co = pro->prof_co_2;
-}
+}
 /* HANS-TODO: Why this assert? */
 BLI_assert((r == PRO_LINE_R || (xvals != NULL && yvals != NULL)) && 
prof_co != NULL);
 
@@ -1727,10 +1726,10 @@ static void calculate_profile_custom(BevelParams *bp, 
BoundVert *bndv, bool reve
 if (map_ok) {
   if (reversed) {
 #if DEBUG_CUSTOM_PROFILE_ORIENTATION
-printf("Using reversed custom profile orientation\n");
+printf("(reversed)\n");
 #endif
-p[0] = (float)yvals[k];
-p[1] = (float)xvals[k];
+p[0] = (float)yvals[ns - k];
+p[1] = (float)xvals[ns - k];
   }
   else {
 p[0] = (float)xvals[k];
@@ -1763,102 +1762,6 @@ static void calculate_profile_custom(BevelParams *bp, 
BoundVert *bndv, bool reve
   }
 }
 
-/* Calculate the actual coordinate values for bndv's profile.
- * This is only needed if bp->seg > 1.
- * Allocate the space for them if that hasn't been done already.
- * If bp->seg is not a power of 2, also need to calculate
- * the coordinate values for the power of 2 >= bp->seg,
- * because the ADJ pattern needs power-of-2 boundaries
- * during construction. */
-static void calculate_profile(BevelParams *bp, BoundVert *bndv)
-{
-  int i, k, ns;
-  const double *xvals, *yvals;
-  float co[3], co2[3], p[3], m[4][4];
-  float *prof_co, *prof_co_k;
-  float r;
-  bool need_2, map_ok;
-  Profile *pro = &bndv->profile;
-
-  if (bp->seg == 1) {
-return;
-  }
-
-  need_2 = bp->seg != bp->pro_spacing.seg_2;
-  if (!pro->prof_co) {
-pro->prof_co = (float *)BLI_memarena_alloc(bp->mem_arena,
-   ((size_t)bp->seg + 1) * 3 * 
sizeof(float));
-if (need_2) {
-  pro->prof_co_2 = (float *)BLI_memarena_alloc(
-  bp->mem_arena, ((size_t)bp->pro_spacing.seg_2 + 1) * 3 * 
sizeof(float));
-}
-else {
-  pro->prof_co_2 = pro->prof_co;
-}
-  }
-  r = pro->super_r;
-  if (r == PRO_LINE_R) {
-

[Bf-blender-cvs] [d06671b3d9a] master: GPencil: Don't hide Cursor while drawing

2019-06-27 Thread Antonioya
Commit: d06671b3d9a1469dd03fc68c4506f957e758d18d
Author: Antonioya
Date:   Thu Jun 27 23:19:05 2019 +0200
Branches: master
https://developer.blender.org/rBd06671b3d9a1469dd03fc68c4506f957e758d18d

GPencil: Don't hide Cursor while drawing

This is a partial solution for T62446 while we prepare a way to hide the cursor 
all the time.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 46a016b8c78..03b4dd444d7 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2393,10 +2393,10 @@ static void gpencil_draw_exit(bContext *C, wmOperator 
*op)
   WM_cursor_modal_restore(CTX_wm_window(C));
 }
 else {
-  /* or restore paint if 3D view */
-  if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) {
-WM_cursor_modal_set(p->win, CURSOR_STD);
-  }
+  ///* or restore paint if 3D view */
+  // if ((p) && (p->paintmode == GP_PAINTMODE_ERASER)) {
+  //  WM_cursor_modal_set(p->win, CURSOR_STD);
+  //}
 
   /* drawing batch cache is dirty now */
   bGPdata *gpd = CTX_data_gpencil_data(C);
@@ -2410,7 +2410,7 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
 gpencil_undo_finish();
 
 /* cleanup */
-WM_cursor_modal_set(p->win, CURSOR_STD);
+// WM_cursor_modal_set(p->win, CURSOR_STD);
 
 gp_paint_cleanup(p);
 gp_session_cleanup(p);
@@ -2479,6 +2479,9 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, 
const wmEvent *event)
 /* ensure that the correct cursor icon is set */
 static void gpencil_draw_cursor_set(tGPsdata *p)
 {
+  return;
+  /* Disable while we get a better cursor handling for direct input devices 
(Cintiq/Ipad)*/
+#if 0
   Brush *brush = p->brush;
   if ((p->paintmode == GP_PAINTMODE_ERASER) || (brush->gpencil_tool == 
GPAINT_TOOL_ERASE)) {
 WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */
@@ -2486,6 +2489,7 @@ static void gpencil_draw_cursor_set(tGPsdata *p)
   else {
 WM_cursor_modal_set(p->win, CURSOR_NONE);
   }
+#endif
 }
 
 /* update UI indicators of status, including cursor and header prints */

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


[Bf-blender-cvs] [57d9f004aa5] soc-2019-openxr: Fix compile/CMake errors and warnings on Linux

2019-06-27 Thread Julian Eisel
Commit: 57d9f004aa55ecb0f564b2e4199a1821d69fbbc6
Author: Julian Eisel
Date:   Thu Jun 27 19:54:05 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB57d9f004aa55ecb0f564b2e4199a1821d69fbbc6

Fix compile/CMake errors and warnings on Linux

===

R092intern/ghost/intern/GHOST_IXRGraphicsBinding.h  
intern/ghost/intern/GHOST_IXrGraphicsBinding.h
R099intern/ghost/intern/GHOST_XR.cppintern/ghost/intern/GHOST_Xr.cpp
R098intern/ghost/intern/GHOST_XREvent.cpp   
intern/ghost/intern/GHOST_XrEvent.cpp
R092intern/ghost/intern/GHOST_XRGraphicsBinding.cpp 
intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
R098intern/ghost/intern/GHOST_XRSession.cpp 
intern/ghost/intern/GHOST_XrSession.cpp
R097intern/ghost/intern/GHOST_XR_intern.h   
intern/ghost/intern/GHOST_Xr_intern.h
R100intern/ghost/intern/GHOST_XR_openxr_includes.h  
intern/ghost/intern/GHOST_Xr_openxr_includes.h
M   release/scripts/addons
M   source/blender/windowmanager/intern/wm_xr.c
M   source/tools

===

diff --git a/intern/ghost/intern/GHOST_IXRGraphicsBinding.h 
b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h
similarity index 92%
rename from intern/ghost/intern/GHOST_IXRGraphicsBinding.h
rename to intern/ghost/intern/GHOST_IXrGraphicsBinding.h
index 60b2304b239..6bb53b3b6ba 100644
--- a/intern/ghost/intern/GHOST_IXRGraphicsBinding.h
+++ b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h
@@ -23,7 +23,7 @@
 
 #include 
 #include 
-#include "GHOST_XR_openxr_includes.h"
+#include "GHOST_Xr_openxr_includes.h"
 
 class GHOST_IXrGraphicsBinding {
   friend std::unique_ptr 
GHOST_XrGraphicsBindingCreateFromType(
@@ -52,4 +52,7 @@ class GHOST_IXrGraphicsBinding {
   GHOST_IXrGraphicsBinding() = default;
 };
 
+std::unique_ptr 
GHOST_XrGraphicsBindingCreateFromType(
+GHOST_TXrGraphicsBinding type);
+
 #endif /* __GHOST_IXRGRAPHICSBINDING_H__ */
diff --git a/intern/ghost/intern/GHOST_XR.cpp b/intern/ghost/intern/GHOST_Xr.cpp
similarity index 99%
rename from intern/ghost/intern/GHOST_XR.cpp
rename to intern/ghost/intern/GHOST_Xr.cpp
index 633de1dde16..9e77443edb0 100644
--- a/intern/ghost/intern/GHOST_XR.cpp
+++ b/intern/ghost/intern/GHOST_Xr.cpp
@@ -25,7 +25,7 @@
 
 #include "GHOST_C-api.h"
 
-#include "GHOST_XR_intern.h"
+#include "GHOST_Xr_intern.h"
 
 /* Toggle printing of available OpenXR extensions and API-layers. Should 
probably be changed to use
  * CLOG at some point */
diff --git a/intern/ghost/intern/GHOST_XREvent.cpp 
b/intern/ghost/intern/GHOST_XrEvent.cpp
similarity index 98%
rename from intern/ghost/intern/GHOST_XREvent.cpp
rename to intern/ghost/intern/GHOST_XrEvent.cpp
index 6d53d5b6adb..b3ea35194f7 100644
--- a/intern/ghost/intern/GHOST_XREvent.cpp
+++ b/intern/ghost/intern/GHOST_XrEvent.cpp
@@ -21,7 +21,7 @@
 #include 
 
 #include "GHOST_C-api.h"
-#include "GHOST_XR_intern.h"
+#include "GHOST_Xr_intern.h"
 
 static bool GHOST_XrEventPollNext(OpenXRData *oxr, XrEventDataBuffer 
&r_event_data)
 {
diff --git a/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp 
b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
similarity index 92%
rename from intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
rename to intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
index ee1655a2150..22f5e80c7ca 100644
--- a/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
+++ b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
@@ -28,13 +28,13 @@
 #  include "GHOST_ContextD3D.h"
 #endif
 #include "GHOST_C-api.h"
-#include "GHOST_XR_intern.h"
+#include "GHOST_Xr_intern.h"
 
-#include "GHOST_IXRGraphicsBinding.h"
+#include "GHOST_IXrGraphicsBinding.h"
 
-bool choose_swapchain_format_from_candidates(std::vector 
gpu_binding_formats,
- std::vector 
runtime_formats,
- int64_t *r_result)
+static bool choose_swapchain_format_from_candidates(std::vector 
gpu_binding_formats,
+std::vector 
runtime_formats,
+int64_t *r_result)
 {
   if (gpu_binding_formats.empty()) {
 return false;
@@ -161,9 +161,8 @@ class GHOST_XrGraphicsBindingD3D : public 
GHOST_IXrGraphicsBinding {
 const CD3D11_RENDER_TARGET_VIEW_DESC 
render_target_view_desc(D3D11_RTV_DIMENSION_TEXTURE2D,
  
DXGI_FORMAT_R8G8B8A8_UNORM);
 ID3D11RenderTargetView *render_target_view;
-m_ghost_ctx->m_device->CreateRenderTargetView(d3d_swapchain_image->texture,
-  &render_target_view_desc,
-  &render_target_view);
+m_ghost_ctx->m_device->CreateRenderTargetView(
+d3d_swapchain_image->texture, &render_target_view_desc, 
&render_target_view);
 
 const float clear_col[] = {0.2f, 0.5f, 0.

[Bf-blender-cvs] [043a54d5c83] soc-2019-bevel-profiles: Comments: Updated questions in comments marked with HANS-QUESTION. Deleted solved questions.

2019-06-27 Thread Hans Goudey
Commit: 043a54d5c8393f4727bac2d00be4a2510969a8ee
Author: Hans Goudey
Date:   Thu Jun 27 13:41:06 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB043a54d5c8393f4727bac2d00be4a2510969a8ee

Comments: Updated questions in comments marked with HANS-QUESTION. Deleted 
solved questions.

===

M   source/blender/blenkernel/intern/profile_path.c
M   source/blender/blenloader/intern/writefile.c
M   source/blender/bmesh/tools/bmesh_bevel.c
M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/blenkernel/intern/profile_path.c 
b/source/blender/blenkernel/intern/profile_path.c
index ed01a75cf30..13fc006f2b2 100644
--- a/source/blender/blenkernel/intern/profile_path.c
+++ b/source/blender/blenkernel/intern/profile_path.c
@@ -704,10 +704,10 @@ static void profilepath_make_table(ProfilePath *prpath, 
const rctf *clipr)
   fp += 2;
 }
 if (fp == allpoints || (curf >= fp[0] && fp == lastpoint)) {
-  /* HANS-TODO: Remove this case. Why did I say this? */
+  /* HANS-TODO: Remove this case... Why did I say this? */
 }
 else {
-  /* HANS-QUESTION: Why this factor stuff? */
+  /* HANS-QUESTION: What's the idea behind this factor stuff? */
   float fac1 = fp[0] - fp[-2];
   float fac2 = fp[0] - curf;
   if (fac1 > FLT_EPSILON) {
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index 57b4ddde648..68943382938 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -958,8 +958,9 @@ static void write_curvemapping(WriteData *wd, CurveMapping 
*cumap)
 
 static void write_profilewidget(WriteData *wd, ProfileWidget *prwdgt)
 {
-  /* HANS-QUESTION: Why do I have to write the ProfilePath struct when the 
curvemapping write
-   * function doesn't have to do the analagous write? */
+  /* HANS-QUESTION: I seem to have to write the ProfilePath struct when the 
curvemapping write
+   * function doesn't have to do the analagous write. Anyway, the loading 
after a save crashes, so
+   * this can't be right. */
   writestruct(wd, DATA, ProfileWidget, 1, prwdgt);
   writestruct(wd, DATA, ProfilePath, 1, prwdgt->profile);
   writestruct(wd, DATA, ProfilePoint, prwdgt->profile->totpoint, 
prwdgt->profile->path);
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index 31d4e50c676..bb1f4c31845 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -101,8 +101,7 @@ typedef struct EdgeHalf {
   bool is_seam; /* is e a seam for custom loopdata (e.g., 
UVs)? */
   /** Used during the custom profile orientation pass */
   bool visited_custom;
-  //  int _pad;
-  char _pad[5];  // HANS-TODO: Delete these pads
+  char _pad[5];
 } EdgeHalf;
 
 /* Profile specification.
@@ -156,9 +155,11 @@ typedef struct BoundVert {
   EdgeHalf *efirst;
   EdgeHalf *elast;
   /** The "edge between" that this is on, in offset_on_edge_between case. */
-  EdgeHalf *eon; /* HANS-QUESTION: What is the "eon edge?" */
+  EdgeHalf *eon;
+  /* HANS-QUESTION: What is the "eon edge?" I haven't been able to visualize 
where this is. */
   /** Beveled edge whose left side is attached here, if any. */
-  EdgeHalf *ebev; /* HANS-QUESTION: Why just store the left edge? */
+  EdgeHalf *ebev;
+  /* HANS-QUESTION: Why just store the left edge? For travelling 
counterclockwise? */
   /** Used for vmesh indexing. */
   int index;
   /** When eon set, ratio of sines of angles to eon edge. */
@@ -190,8 +191,9 @@ typedef struct VMesh {
   NewVert *mesh; /* allocated array - size and structure depends on 
kind */
   BoundVert *boundstart; /* start of boundary double-linked list */
   int count; /* number of vertices in the boundary */
-  /* HANS-QUESTION: Does that mean the number of points in the profile so far? 
*/
   int seg;   /* common # of segments for segmented edges */
+  /* HANS-QUESTION: How is this seg different than the global bp->seg? Is it 
the number of segments
+   * built so far? */
   enum {
 M_NONE,/* no polygon mesh needed */
 M_POLY,/* a simple polygon */
@@ -1268,7 +1270,8 @@ static void project_to_edge(BMEdge *e, const float 
co_a[3], const float co_b[3],
 /* If there is a bndv->ebev edge, find the mid control point if necessary.
  * It is the closest point on the beveled edge to the line segment between
  * bndv and bndv->next.  */
-/* HANS-QUESTION: Will I need to change this? */
+/* HANS-QUESTION: I'm not sure if I'll need to change this. I don't think the 
custom situation
+ * uses the mid control point yet.*/
 static void set_profi

[Bf-blender-cvs] [9ae5708df42] soc-2019-cycles-procedural: Fix 2D noise_grad function

2019-06-27 Thread OmarSquircleArt
Commit: 9ae5708df425ea6c8c40e4e807a3604e72b28b2f
Author: OmarSquircleArt
Date:   Thu Jun 27 19:36:37 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB9ae5708df425ea6c8c40e4e807a3604e72b28b2f

Fix 2D noise_grad function

===

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

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 8917c3977a6..a7a5b1eb494 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3230,7 +3230,7 @@ float noise_grad(uint hash, float x, float y)
 {
   uint h = hash & 7u;
   float u = h < 4u ? x : y;
-  float v = 2.0 * h < 4 ? y : x;
+  float v = 2.0 * (h < 4u ? y : x);
   return negate_if(u, h & 1u) + negate_if(v, h & 2u);
 }
 
@@ -3246,9 +3246,9 @@ float noise_grad(uint hash, float x, float y, float z)
 float noise_grad(uint hash, float x, float y, float z, float w)
 {
   uint h = hash & 31u;
-  float u = (h < 24u) ? x : y;
-  float v = (h < 16u) ? y : z;
-  float s = (h < 8u) ? z : w;
+  float u = h < 24u ? x : y;
+  float v = h < 16u ? y : z;
+  float s = h < 8u ? z : w;
   return negate_if(u, h & 1u) + negate_if(v, h & 2u) + negate_if(s, h & 4u);
 }

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


[Bf-blender-cvs] [b5a1a2d1866] master: GPencil: Fix missing Fill area when drawing an stroke

2019-06-27 Thread Antonioya
Commit: b5a1a2d1866ed4fda67560f179c0d885f680d505
Author: Antonioya
Date:   Thu Jun 27 19:34:04 2019 +0200
Branches: master
https://developer.blender.org/rBb5a1a2d1866ed4fda67560f179c0d885f680d505

GPencil: Fix missing Fill area when drawing an stroke

There was a mistake in the shading group name.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index fa706812715..13b17af8f76 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1574,7 +1574,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
   stl->g_data->shgrps_drawing_fill = 
DRW_shgroup_create(e_data->gpencil_drawing_fill_sh,
 
psl->drawing_pass);
   /* Disable stencil for this type */
-  DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_stroke,
+  DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_fill,
 DRW_STATE_WRITE_STENCIL | 
DRW_STATE_STENCIL_NEQUAL);
 
   stl->g_data->batch_buffer_fill = gpencil_get_buffer_fill_geom(gpd);

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


[Bf-blender-cvs] [89415e083d0] temp-gpencil-drw-engine: Merge branch 'master' into temp-gpencil-drw-engine

2019-06-27 Thread Antonioya
Commit: 89415e083d0e0c283cc36db20d1b4682a859a331
Author: Antonioya
Date:   Thu Jun 27 19:34:27 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rB89415e083d0e0c283cc36db20d1b4682a859a331

Merge branch 'master' into temp-gpencil-drw-engine

===



===



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


[Bf-blender-cvs] [e4fcf25fc5e] soc-2019-openxr: Don't use Microsoft::WRL::ComPtr<...> for COM types

2019-06-27 Thread Julian Eisel
Commit: e4fcf25fc5ee92ca33b69063eb9c945fa41f2d45
Author: Julian Eisel
Date:   Thu Jun 27 18:56:20 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBe4fcf25fc5ee92ca33b69063eb9c945fa41f2d45

Don't use Microsoft::WRL::ComPtr<...> for COM types

Makes things difficult if you're not familar with COM.

===

M   intern/ghost/intern/GHOST_ContextD3D.cpp
M   intern/ghost/intern/GHOST_ContextD3D.h
M   intern/ghost/intern/GHOST_XRGraphicsBinding.cpp

===

diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp 
b/intern/ghost/intern/GHOST_ContextD3D.cpp
index 6a617824856..b6c2a402e5f 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -71,7 +71,7 @@ class SharedOpenGLContext {
 
 m_wgl_ctx->activateDrawingContext();
 
-m_shared.device = wglDXOpenDeviceNV(m_d3d_ctx->m_device.Get());
+m_shared.device = wglDXOpenDeviceNV(m_d3d_ctx->m_device);
 if (m_shared.device == NULL) {
   fprintf(stderr, "Error opening shared device using 
wglDXOpenDeviceNV()\n");
   return GHOST_kFailure;
@@ -122,6 +122,10 @@ GHOST_ContextD3D::GHOST_ContextD3D(bool stereoVisual, HWND 
hWnd)
 GHOST_ContextD3D::~GHOST_ContextD3D()
 {
   delete glshared;
+  m_swapchain->Release();
+  m_backbuffer_view->Release();
+  m_device->Release();
+  m_device_ctx->Release();
 }
 
 GHOST_TSuccess GHOST_ContextD3D::swapBuffers()
@@ -198,10 +202,11 @@ GHOST_TSuccess 
GHOST_ContextD3D::initializeDrawingContext()
&m_device_ctx);
   WIN32_CHK(hres == S_OK);
 
-  Microsoft::WRL::ComPtr back_buffer = nullptr;
-  m_swapchain->GetBuffer(0, __uuidof(ID3D11Resource), &back_buffer);
+  ID3D11Texture2D *back_buffer;
+  m_swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void **)&back_buffer);
 
-  m_device->CreateRenderTargetView(back_buffer.Get(), nullptr, 
&m_backbuffer_view);
+  m_device->CreateRenderTargetView(back_buffer, nullptr, &m_backbuffer_view);
+  back_buffer->Release();
 
   m_swapchain->Present(0, 0);
 
@@ -225,8 +230,8 @@ GHOST_TSuccess 
GHOST_ContextD3D::blitOpenGLOffscreenContext(GHOST_Context *offsc
   }
 
   // const float clear_col[] = {0.2f, 0.5f, 0.8f, 1.0f};
-  // m_device_ctx->ClearRenderTargetView(m_backbuffer_view.Get(), clear_col);
-  m_device_ctx->OMSetRenderTargets(1, m_backbuffer_view.GetAddressOf(), 
nullptr);
+  // m_device_ctx->ClearRenderTargetView(m_backbuffer_view, clear_col);
+  m_device_ctx->OMSetRenderTargets(1, &m_backbuffer_view, nullptr);
 
   offscreen_ctx->activateDrawingContext();
 
diff --git a/intern/ghost/intern/GHOST_ContextD3D.h 
b/intern/ghost/intern/GHOST_ContextD3D.h
index a4ff58a0b46..430ac12abbd 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.h
+++ b/intern/ghost/intern/GHOST_ContextD3D.h
@@ -26,7 +26,6 @@
 #endif  // WIN32
 
 #include 
-#include   // Microsoft::WRL::ComPtr
 
 #include "GHOST_Context.h"
 
@@ -126,10 +125,10 @@ class GHOST_ContextD3D : public GHOST_Context {
 
   HWND m_hWnd;
 
-  Microsoft::WRL::ComPtr m_device;
-  Microsoft::WRL::ComPtr m_device_ctx;
-  Microsoft::WRL::ComPtr m_swapchain;
-  Microsoft::WRL::ComPtr m_backbuffer_view;
+  ID3D11Device *m_device;
+  ID3D11DeviceContext *m_device_ctx;
+  IDXGISwapChain *m_swapchain;
+  ID3D11RenderTargetView *m_backbuffer_view;
 
   SharedOpenGLContext *glshared{NULL};
 };
diff --git a/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp 
b/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
index d08940a951e..ee1655a2150 100644
--- a/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
+++ b/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
@@ -123,7 +123,7 @@ class GHOST_XrGraphicsBindingD3D : public 
GHOST_IXrGraphicsBinding {
 GHOST_ContextD3D *ctx_d3d = static_cast(ghost_ctx);
 
 oxr_binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR;
-oxr_binding.d3d11.device = ctx_d3d->m_device.Get();
+oxr_binding.d3d11.device = ctx_d3d->m_device;
 m_ghost_ctx = ctx_d3d;
   }
 
@@ -160,13 +160,15 @@ class GHOST_XrGraphicsBindingD3D : public 
GHOST_IXrGraphicsBinding {
 swapchain_image);
 const CD3D11_RENDER_TARGET_VIEW_DESC 
render_target_view_desc(D3D11_RTV_DIMENSION_TEXTURE2D,
  
DXGI_FORMAT_R8G8B8A8_UNORM);
-Microsoft::WRL::ComPtr renderTargetView;
+ID3D11RenderTargetView *render_target_view;
 m_ghost_ctx->m_device->CreateRenderTargetView(d3d_swapchain_image->texture,
   &render_target_view_desc,
-  
renderTargetView.ReleaseAndGetAddressOf());
+  &render_target_view);
 
 const float clear_col[] = {0.2f, 0.5f, 0.8f, 1.0f};
-m_ghost_ctx->m_device_ctx->ClearRenderTargetView(renderTargetView.Get(), 
clear_col);
+m_ghost_ctx->m_device_ct

[Bf-blender-cvs] [62cde7a9ef8] soc-2019-openxr: Finish VR view drawing callback set up

2019-06-27 Thread Julian Eisel
Commit: 62cde7a9ef8ebfd0d33bbc14210db338608411c1
Author: Julian Eisel
Date:   Thu Jun 27 19:12:54 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB62cde7a9ef8ebfd0d33bbc14210db338608411c1

Finish VR view drawing callback set up

* Allow passing custom data to session draw function, passed to the
  callback
* Actually call the callback
* Create and bind a WM level callback. Will later be used to draw the
  viewport.

Also, check if session is actually visible before drawing.

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/intern/GHOST_XRSession.cpp
M   source/blender/windowmanager/intern/wm_draw.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/intern/wm_xr.c
M   source/blender/windowmanager/wm.h

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 40a711b207d..a7fcb46211c 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -1002,7 +1002,7 @@ 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);
+typedef void (*GHOST_XrDrawViewFn)(const GHOST_XrDrawViewInfo *draw_view, void 
*customdata);
 
 void GHOST_XrGraphicsContextBindFuncs(struct GHOST_XrContext *xr_context,
   GHOST_XrGraphicsContextBindFn bind_fn,
@@ -1015,7 +1015,7 @@ 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 GHOST_XrSessionDrawViews(struct GHOST_XrContext *xr_context, void 
*customdata);
 
 /* events */
 GHOST_TSuccess GHOST_XrEventsHandle(struct GHOST_XrContext *xr_context);
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index 84193b2f13f..be7a7849929 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -42,6 +42,19 @@ GHOST_TSuccess GHOST_XrSessionIsRunning(const 
GHOST_XrContext *xr_context)
   return GHOST_kFailure;
   }
 }
+static GHOST_TSuccess GHOST_XrSessionIsVisible(const GHOST_XrContext 
*xr_context)
+{
+  if ((xr_context == nullptr) || (xr_context->oxr.session == XR_NULL_HANDLE)) {
+return GHOST_kFailure;
+  }
+  switch (xr_context->oxr.session_state) {
+case XR_SESSION_STATE_VISIBLE:
+case XR_SESSION_STATE_FOCUSED:
+  return GHOST_kSuccess;
+default:
+  return GHOST_kFailure;
+  }
+}
 
 /**
  * A system in OpenXR the combination of some sort of HMD plus controllers and 
whatever other
@@ -231,12 +244,14 @@ static void draw_view(GHOST_XrContext *xr_context,
   OpenXRData *oxr,
   XrSwapchain swapchain,
   XrCompositionLayerProjectionView &proj_layer_view,
-  XrView &view)
+  XrView &view,
+  void *draw_customdata)
 {
   XrSwapchainImageAcquireInfo 
acquire_info{XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO};
   XrSwapchainImageWaitInfo wait_info{XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO};
   XrSwapchainImageReleaseInfo 
release_info{XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO};
   XrSwapchainImageBaseHeader *swapchain_image;
+  GHOST_XrDrawViewInfo draw_view_info{};
   uint32_t swapchain_idx;
 
   xrAcquireSwapchainImage(swapchain, &acquire_info, &swapchain_idx);
@@ -254,7 +269,7 @@ static void draw_view(GHOST_XrContext *xr_context,
   swapchain_image = oxr->swapchain_images[swapchain][swapchain_idx];
 
   xr_context->gpu_binding->drawViewBegin(swapchain_image);
-  //  xr_context->draw_view_fn();
+  xr_context->draw_view_fn(&draw_view_info, draw_customdata);
   xr_context->gpu_binding->drawViewEnd(swapchain_image);
 
   xrReleaseSwapchainImage(swapchain, &release_info);
@@ -264,7 +279,8 @@ static XrCompositionLayerProjection draw_layer(
 GHOST_XrContext *xr_context,
 OpenXRData *oxr,
 XrSpace space,
-std::vector &proj_layer_views)
+std::vector &proj_layer_views,
+void *draw_customdata)
 {
   XrViewLocateInfo viewloc_info{XR_TYPE_VIEW_LOCATE_INFO};
   XrViewState view_state{XR_TYPE_VIEW_STATE};
@@ -285,7 +301,8 @@ static XrCompositionLayerProjection draw_layer(
   oxr,
   oxr->swapchains[view_idx],
   proj_layer_views[view_idx],
-  oxr->views[view_idx]);
+  oxr->views[view_idx]

[Bf-blender-cvs] [215c919b33e] soc-2019-openxr: Merge branch 'master' into soc-2019-openxr

2019-06-27 Thread Julian Eisel
Commit: 215c919b33e73e28fbb2aed2e8d0690bf8e51458
Author: Julian Eisel
Date:   Wed Jun 26 18:39:31 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB215c919b33e73e28fbb2aed2e8d0690bf8e51458

Merge branch 'master' into soc-2019-openxr

===



===



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


[Bf-blender-cvs] [da44a02d00c] soc-2019-openxr: The first pixels pushed to Windows Mixed Reality HMDs!

2019-06-27 Thread Julian Eisel
Commit: da44a02d00ca9431ce232b9ac83009f0b3ab57a5
Author: Julian Eisel
Date:   Mon Jun 24 21:22:23 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBda44a02d00ca9431ce232b9ac83009f0b3ab57a5

The first pixels pushed to Windows Mixed Reality HMDs!

Just a clear call for now, so all you see is a blue world. This blue
"world" is however drawn by Blender!

Also fixes use after destruction of compositor layer data.

===

M   intern/ghost/intern/GHOST_ContextD3D.cpp
M   intern/ghost/intern/GHOST_IXRGraphicsBinding.h
M   intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
M   intern/ghost/intern/GHOST_XRSession.cpp

===

diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp 
b/intern/ghost/intern/GHOST_ContextD3D.cpp
index 2f3e28a28b2..6a617824856 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -176,7 +176,7 @@ GHOST_TSuccess GHOST_ContextD3D::initializeDrawingContext()
 
   DXGI_SWAP_CHAIN_DESC sd{};
 
-  sd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
+  sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
   sd.SampleDesc.Count = 1;
   sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
   sd.BufferCount = 3;
diff --git a/intern/ghost/intern/GHOST_IXRGraphicsBinding.h 
b/intern/ghost/intern/GHOST_IXRGraphicsBinding.h
index 794153f251f..60b2304b239 100644
--- a/intern/ghost/intern/GHOST_IXRGraphicsBinding.h
+++ b/intern/ghost/intern/GHOST_IXRGraphicsBinding.h
@@ -44,6 +44,8 @@ class GHOST_IXrGraphicsBinding {
  int64_t *r_result) const = 0;
   virtual std::vector createSwapchainImages(
   uint32_t image_count) = 0;
+  virtual void drawViewBegin(XrSwapchainImageBaseHeader *swapchain_image) = 0;
+  virtual void drawViewEnd(XrSwapchainImageBaseHeader *swapchain_image) = 0;
 
  protected:
   /* Use GHOST_XrGraphicsBindingCreateFromType */
diff --git a/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp 
b/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
index f42fa0fe059..d08940a951e 100644
--- a/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
+++ b/intern/ghost/intern/GHOST_XRGraphicsBinding.cpp
@@ -100,6 +100,17 @@ class GHOST_XrGraphicsBindingOpenGL : public 
GHOST_IXrGraphicsBinding {
 return base_images;
   }
 
+  void drawViewBegin(XrSwapchainImageBaseHeader *swapchain_image) override
+  {
+// TODO
+(void)swapchain_image;
+  }
+  void drawViewEnd(XrSwapchainImageBaseHeader *swapchain_image) override
+  {
+// TODO
+(void)swapchain_image;
+  }
+
  private:
   std::list> m_image_cache;
 };
@@ -113,6 +124,7 @@ class GHOST_XrGraphicsBindingD3D : public 
GHOST_IXrGraphicsBinding {
 
 oxr_binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR;
 oxr_binding.d3d11.device = ctx_d3d->m_device.Get();
+m_ghost_ctx = ctx_d3d;
   }
 
   bool chooseSwapchainFormat(std::vector runtime_formats,
@@ -140,7 +152,30 @@ class GHOST_XrGraphicsBindingD3D : public 
GHOST_IXrGraphicsBinding {
 return base_images;
   }
 
+  void drawViewBegin(XrSwapchainImageBaseHeader *swapchain_image) override
+  {
+// Can't we simply use the backbuffer texture? Didn't work in initial test.
+
+XrSwapchainImageD3D11KHR *d3d_swapchain_image = 
reinterpret_cast(
+swapchain_image);
+const CD3D11_RENDER_TARGET_VIEW_DESC 
render_target_view_desc(D3D11_RTV_DIMENSION_TEXTURE2D,
+ 
DXGI_FORMAT_R8G8B8A8_UNORM);
+Microsoft::WRL::ComPtr renderTargetView;
+m_ghost_ctx->m_device->CreateRenderTargetView(d3d_swapchain_image->texture,
+  &render_target_view_desc,
+  
renderTargetView.ReleaseAndGetAddressOf());
+
+const float clear_col[] = {0.2f, 0.5f, 0.8f, 1.0f};
+m_ghost_ctx->m_device_ctx->ClearRenderTargetView(renderTargetView.Get(), 
clear_col);
+  }
+  void drawViewEnd(XrSwapchainImageBaseHeader *swapchain_image) override
+  {
+// TODO
+(void)swapchain_image;
+  }
+
  private:
+  GHOST_ContextD3D *m_ghost_ctx;
   std::list> m_image_cache;
 };
 #endif  // WIN32
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp 
b/intern/ghost/intern/GHOST_XRSession.cpp
index 11bd65b20fe..84193b2f13f 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -227,7 +227,8 @@ void drawing_end(GHOST_XrContext *xr_context, 
std::vectordraw_frame = nullptr;
 }
 
-static void draw_view(OpenXRData *oxr,
+static void draw_view(GHOST_XrContext *xr_context,
+  OpenXRData *oxr,
   XrSwapchain swapchain,
   XrCompositionLayerProjectionView &proj_layer_view,
   XrView &view)
@@ -252,19 +253,22 @@ static void draw_view(OpenXRData *oxr,
 
   swapchain_image = oxr->swapchain_images[swapchain][s

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

2019-06-27 Thread Brecht Van Lommel
Commit: b2c92d90c8f713b90180f5d4652c5e831fa8e506
Author: Brecht Van Lommel
Date:   Thu Jun 27 18:30:51 2019 +0200
Branches: master
https://developer.blender.org/rBb2c92d90c8f713b90180f5d4652c5e831fa8e506

Cleanup: fix compiler warnings

===

M   source/blender/draw/engines/eevee/eevee_volumes.c
M   source/blender/draw/modes/object_mode.c

===

diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c 
b/source/blender/draw/engines/eevee/eevee_volumes.c
index 79a133ed7fc..9c8ec6e52a4 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -630,7 +630,6 @@ void EEVEE_volumes_compute(EEVEE_ViewLayerData 
*UNUSED(sldata), EEVEE_Data *veda
 void EEVEE_volumes_resolve(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data 
*vedata)
 {
   EEVEE_PassList *psl = vedata->psl;
-  EEVEE_TextureList *txl = vedata->txl;
   EEVEE_FramebufferList *fbl = vedata->fbl;
   EEVEE_StorageList *stl = vedata->stl;
   EEVEE_EffectsInfo *effects = stl->effects;
diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 330b24f5e1a..68f3e058693 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1212,6 +1212,9 @@ static void 
DRW_shgroup_camera_background_images(OBJECT_Shaders *sh_data,
 BKE_movieclip_get_size(clip, &bgpic->cuser, &image_width, 
&image_height);
 image_aspect = (image_width * image_aspect_x) / (image_height * 
image_aspect_y);
   }
+  else {
+continue;
+  }
 
   /* ensure link_data is allocated to store matrice */
   CameraEngineBGData *bg_data;

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


[Bf-blender-cvs] [b3c2926bc06] temp-gpencil-drw-engine: GPencil: Remove redundant parameter

2019-06-27 Thread Antonioya
Commit: b3c2926bc06bf55c169b1a74d29a285a906efe3a
Author: Antonioya
Date:   Thu Jun 27 19:11:39 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rBb3c2926bc06bf55c169b1a74d29a285a906efe3a

GPencil: Remove redundant parameter

===

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

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index a35c4a06f75..3a34deafa4f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -819,14 +819,14 @@ static void 
gpencil_draw_pass_range(GPENCIL_FramebufferList *fbl,
 Object *ob,
 bGPdata *gpd,
 DRWShadingGroup *init_shgrp,
-DRWShadingGroup *end_shgrp,
-bool multi)
+DRWShadingGroup *end_shgrp)
 {
   if (init_shgrp == NULL) {
 return;
   }
 
-  const bool do_antialiasing = ((!stl->storage->is_mat_preview) && (multi));
+  const bool do_antialiasing = ((!stl->storage->is_mat_preview) &&
+(stl->storage->multisamples > 0));
 
   DRWShadingGroup *shgrp = init_shgrp;
   DRWShadingGroup *from_shgrp = init_shgrp;
@@ -834,10 +834,6 @@ static void 
gpencil_draw_pass_range(GPENCIL_FramebufferList *fbl,
   int stencil_tot = 0;
   bool do_last = true;
 
-  if (do_antialiasing) {
-MULTISAMPLE_GP_SYNC_ENABLE(stl->storage->multisamples, fbl);
-  }
-
   /* Loop all shading groups to separate by stencil groups. */
   while ((shgrp) && (shgrp != end_shgrp)) {
 do_last = true;
@@ -898,10 +894,6 @@ static void 
gpencil_draw_pass_range(GPENCIL_FramebufferList *fbl,
  from_shgrp,
  to_shgrp);
   }
-
-  if (do_antialiasing) {
-MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fb, txl);
-  }
 }
 
 /* draw strokes to use for selection */
@@ -1052,14 +1044,14 @@ void GPENCIL_draw_scene(void *ved)
   }
 
   gpencil_draw_pass_range(
-  fbl, stl, psl, txl, fbl->temp_fb_a, ob, gpd, init_shgrp, 
end_shgrp, false);
+  fbl, stl, psl, txl, fbl->temp_fb_a, ob, gpd, init_shgrp, 
end_shgrp);
 }
 else {
   /* Draw current group in separated texture to blend later. */
   GPU_framebuffer_bind(fbl->temp_fb_fx);
   GPU_framebuffer_clear_color_depth_stencil(fbl->temp_fb_fx, 
clearcol, 1.0f, 0x0);
   gpencil_draw_pass_range(
-  fbl, stl, psl, txl, fbl->temp_fb_a, ob, gpd, init_shgrp, 
end_shgrp, false);
+  fbl, stl, psl, txl, fbl->temp_fb_a, ob, gpd, init_shgrp, 
end_shgrp);
 
   /* Draw Blended texture over MSAA texture */
   GPU_framebuffer_bind(fbl->multisample_fb);

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


[Bf-blender-cvs] [c187fc09b61] master: Masking: make image editor UI consistent with clip editor

2019-06-27 Thread Sebastian Koenig
Commit: c187fc09b6129f31c4e856227adcf5d1224cfde3
Author: Sebastian Koenig
Date:   Thu Jun 27 18:27:47 2019 +0200
Branches: master
https://developer.blender.org/rBc187fc09b6129f31c4e856227adcf5d1224cfde3

Masking: make image editor UI consistent with clip editor

* Mask Display menu is now part of the header
* Sidebar now has a separate Mask tab
* Add context menu when in mask mode

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

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_image.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 4f907bf3e80..87871822e5f 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1552,6 +1552,7 @@ def km_image(params):
  )
 ),
 op_menu_pie("IMAGE_MT_pivot_pie", {"type": 'PERIOD', "value": 
'PRESS'}),
+op_menu("IMAGE_MT_mask_context_menu", params.context_menu_event),
 ("image.render_border", {"type": 'B', "value": 'PRESS', "ctrl": True}, 
None),
 ("image.clear_render_border", {"type": 'B', "value": 'PRESS', "ctrl": 
True, "alt": True}, None),
 ])
diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index e3f4ceb7ed1..8f6e9d71790 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -724,6 +724,9 @@ class IMAGE_HT_header(Header):
 if ima.is_stereo_3d:
 row = layout.row()
 row.prop(sima, "show_stereo_3d", text="")
+if show_maskedit:
+row = layout.row()
+row.popover(panel='CLIP_PT_mask_display')
 
 # layers.
 layout.template_image_layers(ima, iuser)
@@ -773,6 +776,51 @@ class MASK_MT_editor_menus(Menu):
 layout.menu("MASK_MT_mask")
 
 
+class IMAGE_MT_mask_context_menu(Menu):
+bl_label = "Mask Context Menu"
+
+@classmethod
+def poll(cls, context):
+sima = context.space_data
+return (sima.show_maskedit)
+
+def draw(self, context):
+layout = self.layout
+sima = context.space_data
+
+if not sima.mask:
+layout.operator("mask.new")
+layout.separator()
+layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE')
+layout.operator("mask.primitive_square_add", icon='MESH_PLANE')
+else:
+layout.operator_menu_enum("mask.handle_type_set", "type")
+layout.operator("mask.switch_direction")
+layout.operator("mask.cyclic_toggle")
+
+layout.separator()
+layout.operator("mask.primitive_circle_add", icon='MESH_CIRCLE')
+layout.operator("mask.primitive_square_add", icon='MESH_PLANE')
+
+layout.separator()
+layout.operator("mask.copy_splines", icon='COPYDOWN')
+layout.operator("mask.paste_splines", icon='PASTEDOWN')
+
+layout.separator()
+
+layout.operator("mask.shape_key_rekey", text="Re-key Shape Points")
+layout.operator("mask.feather_weight_clear")
+layout.operator("mask.shape_key_feather_reset", text="Reset 
Feather Animation")
+
+layout.separator()
+
+layout.operator("mask.parent_set")
+layout.operator("mask.parent_clear")
+
+layout.separator()
+
+layout.operator("mask.delete")
+
 # -
 # Mask (similar code in space_clip.py, keep in sync)
 # note! - panel placement does _not_ fit well with image panels... need to fix.
@@ -789,31 +837,25 @@ from bl_ui.properties_mask_common import (
 class IMAGE_PT_mask(MASK_PT_mask, Panel):
 bl_space_type = 'IMAGE_EDITOR'
 bl_region_type = 'UI'
-bl_category = "Image"
+bl_category = "Mask"
 
 
 class IMAGE_PT_mask_layers(MASK_PT_layers, Panel):
 bl_space_type = 'IMAGE_EDITOR'
 bl_region_type = 'UI'
-bl_category = "Image"
-
-
-class IMAGE_PT_mask_display(MASK_PT_display, Panel):
-bl_space_type = 'IMAGE_EDITOR'
-bl_region_type = 'UI'
-bl_category = "Image"
+bl_category = "Mask"
 
 
 class IMAGE_PT_active_mask_spline(MASK_PT_spline, Panel):
 bl_space_type = 'IMAGE_EDITOR'
 bl_region_type = 'UI'
-bl_category = "Image"
+bl_category = "Mask"
 
 
 class IMAGE_PT_active_mask_point(MASK_PT_point, Panel):
 bl_space_type = 'IMAGE_EDITOR'
 bl_region_type = 'UI'
-bl_category = "Image"
+bl_category = "Mask"
 
 
 # --- end mask ---
@@ -1667,6 +1709,7 @@ classes = (
 IMAGE_MT_uvs_weldalign,
 IMAG

[Bf-blender-cvs] [1cd11c9d75b] master: Fix T66166: NLA invisible source list selection

2019-06-27 Thread William Reynish
Commit: 1cd11c9d75b890745a30dfbb49addcd6a1084777
Author: William Reynish
Date:   Thu Jun 27 18:22:34 2019 +0200
Branches: master
https://developer.blender.org/rB1cd11c9d75b890745a30dfbb49addcd6a1084777

Fix T66166: NLA invisible source list selection

===

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 e1794495ee6..95d27e41440 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -558,7 +558,7 @@ const bTheme U_theme_default = {
 .list = RGBA(0x282828ff),
 .list_title = RGBA(0x),
 .list_text = RGBA(0xb8b8b8ff),
-.list_text_hi = RGBA(0xccff),
+.list_text_hi = RGBA(0x),
 .panelcolors = {
   .header = RGBA(0x424242cc),
   .back = RGBA(0x33b3),

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


[Bf-blender-cvs] [7c948609db2] temp-gpencil-drw-engine: GPencil: Initial changes to redesign the layers blend modes.

2019-06-27 Thread Antonioya
Commit: 7c948609db2b1f1387db035d0b859b93ef94ad07
Author: Antonioya
Date:   Thu Jun 27 17:59:35 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rB7c948609db2b1f1387db035d0b859b93ef94ad07

GPencil: Initial changes to redesign the layers blend modes.

These changes were proposed by @fclem in order to make more efficient the 
engine.

Still WIP: NO layers blend modes working and no clamp.

===

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

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index b4c015b8527..a35c4a06f75 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -84,7 +84,7 @@ void gpencil_multisample_ensure(GPENCIL_Data *vedata, int 
rect_w, int rect_h)
   if (fbl->multisample_fb) {
 if (txl->multisample_color == NULL) {
   txl->multisample_color = GPU_texture_create_2d_multisample(
-  rect_w, rect_h, GPU_RGBA16F, NULL, samples, NULL);
+  rect_w, rect_h, GPU_RGBA16, NULL, samples, NULL);
 }
 if (txl->multisample_depth == NULL) {
   txl->multisample_depth = GPU_texture_create_2d_multisample(
@@ -105,7 +105,7 @@ static void GPENCIL_create_framebuffers(void *vedata)
   GPENCIL_TextureList *txl = ((GPENCIL_Data *)vedata)->txl;
 
   /* Go full 32bits for rendering */
-  eGPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : 
GPU_RGBA16F;
+  eGPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : 
GPU_RGBA16;
 
   if (DRW_state_is_fbo()) {
 const float *viewport_size = DRW_viewport_size_get();
@@ -469,10 +469,11 @@ void GPENCIL_cache_init(void *vedata)
 
 /* full screen pass to combine the result with default framebuffer */
 struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
-psl->mix_pass = DRW_pass_create("GPencil Mix Pass",
-DRW_STATE_WRITE_COLOR | 
DRW_STATE_BLEND_ALPHA |
-DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
-DRWShadingGroup *mix_shgrp = 
DRW_shgroup_create(e_data.gpencil_fullscreen_sh, psl->mix_pass);
+psl->mix_screen_pass = DRW_pass_create("GPencil Mix Pass",
+   DRW_STATE_WRITE_COLOR | 
DRW_STATE_BLEND_ALPHA |
+   DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+DRWShadingGroup *mix_shgrp = 
DRW_shgroup_create(e_data.gpencil_fullscreen_sh,
+psl->mix_screen_pass);
 DRW_shgroup_call(mix_shgrp, quad, NULL);
 DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeColor", 
&stl->g_data->input_color_tx);
 DRW_shgroup_uniform_texture_ref(mix_shgrp, "strokeDepth", 
&stl->g_data->input_depth_tx);
@@ -486,11 +487,11 @@ void GPENCIL_cache_init(void *vedata)
  * This pass is used too to take the snapshot used for background_pass. 
This image
  * will be used as the background while the user is drawing.
  */
-psl->mix_pass_noblend = DRW_pass_create("GPencil Mix Pass no blend",
-DRW_STATE_WRITE_COLOR | 
DRW_STATE_WRITE_DEPTH |
-DRW_STATE_DEPTH_LESS);
+psl->mix_screen_noblend_pass = DRW_pass_create("GPencil Mix Pass no blend",
+   DRW_STATE_WRITE_COLOR | 
DRW_STATE_WRITE_DEPTH |
+   DRW_STATE_DEPTH_LESS);
 DRWShadingGroup *mix_shgrp_noblend = 
DRW_shgroup_create(e_data.gpencil_fullscreen_sh,
-
psl->mix_pass_noblend);
+
psl->mix_screen_noblend_pass);
 DRW_shgroup_call(mix_shgrp_noblend, quad, NULL);
 DRW_shgroup_uniform_texture_ref(
 mix_shgrp_noblend, "strokeColor", &stl->g_data->input_color_tx);
@@ -538,11 +539,11 @@ void GPENCIL_cache_init(void *vedata)
 }
 
 /* blend layers pass */
-psl->blend_pass = DRW_pass_create("GPencil Blend Layers Pass",
-  DRW_STATE_WRITE_COLOR | 
DRW_STATE_BLEND_ALPHA |
-  DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
+psl->blend_layers_pass = DRW_pass_create("GPencil Blend Layers Pass",
+ DRW_STATE_WRITE_COLOR | 
DRW_STATE_BLEND_ALPHA |
+ DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS);
 DRWShadingGroup *blend_shgrp = 
DRW_shgroup_create(e_data.gpencil

[Bf-blender-cvs] [ad8b8c07bf1] temp-gpencil-drw-engine: DRW: Add RGBA16 support for framebuffers

2019-06-27 Thread Antonioya
Commit: ad8b8c07bf1aa565a65f1698796d879cee539db1
Author: Antonioya
Date:   Thu Jun 27 17:33:49 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rBad8b8c07bf1aa565a65f1698796d879cee539db1

DRW: Add RGBA16 support for framebuffers

This avoid assert.

===

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

===

diff --git a/source/blender/draw/intern/draw_manager_texture.c 
b/source/blender/draw/intern/draw_manager_texture.c
index 4750a35d784..d62b6514763 100644
--- a/source/blender/draw/intern/draw_manager_texture.c
+++ b/source/blender/draw/intern/draw_manager_texture.c
@@ -42,6 +42,7 @@ static bool 
drw_texture_format_supports_framebuffer(eGPUTextureFormat format)
 case GPU_RG16:
 case GPU_RG16F:
 case GPU_RG16I:
+case GPU_RGBA16:
 case GPU_RG32F:
 case GPU_R11F_G11F_B10F:
 case GPU_RGBA8:

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


[Bf-blender-cvs] [7ee5ea77511] master: Fix T65010: Affect options not being displayed in the UV editor snap settings.

2019-06-27 Thread mano-wii
Commit: 7ee5ea77511a800a2442f786839366aa15678276
Author: mano-wii
Date:   Thu Jun 27 12:24:03 2019 -0300
Branches: master
https://developer.blender.org/rB7ee5ea77511a800a2442f786839366aa15678276

Fix T65010: Affect options not being displayed in the UV editor snap settings.

Reviewers: brecht, billreynish

Reviewed By: brecht

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_image.py 
b/release/scripts/startup/bl_ui/space_image.py
index 2aba440bf1d..e3f4ceb7ed1 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -645,11 +645,18 @@ class IMAGE_HT_header(Header):
 tool_settings = context.tool_settings
 
 # Snap.
+snap_uv_element = tool_settings.snap_uv_element
+act_snap_uv_element = 
tool_settings.bl_rna.properties['snap_uv_element'].enum_items[snap_uv_element]
+
 row = layout.row(align=True)
 row.prop(tool_settings, "use_snap", text="")
-row.prop(tool_settings, "snap_uv_element", icon_only=True)
-if tool_settings.snap_uv_element != 'INCREMENT':
-row.prop(tool_settings, "snap_target", text="")
+
+sub = row.row(align=True)
+sub.popover(
+panel="IMAGE_PT_snapping",
+icon=act_snap_uv_element.icon,
+text="",
+)
 
 # Proportional Editing
 row = layout.row(align=True)
@@ -811,6 +818,30 @@ class IMAGE_PT_active_mask_point(MASK_PT_point, Panel):
 
 # --- end mask ---
 
+class IMAGE_PT_snapping(Panel):
+bl_space_type = 'IMAGE_EDITOR'
+bl_region_type = 'HEADER'
+bl_label = "Snapping"
+
+def draw(self, context):
+tool_settings = context.tool_settings
+
+layout = self.layout
+col = layout.column()
+col.label(text="Snapping")
+col.prop(tool_settings, "snap_uv_element", expand=True)
+
+if tool_settings.snap_uv_element != 'INCREMENT':
+col.label(text="Target")
+row = col.row(align=True)
+row.prop(tool_settings, "snap_target", expand=True)
+
+col.label(text="Affect")
+row = col.row(align=True)
+row.prop(tool_settings, "use_snap_translate", text="Move", toggle=True)
+row.prop(tool_settings, "use_snap_rotate", text="Rotate", toggle=True)
+row.prop(tool_settings, "use_snap_scale", text="Scale", toggle=True)
+
 
 class IMAGE_PT_image_properties(Panel):
 bl_space_type = 'IMAGE_EDITOR'
@@ -1647,6 +1678,7 @@ classes = (
 IMAGE_PT_mask_display,
 IMAGE_PT_active_mask_spline,
 IMAGE_PT_active_mask_point,
+IMAGE_PT_snapping,
 IMAGE_PT_image_properties,
 IMAGE_UL_render_slots,
 IMAGE_PT_render_slots,

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


[Bf-blender-cvs] [60090d61ead] sybren-usd: USD: support for simple preview materials

2019-06-27 Thread Sybren A. Stüvel
Commit: 60090d61eadb7daadf10f12c3387b2c118499736
Author: Sybren A. Stüvel
Date:   Thu Jun 27 16:45:36 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB60090d61eadb7daadf10f12c3387b2c118499736

USD: support for simple preview materials

Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.

When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.

The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.

Note that the geometry subsets are not yet time-sampled, so it will
break when an animated mesh changes topology.

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_hierarchy_iterator.h
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_mesh.h

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.h 
b/source/blender/usd/intern/abstract_hierarchy_iterator.h
index 4d39778b0bd..fa5661adb3d 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.h
@@ -70,6 +70,8 @@ class AbstractHierarchyIterator {
   const WriterMap &writer_map() const;
   void release_writers();
 
+  virtual std::string get_id_name(const ID *id) const = 0;
+
  private:
   void construct_export_graph();
   void visit_object(Object *object, Object *export_parent, bool weak_export);
@@ -96,7 +98,6 @@ class AbstractHierarchyIterator {
 
   virtual void delete_object_writer(AbstractHierarchyWriter *writer) = 0;
 
-  virtual std::string get_id_name(const ID *id) const = 0;
   virtual std::string path_concatenate(const std::string &parent_path,
const std::string &child_path) const;
 };
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.h 
b/source/blender/usd/intern/usd_hierarchy_iterator.h
index c52bdec6471..7c4df467da3 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.h
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.h
@@ -28,13 +28,14 @@ class USDHierarchyIterator : public 
AbstractHierarchyIterator {
   void set_export_frame(float frame_nr);
   const pxr::UsdTimeCode &get_export_time_code() const;
 
+  virtual std::string get_id_name(const ID *const id) const override;
+
  protected:
   virtual bool should_export_object(const Object *object) const override;
 
   virtual AbstractHierarchyWriter *create_xform_writer(const HierarchyContext 
&context) override;
   virtual AbstractHierarchyWriter *create_data_writer(const HierarchyContext 
&context) override;
 
-  virtual std::string get_id_name(const ID *const id) const override;
   virtual void delete_object_writer(AbstractHierarchyWriter *writer) override;
 };
 
diff --git a/source/blender/usd/intern/usd_writer_abstract.cc 
b/source/blender/usd/intern/usd_writer_abstract.cc
index 59e3a34d6ef..86143b1d035 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -94,3 +94,33 @@ const pxr::SdfPath &USDAbstractWriter::usd_path() const
 {
   return usd_path_;
 }
+
+pxr::UsdShadeMaterial USDAbstractWriter::ensure_usd_material(Material 
*material)
+{
+  static pxr::SdfPath material_library_path("/_materials");
+
+  // Construct the material.
+  pxr::TfToken material_name(hierarchy_iterator->get_id_name(&material->id));
+  pxr::SdfPath usd_path = material_library_path.AppendChild(material_name);
+  pxr::UsdShadeMaterial usd_material = pxr::UsdShadeMaterial::Get(stage, 
usd_path);
+  if (usd_material) {
+return usd_material;
+  }
+  usd_material = pxr::UsdShadeMaterial::Define(stage, usd_path);
+
+  // Construct the shader.
+  pxr::SdfPath shader_path = 
usd_path.AppendChild(pxr::TfToken("previewShader"));
+  pxr::UsdShadeShader shader = pxr::UsdShadeShader::Define(stage, shader_path);
+  shader.CreateIdAttr(pxr::VtValue(pxr::TfToken("UsdPreviewSurface")));
+  shader.CreateInput(pxr::TfToken("diffuseColor"), 
pxr::SdfValueTypeNames->Color3f)
+  .Set(pxr::GfVec3f(material->r, material->g, material->b));
+  shader.CreateInput(pxr::TfToken("roughness"), pxr::SdfValueTypeNames->Float)
+  .Set(material->roughness);
+  shader.CreateInput(pxr::TfToken("metallic"), pxr::SdfValueTypeNames->Float)
+  .Set(material->metallic);
+
+  // Connect the shader and the material together.
+  usd_material.CreateSurfaceOutput().ConnectToSource(shader, 
pxr:

[Bf-blender-cvs] [1294eb47b30] sybren-usd: USD: Better detection of whether transforms are animated

2019-06-27 Thread Sybren A. Stüvel
Commit: 1294eb47b30555ef83f833f39cef3cf521e3541c
Author: Sybren A. Stüvel
Date:   Thu Jun 27 13:45:46 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB1294eb47b30555ef83f833f39cef3cf521e3541c

USD: Better detection of whether transforms are animated

When an object in a duplicated collection has a parent that's not in that
collection, it needs to check its entire parent chain for animatedness
(because those parents aren't going to be in the USD hierarchy for that
duplicated object).

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_transform.cc
M   source/blender/usd/intern/usd_writer_transform.h

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index dec7e78f38b..65647e93abe 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -45,67 +45,7 @@ void AbstractHierarchyIterator::release_writers()
 
 void AbstractHierarchyIterator::iterate()
 {
-  Scene *scene = DEG_get_evaluated_scene(depsgraph);
-
-  // printf("== Visiting objects:\n");
-  DEG_OBJECT_ITER_BEGIN (depsgraph,
- object,
- DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
- DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET) {
-if (object->base_flag & BASE_HOLDOUT) {
-  visit_object(object, object->parent, true);
-  continue;
-}
-
-// Non-instanced objects always have their object-parent as export-parent.
-bool weak_export = !should_export_object(object);
-visit_object(object, object->parent, weak_export);
-
-if (weak_export) {
-  // If a duplicator shouldn't be exported, its duplilist also shouldn't 
be.
-  continue;
-}
-
-// Export the duplicated objects instanced by this object.
-ListBase *lb = object_duplilist(depsgraph, scene, object);
-if (lb) {
-  DupliObject *link = nullptr;
-
-  // Construct the set of duplicated objects, so that later we can 
determine whether a parent
-  // is also duplicated itself.
-  std::set dupli_set;
-  for (link = static_cast(lb->first); link; link = 
link->next) {
-if (!should_visit_duplilink(link)) {
-  continue;
-}
-dupli_set.insert(link->ob);
-  }
-
-  Object *export_parent = nullptr;
-  for (link = static_cast(lb->first); link; link = 
link->next) {
-if (!should_visit_duplilink(link)) {
-  continue;
-}
-
-// If the dupli-object's scene parent is also instanced by this 
object, use that as the
-// export parent. Otherwise use the dupli-parent as export parent.
-ExportGraph::key_type graph_index;
-if (link->ob->parent != nullptr && dupli_set.find(link->ob->parent) != 
dupli_set.end()) {
-  export_parent = link->ob->parent;
-  graph_index = std::make_pair(export_parent, object);
-}
-else {
-  export_parent = object;
-  graph_index = std::make_pair(export_parent, nullptr);
-}
-
-visit_dupli_object(link, graph_index, object, export_parent, false);
-  }
-}
-
-free_object_duplilist(lb);
-  }
-  DEG_OBJECT_ITER_END;
+  construct_export_graph();
 
   // // For debug: print the export graph.
   // printf("== Export graph pre-prune:\n");
@@ -180,6 +120,58 @@ void AbstractHierarchyIterator::iterate()
   export_graph.clear();
 }
 
+void AbstractHierarchyIterator::construct_export_graph()
+{
+  Scene *scene = DEG_get_evaluated_scene(depsgraph);
+
+  // printf("== Visiting objects:\n");
+  DEG_OBJECT_ITER_BEGIN (depsgraph,
+ object,
+ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET) {
+if (object->base_flag & BASE_HOLDOUT) {
+  visit_object(object, object->parent, true);
+  continue;
+}
+
+// Non-instanced objects always have their object-parent as export-parent.
+bool weak_export = !should_export_object(object);
+visit_object(object, object->parent, weak_export);
+
+if (weak_export) {
+  // If a duplicator shouldn't be exported, its duplilist also shouldn't 
be.
+  continue;
+}
+
+// Export the duplicated objects instanced by this object.
+ListBase *lb = object_duplilist(depsgraph, scene, object);
+if (lb) {
+  DupliObject *link = nullptr;
+
+  // Construct the set of duplicated objects, so that later we can 
determine whether a parent
+  // is also duplicated itself.
+  std::set dupli_set;
+

[Bf-blender-cvs] [17441b327b9] functions: use one block allocator per thread instead of per block

2019-06-27 Thread Jacques Lucke
Commit: 17441b327b9b85f93fc0e00b2d6f40dbb9a682e2
Author: Jacques Lucke
Date:   Thu Jun 27 17:03:44 2019 +0200
Branches: functions
https://developer.blender.org/rB17441b327b9b85f93fc0e00b2d6f40dbb9a682e2

use one block allocator per thread instead of per block

===

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

===

diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index cd5b4937f58..3f4bbbde9af 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -285,11 +285,11 @@ BLI_NOINLINE static void 
simulate_ignoring_events(ParticleSet particles,
   }
 }
 
-BLI_NOINLINE static void step_individual_particles(BlockAllocator 
&block_allocator,
-   ParticleSet particles,
-   ArrayRef durations,
-   float end_time,
-   ParticleType &particle_type)
+BLI_NOINLINE static void step_particle_set(BlockAllocator &block_allocator,
+   ParticleSet particles,
+   ArrayRef durations,
+   float end_time,
+   ParticleType &particle_type)
 {
   SmallVector unfinished_particle_indices;
   SmallVector remaining_durations;
@@ -307,32 +307,78 @@ BLI_NOINLINE static void 
step_individual_particles(BlockAllocator &block_allocat
   simulate_ignoring_events(remaining_particles, remaining_durations, 
particle_type);
 }
 
+class BlockAllocators {
+ private:
+  ParticlesState &m_state;
+  SmallVector m_allocators;
+  SmallMap m_allocator_per_thread_id;
+  std::mutex m_access_mutex;
+
+ public:
+  BlockAllocators(ParticlesState &state) : m_state(state)
+  {
+  }
+
+  ~BlockAllocators()
+  {
+for (BlockAllocator *allocator : m_allocators) {
+  delete allocator;
+}
+  }
+
+  BlockAllocator &get_standalone_allocator()
+  {
+BlockAllocator *new_allocator = new BlockAllocator(m_state);
+m_allocators.append(new_allocator);
+return *new_allocator;
+  }
+
+  BlockAllocator &get_threadlocal_allocator(int thread_id)
+  {
+std::lock_guard lock(m_access_mutex);
+
+if (!m_allocator_per_thread_id.contains(thread_id)) {
+  BlockAllocator *new_allocator = new BlockAllocator(m_state);
+  m_allocators.append(new_allocator);
+  m_allocator_per_thread_id.add_new(thread_id, new_allocator);
+}
+return *m_allocator_per_thread_id.lookup(thread_id);
+  }
+
+  ArrayRef allocators()
+  {
+return m_allocators;
+  }
+};
+
 struct StepBlocksParallelData {
   ArrayRef blocks;
   ArrayRef all_durations;
   float end_time;
   ParticleType &particle_type;
-  ParticlesState &particles_state;
+  BlockAllocators &block_allocators;
 };
 
-BLI_NOINLINE static void step_individual_particles_cb(
-void *__restrict userdata, const int index, const ParallelRangeTLS 
*__restrict UNUSED(tls))
+BLI_NOINLINE static void step_individual_particles_cb(void *__restrict 
userdata,
+  const int index,
+  const ParallelRangeTLS 
*__restrict tls)
 {
   StepBlocksParallelData *data = (StepBlocksParallelData *)userdata;
   ParticlesBlock &block = *data->blocks[index];
 
-  BlockAllocator block_allocator(data->particles_state);
+  BlockAllocator block_allocator = 
data->block_allocators.get_threadlocal_allocator(
+  tls->thread_id);
 
   uint active_amount = block.active_amount();
   ParticleSet active_particles(block, static_number_range_ref(0, 
active_amount));
-  step_individual_particles(block_allocator,
-active_particles,
-data->all_durations.take_front(active_amount),
-data->end_time,
-data->particle_type);
+  step_particle_set(block_allocator,
+active_particles,
+data->all_durations.take_front(active_amount),
+data->end_time,
+data->particle_type);
 }
 
-BLI_NOINLINE static void step_individual_particles(ParticlesState &state,
+BLI_NOINLINE static void step_individual_particles(BlockAllocators 
&block_allocators,
ArrayRef 
blocks,
TimeSpan time_span,
ParticleType &particle_type)
@@ -348,7 +394,8 @@ BLI_NOINLINE static void 
step_individual_particles(ParticlesState &state,
   SmallVector all_durations(block_size);
   all_durations.fill(time_span.duration());
 
-  StepBlo

[Bf-blender-cvs] [c5eceb35829] master: Cleanup: EditMode: Remove uneeded shader depth bias

2019-06-27 Thread Clément Foucault
Commit: c5eceb35829560dcb7e31e0c41bf59ea4feec0c0
Author: Clément Foucault
Date:   Thu Jun 27 17:01:28 2019 +0200
Branches: master
https://developer.blender.org/rBc5eceb35829560dcb7e31e0c41bf59ea4feec0c0

Cleanup: EditMode: Remove uneeded shader depth bias

The bias is done using the DRWView now, no need to double it.

===

M   source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl

===

diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl 
b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
index fabc317cf4f..af0a47f1858 100644
--- a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
+++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl
@@ -1,7 +1,6 @@
 
 uniform float faceAlphaMod;
 uniform ivec4 dataMask = ivec4(0xFF);
-uniform float ofs;
 
 in ivec4 data;
 in vec3 pos;
@@ -23,24 +22,13 @@ void main()
   GPU_INTEL_VERTEX_SHADER_WORKAROUND
 
   vec3 world_pos = point_object_to_world(pos);
-
-#if !defined(FACE)
-  /* TODO override the ViewProjection Matrix for this case. */
-  mat4 projmat = ProjectionMatrix;
-  projmat[3][2] -= ofs;
-
-  gl_Position = projmat * (ViewMatrix * vec4(world_pos, 1.0));
-#else
-
   gl_Position = point_world_to_ndc(world_pos);
-#endif
 
   ivec4 m_data = data & dataMask;
 
 #if defined(VERT)
   finalColor = EDIT_MESH_vertex_color(m_data.y);
   gl_PointSize = sizeVertex * 2.0;
-  gl_Position.z -= 3e-5 * ((ProjectionMatrix[3][3] == 0.0) ? 1.0 : 0.0);
   /* Make selected and active vertex always on top. */
   if ((data.x & VERT_SELECTED) != 0) {
 gl_Position.z -= 1e-7;

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


[Bf-blender-cvs] [19d90c86021] master: Fix T66119: Assert editing Lattice

2019-06-27 Thread Clément Foucault
Commit: 19d90c8602193f370c8d47805c82f16d9e6c18c0
Author: Clément Foucault
Date:   Thu Jun 27 16:42:29 2019 +0200
Branches: master
https://developer.blender.org/rB19d90c8602193f370c8d47805c82f16d9e6c18c0

Fix T66119: Assert editing Lattice

===

M   source/blender/draw/modes/edit_lattice_mode.c

===

diff --git a/source/blender/draw/modes/edit_lattice_mode.c 
b/source/blender/draw/modes/edit_lattice_mode.c
index 04404058813..0fb8f555819 100644
--- a/source/blender/draw/modes/edit_lattice_mode.c
+++ b/source/blender/draw/modes/edit_lattice_mode.c
@@ -186,7 +186,7 @@ static void EDIT_LATTICE_cache_init(void *vedata)
   DRW_shgroup_state_enable(stl->g_data->wire_shgrp, DRW_STATE_CLIP_PLANES);
 }
 
-state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH;
+state = DRW_STATE_WRITE_COLOR;
 psl->vert_pass = DRW_pass_create("Lattice Verts", state);
 stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, 
psl->vert_pass);
 DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", 
G_draw.block_ubo);

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


[Bf-blender-cvs] [4b124143b10] master: ObjectMode: Fix selection points of LightGrids

2019-06-27 Thread Clément Foucault
Commit: 4b124143b1038f406d38167e892ecda64ef6db5e
Author: Clément Foucault
Date:   Thu Jun 27 16:37:34 2019 +0200
Branches: master
https://developer.blender.org/rB4b124143b1038f406d38167e892ecda64ef6db5e

ObjectMode: Fix selection points of LightGrids

===

M   source/blender/draw/modes/object_mode.c

===

diff --git a/source/blender/draw/modes/object_mode.c 
b/source/blender/draw/modes/object_mode.c
index 2fbcda11500..330b24f5e1a 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -535,7 +535,10 @@ static void OBJECT_engine_init(void *vedata)
 
 /* Lightprobes */
 sh_data->lightprobe_grid = GPU_shader_create_from_arrays({
-.vert = (const char *[]){sh_cfg_data->lib, 
datatoc_object_lightprobe_grid_vert_glsl, NULL},
+.vert = (const char *[]){sh_cfg_data->lib,
+ datatoc_common_globals_lib_glsl,
+ datatoc_object_lightprobe_grid_vert_glsl,
+ NULL},
 .frag = (const char *[]){datatoc_gpu_shader_flat_id_frag_glsl, NULL},
 .defs = (const char *[]){sh_cfg_data->def, NULL},
 });
@@ -2794,7 +2797,7 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders 
*sh_data,
   OBJECT_LightProbeEngineData *prb_data = (OBJECT_LightProbeEngineData 
*)DRW_drawdata_ensure(
   &ob->id, &draw_engine_object_type, sizeof(OBJECT_LightProbeEngineData), 
NULL, NULL);
 
-  if ((DRW_state_is_select() || do_outlines) && ((prb->flag & 
LIGHTPROBE_FLAG_SHOW_DATA) != 0)) {
+  if (DRW_state_is_select() || do_outlines) {
 int *call_id = shgroup_theme_id_to_probe_outline_counter(stl, theme_id, 
ob->base_flag);
 
 if (prb->type == LIGHTPROBE_TYPE_GRID) {
@@ -2832,6 +2835,7 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders 
*sh_data,
 
   uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * 
prb->grid_resolution_z;
   DRWShadingGroup *grp = DRW_shgroup_create(sh_data->lightprobe_grid, 
psl->lightprobes);
+  DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
   DRW_shgroup_uniform_int_copy(grp, "call_id", *call_id);
   DRW_shgroup_uniform_int(grp, "baseId", call_id, 1); /* that's correct */
   DRW_shgroup_uniform_vec3(grp, "corner", prb_data->corner, 1);
@@ -2839,10 +2843,11 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders 
*sh_data,
   DRW_shgroup_uniform_vec3(grp, "increment_y", prb_data->increment_y, 1);
   DRW_shgroup_uniform_vec3(grp, "increment_z", prb_data->increment_z, 1);
   DRW_shgroup_uniform_ivec3(grp, "grid_resolution", 
&prb->grid_resolution_x, 1);
-  DRW_shgroup_call_procedural_points(grp, NULL, cell_count);
   if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
 DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES);
   }
+  DRW_shgroup_call_procedural_points(grp, NULL, cell_count);
+  *call_id += 1;
 }
 else if (prb->type == LIGHTPROBE_TYPE_CUBE) {
   float draw_size = 1.0f;
@@ -2857,14 +2862,14 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders 
*sh_data,
* to keep the call ids correct. */
   zero_m4(probe_cube_mat);
   DRW_buffer_add_entry(buf, call_id, &draw_size, probe_cube_mat);
+  *call_id += 1;
 }
-else {
+else if (prb->flag & LIGHTPROBE_FLAG_SHOW_DATA) {
   float draw_size = 1.0f;
   DRWCallBuffer *buf = buffer_theme_id_to_probe_planar_outline_shgrp(stl, 
theme_id);
   DRW_buffer_add_entry(buf, call_id, &draw_size, ob->obmat);
+  *call_id += 1;
 }
-
-*call_id += 1;
   }
 
   switch (prb->type) {

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


[Bf-blender-cvs] [c74ccf6a970] master: DRW: Fix point shaders not using gl_PointSize

2019-06-27 Thread Clément Foucault
Commit: c74ccf6a97098a53b36dab86092da1d47f5edbf9
Author: Clément Foucault
Date:   Thu Jun 27 15:08:17 2019 +0200
Branches: master
https://developer.blender.org/rBc74ccf6a97098a53b36dab86092da1d47f5edbf9

DRW: Fix point shaders not using gl_PointSize

All Shaders inside DRW should use gl_PointSize.

===

M   source/blender/draw/modes/shaders/paint_wire_vert.glsl

===

diff --git a/source/blender/draw/modes/shaders/paint_wire_vert.glsl 
b/source/blender/draw/modes/shaders/paint_wire_vert.glsl
index 10bf8729f47..371c3120811 100644
--- a/source/blender/draw/modes/shaders/paint_wire_vert.glsl
+++ b/source/blender/draw/modes/shaders/paint_wire_vert.glsl
@@ -42,6 +42,7 @@ void main()
 #endif
 
   finalColor.a = nor.w;
+  gl_PointSize = sizeVertex * 2.0;
 
 #ifdef USE_WORLD_CLIP_PLANES
   world_clip_planes_calc_clip_distance(world_pos);

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


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

2019-06-27 Thread Antonioya
Commit: 56bc8e929a7d5fccf8caec49d2e0889187b9d9f3
Author: Antonioya
Date:   Thu Jun 27 16:44:09 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB56bc8e929a7d5fccf8caec49d2e0889187b9d9f3

Merge branch 'master' into greasepencil-object

 Conflicts:
source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===



===

diff --cc source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index c270480e4dd,18950f00823..65c1ba89dda
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@@ -129,19 -129,12 +129,19 @@@ static void gpencil_vbo_ensure_size(Gpe
}
  }
  
 +static void gpencil_elem_format_ensure(GpencilBatchCacheElem *be)
 +{
 +  if (be->format == NULL) {
 +be->format = MEM_callocN(sizeof(GPUVertFormat), __func__);
 +  }
 +}
 +
  /* create batch geometry data for points stroke shader */
- void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be,
- bGPDstroke *gps,
- short thickness,
- const float ink[4],
- const int alignment_mode)
+ void gpencil_get_point_geom(GpencilBatchCacheElem *be,
+ bGPDstroke *gps,
+ short thickness,
+ const float ink[4],
+ const int alignment_mode)
  {
int totvertex = gps->totpoints;
if (be->vbo == NULL) {
diff --cc source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 0af3fcd19fe,fa706812715..de2b799a683
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@@ -82,8 -86,9 +82,8 @@@ static void gpencil_calc_vertex(GPENCIL
 (bool)((draw_ctx->v3d->flag2 & V3D_HIDE_OVERLAYS) 
== 0) :
 true;
const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) 
&& overlay &&
- main_onion && DRW_gpencil_onion_active(gpd) && 
!playing;
+ main_onion && gpencil_onion_active(gpd) && !playing;
  
 -  const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
  
cache_ob->tot_vertex = 0;
@@@ -1041,8 -1069,9 +1041,8 @@@ static void gpencil_draw_strokes(Gpenci
  
  /* be sure recalc all cache in source stroke to avoid recalculation when 
frame change
   * and improve fps */
- DRW_gpencil_recalc_geometry_caches(
 -if (src_gps) {
 -  gpencil_recalc_geometry_caches(ob, gpl, gp_style, src_gps);
 -}
++gpencil_recalc_geometry_caches(
 +ob, gpl, gp_style, (gps->runtime.gps_orig) ? gps->runtime.gps_orig : 
gps);
  
  /* if the fill has any value, it's considered a fill and is not drawn if 
simplify fill is
   * enabled */
@@@ -1315,9 -1356,28 +1315,9 @@@ static void gpencil_draw_onionskins(Gpe
}
  }
  
 -static void gpencil_copy_frame(bGPDframe *gpf, bGPDframe *derived_gpf)
 -{
 -  derived_gpf->prev = gpf->prev;
 -  derived_gpf->next = gpf->next;
 -  derived_gpf->framenum = gpf->framenum;
 -  derived_gpf->flag = gpf->flag;
 -  derived_gpf->key_type = gpf->key_type;
 -  derived_gpf->runtime = gpf->runtime;
 -  copy_m4_m4(derived_gpf->runtime.parent_obmat, gpf->runtime.parent_obmat);
 -
 -  /* copy strokes */
 -  BLI_listbase_clear(&derived_gpf->strokes);
 -  for (bGPDstroke *gps_src = gpf->strokes.first; gps_src; gps_src = 
gps_src->next) {
 -/* make copy of source stroke */
 -bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps_src);
 -BLI_addtail(&derived_gpf->strokes, gps_dst);
 -  }
 -}
 -
  /* Triangulate stroke for high quality fill (this is done only if cache is 
null or stroke was
   * modified) */
- void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
+ void gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
  {
BLI_assert(gps->totpoints >= 3);
  
@@@ -1851,11 -1914,33 +1852,11 @@@ void gpencil_populate_multiedit(GPENCIL
cache->is_dirty = false;
  }
  
 -/* ensure there is a derived frame */
 -static void gpencil_ensure_derived_frame(bGPdata *gpd,
 - bGPDlayer *gpl,
 - bGPDframe *gpf,
 - GpencilBatchCache *cache,
 - bGPDframe **derived_gpf)
 -{
 -  /* create derived frames array data or expand */
 -  int derived_idx = BLI_findindex(&gpd->layers, gpl);
 -  *derived_gpf = &cache->derived_array[derived_idx];
 -
 -  /* if no derived frame or dirty cache, create a new one */
 -  if ((*derived_gpf == NULL) || (cache->is_dirty)) {
 -if (*derived_gpf != NULL) {
 -  /* first clear t

[Bf-blender-cvs] [58996e3057f] master: Cleanup: GPencil remove DRW_ prefix for internal functions.

2019-06-27 Thread Antonioya
Commit: 58996e3057f9a2a6ce4a87a0b36b8fcfafcb8967
Author: Antonioya
Date:   Thu Jun 27 16:42:18 2019 +0200
Branches: master
https://developer.blender.org/rB58996e3057f9a2a6ce4a87a0b36b8fcfafcb8967

Cleanup: GPencil remove DRW_ prefix for internal functions.

The prefix DRW_ must be used only for modules inside Draw Manager and not in 
the Engines.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/gpencil/gpencil_engine.h
M   source/blender/draw/engines/gpencil/gpencil_render.c
M   source/blender/draw/engines/gpencil/gpencil_shader_fx.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 7b2c0ed168e..18950f00823 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -130,11 +130,11 @@ static void gpencil_vbo_ensure_size(GpencilBatchCacheElem 
*be, int totvertex)
 }
 
 /* create batch geometry data for points stroke shader */
-void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be,
-bGPDstroke *gps,
-short thickness,
-const float ink[4],
-const int alignment_mode)
+void gpencil_get_point_geom(GpencilBatchCacheElem *be,
+bGPDstroke *gps,
+short thickness,
+const float ink[4],
+const int alignment_mode)
 {
   int totvertex = gps->totpoints;
   if (be->vbo == NULL) {
@@ -211,10 +211,10 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be,
 }
 
 /* create batch geometry data for stroke shader */
-void DRW_gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be,
- bGPDstroke *gps,
- short thickness,
- const float ink[4])
+void gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be,
+ bGPDstroke *gps,
+ short thickness,
+ const float ink[4])
 {
   bGPDspoint *points = gps->points;
   int totpoints = gps->totpoints;
@@ -319,17 +319,17 @@ void DRW_gpencil_get_stroke_geom(struct 
GpencilBatchCacheElem *be,
 }
 
 /* create batch geometry data for stroke shader */
-void DRW_gpencil_get_fill_geom(struct GpencilBatchCacheElem *be,
-   Object *ob,
-   bGPDstroke *gps,
-   const float color[4])
+void gpencil_get_fill_geom(struct GpencilBatchCacheElem *be,
+   Object *ob,
+   bGPDstroke *gps,
+   const float color[4])
 {
   BLI_assert(gps->totpoints >= 3);
 
   /* Calculate triangles cache for filling area (must be done only after 
changes) */
   if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 0) ||
   (gps->triangles == NULL)) {
-DRW_gpencil_triangulate_stroke_fill(ob, gps);
+gpencil_triangulate_stroke_fill(ob, gps);
   }
 
   BLI_assert(gps->tot_triangles >= 1);
@@ -365,7 +365,7 @@ void DRW_gpencil_get_fill_geom(struct GpencilBatchCacheElem 
*be,
 }
 
 /* create batch geometry data for current buffer stroke shader */
-GPUBatch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
+GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   Scene *scene = draw_ctx->scene;
@@ -467,7 +467,7 @@ GPUBatch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, 
short thickness)
 }
 
 /* create batch geometry data for current buffer point shader */
-GPUBatch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
+GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   Scene *scene = draw_ctx->scene;
@@ -550,7 +550,7 @@ GPUBatch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, 
short thickness)
 }
 
 /* create batch geometry data for current buffer control point shader */
-GPUBatch *DRW_gpencil_get_buffer_ctrlpoint_geom(bGPdata *gpd)
+GPUBatch *gpencil_get_buffer_ctrlpoint_geom(bGPdata *gpd)
 {
   bGPDcontrolpoint *cps = gpd->runtime.cp_points;
   int totpoints = gpd->runtime.tot_cp_points;
@@ -614,7 +614,7 @@ GPUBatch *DRW_gpencil_get_buffer_ctrlpoint_geom(bGPdata 
*gpd)
 }
 
 /* create batch geometry data for current buffer fill shader */
-GPUBatch *DRW_gpencil_get_buffer_fill_geom(bGPdata *gpd)
+GPUBatch *gpencil_get_buffer_fill_geom

[Bf-blender-cvs] [700c2c823ac] functions: keep track of newly allocated blocks

2019-06-27 Thread Jacques Lucke
Commit: 700c2c823ac7da8a53f56f3e6d2a6951bd4d05cf
Author: Jacques Lucke
Date:   Thu Jun 27 16:21:29 2019 +0200
Branches: functions
https://developer.blender.org/rB700c2c823ac7da8a53f56f3e6d2a6951bd4d05cf

keep track of newly allocated blocks

===

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 848f0dcb3c3..0ff727bc4a6 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -45,20 +45,21 @@ ParticlesBlock &BlockAllocator::get_non_full_block(uint 
particle_type_id)
   ParticlesContainer &container = m_state.particle_container(particle_type_id);
 
   uint index = 0;
-  while (index < m_block_cache.size()) {
-if (m_block_cache[index]->inactive_amount() == 0) {
-  m_block_cache.remove_and_reorder(index);
+  while (index < m_non_full_cache.size()) {
+if (m_non_full_cache[index]->inactive_amount() == 0) {
+  m_non_full_cache.remove_and_reorder(index);
   continue;
 }
 
-if (m_block_cache[index]->container() == container) {
-  return *m_block_cache[index];
+if (m_non_full_cache[index]->container() == container) {
+  return *m_non_full_cache[index];
 }
 index++;
   }
 
   ParticlesBlock &block = container.new_block();
-  m_block_cache.append(&block);
+  m_non_full_cache.append(&block);
+  m_allocated_blocks.append(&block);
   return block;
 }
 
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index b1d3ff15452..2e784ae9cc6 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -56,7 +56,8 @@ class ParticlesState {
 class BlockAllocator {
  private:
   ParticlesState &m_state;
-  SmallVector m_block_cache;
+  SmallVector m_non_full_cache;
+  SmallVector m_allocated_blocks;
 
  public:
   BlockAllocator(ParticlesState &state);
@@ -67,6 +68,11 @@ class BlockAllocator {
   {
 return m_state;
   }
+
+  ArrayRef allocated_blocks()
+  {
+return m_allocated_blocks;
+  }
 };
 
 class EmitTarget {

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


[Bf-blender-cvs] [91e00bd7032] master: Fix compositor preview not respecting un-keyed changes

2019-06-27 Thread Sergey Sharybin
Commit: 91e00bd7032ef5e7f7b94a415fd732fc35dff6d7
Author: Sergey Sharybin
Date:   Thu Jun 27 16:21:18 2019 +0200
Branches: master
https://developer.blender.org/rB91e00bd7032ef5e7f7b94a415fd732fc35dff6d7

Fix compositor preview not respecting un-keyed changes

This is a part of T66099.

===

M   source/blender/editors/space_node/node_edit.c

===

diff --git a/source/blender/editors/space_node/node_edit.c 
b/source/blender/editors/space_node/node_edit.c
index d57bfbdc1eb..a5755ae43c6 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -207,7 +207,10 @@ static void compo_initjob(void *cjv)
   cj->compositor_depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
   DEG_graph_build_for_compositor_preview(
   cj->compositor_depsgraph, bmain, scene, view_layer, cj->ntree);
-  DEG_evaluate_on_framechange(bmain, cj->compositor_depsgraph, CFRA);
+
+  /* NOTE: Don't update animation to preserve unkeyed changes, this means can 
not use
+   * evaluate_on_framechange. */
+  DEG_evaluate_on_refresh(cj->compositor_depsgraph);
 
   bNodeTree *ntree_eval = (bNodeTree 
*)DEG_get_evaluated_id(cj->compositor_depsgraph,
 &cj->ntree->id);

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


[Bf-blender-cvs] [ccfb98511b5] master: GPencil: Fix Control points of primitives clampoed by Stencil

2019-06-27 Thread Antonioya
Commit: ccfb98511b5032394d12880d6ebd91d39707f51a
Author: Antonioya
Date:   Thu Jun 27 16:05:42 2019 +0200
Branches: master
https://developer.blender.org/rBccfb98511b5032394d12880d6ebd91d39707f51a

GPencil: Fix Control points of primitives clampoed by Stencil

The control points were clamped to the stroke thickness due the last stencil 
change.

Now, the shading group is not clamped.

===

M   source/blender/draw/engines/gpencil/gpencil_draw_utils.c

===

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 7df28bb9730..b41085868d1 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1596,7 +1596,8 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data,
 DRWShadingGroup *shgrp = DRW_shgroup_create(e_data->gpencil_edit_point_sh, 
psl->drawing_pass);
 const float *viewport_size = DRW_viewport_size_get();
 DRW_shgroup_uniform_vec2(shgrp, "Viewport", viewport_size, 1);
-
+/* Disable stencil for this type */
+DRW_shgroup_state_disable(shgrp, DRW_STATE_WRITE_STENCIL | 
DRW_STATE_STENCIL_NEQUAL);
 stl->g_data->batch_buffer_ctrlpoint = 
DRW_gpencil_get_buffer_ctrlpoint_geom(gpd);
 
 DRW_shgroup_call(shgrp, stl->g_data->batch_buffer_ctrlpoint, NULL);

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


[Bf-blender-cvs] [ab136cb1888] functions: size-value constructor for SmallVector

2019-06-27 Thread Jacques Lucke
Commit: ab136cb18889392d111dee788eb1707a80b942d9
Author: Jacques Lucke
Date:   Thu Jun 27 13:59:18 2019 +0200
Branches: functions
https://developer.blender.org/rBab136cb18889392d111dee788eb1707a80b942d9

size-value constructor for SmallVector

===

M   source/blender/blenlib/BLI_small_vector.hpp
M   tests/gtests/blenlib/BLI_small_vector_test.cc

===

diff --git a/source/blender/blenlib/BLI_small_vector.hpp 
b/source/blender/blenlib/BLI_small_vector.hpp
index 19d15e7670d..4823b1dfb1a 100644
--- a/source/blender/blenlib/BLI_small_vector.hpp
+++ b/source/blender/blenlib/BLI_small_vector.hpp
@@ -77,6 +77,16 @@ template class SmallVector {
 m_size = size;
   }
 
+  /**
+   * Create a vector filled with a specific value.
+   */
+  SmallVector(uint size, const T &value) : SmallVector()
+  {
+this->reserve(size);
+std::fill_n(m_elements, size, value);
+m_size = size;
+  }
+
   /**
* Create a vector from an initializer list.
*/
diff --git a/tests/gtests/blenlib/BLI_small_vector_test.cc 
b/tests/gtests/blenlib/BLI_small_vector_test.cc
index 5cb0d23461e..c38597128ec 100644
--- a/tests/gtests/blenlib/BLI_small_vector_test.cc
+++ b/tests/gtests/blenlib/BLI_small_vector_test.cc
@@ -18,6 +18,16 @@ TEST(small_vector, SizeConstructor)
   EXPECT_EQ(vec[2], 0);
 }
 
+TEST(small_vector, SizeValueConstructor)
+{
+  IntVector vec(4, 10);
+  EXPECT_EQ(vec.size(), 4);
+  EXPECT_EQ(vec[0], 10);
+  EXPECT_EQ(vec[1], 10);
+  EXPECT_EQ(vec[2], 10);
+  EXPECT_EQ(vec[3], 10);
+}
+
 TEST(small_vector, InitializerListConstructor)
 {
   IntVector vec = {1, 3, 4, 6};

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


[Bf-blender-cvs] [42d70c81522] functions: emitter decides at which time individual particles are spawned

2019-06-27 Thread Jacques Lucke
Commit: 42d70c8152261b6dd36fa57dbdda25ea83ebfe79
Author: Jacques Lucke
Date:   Thu Jun 27 14:29:26 2019 +0200
Branches: functions
https://developer.blender.org/rB42d70c8152261b6dd36fa57dbdda25ea83ebfe79

emitter decides at which time individual particles are spawned

===

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/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index 590010fd9e8..b9e67a81f85 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -104,9 +104,9 @@ void EmitTarget::set_elements(uint index, void *data)
 
   void *remaining_data = data;
 
-  for (uint i = 0; i < m_ranges.size(); i++) {
-ParticlesBlock &block = *m_blocks[i];
-Range range = m_ranges[i];
+  for (uint part = 0; part < m_ranges.size(); part++) {
+ParticlesBlock &block = *m_blocks[part];
+Range range = m_ranges[part];
 
 AttributeArrays attributes = block.slice(range);
 void *dst = attributes.get_ptr(index);
@@ -117,6 +117,21 @@ void EmitTarget::set_elements(uint index, void *data)
   }
 }
 
+void EmitTarget::fill_elements(uint index, void *value)
+{
+  AttributeType type = m_attributes_info.type_of(index);
+  uint element_size = size_of_attribute_type(type);
+
+  for (uint part = 0; part < m_ranges.size(); part++) {
+ParticlesBlock &block = *m_blocks[part];
+
+void *dst = block.slice_all().get_ptr(index);
+for (uint i : m_ranges[part]) {
+  memcpy(POINTER_OFFSET(dst, element_size * i), value, element_size);
+}
+  }
+}
+
 void EmitTarget::set_byte(uint index, ArrayRef data)
 {
   BLI_assert(data.size() == m_size);
@@ -152,4 +167,37 @@ void EmitTarget::set_float3(StringRef name, 
ArrayRef data)
   this->set_float3(index, data);
 }
 
+void EmitTarget::fill_byte(uint index, uint8_t value)
+{
+  this->fill_elements(index, (void *)&value);
+}
+
+void EmitTarget::fill_byte(StringRef name, uint8_t value)
+{
+  uint index = m_attributes_info.attribute_index(name);
+  this->fill_byte(index, value);
+}
+
+void EmitTarget::fill_float(uint index, float value)
+{
+  this->fill_elements(index, (void *)&value);
+}
+
+void EmitTarget::fill_float(StringRef name, float value)
+{
+  uint index = m_attributes_info.attribute_index(name);
+  this->fill_float(index, value);
+}
+
+void EmitTarget::fill_float3(uint index, float3 value)
+{
+  this->fill_elements(index, (void *)&value);
+}
+
+void EmitTarget::fill_float3(StringRef name, float3 value)
+{
+  uint index = m_attributes_info.attribute_index(name);
+  this->fill_float3(index, value);
+}
+
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 7ddced9956d..e3071f4547f 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -89,6 +89,13 @@ class EmitTarget {
   void set_float3(uint index, ArrayRef data);
   void set_float3(StringRef name, ArrayRef data);
 
+  void fill_byte(uint index, uint8_t value);
+  void fill_byte(StringRef name, uint8_t value);
+  void fill_float(uint index, float value);
+  void fill_float(StringRef name, float value);
+  void fill_float3(uint index, float3 value);
+  void fill_float3(StringRef name, float3 value);
+
   ArrayRef blocks()
   {
 return m_blocks;
@@ -116,6 +123,7 @@ class EmitTarget {
 
  private:
   void set_elements(uint index, void *data);
+  void fill_elements(uint index, void *value);
 };
 
 class EmitterInterface {
diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index 73cdafb52b4..34a788be04d 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -25,6 +25,7 @@ class PointEmitter : public Emitter {
 auto attributes = interface.request(0, 1);
 attributes.set_float3("Position", {m_point});
 attributes.set_float3("Velocity", {float3{-1, -1, 0}});
+attributes.fill_float("Birth Factor", 1.0f);
   }
 };
 
@@ -72,6 +73,7 @@ class SurfaceEmitter : public Emitter {
 auto target = interface.request(m_particle_type_id, positions.size());
 target.set_float3("Position", positions);
 target.set_float3("Velocity", velocities);
+target.fill_float("Birth Factor", 1.0f);
   }
 };
 
@@ -103,6 +105,7 @@ class PathEmitter : public Emitter {
 auto target = interface.request(0, positions.size());
 target.set_float3("Position", positions);
 target.set_float3("Velocity", SmallVector(positions.size()));
+target.fill_float("Birth Factor", 1.0f);
   }
 };
 
diff --git a/sourc

[Bf-blender-cvs] [878028d385c] functions: make it easier for emitters to specify birth moments

2019-06-27 Thread Jacques Lucke
Commit: 878028d385cb8ec44d80af2882964777cc3d0423
Author: Jacques Lucke
Date:   Thu Jun 27 15:07:39 2019 +0200
Branches: functions
https://developer.blender.org/rB878028d385cb8ec44d80af2882964777cc3d0423

make it easier for emitters to specify birth moments

===

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/simulate.cpp

===

diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index b9e67a81f85..3ca4f9c22fd 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -62,9 +62,16 @@ ParticlesBlock &BlockAllocator::get_non_full_block(uint 
particle_type_id)
   return block;
 }
 
-/* EmitterInterface
+/* Emitter Interface
  **/
 
+EmitterInterface::~EmitterInterface()
+{
+  for (EmitTarget *target : m_targets) {
+delete target;
+  }
+}
+
 EmitTarget &EmitterInterface::request(uint particle_type_id, uint size)
 {
   SmallVector blocks;
@@ -90,8 +97,8 @@ EmitTarget &EmitterInterface::request(uint particle_type_id, 
uint size)
   }
 
   ParticlesContainer &container = m_state.particle_container(particle_type_id);
-  m_targets.append(EmitTarget(particle_type_id, container.attributes_info(), 
blocks, ranges));
-  return m_targets.last();
+  m_targets.append(new EmitTarget(particle_type_id, 
container.attributes_info(), blocks, ranges));
+  return *m_targets.last();
 }
 
 /* EmitTarget
@@ -200,4 +207,17 @@ void EmitTarget::fill_float3(StringRef name, float3 value)
   this->fill_float3(index, value);
 }
 
+void EmitTarget::set_birth_moment(float time_factor)
+{
+  BLI_assert(time_factor >= 0.0 && time_factor <= 1.0f);
+  m_birth_moments.fill(time_factor);
+}
+
+void EmitTarget::set_randomized_birth_moments()
+{
+  for (float &birth_moment : m_birth_moments) {
+birth_moment = (rand() % 1) / 1.0f;
+  }
+}
+
 }  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index e3071f4547f..945b49ec42d 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -64,6 +64,7 @@ class EmitTarget {
   AttributesInfo &m_attributes_info;
   SmallVector m_blocks;
   SmallVector> m_ranges;
+  SmallVector m_birth_moments;
   uint m_size = 0;
 
  public:
@@ -80,8 +81,11 @@ class EmitTarget {
 for (auto range : ranges) {
   m_size += range.size();
 }
+m_birth_moments = SmallVector(m_size, 1.0f);
   }
 
+  EmitTarget(EmitTarget &other) = delete;
+
   void set_byte(uint index, ArrayRef data);
   void set_byte(StringRef name, ArrayRef data);
   void set_float(uint index, ArrayRef data);
@@ -96,6 +100,9 @@ class EmitTarget {
   void fill_float3(uint index, float3 value);
   void fill_float3(StringRef name, float3 value);
 
+  void set_birth_moment(float time_factor);
+  void set_randomized_birth_moments();
+
   ArrayRef blocks()
   {
 return m_blocks;
@@ -106,6 +113,11 @@ class EmitTarget {
 return m_ranges;
   }
 
+  ArrayRef birth_moments()
+  {
+return m_birth_moments;
+  }
+
   uint part_amount()
   {
 return m_ranges.size();
@@ -130,7 +142,7 @@ class EmitterInterface {
  private:
   ParticlesState &m_state;
   BlockAllocator &m_allocator;
-  SmallVector m_targets;
+  SmallVector m_targets;
 
  public:
   EmitterInterface(ParticlesState &state, BlockAllocator &allocator)
@@ -138,7 +150,9 @@ class EmitterInterface {
   {
   }
 
-  ArrayRef targets()
+  ~EmitterInterface();
+
+  ArrayRef targets()
   {
 return m_targets;
   }
diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index 34a788be04d..aaeeb225b04 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -22,10 +22,10 @@ class PointEmitter : public Emitter {
 
   void emit(EmitterInterface &interface) override
   {
-auto attributes = interface.request(0, 1);
-attributes.set_float3("Position", {m_point});
-attributes.set_float3("Velocity", {float3{-1, -1, 0}});
-attributes.fill_float("Birth Factor", 1.0f);
+EmitTarget &target = interface.request(0, 1);
+target.set_float3("Position", {m_point});
+target.set_float3("Velocity", {float3{-1, -1, 0}});
+target.set_birth_moment(1.0f);
   }
 };
 
@@ -70,10 +70,10 @@ class SurfaceEmitter : public Emitter {
   velocities.append(m_transform.transform_direction(normal * 
m_normal_velocity));
 }
 
-auto target = interface.request(m_particle_type_id, positions.size());
+EmitTarget &target = interface.request(m_particle_type_id, 
positions.s

[Bf-blender-cvs] [551ae21bff3] functions: use block allocator to allow muliple emitters to emit into the same block

2019-06-27 Thread Jacques Lucke
Commit: 551ae21bff3fcfdec1e30f9d5cabf350498ed119
Author: Jacques Lucke
Date:   Thu Jun 27 13:25:01 2019 +0200
Branches: functions
https://developer.blender.org/rB551ae21bff3fcfdec1e30f9d5cabf350498ed119

use block allocator to allow muliple emitters to emit into the same block

===

M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
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/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index 67ad13ded1b..0bda6770598 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -33,19 +33,46 @@ ParticlesState::~ParticlesState()
   }
 }
 
-/* EmitterInterface
+/* Block Allocator
  **/
 
-EmitTarget &EmitterInterface::request(uint particle_type_id, uint size)
+BlockAllocator::BlockAllocator(ParticlesState &state) : m_state(state)
+{
+}
+
+ParticlesBlock &BlockAllocator::get_non_full_block(uint particle_type_id)
 {
   ParticlesContainer &container = m_state.particle_container(particle_type_id);
 
+  uint index = 0;
+  while (index < m_block_cache.size()) {
+if (m_block_cache[index]->inactive_amount() == 0) {
+  m_block_cache.remove_and_reorder(index);
+  continue;
+}
+
+if (m_block_cache[index]->container() == container) {
+  return *m_block_cache[index];
+}
+index++;
+  }
+
+  ParticlesBlock &block = container.new_block();
+  m_block_cache.append(&block);
+  return block;
+}
+
+/* EmitterInterface
+ **/
+
+EmitTarget &EmitterInterface::request(uint particle_type_id, uint size)
+{
   SmallVector blocks;
   SmallVector> ranges;
 
   uint remaining_size = size;
   while (remaining_size > 0) {
-ParticlesBlock &block = *container.new_block();
+ParticlesBlock &block = m_allocator.get_non_full_block(particle_type_id);
 
 uint size_to_use = std::min(block.size(), remaining_size);
 block.active_amount() += size_to_use;
@@ -56,6 +83,7 @@ EmitTarget &EmitterInterface::request(uint particle_type_id, 
uint size)
 remaining_size -= size_to_use;
   }
 
+  ParticlesContainer &container = m_state.particle_container(particle_type_id);
   m_targets.append(EmitTarget(particle_type_id, container.attributes_info(), 
blocks, ranges));
   return m_targets.last();
 }
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index c86192c023c..7ddced9956d 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -47,6 +47,17 @@ class ParticlesState {
   }
 };
 
+class BlockAllocator {
+ private:
+  ParticlesState &m_state;
+  SmallVector m_block_cache;
+
+ public:
+  BlockAllocator(ParticlesState &state);
+
+  ParticlesBlock &get_non_full_block(uint particle_type_id);
+};
+
 class EmitTarget {
  private:
   uint m_particle_type_id;
@@ -110,10 +121,12 @@ class EmitTarget {
 class EmitterInterface {
  private:
   ParticlesState &m_state;
+  BlockAllocator &m_allocator;
   SmallVector m_targets;
 
  public:
-  EmitterInterface(ParticlesState &state) : m_state(state)
+  EmitterInterface(ParticlesState &state, BlockAllocator &allocator)
+  : m_state(state), m_allocator(allocator)
   {
   }
 
diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index b1f7bf1119c..ab4d586f4e4 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -17,29 +17,28 @@ ParticlesContainer::~ParticlesContainer()
   while (m_blocks.size() > 0) {
 ParticlesBlock *block = m_blocks.any();
 block->clear();
-this->release_block(block);
+this->release_block(*block);
   }
 }
 
-ParticlesBlock *ParticlesContainer::new_block()
+ParticlesBlock &ParticlesContainer::new_block()
 {
   AttributeArraysCore attributes_core = 
AttributeArraysCore::NewWithSeparateAllocations(
   m_attributes_info, m_block_size);
   ParticlesBlock *block = new ParticlesBlock(*this, attributes_core);
   m_blocks.add_new(block);
-  return block;
+  return *block;
 }
 
-void ParticlesContainer::release_block(ParticlesBlock *block)
+void ParticlesContainer::release_block(ParticlesBlock &block)
 {
-  BLI_assert(block);
-  BLI_assert(block->active_amount() == 0);
-  BLI_assert(m_blocks.contains(block));
-  BLI_assert(&block->container() == this);
-
-  block->attributes_core().free_buffers();
-  m_blocks.remove(block);
-  delete block;
+  BLI_assert(block.active_amount() == 0);
+  

[Bf-blender-cvs] [e858f2e9fff] functions: thread safe block creation and deletion

2019-06-27 Thread Jacques Lucke
Commit: e858f2e9fff19d6325533e08ebf1068cbcea48ec
Author: Jacques Lucke
Date:   Thu Jun 27 13:27:52 2019 +0200
Branches: functions
https://developer.blender.org/rBe858f2e9fff19d6325533e08ebf1068cbcea48ec

thread safe block creation and deletion

===

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

===

diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index ab4d586f4e4..990709c4992 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -23,6 +23,8 @@ ParticlesContainer::~ParticlesContainer()
 
 ParticlesBlock &ParticlesContainer::new_block()
 {
+  std::lock_guard lock(m_blocks_mutex);
+
   AttributeArraysCore attributes_core = 
AttributeArraysCore::NewWithSeparateAllocations(
   m_attributes_info, m_block_size);
   ParticlesBlock *block = new ParticlesBlock(*this, attributes_core);
@@ -32,6 +34,8 @@ ParticlesBlock &ParticlesContainer::new_block()
 
 void ParticlesContainer::release_block(ParticlesBlock &block)
 {
+  std::lock_guard lock(m_blocks_mutex);
+
   BLI_assert(block.active_amount() == 0);
   BLI_assert(m_blocks.contains(&block));
   BLI_assert(&block.container() == this);
diff --git a/source/blender/simulations/bparticles/particles_container.hpp 
b/source/blender/simulations/bparticles/particles_container.hpp
index 86cfea31727..817ed18741c 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include 
+
 #include "BLI_array_ref.hpp"
 #include "BLI_small_vector.hpp"
 #include "BLI_small_set_vector.hpp"
@@ -27,6 +29,7 @@ class ParticlesContainer {
   AttributesInfo m_attributes_info;
   SmallSet m_blocks;
   uint m_block_size;
+  std::mutex m_blocks_mutex;
 
  public:
   ParticlesContainer(AttributesInfo attributes, uint block_size);

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


[Bf-blender-cvs] [f2ed497129b] functions: initialize attributes with default values

2019-06-27 Thread Jacques Lucke
Commit: f2ed497129bea76eeb03f3e15c54acb1136621eb
Author: Jacques Lucke
Date:   Thu Jun 27 13:46:03 2019 +0200
Branches: functions
https://developer.blender.org/rBf2ed497129bea76eeb03f3e15c54acb1136621eb

initialize attributes with default values

===

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

===

diff --git a/source/blender/simulations/bparticles/attributes.hpp 
b/source/blender/simulations/bparticles/attributes.hpp
index a953a6ab31f..2e21b1ca729 100644
--- a/source/blender/simulations/bparticles/attributes.hpp
+++ b/source/blender/simulations/bparticles/attributes.hpp
@@ -170,6 +170,9 @@ class AttributeArrays {
 
   void *get_ptr(uint index) const;
 
+  void init_default(uint index);
+  void init_default(StringRef name);
+
   ArrayRef get_byte(uint index) const;
   ArrayRef get_byte(StringRef name);
   ArrayRef get_float(uint index) const;
@@ -246,6 +249,23 @@ inline void *AttributeArrays::get_ptr(uint index) const
   return POINTER_OFFSET(ptr, m_start * size);
 }
 
+inline void AttributeArrays::init_default(uint index)
+{
+  void *default_value = m_core.info().default_value_ptr(index);
+  void *dst = this->get_ptr(index);
+  AttributeType type = m_core.get_type(index);
+  uint element_size = size_of_attribute_type(type);
+
+  for (uint i = 0; i < m_size; i++) {
+memcpy(POINTER_OFFSET(dst, element_size * i), default_value, element_size);
+  }
+}
+
+inline void AttributeArrays::init_default(StringRef name)
+{
+  this->init_default(this->attribute_index(name));
+}
+
 inline ArrayRef AttributeArrays::get_byte(uint index) const
 {
   BLI_assert(m_core.get_type(index) == AttributeType::Byte);
diff --git a/source/blender/simulations/bparticles/core.cpp 
b/source/blender/simulations/bparticles/core.cpp
index 0bda6770598..590010fd9e8 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -74,11 +74,17 @@ EmitTarget &EmitterInterface::request(uint 
particle_type_id, uint size)
   while (remaining_size > 0) {
 ParticlesBlock &block = m_allocator.get_non_full_block(particle_type_id);
 
-uint size_to_use = std::min(block.size(), remaining_size);
+uint size_to_use = std::min(block.inactive_amount(), remaining_size);
+Range range(block.active_amount(), block.active_amount() + 
size_to_use);
 block.active_amount() += size_to_use;
 
 blocks.append(&block);
-ranges.append(Range(0, size_to_use));
+ranges.append(range);
+
+AttributeArrays attributes = block.slice(range);
+for (uint i : attributes.info().attribute_indices()) {
+  attributes.init_default(i);
+}
 
 remaining_size -= size_to_use;
   }
diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index 990709c4992..50b78b51506 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -82,6 +82,13 @@ void ParticlesContainer::update_attributes(AttributesInfo 
new_info)
 }
   }
 
+  SmallVector indices_to_allocate;
+  for (uint i = 0; i < new_to_old_mapping.size(); i++) {
+if (new_to_old_mapping[i] == -1) {
+  indices_to_allocate.append(i);
+}
+  }
+
   m_attributes_info = new_info;
 
   SmallVector arrays;
@@ -94,13 +101,7 @@ void ParticlesContainer::update_attributes(AttributesInfo 
new_info)
   AttributeType type = new_info.type_of(new_index);
 
   if (old_index == -1) {
-void *array = MEM_malloc_arrayN(m_block_size, 
size_of_attribute_type(type), __func__);
-uint value_size = size_of_attribute_type(type);
-void *default_ptr = new_info.default_value_ptr(new_index);
-for (uint i = 0; i < m_block_size; i++) {
-  memcpy(POINTER_OFFSET(array, i * value_size), default_ptr, 
value_size);
-}
-arrays.append(array);
+arrays.append(MEM_malloc_arrayN(m_block_size, 
size_of_attribute_type(type), __func__));
   }
   else {
 arrays.append(block->attributes_core().get_ptr((uint)old_index));
@@ -113,6 +114,10 @@ void ParticlesContainer::update_attributes(AttributesInfo 
new_info)
 }
 
 block->m_attributes_core = AttributeArraysCore(m_attributes_info, arrays, 
m_block_size);
+
+for (uint new_index : indices_to_allocate) {
+  block->m_attributes_core.slice_all().init_default(new_index);
+}
   }
 }

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


[Bf-blender-cvs] [58253b535fa] functions: make Block Allocator part of action interface

2019-06-27 Thread Jacques Lucke
Commit: 58253b535fa3545ae2839e61c9d9f58283407ba6
Author: Jacques Lucke
Date:   Thu Jun 27 15:41:25 2019 +0200
Branches: functions
https://developer.blender.org/rB58253b535fa3545ae2839e61c9d9f58283407ba6

make Block Allocator part of action interface

===

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 0e57a356b8a..b1d3ff15452 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -47,6 +47,12 @@ class ParticlesState {
   }
 };
 
+/**
+ * This class allows allocating new blocks from different particle containers.
+ * A single instance is not thread safe, but multiple allocator instances can
+ * be used by multiple threads at the same time.
+ * It might hand out the same block more than once until it is full.
+ */
 class BlockAllocator {
  private:
   ParticlesState &m_state;
@@ -290,10 +296,17 @@ class Event {
 class ActionInterface {
  private:
   ParticleSet m_particles;
+  BlockAllocator &m_block_allocator;
 
  public:
-  ActionInterface(ParticleSet particles) : m_particles(particles)
+  ActionInterface(ParticleSet particles, BlockAllocator &block_allocator)
+  : m_particles(particles), m_block_allocator(block_allocator)
+  {
+  }
+
+  BlockAllocator &block_allocator()
   {
+return m_block_allocator;
   }
 
   ParticleSet &particles()
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index e3624a37179..cd5b4937f58 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -118,7 +118,8 @@ BLI_NOINLINE static void find_unfinished_particles(
   }
 }
 
-BLI_NOINLINE static void run_actions(ParticlesBlock &block,
+BLI_NOINLINE static void run_actions(BlockAllocator &block_allocator,
+ ParticlesBlock &block,
  ArrayRef> 
particles_per_event,
  ArrayRef events,
  ArrayRef action_per_event)
@@ -127,7 +128,7 @@ BLI_NOINLINE static void run_actions(ParticlesBlock &block,
 Action *action = action_per_event[event_index];
 ParticleSet particles(block, particles_per_event[event_index]);
 
-ActionInterface interface(particles);
+ActionInterface interface(particles, block_allocator);
 action->execute(interface);
   }
 }
@@ -175,7 +176,8 @@ BLI_NOINLINE static void 
compute_ideal_attribute_offsets(ParticleSet particles,
   }
 }
 
-BLI_NOINLINE static void simulate_to_next_event(ParticleSet particles,
+BLI_NOINLINE static void simulate_to_next_event(BlockAllocator 
&block_allocator,
+ParticleSet particles,
 ArrayRef durations,
 float end_time,
 ParticleType &particle_type,
@@ -205,7 +207,8 @@ BLI_NOINLINE static void simulate_to_next_event(ParticleSet 
particles,
 
   SmallVector> 
particles_per_event(particle_type.events().size());
   find_particles_per_event(particles.indices(), next_event_indices, 
particles_per_event);
-  run_actions(particles.block(),
+  run_actions(block_allocator,
+  particles.block(),
   particles_per_event,
   particle_type.events(),
   particle_type.action_per_event());
@@ -221,6 +224,7 @@ BLI_NOINLINE static void simulate_to_next_event(ParticleSet 
particles,
 
 BLI_NOINLINE static void simulate_with_max_n_events(
 uint max_events,
+BlockAllocator &block_allocator,
 ParticleSet particles,
 ArrayRef durations,
 float end_time,
@@ -236,7 +240,8 @@ BLI_NOINLINE static void simulate_with_max_n_events(
 r_remaining_durations.clear();
 
 ParticleSet particles_to_simulate(particles.block(), 
remaining_particle_indices);
-simulate_to_next_event(particles_to_simulate,
+simulate_to_next_event(block_allocator,
+   particles_to_simulate,
durations,
end_time,
particle_type,
@@ -280,7 +285,8 @@ BLI_NOINLINE static void 
simulate_ignoring_events(ParticleSet particles,
   }
 }
 
-BLI_NOINLINE static void step_individual_particles(ParticleSet particles,
+BLI_NOINLINE static void step_individual_particles(BlockAllocator 
&block_allocator,
+   ParticleSet particles,
ArrayRef durations,
float end_time,
   

[Bf-blender-cvs] [8349161f141] functions: refactor emitter interface internals

2019-06-27 Thread Jacques Lucke
Commit: 8349161f1417594784d4f74b98a513fbeee1ba41
Author: Jacques Lucke
Date:   Thu Jun 27 12:36:47 2019 +0200
Branches: functions
https://developer.blender.org/rB8349161f1417594784d4f74b98a513fbeee1ba41

refactor emitter interface internals

The problem previously was that all the information about which
blocks contain the attributes was not accessible by the emitter.

===

M   source/blender/modifiers/intern/MOD_nodeparticles.c
M   source/blender/simulations/bparticles/attributes.cpp
M   source/blender/simulations/bparticles/attributes.hpp
M   source/blender/simulations/bparticles/core.cpp
M   source/blender/simulations/bparticles/core.hpp
M   source/blender/simulations/bparticles/particles_container.hpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git a/source/blender/modifiers/intern/MOD_nodeparticles.c 
b/source/blender/modifiers/intern/MOD_nodeparticles.c
index 2e98f865a90..d616dc5b57a 100644
--- a/source/blender/modifiers/intern/MOD_nodeparticles.c
+++ b/source/blender/modifiers/intern/MOD_nodeparticles.c
@@ -179,7 +179,7 @@ static Mesh *applyModifier(ModifierData *md,
 runtime->last_simulated_frame = current_frame;
   }
 
-  return BParticles_test_mesh_from_state(runtime->state);
+  return point_mesh_from_particle_state(runtime->state);
 }
 
 static void initData(ModifierData *md)
diff --git a/source/blender/simulations/bparticles/attributes.cpp 
b/source/blender/simulations/bparticles/attributes.cpp
index 7d9ff3e0c24..d5b0cfd1358 100644
--- a/source/blender/simulations/bparticles/attributes.cpp
+++ b/source/blender/simulations/bparticles/attributes.cpp
@@ -52,55 +52,4 @@ void AttributeArraysCore::free_buffers()
   }
 }
 
-void JoinedAttributeArrays::set_elements(uint index, void *data)
-{
-  AttributeType type = m_info.type_of(index);
-  uint element_size = size_of_attribute_type(type);
-
-  void *remaining_data = data;
-
-  for (auto arrays : m_arrays) {
-void *target = arrays.get_ptr(index);
-uint bytes_to_copy = element_size * arrays.size();
-memcpy(target, remaining_data, bytes_to_copy);
-
-remaining_data = POINTER_OFFSET(remaining_data, bytes_to_copy);
-  }
-}
-
-void JoinedAttributeArrays::set_byte(uint index, ArrayRef data)
-{
-  BLI_assert(data.size() == m_size);
-  BLI_assert(m_info.type_of(index) == AttributeType::Byte);
-  this->set_elements(index, (void *)data.begin());
-}
-void JoinedAttributeArrays::set_float(uint index, ArrayRef data)
-{
-  BLI_assert(data.size() == m_size);
-  BLI_assert(m_info.type_of(index) == AttributeType::Float);
-  this->set_elements(index, (void *)data.begin());
-}
-void JoinedAttributeArrays::set_float3(uint index, ArrayRef data)
-{
-  BLI_assert(data.size() == m_size);
-  BLI_assert(m_info.type_of(index) == AttributeType::Float3);
-  this->set_elements(index, (void *)data.begin());
-}
-
-void JoinedAttributeArrays::set_byte(StringRef name, ArrayRef data)
-{
-  uint index = m_info.attribute_index(name);
-  this->set_byte(index, data);
-}
-void JoinedAttributeArrays::set_float(StringRef name, ArrayRef data)
-{
-  uint index = m_info.attribute_index(name);
-  this->set_float(index, data);
-}
-void JoinedAttributeArrays::set_float3(StringRef name, ArrayRef data)
-{
-  uint index = m_info.attribute_index(name);
-  this->set_float3(index, data);
-}
-
 };  // namespace BParticles
diff --git a/source/blender/simulations/bparticles/attributes.hpp 
b/source/blender/simulations/bparticles/attributes.hpp
index 4876232807b..a953a6ab31f 100644
--- a/source/blender/simulations/bparticles/attributes.hpp
+++ b/source/blender/simulations/bparticles/attributes.hpp
@@ -181,31 +181,6 @@ class AttributeArrays {
   AttributeArrays take_front(uint n) const;
 };
 
-class JoinedAttributeArrays {
- private:
-  AttributesInfo &m_info;
-  SmallVector m_arrays;
-  uint m_size;
-
- public:
-  JoinedAttributeArrays(AttributesInfo &info, ArrayRef 
arrays_list);
-
-  AttributesInfo &info();
-
-  uint size() const;
-  ArrayRef arrays_list();
-
-  void set_byte(uint index, ArrayRef data);
-  void set_byte(StringRef name, ArrayRef data);
-  void set_float(uint index, ArrayRef data);
-  void set_float(StringRef name, ArrayRef data);
-  void set_float3(uint index, ArrayRef data);
-  void set_float3(StringRef name, ArrayRef data);
-
- private:
-  void set_elements(uint index, void *data);
-};
-
 /* Attribute Arrays Core
  */
 
@@ -315,33 +290,4 @@ inline AttributeArrays AttributeArrays::take_front(uint n) 
const
   return AttributeArrays(m_core, m_start, n);
 }
 
-/* Joined Attribute Arrays
- **/
-
-inline JoinedAttributeArrays::JoinedAttributeArrays(AttributesInfo &info,
-ArrayRef 
arrays_list)
-: m_info(info), m_arrays(arrays_list.to_small_vector())
-{
-  m_size = 0

[Bf-blender-cvs] [dd55ac91281] functions: cleanup: remove unnecessary state parameter

2019-06-27 Thread Jacques Lucke
Commit: dd55ac91281470cac147f80e01402fe41ace9d2e
Author: Jacques Lucke
Date:   Thu Jun 27 15:30:56 2019 +0200
Branches: functions
https://developer.blender.org/rBdd55ac91281470cac147f80e01402fe41ace9d2e

cleanup: remove unnecessary state parameter

===

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 3ca4f9c22fd..848f0dcb3c3 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -79,7 +79,7 @@ EmitTarget &EmitterInterface::request(uint particle_type_id, 
uint size)
 
   uint remaining_size = size;
   while (remaining_size > 0) {
-ParticlesBlock &block = m_allocator.get_non_full_block(particle_type_id);
+ParticlesBlock &block = 
m_block_allocator.get_non_full_block(particle_type_id);
 
 uint size_to_use = std::min(block.inactive_amount(), remaining_size);
 Range range(block.active_amount(), block.active_amount() + 
size_to_use);
@@ -96,7 +96,8 @@ EmitTarget &EmitterInterface::request(uint particle_type_id, 
uint size)
 remaining_size -= size_to_use;
   }
 
-  ParticlesContainer &container = m_state.particle_container(particle_type_id);
+  ParticlesContainer &container = 
m_block_allocator.particles_state().particle_container(
+  particle_type_id);
   m_targets.append(new EmitTarget(particle_type_id, 
container.attributes_info(), blocks, ranges));
   return *m_targets.last();
 }
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 945b49ec42d..0e57a356b8a 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -56,6 +56,11 @@ class BlockAllocator {
   BlockAllocator(ParticlesState &state);
 
   ParticlesBlock &get_non_full_block(uint particle_type_id);
+
+  ParticlesState &particles_state()
+  {
+return m_state;
+  }
 };
 
 class EmitTarget {
@@ -140,13 +145,11 @@ class EmitTarget {
 
 class EmitterInterface {
  private:
-  ParticlesState &m_state;
-  BlockAllocator &m_allocator;
+  BlockAllocator &m_block_allocator;
   SmallVector m_targets;
 
  public:
-  EmitterInterface(ParticlesState &state, BlockAllocator &allocator)
-  : m_state(state), m_allocator(allocator)
+  EmitterInterface(BlockAllocator &allocator) : m_block_allocator(allocator)
   {
   }
 
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 94190642264..e3624a37179 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -372,12 +372,11 @@ BLI_NOINLINE static void 
delete_tagged_particles(ArrayRef bloc
  **/
 
 BLI_NOINLINE static void emit_new_particles_from_emitter(StepDescription 
&description,
- ParticlesState &state,
  BlockAllocator 
&block_allocator,
  TimeSpan time_span,
  Emitter &emitter)
 {
-  EmitterInterface interface(state, block_allocator);
+  EmitterInterface interface(block_allocator);
   emitter.emit(interface);
 
   for (EmitTarget *target_ptr : interface.targets()) {
@@ -483,7 +482,7 @@ void simulate_step(ParticlesState &state, StepDescription 
&description)
 
   BlockAllocator block_allocator(state);
   for (Emitter *emitter : description.emitters()) {
-emit_new_particles_from_emitter(description, state, block_allocator, 
time_span, *emitter);
+emit_new_particles_from_emitter(description, block_allocator, time_span, 
*emitter);
   }
 
   for (uint type_id : description.particle_type_ids()) {

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


[Bf-blender-cvs] [2fa66f6f966] functions: move function from header to cpp

2019-06-27 Thread Jacques Lucke
Commit: 2fa66f6f966b5dc7d79f9fbea55f39813d48909d
Author: Jacques Lucke
Date:   Thu Jun 27 12:40:33 2019 +0200
Branches: functions
https://developer.blender.org/rB2fa66f6f966b5dc7d79f9fbea55f39813d48909d

move function from header to cpp

===

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 6bee750a1ae..67ad13ded1b 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -33,6 +33,33 @@ ParticlesState::~ParticlesState()
   }
 }
 
+/* EmitterInterface
+ **/
+
+EmitTarget &EmitterInterface::request(uint particle_type_id, uint size)
+{
+  ParticlesContainer &container = m_state.particle_container(particle_type_id);
+
+  SmallVector blocks;
+  SmallVector> ranges;
+
+  uint remaining_size = size;
+  while (remaining_size > 0) {
+ParticlesBlock &block = *container.new_block();
+
+uint size_to_use = std::min(block.size(), remaining_size);
+block.active_amount() += size_to_use;
+
+blocks.append(&block);
+ranges.append(Range(0, size_to_use));
+
+remaining_size -= size_to_use;
+  }
+
+  m_targets.append(EmitTarget(particle_type_id, container.attributes_info(), 
blocks, ranges));
+  return m_targets.last();
+}
+
 /* EmitTarget
  **/
 
diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 9e2980a580f..c86192c023c 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -122,29 +122,7 @@ class EmitterInterface {
 return m_targets;
   }
 
-  EmitTarget &request(uint particle_type_id, uint size)
-  {
-ParticlesContainer &container = 
m_state.particle_container(particle_type_id);
-
-SmallVector blocks;
-SmallVector> ranges;
-
-uint remaining_size = size;
-while (remaining_size > 0) {
-  ParticlesBlock &block = *container.new_block();
-
-  uint size_to_use = std::min(block.size(), remaining_size);
-  block.active_amount() += size_to_use;
-
-  blocks.append(&block);
-  ranges.append(Range(0, size_to_use));
-
-  remaining_size -= size_to_use;
-}
-
-m_targets.append(EmitTarget(particle_type_id, container.attributes_info(), 
blocks, ranges));
-return m_targets.last();
-  }
+  EmitTarget &request(uint particle_type_id, uint size);
 };
 
 struct ParticleSet {

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


[Bf-blender-cvs] [938bd0edc45] functions: ParticleSet should know the block it is in

2019-06-27 Thread Jacques Lucke
Commit: 938bd0edc45dc34d4a39abca7e6515194d9dc964
Author: Jacques Lucke
Date:   Thu Jun 27 11:13:48 2019 +0200
Branches: functions
https://developer.blender.org/rB938bd0edc45dc34d4a39abca7e6515194d9dc964

ParticleSet should know the block it is in

===

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 d60af1f87c2..88c50215926 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -27,7 +27,7 @@ using std::unique_ptr;
 
 struct ParticleSet {
  private:
-  AttributeArrays m_attributes;
+  ParticlesBlock &m_block;
 
   /* Indices into the attribute arrays.
* Invariants:
@@ -36,14 +36,19 @@ struct ParticleSet {
   ArrayRef m_particle_indices;
 
  public:
-  ParticleSet(AttributeArrays attributes, ArrayRef particle_indices)
-  : m_attributes(attributes), m_particle_indices(particle_indices)
+  ParticleSet(ParticlesBlock &block, ArrayRef particle_indices)
+  : m_block(block), m_particle_indices(particle_indices)
   {
   }
 
+  ParticlesBlock &block()
+  {
+return m_block;
+  }
+
   AttributeArrays attributes()
   {
-return m_attributes;
+return m_block.slice_all();
   }
 
   ArrayRef indices()
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 3ce7a3a47e7..2a93ce01fdd 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -110,14 +110,14 @@ BLI_NOINLINE static void find_unfinished_particles(
   }
 }
 
-BLI_NOINLINE static void run_actions(AttributeArrays attributes,
+BLI_NOINLINE static void run_actions(ParticlesBlock &block,
  ArrayRef> 
particles_per_event,
  ArrayRef events,
  ArrayRef action_per_event)
 {
   for (uint event_index = 0; event_index < events.size(); event_index++) {
 Action *action = action_per_event[event_index];
-ParticleSet particles(attributes, particles_per_event[event_index]);
+ParticleSet particles(block, particles_per_event[event_index]);
 
 ActionInterface interface(particles);
 action->execute(interface);
@@ -197,7 +197,7 @@ BLI_NOINLINE static void simulate_to_next_event(ParticleSet 
particles,
 
   SmallVector> 
particles_per_event(particle_type.events().size());
   find_particles_per_event(particles.indices(), next_event_indices, 
particles_per_event);
-  run_actions(particles.attributes(),
+  run_actions(particles.block(),
   particles_per_event,
   particle_type.events(),
   particle_type.action_per_event());
@@ -227,7 +227,7 @@ BLI_NOINLINE static void simulate_with_max_n_events(
 r_unfinished_particle_indices.clear();
 r_remaining_durations.clear();
 
-ParticleSet particles_to_simulate(particles.attributes(), 
remaining_particle_indices);
+ParticleSet particles_to_simulate(particles.block(), 
remaining_particle_indices);
 simulate_to_next_event(particles_to_simulate,
durations,
end_time,
@@ -288,7 +288,7 @@ BLI_NOINLINE static void 
step_individual_particles(ParticleSet particles,
  unfinished_particle_indices,
  remaining_durations);
 
-  ParticleSet remaining_particles(particles.attributes(), 
unfinished_particle_indices);
+  ParticleSet remaining_particles(particles.block(), 
unfinished_particle_indices);
   simulate_ignoring_events(remaining_particles, remaining_durations, 
particle_type);
 }
 
@@ -303,11 +303,10 @@ BLI_NOINLINE static void step_individual_particles_cb(
 void *__restrict userdata, const int index, const ParallelRangeTLS 
*__restrict UNUSED(tls))
 {
   StepBlocksParallelData *data = (StepBlocksParallelData *)userdata;
-  ParticlesBlock *block = data->blocks[index];
+  ParticlesBlock &block = *data->blocks[index];
 
-  uint active_amount = block->active_amount();
-  ParticleSet active_particles(block->slice_active(),
-   
static_number_range_ref().take_front(active_amount));
+  uint active_amount = block.active_amount();
+  ParticleSet active_particles(block, 
static_number_range_ref().take_front(active_amount));
   step_individual_particles(active_particles,
 data->all_durations.take_front(active_amount),
 data->end_time,
@@ -388,7 +387,7 @@ BLI_NOINLINE static void 
emit_new_particles_from_emitter(StepDescription &descri
 
   for (uint i = 0; i < targets.size(); i++) {
 EmitterTarget &target = targets[i];
-ParticlesBlock *block = blocks[i];
+

[Bf-blender-cvs] [db8c116f5c6] functions: remove request_raw function from public emitter interface

2019-06-27 Thread Jacques Lucke
Commit: db8c116f5c6b91020d69f5cc4154b9dc29076bbe
Author: Jacques Lucke
Date:   Thu Jun 27 11:21:59 2019 +0200
Branches: functions
https://developer.blender.org/rBdb8c116f5c6b91020d69f5cc4154b9dc29076bbe

remove request_raw function from public emitter interface

===

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

===

diff --git a/source/blender/simulations/bparticles/core.hpp 
b/source/blender/simulations/bparticles/core.hpp
index 88c50215926..3317a78ea0c 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -209,11 +209,6 @@ class EmitterInterface {
  private:
   RequestEmitterTarget &m_request_target;
 
- public:
-  EmitterInterface(RequestEmitterTarget &request_target) : 
m_request_target(request_target)
-  {
-  }
-
   EmitterTarget &request_raw(uint particle_type_id)
   {
 EmitterTarget &target = m_request_target(particle_type_id);
@@ -221,6 +216,11 @@ class EmitterInterface {
 return target;
   }
 
+ public:
+  EmitterInterface(RequestEmitterTarget &request_target) : 
m_request_target(request_target)
+  {
+  }
+
   JoinedAttributeArrays request(uint particle_type_id, uint size)
   {
 SmallVector arrays_list;
diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index 948db9c4a35..73cdafb52b4 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -22,13 +22,9 @@ class PointEmitter : public Emitter {
 
   void emit(EmitterInterface &interface) override
   {
-auto &target = interface.request_raw(0);
-auto positions = target.attributes().get_float3("Position");
-auto velocities = target.attributes().get_float3("Velocity");
-
-positions[0] = m_point;
-velocities[0] = float3{-1, -1, 0};
-target.set_initialized(1);
+auto attributes = interface.request(0, 1);
+attributes.set_float3("Position", {m_point});
+attributes.set_float3("Velocity", {float3{-1, -1, 0}});
   }
 };

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


[Bf-blender-cvs] [658aa007189] master: Build environment: Update OpenSubdiv to 3.4.0 RC 2

2019-06-27 Thread Sergey Sharybin
Commit: 658aa007189c68bc4edad223fd8303c37d34dda9
Author: Sergey Sharybin
Date:   Thu Jun 27 15:13:18 2019 +0200
Branches: master
https://developer.blender.org/rB658aa007189c68bc4edad223fd8303c37d34dda9

Build environment: Update OpenSubdiv to 3.4.0 RC 2

Newer OpenSubdiv brings fixes and improvements for non-manifold meshes,
which fixes some crashes we've experienced in the recent past when using
Gregory patches.

Additionally, thing new version of OpenSubdiv brings sparse patches,
which allows to multi-thread topology refinement step.

===

M   build_files/build_environment/cmake/opensubdiv.cmake
M   build_files/build_environment/cmake/versions.cmake
D   build_files/build_environment/patches/opensubdiv.diff

===

diff --git a/build_files/build_environment/cmake/opensubdiv.cmake 
b/build_files/build_environment/cmake/opensubdiv.cmake
index a5cf4efd128..b81170c72b7 100644
--- a/build_files/build_environment/cmake/opensubdiv.cmake
+++ b/build_files/build_environment/cmake/opensubdiv.cmake
@@ -70,7 +70,6 @@ ExternalProject_Add(external_opensubdiv
   DOWNLOAD_DIR ${DOWNLOAD_DIR}
   URL_HASH MD5=${OPENSUBDIV_Hash}
   PREFIX ${BUILD_DIR}/opensubdiv
-  PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d 
${BUILD_DIR}/opensubdiv/src/external_opensubdiv < ${PATCH_DIR}/opensubdiv.diff
   CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opensubdiv -Wno-dev 
${DEFAULT_CMAKE_FLAGS} ${OPENSUBDIV_EXTRA_ARGS}
   INSTALL_DIR ${LIBDIR}/opensubdiv
 )
diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index 886dd3a8577..609a8926d2b 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -105,8 +105,8 @@ set(CUEW_GIT_UID 1744972026de9cf27c8a7dc39cf39cd83d5f922f)
 set(CUEW_URI https://github.com/CudaWrangler/cuew/archive/${CUEW_GIT_UID}.zip)
 set(CUEW_HASH 86760d62978ebfd96cd93f5aa1abaf4a)
 
-set(OPENSUBDIV_VERSION v3_3_3)
-set(OPENSUBDIV_Hash 29c79dc01ef616aab02670bed5544ddd)
+set(OPENSUBDIV_VERSION v3_4_0_RC2)
+set(OPENSUBDIV_Hash f6a10ba9efaa82fde86fe65aad346319)
 set(OPENSUBDIV_URI 
https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
 
 set(SDL_VERSION 2.0.8)
diff --git a/build_files/build_environment/patches/opensubdiv.diff 
b/build_files/build_environment/patches/opensubdiv.diff
deleted file mode 100644
index 3fc78bf3c18..000
--- a/build_files/build_environment/patches/opensubdiv.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/opensubdiv/far/topologyRefiner.cpp 
b/opensubdiv/far/topologyRefiner.cpp
-index 3754b36e..7fe42bcc 100644
 a/opensubdiv/far/topologyRefiner.cpp
-+++ b/opensubdiv/far/topologyRefiner.cpp
-@@ -263,7 +263,7 @@ namespace internal {
- bool IsEmpty() const { return *((int_type*)this) == 0; }
- 
- FeatureMask() { Clear(); }
--FeatureMask(Options const & options, Sdc::SchemeType sType) { 
InitializeFeatures(options, sType); }
-+FeatureMask(Options const & options, Sdc::SchemeType sType) { 
Clear(); InitializeFeatures(options, sType); }
- 
- //  These are the two primary methods intended for use -- 
intialization via a set of Options
- //  and reduction of the subsequent feature set (which presumes prior 
initialization with the
\ No newline at end of file

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


[Bf-blender-cvs] [34d36447cf0] soc-2019-cycles-procedural: Merge remote-tracking branch 'origin' into soc-2019-cycles-procedural

2019-06-27 Thread OmarSquircleArt
Commit: 34d36447cf0e88dce0c8e4426f0f477d60551fb7
Author: OmarSquircleArt
Date:   Thu Jun 27 15:28:37 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB34d36447cf0e88dce0c8e4426f0f477d60551fb7

Merge remote-tracking branch 'origin' into soc-2019-cycles-procedural

===



===



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


[Bf-blender-cvs] [869b0021529] soc-2019-cycles-procedural: Use Blender's comments convention

2019-06-27 Thread OmarSquircleArt
Commit: 869b0021529d398df9265e23acc571f01c06444e
Author: OmarSquircleArt
Date:   Thu Jun 27 15:27:57 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB869b0021529d398df9265e23acc571f01c06444e

Use Blender's comments convention

===

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

===

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 7b8ae3af201..8917c3977a6 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -3115,19 +3115,22 @@ void node_tex_magic(
 
 /*  Perlin Noise  */
 
-// The following functions compute 1D, 2D, 3D, and 4D perlin noise.
-// The code is based on the OSL noise code for compatibility.
-// See oslnoise.h
-
-// Bilinear Interpolation:
-//
-// v2  v3
-//  @ + + + + @   y
-//  + +   ^
-//  + +   |
-//  + +   |
-//  @ + + + + @   @--> x
-// v0  v1
+/* The following functions compute 1D, 2D, 3D, and 4D perlin noise.
+ * The code is based on the OSL noise code for compatibility.
+ * See oslnoise.h
+ */
+
+/* Bilinear Interpolation:
+ *
+ * v2  v3
+ *  @ + + + + @   y
+ *  + +   ^
+ *  + +   |
+ *  + +   |
+ *  @ + + + + @   @--> x
+ * v0  v1
+ *
+ */
 
 float bi_mix(float v0, float v1, float v2, float v3, float x, float y)
 {
@@ -3135,23 +3138,24 @@ float bi_mix(float v0, float v1, float v2, float v3, 
float x, float y)
   return (1.0 - y) * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x);
 }
 
-// Trilinear Interpolation:
-//
-//  v6   v7
-//@ + + + + + + @
-//+\+\
-//+ \   + \
-//+  \  +  \
-//+   \ v4  +   \ v5
-//+@ + + + +++ + @  z
-//++++  y   ^
-// v2 @ + +++ + + + @ v3 +   \  |
-// \   + \   +\ |
-//  \  +  \  + \|
-//   \ +   \ +  +-> x
-//\+\+
-// @ + + + + + + @
-//   v0   v1
+/* Trilinear Interpolation:
+ *
+ *   v6   v7
+ * @ + + + + + + @
+ * +\+\
+ * + \   + \
+ * +  \  +  \
+ * +   \ v4  +   \ v5
+ * +@ + + + +++ + @  z
+ * ++++  y   ^
+ *  v2 @ + +++ + + + @ v3 +   \  |
+ *  \   + \   +\ |
+ *   \  +  \  + \|
+ *\ +   \ +  +-> x
+ * \+\+
+ *  @ + + + + + + @
+ *v0   v1
+ */
 
 float tri_mix(float v0,
   float v1,
@@ -3172,17 +3176,19 @@ float tri_mix(float v0,
  z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));
 }
 
-// An alternative to Hermite interpolation that have zero first and
-// second derivatives at t = 0 and t = 1.
-// Described in Ken Perlin's "Improving noise" [2002].
+/* An alternative to Hermite interpolation that have zero first and
+ * second derivatives at t = 0 and t = 1.
+ * Described in Ken Perlin's "Improving noise" [2002].
+ */
 
 float noise_fade(float t)
 {
   return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
 }
 
-// Remap the output of noise to a predictable range [-1, 1].
-// The values were computed experimentally by the OSL developers.
+/* Remap the output of noise to a predictable range [-1, 1].
+ * The values were computed experimentally by the OSL developers.
+ */
 
 float noise_scale1(float result)
 {
@@ -3209,8 +3215,9 @@ float negate_if(float val, uint condition)
   return (condition != 0u) ? -val : val;
 }
 
-// Compute the dot product with a randomly choose vector from a list of
-// predetermined vectors based on a hash value.
+/* Compute the dot product with a randomly choose vector from a list of
+ * predetermined vectors based on a hash value.
+ */
 
 float noise_grad(uint hash, float x)
 {
@@ -3391,8 +3398,9 @@ float snoise(vec4 p)
   return noise_perlin(p);
 }
 
-// The following 4 functions are exactly the same but with different input 
type.
-// When refactoring, simply copy the function body to the rest of the 
functions.
+/* The following 4 functions are exactly the same but with different input 
type.
+ * When refactoring, simply copy the function body to the rest of the 
functions.
+ */
 
 float noise_turbulence(float p, float octaves)
 {
@@ -3502,8 +3510,9 @@ float noise_turbulence(vec4 p, float octaves)
   }
 }
 
-// To compute the color output of the noise, we either swizzle the
-// components, add a random offset {75, 125, 150}, or do both.
+/* To compute the color output of the noise, we either swizzle the
+ * components, add a random offset {75, 125, 150}, or do both.
+ */
 
 void node_tex_noise_1d(
 vec3 co,

[Bf-blender-cvs] [931da132330] soc-2019-cycles-procedural: Add 1D, 2D, and 4D noise to EEVEE

2019-06-27 Thread OmarSquircleArt
Commit: 931da132330eb95d519aaf6708ae3d62acc5fafc
Author: OmarSquircleArt
Date:   Thu Jun 27 15:10:36 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB931da132330eb95d519aaf6708ae3d62acc5fafc

Add 1D, 2D, and 4D noise to EEVEE

===

M   source/blender/editors/space_node/drawnode.c
M   source/blender/gpu/shaders/gpu_shader_material.glsl
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/shader/nodes/node_shader_tex_noise.c

===

diff --git a/source/blender/editors/space_node/drawnode.c 
b/source/blender/editors/space_node/drawnode.c
index 3ab27a37857..8bac4317b09 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -915,6 +915,11 @@ static void node_shader_buts_tex_voronoi(uiLayout *layout, 
bContext *UNUSED(C),
   }
 }
 
+static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), 
PointerRNA *ptr)
+{
+  uiItemR(layout, ptr, "dimensions", 0, "", ICON_NONE);
+}
+
 static void node_shader_buts_tex_pointdensity(uiLayout *layout,
   bContext *UNUSED(C),
   PointerRNA *ptr)
@@ -1231,6 +1236,9 @@ static void node_shader_set_butfunc(bNodeType *ntype)
 case SH_NODE_TEX_VORONOI:
   ntype->draw_buttons = node_shader_buts_tex_voronoi;
   break;
+case SH_NODE_TEX_NOISE:
+  ntype->draw_buttons = node_shader_buts_tex_noise;
+  break;
 case SH_NODE_TEX_POINTDENSITY:
   ntype->draw_buttons = node_shader_buts_tex_pointdensity;
   break;
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl 
b/source/blender/gpu/shaders/gpu_shader_material.glsl
index de1eec6ffef..7b8ae3af201 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1389,6 +1389,26 @@ uint hash(uint kx, uint ky, uint kz, uint kw)
 #undef final
 #undef mix
 
+uint hash(int kx)
+{
+  return hash(uint(kx));
+}
+
+uint hash(int kx, int ky)
+{
+  return hash(uint(kx), uint(ky));
+}
+
+uint hash(int kx, int ky, int kz)
+{
+  return hash(uint(kx), uint(ky), uint(kz));
+}
+
+uint hash(int kx, int ky, int kz, int kw)
+{
+  return hash(uint(kx), uint(ky), uint(kz), uint(kw));
+}
+
 float bits_to_01(uint bits)
 {
   return (float(bits) / 4294967295.0);
@@ -1472,29 +1492,6 @@ void white_noise_4D(vec3 vec, float w, out float fac)
   floatBitsToUint(vec.x), floatBitsToUint(vec.y), floatBitsToUint(vec.z), 
floatBitsToUint(w)));
 }
 
-uint hash(int kx, int ky, int kz)
-{
-  return hash(uint(kx), uint(ky), uint(kz));
-}
-
-float cellnoise(vec3 p)
-{
-  int ix = quick_floor(p.x);
-  int iy = quick_floor(p.y);
-  int iz = quick_floor(p.z);
-
-  return bits_to_01(hash(uint(ix), uint(iy), uint(iz)));
-}
-
-vec3 cellnoise_color(vec3 p)
-{
-  float r = cellnoise(p.xyz);
-  float g = cellnoise(p.yxz);
-  float b = cellnoise(p.yzx);
-
-  return vec3(r, g, b);
-}
-
 float floorfrac(float x, out int i)
 {
   float x_floor = floor(x);
@@ -3116,19 +3113,118 @@ void node_tex_magic(
   fac = (color.x + color.y + color.z) / 3.0;
 }
 
+/*  Perlin Noise  */
+
+// The following functions compute 1D, 2D, 3D, and 4D perlin noise.
+// The code is based on the OSL noise code for compatibility.
+// See oslnoise.h
+
+// Bilinear Interpolation:
+//
+// v2  v3
+//  @ + + + + @   y
+//  + +   ^
+//  + +   |
+//  + +   |
+//  @ + + + + @   @--> x
+// v0  v1
+
+float bi_mix(float v0, float v1, float v2, float v3, float x, float y)
+{
+  float x1 = 1.0 - x;
+  return (1.0 - y) * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x);
+}
+
+// Trilinear Interpolation:
+//
+//  v6   v7
+//@ + + + + + + @
+//+\+\
+//+ \   + \
+//+  \  +  \
+//+   \ v4  +   \ v5
+//+@ + + + +++ + @  z
+//++++  y   ^
+// v2 @ + +++ + + + @ v3 +   \  |
+// \   + \   +\ |
+//  \  +  \  + \|
+//   \ +   \ +  +-> x
+//\+\+
+// @ + + + + + + @
+//   v0   v1
+
+float tri_mix(float v0,
+  float v1,
+  float v2,
+  float v3,
+  float v4,
+  float v5,
+  float v6,
+  float v7,
+  float x,
+  float y,
+  float z)
+{
+  float x1 = 1.0 - x;
+  float y1 = 1.0 - y;
+  float z1 = 1.0 - z;
+  return z1 * (y1 * (v0 * x1 + v1 * x) + y * (v2 * x1 + v3 * x)) +
+ z * (y1 * (v4 * x1 + v5 * x) + y * (v6 * x1 + v7 * x));
+}
+
+// An alternative to Hermite interpolation that have zero first and
+// second derivatives at t = 0 a

[Bf-blender-cvs] [2a22b8af04e] master: Eevee: Make use of dual source blending for volumetric resolve

2019-06-27 Thread Clément Foucault
Commit: 2a22b8af04eb2edccfd3d378b8e279bec54639e0
Author: Clément Foucault
Date:   Thu Jun 27 14:40:29 2019 +0200
Branches: master
https://developer.blender.org/rB2a22b8af04eb2edccfd3d378b8e279bec54639e0

Eevee: Make use of dual source blending for volumetric resolve

This simplify the code and add an example use of dual source
blending.

===

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_lib.glsl
M   source/blender/draw/engines/eevee/shaders/volumetric_resolve_frag.glsl

===

diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c 
b/source/blender/draw/engines/eevee/eevee_volumes.c
index 9162a604d7c..79a133ed7fc 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -509,11 +509,10 @@ void EEVEE_volumes_cache_finish(EEVEE_ViewLayerData 
*sldata, EEVEE_Data *vedata)
 
 DRW_shgroup_call_procedural_triangles(grp, NULL, 
common_data->vol_tex_size[2]);
 
-DRW_PASS_CREATE(psl->volumetric_resolve_ps, DRW_STATE_WRITE_COLOR);
+DRW_PASS_CREATE(psl->volumetric_resolve_ps, DRW_STATE_WRITE_COLOR | 
DRW_STATE_BLEND_CUSTOM);
 grp = DRW_shgroup_create(e_data.volumetric_resolve_sh, 
psl->volumetric_resolve_ps);
 DRW_shgroup_uniform_texture_ref(grp, "inScattering", &txl->volume_scatter);
 DRW_shgroup_uniform_texture_ref(grp, "inTransmittance", 
&txl->volume_transmit);
-DRW_shgroup_uniform_texture_ref(grp, "inSceneColor", &e_data.color_src);
 DRW_shgroup_uniform_texture_ref(grp, "inSceneDepth", &e_data.depth_src);
 DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
 
@@ -638,22 +637,13 @@ void EEVEE_volumes_resolve(EEVEE_ViewLayerData 
*UNUSED(sldata), EEVEE_Data *veda
 
   if ((effects->enabled_effects & EFFECT_VOLUMETRIC) != 0) {
 DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
-
-e_data.color_src = txl->color;
 e_data.depth_src = dtxl->depth;
 
-/* Step 4: Apply for opaque */
-GPU_framebuffer_bind(fbl->effect_color_fb);
+/* Apply for opaque geometry. */
+GPU_framebuffer_bind(fbl->main_color_fb);
 DRW_draw_pass(psl->volumetric_resolve_ps);
 
-/* Swap the buffers and rebind depth to the current buffer */
-SWAP(GPUFrameBuffer *, fbl->main_fb, fbl->effect_fb);
-SWAP(GPUFrameBuffer *, fbl->main_color_fb, fbl->effect_color_fb);
-SWAP(GPUTexture *, txl->color, txl->color_post);
-
-/* Restore */
-GPU_framebuffer_texture_detach(fbl->effect_fb, dtxl->depth);
-GPU_framebuffer_texture_attach(fbl->main_fb, dtxl->depth, 0, 0);
+/* Restore. */
 GPU_framebuffer_bind(fbl->main_fb);
   }
 }
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 c332f68728f..3a31afc0224 100644
--- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl
@@ -899,7 +899,10 @@ Closure nodetree_exec(void); /* Prototype */
 
 #if defined(USE_ALPHA_BLEND)
 /* Prototype because this file is included before volumetric_lib.glsl */
-vec4 volumetric_resolve(vec4 scene_color, vec2 frag_uvs, float frag_depth);
+void volumetric_resolve(vec2 frag_uvs,
+float frag_depth,
+out vec3 transmittance,
+out vec3 scattering);
 #endif
 
 #define NODETREE_EXEC
@@ -914,7 +917,9 @@ void main()
 #if defined(USE_ALPHA_BLEND)
   /* XXX fragile, better use real viewport resolution */
   vec2 uvs = gl_FragCoord.xy / vec2(2 * textureSize(maxzBuffer, 0).xy);
-  fragColor.rgb = volumetric_resolve(vec4(cl.radiance, cl.opacity), uvs, 
gl_FragCoord.z).rgb;
+  vec3 transmittance, scattering;
+  volumetric_resolve(uvs, gl_FragCoord.z, transmittance, scattering);
+  fragColor.rgb = cl.radiance * transmittance + scattering;
   fragColor.a = cl.opacity;
 #else
   fragColor = vec4(cl.radiance, cl.opacity);
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl 
b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl
index 580b53231a0..40eb3da42d1 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl
@@ -145,15 +145,13 @@ vec3 irradiance_volumetric(vec3 wpos)
 uniform sampler3D inScattering;
 uniform sampler3D inTransmittance;
 
-vec4 volumetric_resolve(vec4 scene_color, vec2 frag_uvs, float frag_depth)
+void volumetric_resolve(vec2 frag_uvs,
+float frag_depth,
+out vec3 transmittance,
+out vec3 scattering)
 {
   vec3 volume_cos = ndc_to_volume(vec3(frag_uvs, frag_depth));
 
-  vec3 sc

[Bf-blender-cvs] [1f4e9754c02] master: DRW: Add DRW_STATE_BLEND_CUSTOM

2019-06-27 Thread Clément Foucault
Commit: 1f4e9754c02891076ffe5c29a2d7c030aace219c
Author: Clément Foucault
Date:   Thu Jun 27 14:36:40 2019 +0200
Branches: master
https://developer.blender.org/rB1f4e9754c02891076ffe5c29a2d7c030aace219c

DRW: Add DRW_STATE_BLEND_CUSTOM

This one enable dual source blending, enabling more fine tuned
blending parameters inside the shader.

===

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

===

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 392362e73c5..a8f67e10a4d 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -347,12 +347,14 @@ typedef enum {
   DRW_STATE_BLEND_ALPHA_UNDER_PREMUL = (1 << 20),
   DRW_STATE_BLEND_OIT = (1 << 21),
   DRW_STATE_BLEND_MUL = (1 << 22),
+  /** Use dual source blending. WARNING: Only one color buffer allowed. */
+  DRW_STATE_BLEND_CUSTOM = (1 << 23),
 
-  DRW_STATE_CLIP_PLANES = (1 << 23),
-  DRW_STATE_WIRE_SMOOTH = (1 << 24),
-  DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 25),
+  DRW_STATE_CLIP_PLANES = (1 << 28),
+  DRW_STATE_WIRE_SMOOTH = (1 << 29),
+  DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 30),
   /** DO NOT USE. Assumed always enabled. Only used internally. */
-  DRW_STATE_PROGRAM_POINT_SIZE = (1 << 26),
+  DRW_STATE_PROGRAM_POINT_SIZE = (1u << 31),
 } DRWState;
 
 #define DRW_STATE_DEFAULT \
diff --git a/source/blender/draw/intern/draw_manager_exec.c 
b/source/blender/draw/intern/draw_manager_exec.c
index 2596570c022..949d3e1d38b 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -225,7 +225,7 @@ void drw_state_set(DRWState state)
 if (CHANGED_ANY_STORE_VAR(DRW_STATE_BLEND_ALPHA | 
DRW_STATE_BLEND_ALPHA_PREMUL |
   DRW_STATE_BLEND_ADD | DRW_STATE_BLEND_MUL |
   DRW_STATE_BLEND_ADD_FULL | 
DRW_STATE_BLEND_OIT |
-  DRW_STATE_BLEND_ALPHA_UNDER_PREMUL,
+  DRW_STATE_BLEND_ALPHA_UNDER_PREMUL | 
DRW_STATE_BLEND_CUSTOM,
   test)) {
   if (test) {
 glEnable(GL_BLEND);
@@ -262,6 +262,11 @@ void drw_state_set(DRWState state)
   /* Let alpha accumulate. */
   glBlendFunc(GL_ONE, GL_ONE);
 }
+else if ((state & DRW_STATE_BLEND_CUSTOM) != 0) {
+  /* Custom blend parameters using dual source blending.
+   * Can only be used with one Draw Buffer. */
+  glBlendFunc(GL_ONE, GL_SRC1_COLOR);
+}
 else {
   BLI_assert(0);
 }

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


[Bf-blender-cvs] [7f5a21177a0] master: Cleanup: de-duplicate flag checks for button colors

2019-06-27 Thread Campbell Barton
Commit: 7f5a21177a058eab33a2ba1707ef3fc965a32cd7
Author: Campbell Barton
Date:   Thu Jun 27 21:19:17 2019 +1000
Branches: master
https://developer.blender.org/rB7f5a21177a058eab33a2ba1707ef3fc965a32cd7

Cleanup: de-duplicate flag checks for button colors

===

M   source/blender/editors/interface/interface_widgets.c

===

diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index 6c9c36c0d7f..a6c8697ec2c 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2526,22 +2526,27 @@ static void widget_state(uiWidgetType *wt, int state, 
int drawflag)
 
   wt->wcol = *(wt->wcol_theme);
 
+  const char *color_blend = NULL;
+  if (drawflag & UI_BUT_ANIMATED_CHANGED) {
+color_blend = wcol_state->inner_changed_sel;
+  }
+  else if (state & UI_BUT_ANIMATED_KEY) {
+color_blend = wcol_state->inner_key_sel;
+  }
+  else if (state & UI_BUT_ANIMATED) {
+color_blend = wcol_state->inner_anim_sel;
+  }
+  else if (state & UI_BUT_DRIVEN) {
+color_blend = wcol_state->inner_driven_sel;
+  }
+  else if (state & UI_BUT_OVERRIDEN) {
+color_blend = wcol_state->inner_overridden_sel;
+  }
+
   if (state & UI_SELECT) {
 copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
-if (drawflag & UI_BUT_ANIMATED_CHANGED) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_changed_sel, 
wcol_state->blend);
-}
-else if (state & UI_BUT_ANIMATED_KEY) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, 
wcol_state->blend);
-}
-else if (state & UI_BUT_ANIMATED) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, 
wcol_state->blend);
-}
-else if (state & UI_BUT_DRIVEN) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, 
wcol_state->blend);
-}
-else if (state & UI_BUT_OVERRIDEN) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_overridden_sel, 
wcol_state->blend);
+if (color_blend != NULL) {
+  widget_state_blend(wt->wcol.inner, color_blend, wcol_state->blend);
 }
 
 copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
@@ -2551,20 +2556,8 @@ static void widget_state(uiWidgetType *wt, int state, 
int drawflag)
 }
   }
   else {
-if (drawflag & UI_BUT_ANIMATED_CHANGED) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_changed, 
wcol_state->blend);
-}
-else if (state & UI_BUT_ANIMATED_KEY) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_key, 
wcol_state->blend);
-}
-else if (state & UI_BUT_ANIMATED) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, 
wcol_state->blend);
-}
-else if (state & UI_BUT_DRIVEN) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, 
wcol_state->blend);
-}
-else if (state & UI_BUT_OVERRIDEN) {
-  widget_state_blend(wt->wcol.inner, wcol_state->inner_overridden, 
wcol_state->blend);
+if (color_blend != NULL) {
+  widget_state_blend(wt->wcol.inner, color_blend, wcol_state->blend);
 }
 
 if (state & UI_ACTIVE) { /* mouse over? */

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


[Bf-blender-cvs] [0f983e85405] master: Fix T65893: Edit Mesh Culling

2019-06-27 Thread Jeroen Bakker
Commit: 0f983e8540529025d27fd9197f3d6e95ed476d3d
Author: Jeroen Bakker
Date:   Thu Jun 27 11:55:23 2019 +0200
Branches: master
https://developer.blender.org/rB0f983e8540529025d27fd9197f3d6e95ed476d3d

Fix T65893: Edit Mesh Culling

The edit mesh is culled by object. When the object is not visible on
screen, the edit mesh may still be visible. This change will not  cull the
edit mesh anymore.

Reviewed By: fclem

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

===

M   source/blender/draw/modes/edit_mesh_mode.c

===

diff --git a/source/blender/draw/modes/edit_mesh_mode.c 
b/source/blender/draw/modes/edit_mesh_mode.c
index eca60c291fe..272aa552d38 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -667,17 +667,17 @@ static void edit_mesh_add_ob_to_pass(Scene *scene,
 
   geom_tris = DRW_mesh_batch_cache_get_edit_triangles(ob->data);
   geom_edges = DRW_mesh_batch_cache_get_edit_edges(ob->data);
-  DRW_shgroup_call(edge_shgrp, geom_edges, ob);
-  DRW_shgroup_call(face_shgrp, geom_tris, ob);
+  DRW_shgroup_call_no_cull(edge_shgrp, geom_edges, ob);
+  DRW_shgroup_call_no_cull(face_shgrp, geom_tris, ob);
 
   if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) {
 geom_verts = DRW_mesh_batch_cache_get_edit_vertices(ob->data);
-DRW_shgroup_call(vert_shgrp, geom_verts, ob);
+DRW_shgroup_call_no_cull(vert_shgrp, geom_verts, ob);
   }
 
   if (facedot_shgrp && (tsettings->selectmode & SCE_SELECT_FACE) != 0) {
 geom_fcenter = DRW_mesh_batch_cache_get_edit_facedots(ob->data);
-DRW_shgroup_call(facedot_shgrp, geom_fcenter, ob);
+DRW_shgroup_call_no_cull(facedot_shgrp, geom_fcenter, ob);
   }
 }
 
@@ -702,7 +702,7 @@ static void EDIT_MESH_cache_populate(void *vedata, Object 
*ob)
 
   if (do_show_weight) {
 geom = DRW_cache_mesh_surface_weights_get(ob);
-DRW_shgroup_call(g_data->fweights_shgrp, geom, ob);
+DRW_shgroup_call_no_cull(g_data->fweights_shgrp, geom, ob);
   }
 
   if (do_show_mesh_analysis && !XRAY_ACTIVE(v3d)) {
@@ -713,30 +713,30 @@ static void EDIT_MESH_cache_populate(void *vedata, Object 
*ob)
 if (is_original) {
   geom = DRW_cache_mesh_surface_mesh_analysis_get(ob);
   if (geom) {
-DRW_shgroup_call(g_data->mesh_analysis_shgrp, geom, ob);
+DRW_shgroup_call_no_cull(g_data->mesh_analysis_shgrp, geom, ob);
   }
 }
   }
 
   if (do_occlude_wire || do_in_front) {
 geom = DRW_cache_mesh_surface_get(ob);
-DRW_shgroup_call(do_in_front ? 
g_data->depth_shgrp_hidden_wire_in_front :
-   g_data->depth_shgrp_hidden_wire,
- geom,
- ob);
+DRW_shgroup_call_no_cull(do_in_front ? 
g_data->depth_shgrp_hidden_wire_in_front :
+   g_data->depth_shgrp_hidden_wire,
+ geom,
+ ob);
   }
 
   if (vnormals_do) {
 geom = DRW_mesh_batch_cache_get_edit_vertices(ob->data);
-DRW_shgroup_call(g_data->vnormals_shgrp, geom, ob);
+DRW_shgroup_call_no_cull(g_data->vnormals_shgrp, geom, ob);
   }
   if (lnormals_do) {
 geom = DRW_mesh_batch_cache_get_edit_lnors(ob->data);
-DRW_shgroup_call(g_data->lnormals_shgrp, geom, ob);
+DRW_shgroup_call_no_cull(g_data->lnormals_shgrp, geom, ob);
   }
   if (fnormals_do) {
 geom = DRW_mesh_batch_cache_get_edit_facedots(ob->data);
-DRW_shgroup_call(g_data->fnormals_shgrp, geom, ob);
+DRW_shgroup_call_no_cull(g_data->fnormals_shgrp, geom, ob);
   }
 
   if (g_data->do_zbufclip) {

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


[Bf-blender-cvs] [5eb156e7692] master: Fix T66171: Cycles OSL trace() crashing in displacement shaders

2019-06-27 Thread Brecht Van Lommel
Commit: 5eb156e7692b9ab24338c73f82360338396cdbe1
Author: Brecht Van Lommel
Date:   Thu Jun 27 12:39:10 2019 +0200
Branches: master
https://developer.blender.org/rB5eb156e7692b9ab24338c73f82360338396cdbe1

Fix T66171: Cycles OSL trace() crashing in displacement shaders

This is not supported, meshes do not exist in the BVH before displacement.

===

M   intern/cycles/kernel/osl/osl_services.cpp

===

diff --git a/intern/cycles/kernel/osl/osl_services.cpp 
b/intern/cycles/kernel/osl/osl_services.cpp
index 9196caad1b3..316d24b0954 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -1392,9 +1392,16 @@ bool OSLRenderServices::trace(TraceOpt &options,
   tracedata->init = true;
   tracedata->sd.osl_globals = sd->osl_globals;
 
+  KernelGlobals *kg = sd->osl_globals;
+
+  /* Can't raytrace from shaders like displacement, before BVH exists. */
+  if (kernel_data.bvh.bvh_layout == BVH_LAYOUT_NONE) {
+return false;
+  }
+
   /* Raytrace, leaving out shadow opaque to avoid early exit. */
   uint visibility = PATH_RAY_ALL_VISIBILITY - PATH_RAY_SHADOW_OPAQUE;
-  return scene_intersect(sd->osl_globals, ray, visibility, &tracedata->isect);
+  return scene_intersect(kg, ray, visibility, &tracedata->isect);
 }
 
 bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg,

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


[Bf-blender-cvs] [6f516fcc631] master: Tests: speed up render tests by running multiple in the same process

2019-06-27 Thread Brecht Van Lommel
Commit: 6f516fcc631c177a1c9f62b3a22e0c4e0e9713d4
Author: Brecht Van Lommel
Date:   Fri May 10 23:00:35 2019 +0200
Branches: master
https://developer.blender.org/rB6f516fcc631c177a1c9f62b3a22e0c4e0e9713d4

Tests: speed up render tests by running multiple in the same process

Blender startup time and shader compilation is a big factor when running
hundreds of tests, so now all renders in the same ctest run in the same
process.

This was previously reverted due to skipping other tests when one test
crashed. Now if a test crashes, Blender is re-run with the remaining
tests so we get results from them still.

===

M   tests/python/cycles_render_tests.py
M   tests/python/eevee_render_tests.py
M   tests/python/modules/render_report.py
M   tests/python/opengl_draw_tests.py
M   tests/python/workbench_render_tests.py

===

diff --git a/tests/python/cycles_render_tests.py 
b/tests/python/cycles_render_tests.py
index 349ba83f88a..79ba11fdd44 100755
--- a/tests/python/cycles_render_tests.py
+++ b/tests/python/cycles_render_tests.py
@@ -9,14 +9,13 @@ import subprocess
 import sys
 
 
-def render_file(filepath, output_filepath):
+def get_arguments(filepath, output_filepath):
 dirname = os.path.dirname(filepath)
 basedir = os.path.dirname(dirname)
 subject = os.path.basename(dirname)
 
-frame_filepath = output_filepath + '0001.png'
-
-common_args = [
+args = [
+"--background",
 "-noaudio",
 "--factory-startup",
 "--enable-autoexec",
@@ -29,57 +28,17 @@ def render_file(filepath, output_filepath):
 # custom_args += ["--python-expr", "import bpy; 
bpy.context.scene.cycles.shading_system = True"]
 # custom_args += ["--python-expr", "import bpy; 
bpy.context.scene.cycles.device = 'GPU'"]
 custom_args = os.getenv('CYCLESTEST_ARGS')
-custom_args = shlex.split(custom_args) if custom_args else []
-common_args += custom_args
+if custom_args:
+args.extend(shlex.split(custom_args))
 
-if subject == 'opengl':
-command = [BLENDER, "--window-geometry", "0", "0", "1", "1"]
-command += common_args
-command += ['--python', os.path.join(basedir, "util", 
"render_opengl.py")]
-elif subject == 'bake':
-command = [BLENDER, "--background"]
-command += common_args
-command += ['--python', os.path.join(basedir, "util", 
"render_bake.py")]
+if subject == 'bake':
+args.extend(['--python', os.path.join(basedir, "util", 
"render_bake.py")])
 elif subject == 'denoise_animation':
-command = [BLENDER, "--background"]
-command += common_args
-command += ['--python', os.path.join(basedir, "util", 
"render_denoise.py")]
+args.extend(['--python', os.path.join(basedir, "util", 
"render_denoise.py")])
 else:
-command = [BLENDER, "--background"]
-command += common_args
-command += ["-f", "1"]
-
-try:
-# Success
-output = subprocess.check_output(command)
-if os.path.exists(frame_filepath):
-shutil.copy(frame_filepath, output_filepath)
-os.remove(frame_filepath)
-if VERBOSE:
-print(" ".join(command))
-print(output.decode("utf-8"))
-return None
-except subprocess.CalledProcessError as e:
-# Error
-if os.path.exists(frame_filepath):
-os.remove(frame_filepath)
-if VERBOSE:
-print(" ".join(command))
-print(e.output.decode("utf-8"))
-if b"Error: engine not found" in e.output:
-return "NO_ENGINE"
-elif b"blender probably wont start" in e.output:
-return "NO_START"
-return "CRASH"
-except BaseException as e:
-# Crash
-if os.path.exists(frame_filepath):
-os.remove(frame_filepath)
-if VERBOSE:
-print(" ".join(command))
-print(e)
-return "CRASH"
+args.extend(["-f", "1"])
 
+return args
 
 def create_argparse():
 parser = argparse.ArgumentParser()
@@ -94,11 +53,7 @@ def main():
 parser = create_argparse()
 args = parser.parse_args()
 
-global BLENDER, VERBOSE
-
-BLENDER = args.blender[0]
-VERBOSE = os.environ.get("BLENDER_VERBOSE") is not None
-
+blender = args.blender[0]
 test_dir = args.testdir[0]
 idiff = args.idiff[0]
 output_dir = args.outdir[0]
@@ -108,7 +63,7 @@ def main():
 report.set_pixelated(True)
 report.set_reference_dir("cycles_renders")
 report.set_compare_engines('cycles', 'eevee')
-ok = report.run(test_dir, render_file)
+ok = report.run(test_dir, blender, get_arguments, batch=True)
 
 sys.exit(not ok)
 
diff --git a/tests/python/eevee_render_tests.py 
b/tests/python/eevee_render_tests.py
index 9fb8a5f41a8..0875e4b171a 100755
--- a/tests/python/eevee_

[Bf-blender-cvs] [e045fe53f1b] blender2.7: Buildbot: Port configuration to Blender2.7 branch

2019-06-27 Thread Sergey Sharybin
Commit: e045fe53f1b03458cfb8ffb93246d9ad7737597c
Author: Sergey Sharybin
Date:   Thu Jun 27 12:41:52 2019 +0200
Branches: blender2.7
https://developer.blender.org/rBe045fe53f1b03458cfb8ffb93246d9ad7737597c

Buildbot: Port configuration to Blender2.7 branch

===

M   build_files/buildbot/config/blender_linux.cmake
M   build_files/buildbot/slave_compile.py
M   build_files/buildbot/slave_pack.py

===

diff --git a/build_files/buildbot/config/blender_linux.cmake 
b/build_files/buildbot/config/blender_linux.cmake
index 9ba91a9a463..5c9327bcfbe 100644
--- a/build_files/buildbot/config/blender_linux.cmake
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -2,33 +2,22 @@
 
 include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
 
-# Detect which libc we'll be linking against.
-# Some of the paths will depend on this
-
+# For libc-2.24 we are using chroot which runs on a 64bit system.
+# There we can not use CPU bitness check since it is always 64bit. So instead
+# we check for a specific libraries.
+#
+# Other builders we are runnign in a bare virtual machine, and the libraries
+# are installed to /opt/.
+# We assume that only 64bit builders exists in such configuration.
 if(EXISTS "/lib/x86_64-linux-gnu/libc-2.24.so")
message(STATUS "Building in GLibc-2.24 environment")
-   set(GLIBC "2.24")
-   set(MULTILIB "/x86_64-linux-gnu")
set(LIBDIR_NAME "linux_x86_64")
 elseif(EXISTS "/lib/i386-linux-gnu//libc-2.24.so")
message(STATUS "Building in GLibc-2.24 environment")
-   set(GLIBC "2.24")
-   set(MULTILIB "/i386-linux-gnu")
set(LIBDIR_NAME "linux_i686")
-elseif(EXISTS "/lib/x86_64-linux-gnu/libc-2.19.so")
-   message(STATUS "Building in GLibc-2.19 environment")
-   set(GLIBC "2.19")
-   set(MULTILIB "/x86_64-linux-gnu")
-elseif(EXISTS "/lib/i386-linux-gnu//libc-2.19.so")
-   message(STATUS "Building in GLibc-2.19 environment")
-   set(GLIBC "2.19")
-   set(MULTILIB "/i386-linux-gnu")
-elseif(EXISTS "/lib/libc-2.11.3.so")
-   message(STATUS "Building in GLibc-2.11 environment")
-   set(GLIBC "2.11")
-   set(MULTILIB "")
 else()
-   message(FATAL_ERROR "Unknown build environment")
+   message(STATUS "Building in generic 64bit environment")
+   set(LIBDIR_NAME "linux_x86_64")
 endif()
 
 # Default to only build Blender, not the player
@@ -52,122 +41,8 @@ set(WITH_PYTHON_INSTALL_REQUESTS ON CACHE BOOL "" FORCE)
 
 #  Release environment specific settings 
 
-if (NOT ${GLIBC} STREQUAL "2.24")
-
-# All the hardcoded library paths and such
-
-# LLVM libraries
-set(LLVM_VERSION "3.4"  CACHE STRING "" FORCE)
-set(LLVM_ROOT_DIR"/opt/lib/llvm-${LLVM_VERSION}"  CACHE STRING "" 
FORCE)
-set(LLVM_STATIC  ON  CACHE BOOL "" FORCE)
-
-# BOOST libraries
-set(BOOST_ROOT   "/opt/lib/boost" CACHE STRING "" FORCE)
-set(Boost_USE_STATIC_LIBSON CACHE BOOL "" FORCE)
-
-# FFmpeg libraries
-set(FFMPEG   "/opt/lib/ffmpeg" CACHE STRING "" FORCE)
-set(FFMPEG_LIBRARIES
-   avdevice avformat avcodec avutil avfilter swscale swresample
-   /usr/lib${MULTILIB}/libxvidcore.a
-   /usr/lib${MULTILIB}/libx264.a
-   /usr/lib${MULTILIB}/libmp3lame.a
-   /usr/lib${MULTILIB}/libvpx.a
-   /usr/lib${MULTILIB}/libvorbis.a
-   /usr/lib${MULTILIB}/libogg.a
-   /usr/lib${MULTILIB}/libvorbisenc.a
-   /usr/lib${MULTILIB}/libtheora.a
-   /usr/lib${MULTILIB}/libschroedinger-1.0.a
-   /usr/lib${MULTILIB}/liborc-0.4.a
-   CACHE STRING "" FORCE
-)
-
-# SndFile libraries
-set(SNDFILE_LIBRARY  
"/usr/lib${MULTILIB}/libsndfile.a;/usr/lib${MULTILIB}/libFLAC.a" CACHE STRING 
"" FORCE)
-
-# OpenAL libraries
-set(OPENAL_ROOT_DIR   "/opt/lib/openal" CACHE STRING "" FORCE)
-set(OPENAL_INCLUDE_DIR"${OPENAL_ROOT_DIR}/include/AL" CACHE STRING "" 
FORCE)
-set(OPENAL_LIBRARY
-   ${OPENAL_ROOT_DIR}/lib/libopenal.a
-   ${OPENAL_ROOT_DIR}/lib/libcommon.a
-   CACHE STRING "" FORCE
-)
-
-# OpenCollada libraries
-set(OPENCOLLADA_UTF_LIBRARY   ""  CACHE STRING "" 
FORCE)
-set(PCRE_INCLUDE_DIR  "/usr/include"  CACHE STRING "" 
FORCE)
-set(PCRE_LIBRARY  "/usr/lib${MULTILIB}/libpcre.a" CACHE STRING "" 
FORCE)
-set(XML2_INCLUDE_DIR  "/usr/include"  CACHE STRING "" 
FORCE)
-set(XML2_LIBRARY  "/usr/lib${MULTILIB}/libxml2.a" CACHE STRING "" 
FORCE)
-
-# OpenColorIO libraries
-set(OPENCOLORIO_ROOT_DIR  "/opt/lib/ocio" CACHE STRING "" FORCE)
-set(OPENCOLORIO_OPENCOLORIO_LIBRARY 
"${OPENCOLORIO_ROOT_DIR}/lib/libOpenColorIO.a" CACHE STRING "" FORCE)
-set(OPENCOLORIO_TINYXML_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libtinyxml.a" 
CACHE STRING "" FORCE)
-set(OPENCOLORIO_YAML

[Bf-blender-cvs] [4271ae24716] sybren-usd: USD: only write timeSamples when we write animated data

2019-06-27 Thread Sybren A. Stüvel
Commit: 4271ae24716f23a4a98a880b3d6700f8184c320c
Author: Sybren A. Stüvel
Date:   Wed Jun 26 11:55:33 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB4271ae24716f23a4a98a880b3d6700f8184c320c

USD: only write timeSamples when we write animated data

By using the default timecode USD won't even write a single `timeSample`
for non-animated data. Instead, it writes it as non-timesampled. This makes
the USD file more explicit of our intent, and allows for read-time
optimisations.

===

M   source/blender/usd/intern/usd_exporter_context.h
M   source/blender/usd/intern/usd_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_transform.cc

===

diff --git a/source/blender/usd/intern/usd_exporter_context.h 
b/source/blender/usd/intern/usd_exporter_context.h
index 5483d6f49ed..598103765af 100644
--- a/source/blender/usd/intern/usd_exporter_context.h
+++ b/source/blender/usd/intern/usd_exporter_context.h
@@ -1,6 +1,8 @@
 #ifndef __USD__USD_EXPORTER_CONTEXT_H__
 #define __USD__USD_EXPORTER_CONTEXT_H__
 
+#include "../usd.h"
+
 #include 
 #include 
 
@@ -13,6 +15,7 @@ struct USDExporterContext {
   pxr::UsdStageRefPtr stage;
   pxr::SdfPath usd_path;
   USDHierarchyIterator *hierarchy_iterator;
+  const USDExportParams &export_params;
 };
 
 #endif /* __USD__USD_EXPORTER_CONTEXT_H__ */
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc 
b/source/blender/usd/intern/usd_hierarchy_iterator.cc
index b04e7756379..b0587e5ed54 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -68,14 +68,14 @@ AbstractHierarchyWriter 
*USDHierarchyIterator::create_xform_writer(const Hierarc
   // context.export_path.c_str());
 
   USDExporterContext usd_export_context = {
-  depsgraph, stage, pxr::SdfPath(context.export_path), this};
+  depsgraph, stage, pxr::SdfPath(context.export_path), this, params};
   return new USDTransformWriter(usd_export_context);
 }
 
 AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const 
HierarchyContext &context)
 {
   USDExporterContext usd_export_context = {
-  depsgraph, stage, pxr::SdfPath(context.export_path), this};
+  depsgraph, stage, pxr::SdfPath(context.export_path), this, params};
   USDAbstractWriter *data_writer = nullptr;
 
   switch (context.object->type) {
diff --git a/source/blender/usd/intern/usd_writer_abstract.cc 
b/source/blender/usd/intern/usd_writer_abstract.cc
index aed49df9665..c430207ae38 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -1,4 +1,5 @@
 #include "usd_writer_abstract.h"
+#include "usd_hierarchy_iterator.h"
 
 #include 
 
@@ -14,6 +15,7 @@ USDAbstractWriter::USDAbstractWriter(const USDExporterContext 
&usd_export_contex
   stage(usd_export_context.stage),
   usd_path_(usd_export_context.usd_path),
   hierarchy_iterator(usd_export_context.hierarchy_iterator),
+  export_params(usd_export_context.export_params),
   frame_has_been_written_(false),
   is_animated_(false)
 {
@@ -28,6 +30,17 @@ bool USDAbstractWriter::is_supported() const
   return true;
 }
 
+pxr::UsdTimeCode USDAbstractWriter::get_export_time_code() const
+{
+  if (is_animated_) {
+return hierarchy_iterator->get_export_time_code();
+  }
+  // By using the default timecode USD won't even write a single `timeSample` 
for non-animated
+  // data. Instead, it writes it as non-timesampled.
+  static pxr::UsdTimeCode default_timecode = pxr::UsdTimeCode::Default();
+  return default_timecode;
+}
+
 void USDAbstractWriter::write(HierarchyContext &context)
 {
   if (frame_has_been_written_) {
@@ -36,7 +49,7 @@ void USDAbstractWriter::write(HierarchyContext &context)
 }
   }
   else {
-is_animated_ = check_is_animated(context.object);
+is_animated_ = export_params.do_animation && 
check_is_animated(context.object);
 printf("%sANIMATION\033[0m: %20s: %s\n",
is_animated_ ? "\033[32;1m" : "\033[31;1m",
context.export_path.c_str(),
diff --git a/source/blender/usd/intern/usd_writer_abstract.h 
b/source/blender/usd/intern/usd_writer_abstract.h
index c6f0a603aa0..3f463bc0047 100644
--- a/source/blender/usd/intern/usd_writer_abstract.h
+++ b/source/blender/usd/intern/usd_writer_abstract.h
@@ -20,6 +20,7 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
   pxr::UsdStageRefPtr stage;
   pxr::SdfPath usd_path_;
   USDHierarchyIterator *const hierarchy_iterator;
+  const USDExportParams &export_params;
   bool frame_has_been_written_;
   bool is_animated_;
 
@@ -38,6 +39,7 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
  p

[Bf-blender-cvs] [820be7f6879] sybren-usd: USD: Export graph now is indexed by (export parent, duplicator)

2019-06-27 Thread Sybren A. Stüvel
Commit: 820be7f6879919acb6c607bb3ad063d93e635969
Author: Sybren A. Stüvel
Date:   Thu Jun 27 12:24:33 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB820be7f6879919acb6c607bb3ad063d93e635969

USD: Export graph now is indexed by (export parent, duplicator)

By including the duplicator into the export graph, each duplicated object
now has a unique entry in the graph. This solves a problem with the
transform matrices.

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_writer_transform.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 11565b5fd41..dec7e78f38b 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -15,6 +15,12 @@ extern "C" {
 #include "DEG_depsgraph_query.h"
 }
 
+const HierarchyContext &HierarchyContext::root()
+{
+  static const HierarchyContext root_hierarchy_context = {.object = nullptr};
+  return root_hierarchy_context;
+}
+
 AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph)
 : depsgraph(depsgraph), writers()
 {
@@ -83,14 +89,17 @@ void AbstractHierarchyIterator::iterate()
 
 // If the dupli-object's scene parent is also instanced by this 
object, use that as the
 // export parent. Otherwise use the dupli-parent as export parent.
+ExportGraph::key_type graph_index;
 if (link->ob->parent != nullptr && dupli_set.find(link->ob->parent) != 
dupli_set.end()) {
   export_parent = link->ob->parent;
+  graph_index = std::make_pair(export_parent, object);
 }
 else {
   export_parent = object;
+  graph_index = std::make_pair(export_parent, nullptr);
 }
 
-visit_dupli_object(link, export_parent, false);
+visit_dupli_object(link, graph_index, object, export_parent, false);
   }
 }
 
@@ -101,11 +110,32 @@ void AbstractHierarchyIterator::iterate()
   // // For debug: print the export graph.
   // printf("== Export graph pre-prune:\n");
   // for (auto it : export_graph) {
-  //   printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
+  //   const std::pair &parent_info = it.first;
+  //   Object *const export_parent = parent_info.first;
+  //   Object *const duplicator = parent_info.second;
+
+  //   if (duplicator != nullptr) {
+  // printf("DU %s (as dupped by %s):\n",
+  //export_parent == nullptr ? "-null-" : (export_parent->id.name 
+ 2),
+  //duplicator->id.name + 2);
+  //   }
+  //   else {
+  // printf("OB %s:\n", export_parent == nullptr ? "-null-" : 
(export_parent->id.name +
+  // 2));
+  //   }
+
   //   for (auto child_it : it.second) {
-  // printf("   - %s (weak_export=%s)\n",
-  //child_it.object->id.name + 2,
-  //child_it.weak_export ? "true" : "false");
+  // if (child_it.duplicator == nullptr) {
+  //   printf("   - %s%s\n",
+  //  child_it.object->id.name + 2,
+  //  child_it.weak_export ? " (weak)" : "");
+  // }
+  // else {
+  //   printf("   - %s (dup by %s%s)\n",
+  //  child_it.object->id.name + 2,
+  //  child_it.duplicator->id.name + 2,
+  //  child_it.weak_export ? ", weak" : "");
+  // }
   //   }
   // }
 
@@ -114,17 +144,38 @@ void AbstractHierarchyIterator::iterate()
   // // For debug: print the export graph.
   // printf("== Export graph post-prune:\n");
   // for (auto it : export_graph) {
-  //   printf("OB %s (%p):\n", it.first == nullptr ? "/" : 
(it.first->id.name + 2), it.first);
+  //   const std::pair &parent_info = it.first;
+  //   Object *const export_parent = parent_info.first;
+  //   Object *const duplicator = parent_info.second;
+
+  //   if (duplicator != nullptr) {
+  // printf("DU %s (as dupped by %s):\n",
+  //export_parent == nullptr ? "-null-" : (export_parent->id.name 
+ 2),
+  //duplicator->id.name + 2);
+  //   }
+  //   else {
+  // printf("OB %s:\n", export_parent == nullptr ? "-null-" : 
(export_parent->id.name +
+  // 2));
+  //   }
+
   //   for (auto child_it : it.second) {
-  // printf("   - %s (weak_export=%s)\n",
-  //child_it.object->id.name + 2,
-  //child_it.weak_export ? "true" : "false");
+  // if (child_it.duplicator == nullptr) {
+  //   printf("   - %s%s\n",
+  //  child_it.object->id.name + 2,
+  //  child_it.weak_export ? " (weak)" : "");
+  // }
+  // else {
+  //   printf("   - %s (dup by %s%s)\n",
+  //  child_

[Bf-blender-cvs] [e5078278016] sybren-usd: Merge remote-tracking branch 'origin/master' into sybren-usd

2019-06-27 Thread Sybren A. Stüvel
Commit: e50782780167c74981119ff1f45be8e96582db41
Author: Sybren A. Stüvel
Date:   Wed Jun 26 16:40:18 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rBe50782780167c74981119ff1f45be8e96582db41

Merge remote-tracking branch 'origin/master' into sybren-usd

===



===



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


[Bf-blender-cvs] [59f07242bb3] sybren-usd: USD: Initial support for exporting animated data

2019-06-27 Thread Sybren A. Stüvel
Commit: 59f07242bb38cf6d9358df6fe7f999320ad4665b
Author: Sybren A. Stüvel
Date:   Tue Jun 25 15:03:38 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB59f07242bb38cf6d9358df6fe7f999320ad4665b

USD: Initial support for exporting animated data

Mesh and transform animation are now written when passing `animation=True`
to the export operator. There is no inspection of whether an object is
actually animated or not, so this will likely export too much information
(each mesh is written for each frame in the scene).

The administration of which timecode to use for the export is left to the
file-format-specific concrete subclasses of `AbstractHierarchyIterator`;
the abstract iterator itself doesn't know anything about the passage of
time.

===

M   source/blender/editors/io/io_usd.c
M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/abstract_hierarchy_iterator.h
M   source/blender/usd/intern/usd_capi.cc
M   source/blender/usd/intern/usd_exporter_context.h
M   source/blender/usd/intern/usd_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_hierarchy_iterator.h
M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_mesh.cc
M   source/blender/usd/intern/usd_writer_mesh.h
M   source/blender/usd/intern/usd_writer_transform.cc
M   source/blender/usd/intern/usd_writer_transform.h
M   source/blender/usd/usd.h

===

diff --git a/source/blender/editors/io/io_usd.c 
b/source/blender/editors/io/io_usd.c
index 8764e8fef1e..97459b94c24 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -84,10 +84,12 @@ static int wm_usd_export_exec(bContext *C, wmOperator *op)
   const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
   const bool selected_objects_only = RNA_boolean_get(op->ptr, 
"selected_objects_only");
   const bool visible_objects_only = RNA_boolean_get(op->ptr, 
"visible_objects_only");
+  const bool animation = RNA_boolean_get(op->ptr, "animation");
 
   struct USDExportParams params = {
-  .selected_objects_only = selected_objects_only,
-  .visible_objects_only = visible_objects_only,
+  animation,
+  selected_objects_only,
+  visible_objects_only,
   };
 
   bool ok = USD_export(scene, C, filename, ¶ms, as_background_job);
@@ -111,17 +113,24 @@ void WM_OT_usd_export(struct wmOperatorType *ot)
   RNA_def_boolean(ot->srna,
   "selected_objects_only",
   false,
-  "Only export selected objects",
+  "Only Export Selected Objects",
   "Only selected objects are exported. Unselected parents of 
selected objects are "
   "exported as empty transform.");
 
   RNA_def_boolean(ot->srna,
   "visible_objects_only",
   false,
-  "Only export visible objects",
+  "Only Export Visible Objects",
   "Only visible objects are exported. Invisible parents of 
visible objects are "
   "exported as empty transform.");
 
+  RNA_def_boolean(ot->srna,
+  "animation",
+  false,
+  "Export Animation",
+  "When true, the render frame range is exported. When false, 
only the current "
+  "frame is exported.");
+
   RNA_def_boolean(
   ot->srna,
   "as_background_job",
diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 4af2c93e83b..11565b5fd41 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -6,6 +6,7 @@ extern "C" {
 #include "BKE_anim.h"
 
 #include "BLI_assert.h"
+#include "BLI_math_matrix.h"
 
 #include "DNA_ID.h"
 #include "DNA_layer_types.h"
@@ -89,7 +90,7 @@ void AbstractHierarchyIterator::iterate()
   export_parent = object;
 }
 
-visit_object(link->ob, export_parent, false);
+visit_dupli_object(link, export_parent, false);
   }
 }
 
@@ -124,6 +125,51 @@ void AbstractHierarchyIterator::iterate()
   // For debug: print the export paths.
   // printf("== Export paths:\n");
   make_writers(nullptr, "", nullptr);
+
+  export_graph.clear();
+}
+
+void AbstractHierarchyIterator::visit_object(Object *object,
+ Object *export_parent,
+ bool weak_export)
+{
+  HierarchyContext context;
+  context.object = object;
+  context.export_parent = export_parent;
+  context.weak_export = weak_export;
+  context.export_path = "";
+  context.parent_writer = nullptr;
+  // TODO(

[Bf-blender-cvs] [4d095e851b3] sybren-usd: USD: disabled debug print

2019-06-27 Thread Sybren A. Stüvel
Commit: 4d095e851b33c9b993591bdca0c1abe5794285ff
Author: Sybren A. Stüvel
Date:   Thu Jun 27 12:24:47 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB4d095e851b33c9b993591bdca0c1abe5794285ff

USD: disabled debug print

No functional changes.

===

M   source/blender/usd/intern/usd_writer_abstract.cc

===

diff --git a/source/blender/usd/intern/usd_writer_abstract.cc 
b/source/blender/usd/intern/usd_writer_abstract.cc
index c430207ae38..4d5b20d07fb 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -50,10 +50,10 @@ void USDAbstractWriter::write(HierarchyContext &context)
   }
   else {
 is_animated_ = export_params.do_animation && 
check_is_animated(context.object);
-printf("%sANIMATION\033[0m: %20s: %s\n",
-   is_animated_ ? "\033[32;1m" : "\033[31;1m",
-   context.export_path.c_str(),
-   is_animated_ ? "true" : "false");
+// printf("%sANIMATION\033[0m: %20s: %s\n",
+//is_animated_ ? "\033[32;1m" : "\033[31;1m",
+//context.export_path.c_str(),
+//is_animated_ ? "true" : "false");
   }
 
   do_write(context);

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


[Bf-blender-cvs] [1134a406ab5] sybren-usd: USD: be more selective about what to export each frame

2019-06-27 Thread Sybren A. Stüvel
Commit: 1134a406ab5c65ed0b306d29739b245dcc791781
Author: Sybren A. Stüvel
Date:   Tue Jun 25 16:02:07 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB1134a406ab5c65ed0b306d29739b245dcc791781

USD: be more selective about what to export each frame

To prevent too large USD files, we now have a bit of a framework to only
write data on the first frame for non-animated objects. This needs more
work, though, as it can be made more selective.

===

M   source/blender/usd/intern/usd_writer_abstract.cc
M   source/blender/usd/intern/usd_writer_abstract.h
M   source/blender/usd/intern/usd_writer_transform.cc
M   source/blender/usd/intern/usd_writer_transform.h

===

diff --git a/source/blender/usd/intern/usd_writer_abstract.cc 
b/source/blender/usd/intern/usd_writer_abstract.cc
index 1177000ae61..aed49df9665 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -2,11 +2,20 @@
 
 #include 
 
+extern "C" {
+#include "BKE_animsys.h"
+#include "BKE_key.h"
+
+#include "DNA_modifier_types.h"
+}
+
 USDAbstractWriter::USDAbstractWriter(const USDExporterContext 
&usd_export_context)
 : depsgraph(usd_export_context.depsgraph),
   stage(usd_export_context.stage),
   usd_path_(usd_export_context.usd_path),
-  hierarchy_iterator(usd_export_context.hierarchy_iterator)
+  hierarchy_iterator(usd_export_context.hierarchy_iterator),
+  frame_has_been_written_(false),
+  is_animated_(false)
 {
 }
 
@@ -21,9 +30,49 @@ bool USDAbstractWriter::is_supported() const
 
 void USDAbstractWriter::write(HierarchyContext &context)
 {
-  // TODO(Sybren): deal with animatedness of objects and only calling 
do_write() when this is
-  // either the first call or the object is animated.
+  if (frame_has_been_written_) {
+if (!is_animated_) {
+  return;
+}
+  }
+  else {
+is_animated_ = check_is_animated(context.object);
+printf("%sANIMATION\033[0m: %20s: %s\n",
+   is_animated_ ? "\033[32;1m" : "\033[31;1m",
+   context.export_path.c_str(),
+   is_animated_ ? "true" : "false");
+  }
+
   do_write(context);
+
+  frame_has_been_written_ = true;
+}
+
+bool USDAbstractWriter::check_is_animated(Object *object) const
+{
+  if (object->data != nullptr) {
+AnimData *adt = BKE_animdata_from_id(static_cast(object->data));
+/* TODO(Sybren): make this check more strict, as the AnimationData may
+ * actually be empty (no fcurves, drivers, etc.) and thus effectively
+ * have no animation at all. */
+if (adt != nullptr) {
+  return true;
+}
+  }
+  if (BKE_key_from_object(object) != nullptr) {
+return true;
+  }
+
+  /* Test modifiers. */
+  ModifierData *md = static_cast(object->modifiers.first);
+  while (md) {
+if (md->type != eModifierType_Subsurf) {
+  return true;
+}
+md = md->next;
+  }
+
+  return false;
 }
 
 const pxr::SdfPath &USDAbstractWriter::usd_path() const
diff --git a/source/blender/usd/intern/usd_writer_abstract.h 
b/source/blender/usd/intern/usd_writer_abstract.h
index 7bb3185a54c..c6f0a603aa0 100644
--- a/source/blender/usd/intern/usd_writer_abstract.h
+++ b/source/blender/usd/intern/usd_writer_abstract.h
@@ -20,6 +20,8 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
   pxr::UsdStageRefPtr stage;
   pxr::SdfPath usd_path_;
   USDHierarchyIterator *const hierarchy_iterator;
+  bool frame_has_been_written_;
+  bool is_animated_;
 
  public:
   USDAbstractWriter(const USDExporterContext &usd_export_context);
@@ -35,6 +37,7 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
 
  protected:
   virtual void do_write(HierarchyContext &context) = 0;
+  virtual bool check_is_animated(Object *object) const;
 };
 
 #endif /* __USD__USD_WRITER_ABSTRACT_H__ */
diff --git a/source/blender/usd/intern/usd_writer_transform.cc 
b/source/blender/usd/intern/usd_writer_transform.cc
index f6aeb3cb4cb..4969ac1c0f3 100644
--- a/source/blender/usd/intern/usd_writer_transform.cc
+++ b/source/blender/usd/intern/usd_writer_transform.cc
@@ -5,7 +5,11 @@
 #include 
 
 extern "C" {
+#include "BKE_animsys.h"
+
 #include "BLI_math_matrix.h"
+
+#include "DNA_layer_types.h"
 }
 
 USDTransformWriter::USDTransformWriter(const USDExporterContext &ctx) : 
USDAbstractWriter(ctx)
@@ -28,6 +32,32 @@ void USDTransformWriter::do_write(HierarchyContext &context)
   if (!xformOp_) {
 xformOp_ = xform.AddTransformOp();
   }
+  // TODO(Sybren): when not animated, write to the default timecode instead.
   xformOp_.Set(pxr::GfMatrix4d(parent_relative_matrix),
hierarchy_iterator->get_export_time_code());
 }
+
+bool USDTransformWriter::check_is_animated(Object *object) const
+{
+  /* We should also check the animation state of parents that aren't part of 
the export hierarchy
+   * (that is, when the animated par

[Bf-blender-cvs] [0c3d04e7c7e] sybren-usd: USD: Commented-out most debug prints

2019-06-27 Thread Sybren A. Stüvel
Commit: 0c3d04e7c7e7b7de40f9eaa4c4d5ed9778fd0d67
Author: Sybren A. Stüvel
Date:   Tue Jun 25 14:58:09 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB0c3d04e7c7e7b7de40f9eaa4c4d5ed9778fd0d67

USD: Commented-out most debug prints

Things are starting to work, so the debug prints aren't necessary any more.
They will be completely removed at some point, but I'm keeping them in the
code for now so that I can quickly enable them when necessary.

No functional changes.

===

M   source/blender/usd/intern/abstract_hierarchy_iterator.cc
M   source/blender/usd/intern/usd_hierarchy_iterator.cc

===

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc 
b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index bb49da9958d..4af2c93e83b 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -40,7 +40,7 @@ void AbstractHierarchyIterator::iterate()
 {
   Scene *scene = DEG_get_evaluated_scene(depsgraph);
 
-  printf("== Visiting objects:\n");
+  // printf("== Visiting objects:\n");
   DEG_OBJECT_ITER_BEGIN (depsgraph,
  object,
  DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
@@ -97,32 +97,32 @@ void AbstractHierarchyIterator::iterate()
   }
   DEG_OBJECT_ITER_END;
 
-  // For debug: print the export graph.
-  printf("== Export graph pre-prune:\n");
-  for (auto it : export_graph) {
-printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
-for (auto child_it : it.second) {
-  printf("   - %s (weak_export=%s)\n",
- child_it.object->id.name + 2,
- child_it.weak_export ? "true" : "false");
-}
-  }
+  // // For debug: print the export graph.
+  // printf("== Export graph pre-prune:\n");
+  // for (auto it : export_graph) {
+  //   printf("OB %s:\n", it.first == nullptr ? "/" : (it.first->id.name + 
2));
+  //   for (auto child_it : it.second) {
+  // printf("   - %s (weak_export=%s)\n",
+  //child_it.object->id.name + 2,
+  //child_it.weak_export ? "true" : "false");
+  //   }
+  // }
 
   prune_export_graph();
 
-  // For debug: print the export graph.
-  printf("== Export graph post-prune:\n");
-  for (auto it : export_graph) {
-printf("OB %s (%p):\n", it.first == nullptr ? "/" : (it.first->id.name 
+ 2), it.first);
-for (auto child_it : it.second) {
-  printf("   - %s (weak_export=%s)\n",
- child_it.object->id.name + 2,
- child_it.weak_export ? "true" : "false");
-}
-  }
+  // // For debug: print the export graph.
+  // printf("== Export graph post-prune:\n");
+  // for (auto it : export_graph) {
+  //   printf("OB %s (%p):\n", it.first == nullptr ? "/" : 
(it.first->id.name + 2), it.first);
+  //   for (auto child_it : it.second) {
+  // printf("   - %s (weak_export=%s)\n",
+  //child_it.object->id.name + 2,
+  //child_it.weak_export ? "true" : "false");
+  //   }
+  // }
 
   // For debug: print the export paths.
-  printf("== Export paths:\n");
+  // printf("== Export paths:\n");
   make_writers(nullptr, "", nullptr);
 }
 
@@ -175,11 +175,11 @@ void AbstractHierarchyIterator::make_writers(Object 
*parent_object,
 context.parent_writer = parent_writer;
 context.export_path = export_path;
 
-const char *color = context.weak_export ? "31;1" : "30";
-printf("%s \033[%sm%s\033[0m\n",
-   export_path.c_str(),
-   color,
-   context.weak_export ? "true" : "false");
+// const char *color = context.weak_export ? "31;1" : "30";
+// printf("%s \033[%sm%s\033[0m\n",
+//export_path.c_str(),
+//color,
+//context.weak_export ? "true" : "false");
 
 // Get or create the transform writer.
 xform_writer = ensure_xform_writer(context);
@@ -265,15 +265,15 @@ void AbstractHierarchyIterator::visit_object(Object 
*object,
   };
   export_graph[export_parent].insert(context);
 
-  std::string export_parent_name = export_parent ? 
get_object_name(export_parent) : "/";
-  printf("OB %30s %p (parent=%s %p; xform-only=%s; instance=%s)\n",
- get_object_name(object).c_str(),
- object,
- export_parent_name.c_str(),
- export_parent,
- context.weak_export ? "\033[31;1mtrue\033[0m" : "false",
- context.object->base_flag & BASE_FROM_DUPLI ? "\033[35;1mtrue\033[0m" 
:
-   
"\033[30;1mfalse\033[0m");
+  // std::string export_parent_name = export_parent ? 
get_object_name(export_parent) : "/";
+  // printf("OB %30s %p (parent=%s %p; xform-only=%s; instance=%s)\n",
+  //get_object_name(object).c_str(),
+  //object,
+  //export_paren

[Bf-blender-cvs] [3b0e908cc81] sybren-usd: BKE_anim: added comment to explain the matrix `DupliObject.mat`

2019-06-27 Thread Sybren A. Stüvel
Commit: 3b0e908cc812b4c2fbb0c8886b204cc7b50680ca
Author: Sybren A. Stüvel
Date:   Tue Jun 25 14:53:45 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB3b0e908cc812b4c2fbb0c8886b204cc7b50680ca

BKE_anim: added comment to explain the matrix `DupliObject.mat`

`DupliObject.mat` contains the world matrix of the duplicated object, and
this knowledge is now available in a comment.

===

M   source/blender/blenkernel/BKE_anim.h

===

diff --git a/source/blender/blenkernel/BKE_anim.h 
b/source/blender/blenkernel/BKE_anim.h
index dab76fb79f1..48d781eb415 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -73,7 +73,7 @@ void free_object_duplilist(struct ListBase *lb);
 typedef struct DupliObject {
   struct DupliObject *next, *prev;
   struct Object *ob;
-  float mat[4][4];
+  float mat[4][4]; /* World matrix of the duplicated object. */
   float orco[3], uv[2];
 
   short type; /* from Object.transflag */

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


[Bf-blender-cvs] [219a10e46aa] master: Cleanup: clarify WM_gizmoconfig function naming

2019-06-27 Thread Campbell Barton
Commit: 219a10e46aa65c6c416b205cd7389d3ee86777f6
Author: Campbell Barton
Date:   Thu Jun 27 19:58:35 2019 +1000
Branches: master
https://developer.blender.org/rB219a10e46aa65c6c416b205cd7389d3ee86777f6

Cleanup: clarify WM_gizmoconfig function naming

===

M   source/blender/windowmanager/gizmo/WM_gizmo_api.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
M   source/blender/windowmanager/intern/wm_toolsystem.c

===

diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h 
b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
index 5bf18a01af5..5025291a746 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
@@ -159,10 +159,10 @@ struct wmGizmoGroupTypeRef 
*WM_gizmogrouptype_append_and_link(
 /* wm_gizmo_map.c */
 
 /* Dynamic Updates (for RNA runtime registration) */
-void WM_gizmoconfig_update_tag_init(struct wmGizmoMapType *gzmap_type,
-struct wmGizmoGroupType *gzgt);
-void WM_gizmoconfig_update_tag_remove(struct wmGizmoMapType *gzmap_type,
-  struct wmGizmoGroupType *gzgt);
+void WM_gizmoconfig_update_tag_group_type_init(struct wmGizmoMapType 
*gzmap_type,
+   struct wmGizmoGroupType *gzgt);
+void WM_gizmoconfig_update_tag_group_type_remove(struct wmGizmoMapType 
*gzmap_type,
+ struct wmGizmoGroupType 
*gzgt);
 void WM_gizmoconfig_update(struct Main *bmain);
 
 /* wm_maniulator_target_props.c */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 593a2c97df4..2ec0e4e7ec3 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -970,7 +970,7 @@ void WM_gizmo_group_type_add_ptr_ex(wmGizmoGroupType *gzgt, 
wmGizmoMapType *gzma
 {
   WM_gizmomaptype_group_link_ptr(gzmap_type, gzgt);
 
-  WM_gizmoconfig_update_tag_init(gzmap_type, gzgt);
+  WM_gizmoconfig_update_tag_group_type_init(gzmap_type, gzgt);
 }
 void WM_gizmo_group_type_add_ptr(wmGizmoGroupType *gzgt)
 {
@@ -1050,7 +1050,7 @@ void WM_gizmo_group_type_reinit(struct Main *bmain, const 
char *idname)
 
 void WM_gizmo_group_type_unlink_delayed_ptr_ex(wmGizmoGroupType *gzgt, 
wmGizmoMapType *gzmap_type)
 {
-  WM_gizmoconfig_update_tag_remove(gzmap_type, gzgt);
+  WM_gizmoconfig_update_tag_group_type_remove(gzmap_type, gzgt);
 }
 
 void WM_gizmo_group_type_unlink_delayed_ptr(wmGizmoGroupType *gzgt)
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c 
b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index beb2707d94d..edf376b1259 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -1238,7 +1238,7 @@ void wm_gizmos_keymap(wmKeyConfig *keyconf)
  *
  * \{ */
 
-void WM_gizmoconfig_update_tag_init(wmGizmoMapType *gzmap_type, 
wmGizmoGroupType *gzgt)
+void WM_gizmoconfig_update_tag_group_type_init(wmGizmoMapType *gzmap_type, 
wmGizmoGroupType *gzgt)
 {
   /* tag for update on next use */
   gzmap_type->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | 
WM_GIZMOMAPTYPE_KEYMAP_INIT);
@@ -1247,7 +1247,8 @@ void WM_gizmoconfig_update_tag_init(wmGizmoMapType 
*gzmap_type, wmGizmoGroupType
   wm_gzmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
 }
 
-void WM_gizmoconfig_update_tag_remove(wmGizmoMapType *gzmap_type, 
wmGizmoGroupType *gzgt)
+void WM_gizmoconfig_update_tag_group_type_remove(wmGizmoMapType *gzmap_type,
+ wmGizmoGroupType *gzgt)
 {
   /* tag for update on next use */
   gzmap_type->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE;
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c 
b/source/blender/windowmanager/intern/wm_toolsystem.c
index 3d22981f7ba..330ef2944ad 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -186,7 +186,7 @@ static void toolsystem_ref_link(bContext *C, WorkSpace 
*workspace, bToolRef *tre
   /* Even if the group-type was has been linked, it's possible the 
space types
* were not previously using it. (happens with multiple windows.) */
   wmGizmoMapType *gzmap_type = 
WM_gizmomaptype_ensure(&gzgt->gzmap_params);
-  WM_gizmoconfig_update_tag_init(gzmap_type, gzgt);
+  WM_gizmoconfig_update_tag_group_type_init(gzmap_type, gzgt);
 }
   }
 }

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


[Bf-blender-cvs] [1c60f30d043] master: Fix: Text Location lost X/Y text

2019-06-27 Thread William Reynish
Commit: 1c60f30d0434cad528c1e4bf28de4460788deab9
Author: William Reynish
Date:   Thu Jun 27 11:15:56 2019 +0200
Branches: master
https://developer.blender.org/rB1c60f30d0434cad528c1e4bf28de4460788deab9

Fix: Text Location lost X/Y text

Use PROP_XYZ instead, and user Slider=True to make them display as sliders in 
the UI

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/makesrna/intern/rna_sequencer.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 884d68ec850..1f67c9b12cf 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1054,7 +1054,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
 col.prop(strip, "align_x", text="Horizontal")
 col.prop(strip, "align_y", text="Vertical")
 row = col.row(align=True)
-row.prop(strip, "location", text="Location")
+row.prop(strip, "location", text="Location", slider=True)
 col.prop(strip, "wrap_width")
 
 layout.operator("sequencer.export_subtitles", text="Export 
Subtitles", icon='EXPORT')
diff --git a/source/blender/makesrna/intern/rna_sequencer.c 
b/source/blender/makesrna/intern/rna_sequencer.c
index bbf45695d30..241764ff9a6 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -2738,7 +2738,7 @@ static void rna_def_text(StructRNA *srna)
   RNA_def_property_update(
   prop, NC_SCENE | ND_SEQUENCER, 
"rna_Sequence_invalidate_preprocessed_update");
 
-  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_FACTOR);
+  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
   RNA_def_property_float_sdna(prop, NULL, "loc");
   RNA_def_property_ui_text(prop, "Location", "Location of the text");
   RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);

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


[Bf-blender-cvs] [c93af8529df] master: Tool System: don't unlink gizmos when changing tools

2019-06-27 Thread Campbell Barton
Commit: c93af8529dfec9513de3bfcead9d15fa0eeb9a81
Author: Campbell Barton
Date:   Thu Jun 27 18:42:25 2019 +1000
Branches: master
https://developer.blender.org/rBc93af8529dfec9513de3bfcead9d15fa0eeb9a81

Tool System: don't unlink gizmos when changing tools

Needed for tools not to unlink each other with multiple windows.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c 
b/source/blender/windowmanager/intern/wm_toolsystem.c
index f40ea55ee82..3d22981f7ba 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -128,11 +128,16 @@ bool WM_toolsystem_ref_ensure(struct WorkSpace 
*workspace, const bToolKey *tkey,
 
 /** \} */
 
-static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef 
*tref)
+/**
+ * \param do_gizmo: Make removing the gizmo optional because it complicates 
multi-window support
+ * since the tool might be used in another window. The gizmos poll function 
must handle this,
+ * since this is needed for switching workspaces anyway.
+ */
+static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef 
*tref, bool do_gizmo)
 {
   bToolRef_Runtime *tref_rt = tref->runtime;
 
-  if (tref_rt->gizmo_group[0]) {
+  if (do_gizmo && tref_rt->gizmo_group[0]) {
 wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(tref_rt->gizmo_group, 
false);
 if (gzgt != NULL) {
   bool found = false;
@@ -165,7 +170,7 @@ void WM_toolsystem_unlink(bContext *C, WorkSpace 
*workspace, const bToolKey *tke
 {
   bToolRef *tref = WM_toolsystem_ref_find(workspace, tkey);
   if (tref && tref->runtime) {
-toolsystem_unlink_ref(C, workspace, tref);
+toolsystem_unlink_ref(C, workspace, tref, false);
   }
 }
 
@@ -312,7 +317,7 @@ void WM_toolsystem_unlink_all(struct bContext *C, struct 
WorkSpace *workspace)
   LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
 if (tref->runtime) {
   if (tref->tag == 0) {
-toolsystem_unlink_ref(C, workspace, tref);
+toolsystem_unlink_ref(C, workspace, tref, true);
 tref->tag = 1;
   }
 }
@@ -359,7 +364,7 @@ void WM_toolsystem_ref_set_from_runtime(struct bContext *C,
   Main *bmain = CTX_data_main(C);
 
   if (tref->runtime) {
-toolsystem_unlink_ref(C, workspace, tref);
+toolsystem_unlink_ref(C, workspace, tref, false);
   }
 
   STRNCPY(tref->idname, idname);

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


[Bf-blender-cvs] [605f4922375] soc-2019-npr: LANPR: make format.

2019-06-27 Thread YimingWu
Commit: 605f49223754b4ad4ddbdc6b372d21421480fe85
Author: YimingWu
Date:   Thu Jun 27 16:40:56 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB605f49223754b4ad4ddbdc6b372d21421480fe85

LANPR: make format.

===

M   release/scripts/startup/bl_ui/properties_render.py
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/draw/engines/lanpr/lanpr_access.c
M   source/blender/draw/engines/lanpr/lanpr_chain.c
M   source/blender/draw/engines/lanpr/lanpr_data_types.h
M   source/blender/draw/engines/lanpr/lanpr_ops.c
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesrna/intern/rna_collection.c

===

diff --git a/release/scripts/startup/bl_ui/properties_render.py 
b/release/scripts/startup/bl_ui/properties_render.py
index 09f680c94e3..5449d266b37 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -739,6 +739,10 @@ 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":
 
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index b2aac37ec91..3b70d6582cc 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3545,7 +3545,7 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   sce->lanpr.chaining_image_threshold = 0.01;
   sce->lanpr.chaining_geometry_threshold = 0.1;
 }
-for (Collection* co = bmain->collections.first;co;co=co->id.next){
+for (Collection *co = bmain->collections.first; co; co = co->id.next) {
   co->lanpr.types = COLLECTION_FEATURE_LINE_ALL;
 }
   }
diff --git a/source/blender/draw/engines/lanpr/lanpr_access.c 
b/source/blender/draw/engines/lanpr/lanpr_access.c
index 4c380623485..3d3af4352e0 100644
--- a/source/blender/draw/engines/lanpr/lanpr_access.c
+++ b/source/blender/draw/engines/lanpr/lanpr_access.c
@@ -82,7 +82,7 @@ void lanpr_generate_gpencil_from_chain(Depsgraph *depsgraph,
 if (!rlc->object_ref) {
   continue; /* intersection lines are lost! */
 }
-if(!(rlc->type & types)){
+if (!(rlc->type & types)) {
   continue;
 }
 if (rlc->level > qi_end || rlc->level < qi_begin) {
diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c 
b/source/blender/draw/engines/lanpr/lanpr_chain.c
index ddb9acd..eaecdc04609 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain.c
@@ -53,7 +53,7 @@ LANPR_RenderLine 
*lanpr_get_connected_render_line(LANPR_BoundingArea *ba,
   continue;
 }
 
-if(match_flag && ((nrl->flags & LANPR_EDGE_FLAG_ALL_TYPE)&match_flag)==0){
+if (match_flag && ((nrl->flags & LANPR_EDGE_FLAG_ALL_TYPE) & match_flag) 
== 0) {
   continue;
 }
 
@@ -265,7 +265,7 @@ void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer 
*rb)
N,
rl->flags,
rls->occlusion);
-while (ba && (new_rl = lanpr_get_connected_render_line(ba, new_rv, 
&new_rv,rl->flags))) {
+while (ba && (new_rl = lanpr_get_connected_render_line(ba, new_rv, 
&new_rv, rl->flags))) {
   new_rl->flags |= LANPR_EDGE_FLAG_CHAIN_PICKED;
 
   N[0] = N[1] = N[2] = 0;
@@ -363,7 +363,7 @@ void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer 
*rb)
 /*  below already done in step 2 */
 /*  
lanpr_push_render_line_chain_point(rb,rlc,new_rv->fbcoord[0],new_rv->fbcoord[1],rl->flags,0);
  */
-while (ba && (new_rl = lanpr_get_connected_render_line(ba, new_rv, 
&new_rv,rl->flags))) {
+while (ba && (new_rl = lanpr_get_connected_render_line(ba, new_rv, 
&new_rv, rl->flags))) {
   new_rl->flags |= LANPR_EDGE_FLAG_CHAIN_PICKED;
 
   /*  fix leading vertex type */
@@ -641,7 +641,7 @@ void lanpr_connect_chains(LANPR_RenderBuffer *rb, int 
do_geometry_space)
   continue;
 }
 if (cre->rlc == rlc ||
-((LANPR_RenderLineChainItem *)cre->rlc->chain.first)->occlusion != 
occlusion||
+((LANPR_RenderLineChainItem *)cre->rlc->chain.first)->occlusion != 
occlusion ||
 (cre->rlc->type != rlc->type)) {
   continue;
 }
@@ -688,7 +688,7 @@ void lanpr_connect_chains(LANPR_RenderBuffer *rb

[Bf-blender-cvs] [2d247cbda1d] soc-2019-npr: LANPR: GP stroke bake function.

2019-06-27 Thread YimingWu
Commit: 2d247cbda1d66c4e3e85d5d6a8fb1b6b5163906d
Author: YimingWu
Date:   Thu Jun 27 15:48:54 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB2d247cbda1d66c4e3e85d5d6a8fb1b6b5163906d

LANPR: GP stroke bake function.

===

M   source/blender/draw/engines/lanpr/lanpr_ops.c
M   source/blender/editors/render/render_intern.h
M   source/blender/editors/render/render_ops.c

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c 
b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 97bbc797c32..56596ec853a 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -4542,6 +4542,32 @@ int lanpr_update_gp_strokes_exec(struct bContext *C, 
struct wmOperator *op)
 
   lanpr_update_gp_strokes_collection(dg, scene->master_collection, frame);
 
+  return OPERATOR_FINISHED;
+}
+int lanpr_bake_gp_strokes_exec(struct bContext *C, struct wmOperator *op)
+{
+  Scene *scene = CTX_data_scene(C);
+  Depsgraph *dg = CTX_data_depsgraph(C);
+  SceneLANPR *lanpr = &scene->lanpr;
+  int frame, current_frame = scene->r.cfra;
+  int frame_begin = scene->r.sfra;
+  int frame_end = scene->r.efra;
+
+  for(frame = frame_begin;frame<=frame_end;frame++){
+//BKE_scene_frame_set(scene,frame);
+DEG_evaluate_on_framechange(CTX_data_main(C),dg,frame);
+
+lanpr_compute_feature_lines_internal(dg);
+
+lanpr_chain_clear_picked_flag(lanpr_share.render_buffer_shared);
+
+lanpr_update_gp_strokes_recursive(dg, scene->master_collection, frame);
+
+lanpr_update_gp_strokes_collection(dg, scene->master_collection, frame);
+  }
+
+  
+
   return OPERATOR_FINISHED;
 }
 
@@ -4639,3 +4665,13 @@ void SCENE_OT_lanpr_update_gp_strokes(struct 
wmOperatorType *ot)
 
   ot->exec = lanpr_update_gp_strokes_exec;
 }
+
+void SCENE_OT_lanpr_bake_gp_strokes(struct wmOperatorType *ot)
+{
+  ot->name = "Bake LANPR Strokes";
+  ot->description = "Bake strokes for LANPR grease pencil targets in all 
frames";
+  ot->idname = "SCENE_OT_lanpr_bake_gp_strokes";
+
+  ot->exec = lanpr_bake_gp_strokes_exec;
+}
+
diff --git a/source/blender/editors/render/render_intern.h 
b/source/blender/editors/render/render_intern.h
index fe04b2a420c..5b9f648e1d3 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -85,6 +85,7 @@ void SCENE_OT_lanpr_add_line_component(struct wmOperatorType 
*ot);
 void SCENE_OT_lanpr_delete_line_component(struct wmOperatorType *ot);
 void SCENE_OT_lanpr_enable_all_line_types(struct wmOperatorType *ot);
 void SCENE_OT_lanpr_update_gp_strokes(struct wmOperatorType *ot);
+void SCENE_OT_lanpr_bake_gp_strokes(struct wmOperatorType *ot);
 
 void TEXTURE_OT_slot_copy(struct wmOperatorType *ot);
 void TEXTURE_OT_slot_paste(struct wmOperatorType *ot);
diff --git a/source/blender/editors/render/render_ops.c 
b/source/blender/editors/render/render_ops.c
index 853b8cd8cf7..bfeb2c215ce 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -90,6 +90,7 @@ void ED_operatortypes_render(void)
   WM_operatortype_append(SCENE_OT_lanpr_delete_line_component);
   WM_operatortype_append(SCENE_OT_lanpr_enable_all_line_types);
   WM_operatortype_append(SCENE_OT_lanpr_update_gp_strokes);
+  WM_operatortype_append(SCENE_OT_lanpr_bake_gp_strokes);
 
   WM_operatortype_append(TEXTURE_OT_slot_copy);
   WM_operatortype_append(TEXTURE_OT_slot_paste);

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


[Bf-blender-cvs] [0ce9471b492] soc-2019-npr: LANPR: Fixed an accidental if() bracket error in lanpr_line_crosses_bounding_area().

2019-06-27 Thread YimingWu
Commit: 0ce9471b49240778f0c8a586f9e5ac8a794b001d
Author: YimingWu
Date:   Thu Jun 27 16:03:56 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB0ce9471b49240778f0c8a586f9e5ac8a794b001d

LANPR: Fixed an accidental if() bracket error in 
lanpr_line_crosses_bounding_area().

===

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 56596ec853a..053ef534e50 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -327,9 +327,11 @@ int lanpr_line_crosses_bounding_area(LANPR_RenderBuffer 
*fb,
   if (((converted[0] = (real)ba->l) > MAX2(l[0], r[0])) ||
   ((converted[1] = (real)ba->r) < MIN2(l[0], r[0])) ||
   ((converted[2] = (real)ba->b) > MAX2(l[1], r[1])) ||
-  ((converted[3] = (real)ba->u) < MIN2(l[1], r[1])))
+  ((converted[3] = (real)ba->u) < MIN2(l[1], r[1]))){
+return 0;
+  }
 
-vx = l[0] - r[0];
+  vx = l[0] - r[0];
   vy = l[1] - r[1];
 
   c1 = vx * (converted[2] - l[1]) - vy * (converted[0] - l[0]);
@@ -375,19 +377,22 @@ int 
lanpr_triangle_covers_bounding_area(LANPR_RenderBuffer *fb,
 
   if ((FBC1[0] >= p1[0] && FBC1[0] <= p2[0] && FBC1[1] >= p1[1] && FBC1[1] <= 
p3[1]) ||
   (FBC2[0] >= p1[0] && FBC2[0] <= p2[0] && FBC2[1] >= p1[1] && FBC2[1] <= 
p3[1]) ||
-  (FBC3[0] >= p1[0] && FBC3[0] <= p2[0] && FBC3[1] >= p1[1] && FBC3[1] <= 
p3[1]))
+  (FBC3[0] >= p1[0] && FBC3[0] <= p2[0] && FBC3[1] >= p1[1] && FBC3[1] <= 
p3[1])){
 return 1;
+  }
 
   if (lanpr_point_inside_triangled(p1, FBC1, FBC2, FBC3) ||
   lanpr_point_inside_triangled(p2, FBC1, FBC2, FBC3) ||
   lanpr_point_inside_triangled(p3, FBC1, FBC2, FBC3) ||
-  lanpr_point_inside_triangled(p4, FBC1, FBC2, FBC3))
+  lanpr_point_inside_triangled(p4, FBC1, FBC2, FBC3)){
 return 1;
+  }
 
   if ((lanpr_line_crosses_bounding_area(fb, FBC1, FBC2, ba)) ||
   (lanpr_line_crosses_bounding_area(fb, FBC2, FBC3, ba)) ||
-  (lanpr_line_crosses_bounding_area(fb, FBC3, FBC1, ba)))
+  (lanpr_line_crosses_bounding_area(fb, FBC3, FBC1, ba))){
 return 1;
+  }
 
   return 0;
 }

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


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

2019-06-27 Thread Jacques Lucke
Commit: 40a2f975dca5df8b0284cb062b1143db6571d63e
Author: Jacques Lucke
Date:   Thu Jun 27 10:02:07 2019 +0200
Branches: functions
https://developer.blender.org/rB40a2f975dca5df8b0284cb062b1143db6571d63e

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] [3366b333e49] master: Fix switching tools with multiple windows & gizmos

2019-06-27 Thread Campbell Barton
Commit: 3366b333e49dd0623c3c68c2c04aac66e5028be9
Author: Campbell Barton
Date:   Thu Jun 27 17:22:05 2019 +1000
Branches: master
https://developer.blender.org/rB3366b333e49dd0623c3c68c2c04aac66e5028be9

Fix switching tools with multiple windows & gizmos

The gizmo would only added if the gizmo type wasn't already linked.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c 
b/source/blender/windowmanager/intern/wm_toolsystem.c
index 51b44b630cf..f40ea55ee82 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -177,7 +177,12 @@ static void toolsystem_ref_link(bContext *C, WorkSpace 
*workspace, bToolRef *tre
 wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
 if (gzgt != NULL) {
   if ((gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) == 0) {
-WM_gizmo_group_type_ensure_ptr(gzgt);
+if (!WM_gizmo_group_type_ensure_ptr(gzgt)) {
+  /* Even if the group-type was has been linked, it's possible the 
space types
+   * were not previously using it. (happens with multiple windows.) */
+  wmGizmoMapType *gzmap_type = 
WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+  WM_gizmoconfig_update_tag_init(gzmap_type, gzgt);
+}
   }
 }
 else {

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