[Bf-blender-cvs] [a897c8e342f] master: Fix unreported: length measure displayed on the "Sequence Slide" operator panel

2019-08-01 Thread mano-wii
Commit: a897c8e342f46d0fe40711796f496102957bab2b
Author: mano-wii
Date:   Fri Aug 2 01:49:41 2019 -0300
Branches: master
https://developer.blender.org/rBa897c8e342f46d0fe40711796f496102957bab2b

Fix unreported: length measure displayed on the "Sequence Slide" operator panel

===

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

===

diff --git a/source/blender/editors/transform/transform_ops.c 
b/source/blender/editors/transform/transform_ops.c
index c6c2a441d94..5e9add74b42 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -1140,8 +1140,12 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType 
*ot)
   ot->cancel = transform_cancel;
   ot->poll = ED_operator_sequencer_active;
 
-  RNA_def_float_vector_xyz(
+  /* properties */
+  PropertyRNA *prop;
+
+  prop = RNA_def_float_vector(
   ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, 
FLT_MAX);
+  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
 
   WM_operatortype_props_advanced_begin(ot);

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


[Bf-blender-cvs] [2074d850ee5] master: Docs: correct comment for PROP_THICK_WRAP

2019-08-01 Thread Campbell Barton
Commit: 2074d850ee5878c6eefd134536d136f8c555df83
Author: Campbell Barton
Date:   Fri Aug 2 13:12:07 2019 +1000
Branches: master
https://developer.blender.org/rB2074d850ee5878c6eefd134536d136f8c555df83

Docs: correct comment for PROP_THICK_WRAP

===

M   source/blender/makesrna/RNA_types.h

===

diff --git a/source/blender/makesrna/RNA_types.h 
b/source/blender/makesrna/RNA_types.h
index c6f1fd337ed..39889f77a96 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -253,8 +253,13 @@ typedef enum PropertyFlag {
   PROP_REGISTER_OPTIONAL = PROP_REGISTER | (1 << 5),
 
   /**
-   * Use for arrays or for any data that should not have a reference kept
-   * most common case is functions that return arrays where the array.
+   * Use for allocated function return values of arrays or strings
+   * for any data that should not have a reference kept.
+   *
+   * It can be used for properties which are dynamically allocated too.
+   *
+   * \note Currently dynamic sized thick wrapped data isn't supported.
+   * This would be a useful addition and avoid a fixed maximum sized as in 
done at the moment.
*/
   PROP_THICK_WRAP = (1 << 23),

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


[Bf-blender-cvs] [81dc76c19cf] master: Fix T63570: Proportional editing resets scaling along Y and Z axis on mouse wheel

2019-08-01 Thread mano-wii
Commit: 81dc76c19cff51c9c1d13ab47cbfc9a855fc3263
Author: mano-wii
Date:   Fri Aug 2 01:15:33 2019 -0300
Branches: master
https://developer.blender.org/rB81dc76c19cff51c9c1d13ab47cbfc9a855fc3263

Fix T63570: Proportional editing resets scaling along Y and Z axis on mouse 
wheel

`applyResize(...)` considers that `t->values` always represents a `ratio`.
But this is only `true` with the `MOUSEMOVE` event.
The solution proposed is to never change `t->values`.
The result of the final transformation is now written to `t->values_final`.

Reviewers: campbellbarton

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

===

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

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 5ef86c71d2d..973c1c0b7f7 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2093,15 +2093,11 @@ void saveTransform(bContext *C, TransInfo *t, 
wmOperator *op)
   }
 
   if ((prop = RNA_struct_find_property(op->ptr, "value"))) {
-float values[4];
-
-copy_v4_v4(values, (t->flag & T_AUTOVALUES) ? t->auto_values : t->values);
-
 if (RNA_property_array_check(prop)) {
-  RNA_property_float_set_array(op->ptr, prop, values);
+  RNA_property_float_set_array(op->ptr, prop, t->values_final);
 }
 else {
-  RNA_property_float_set(op->ptr, prop, values[0]);
+  RNA_property_float_set(op->ptr, prop, t->values_final[0]);
 }
   }
 
@@ -2488,8 +2484,8 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
   t->redraw = TREDRAW_HARD;
 }
 else {
-  copy_v4_v4(t->auto_values, values);
-  t->flag |= T_AUTOVALUES;
+  copy_v4_v4(t->values, values);
+  t->flag |= T_INPUT_IS_VALUES_FINAL;
 }
   }
 
@@ -3374,7 +3370,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
 values.scale = values.scale / data->warp_init_dist;
   }
 
-  copy_v2_v2(t->values, values.vector);
+  copy_v2_v2(t->values_final, values.vector);
 
   /* header print for NumInput */
   if (hasNumInput(>num)) {
@@ -3615,7 +3611,7 @@ static void applyShear(TransInfo *t, const int 
UNUSED(mval[2]))
 
   applyNumInput(>num, );
 
-  t->values[0] = value;
+  t->values_final[0] = value;
 
   /* header print for NumInput */
   if (hasNumInput(>num)) {
@@ -3946,10 +3942,10 @@ static void ElementResize(TransInfo *t, 
TransDataContainer *tc, TransData *td, f
 
 /* scale stroke thickness */
 if (td->val) {
-  snapGridIncrement(t, t->values);
-  applyNumInput(>num, t->values);
+  snapGridIncrement(t, t->values_final);
+  applyNumInput(>num, t->values_final);
 
-  float ratio = t->values[0];
+  float ratio = t->values_final[0];
   *td->val = td->ival * ratio * gps->runtime.multi_frame_falloff;
   CLAMP_MIN(*td->val, 0.001f);
 }
@@ -3976,24 +3972,24 @@ static void applyResize(TransInfo *t, const int 
UNUSED(mval[2]))
   int i;
   char str[UI_MAX_DRAW_STR];
 
-  if (t->flag & T_AUTOVALUES) {
-copy_v3_v3(t->values, t->auto_values);
+  if (t->flag & T_INPUT_IS_VALUES_FINAL) {
+copy_v3_v3(t->values_final, t->values);
   }
   else {
 float ratio = t->values[0];
 
-copy_v3_fl(t->values, ratio);
+copy_v3_fl(t->values_final, ratio);
 
-snapGridIncrement(t, t->values);
+snapGridIncrement(t, t->values_final);
 
-if (applyNumInput(>num, t->values)) {
-  constraintNumInput(t, t->values);
+if (applyNumInput(>num, t->values_final)) {
+  constraintNumInput(t, t->values_final);
 }
 
-applySnapping(t, t->values);
+applySnapping(t, t->values_final);
   }
 
-  size_to_mat3(mat, t->values);
+  size_to_mat3(mat, t->values_final);
   if (t->con.mode & CON_APPLY) {
 t->con.applySize(t, NULL, NULL, mat);
 
@@ -4002,16 +3998,16 @@ static void applyResize(TransInfo *t, const int 
UNUSED(mval[2]))
 int j = 0;
 for (i = 0; i < 3; i++) {
   if (!(t->con.mode & (CON_AXIS0 << i))) {
-t->values[i] = 1.0f;
+t->values_final[i] = 1.0f;
   }
   else {
-pvec[j++] = t->values[i];
+pvec[j++] = t->values_final[i];
   }
 }
 headerResize(t, pvec, str);
   }
   else {
-headerResize(t, t->values, str);
+headerResize(t, t->values_final, str);
   }
 
   copy_m3_m3(t->mat, mat);  // used in gizmo
@@ -4032,8 +4028,8 @@ static void applyResize(TransInfo *t, const int 
UNUSED(mval[2]))
   }
 
   /* evil hack - redo resize if cliping needed */
-  if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 1)) {
-size_to_mat3(mat, t->values);
+  if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values_final, 1)) {
+size_to_mat3(mat, t->values_final);
 
  

[Bf-blender-cvs] [14b2c41216e] master: Cleanup: doxy sections

2019-08-01 Thread Campbell Barton
Commit: 14b2c41216e86a95572aa0c607fd8807da59baea
Author: Campbell Barton
Date:   Fri Aug 2 12:25:39 2019 +1000
Branches: master
https://developer.blender.org/rB14b2c41216e86a95572aa0c607fd8807da59baea

Cleanup: doxy sections

===

M   source/blender/editors/armature/armature_relations.c
M   source/blender/python/gpu/gpu_py_shader.c
M   source/blender/python/gpu/gpu_py_types.c
M   source/blender/render/intern/source/render_texture.c
M   source/blender/windowmanager/intern/wm_files.c
M   source/creator/creator_args.c

===

diff --git a/source/blender/editors/armature/armature_relations.c 
b/source/blender/editors/armature/armature_relations.c
index 8722e575d15..b3588404cf2 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -64,8 +64,11 @@
 
 #include "armature_intern.h"
 
-/* *** Join 
*** */
-/* NOTE: no operator define here as this is exported to the Object-level 
operator */
+/*  */
+/** \name Edit Armature Join
+ *
+ * \note No operator define here as this is exported to the Object-level 
operator.
+ * \{ */
 
 static void joined_armature_fix_links_constraints(Main *bmain,
   Object *ob,
@@ -434,7 +437,11 @@ int join_armature_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-/* *** Separate 
*** */
+/** \} */
+
+/*  */
+/** \name Edit Armature Separate
+ * \{ */
 
 /* Helper function for armature separating - link fixing */
 static void separated_armature_fix_links(Main *bmain, Object *origArm, Object 
*newArm)
@@ -712,7 +719,11 @@ void ARMATURE_OT_separate(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-/* * Parenting 
* */
+/** \} */
+
+/*  */
+/** \name Edit Armature Parenting
+ * \{ */
 
 /* armature parenting options */
 #define ARM_PAR_CONNECT 1
@@ -1007,3 +1018,5 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
   "ClearType",
   "What way to clear parenting");
 }
+
+/** \} */
diff --git a/source/blender/python/gpu/gpu_py_shader.c 
b/source/blender/python/gpu/gpu_py_shader.c
index 5d6989af4c3..cccf75513f9 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -37,7 +37,6 @@
 #include "gpu_py_vertex_format.h"
 
 /*  */
-
 /** \name Enum Conversion.
  * \{ */
 
diff --git a/source/blender/python/gpu/gpu_py_types.c 
b/source/blender/python/gpu/gpu_py_types.c
index f7909e38f7b..165af47b4b8 100644
--- a/source/blender/python/gpu/gpu_py_types.c
+++ b/source/blender/python/gpu/gpu_py_types.c
@@ -29,7 +29,6 @@
 #include "gpu_py_types.h" /* own include */
 
 /*  */
-
 /** \name GPU Types Module
  * \{ */
 
diff --git a/source/blender/render/intern/source/render_texture.c 
b/source/blender/render/intern/source/render_texture.c
index 67555b70be2..be53a1cb067 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -896,8 +896,6 @@ static int cubemap_glob(const float n[3], float x, float y, 
float z, float *adr1
 
 /* - */
 
-/* - */
-
 static void do_2d_mapping(
 const MTex *mtex, float texvec[3], const float n[3], float dxt[3], float 
dyt[3])
 {
diff --git a/source/blender/windowmanager/intern/wm_files.c 
b/source/blender/windowmanager/intern/wm_files.c
index 10773cf58e1..6a5800f4288 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1061,6 +1061,7 @@ void wm_homefile_read(bContext *C,
   }
 }
 
+/*  */
 /** \name WM History File API
  * \{ */
 
@@ -1189,6 +1190,10 @@ static void wm_history_file_update(void)
 
 /** \} */
 
+/*  */
+/** \name Save Main .blend File (internal)
+ * \{ */
+
 /* screen can be NULL */
 static ImBuf *blend_file_thumb(const bContext *C,
Scene *scene,
@@ -1422,7 +1427,11 @@ static bool wm_file_write(bContext *C, const char 
*filepath, int fileflags, Repo
   return ok;

[Bf-blender-cvs] [c060a835bbc] master: Fix unreported: Selection of mesh_cage element occluded by the mesh_cage itself.

2019-08-01 Thread mano-wii
Commit: c060a835bbcdc994e77460ae69d2fd2ecfc249ab
Author: mano-wii
Date:   Thu Aug 1 23:18:44 2019 -0300
Branches: master
https://developer.blender.org/rBc060a835bbcdc994e77460ae69d2fd2ecfc249ab

Fix unreported: Selection of mesh_cage element occluded by the mesh_cage itself.

The right thing is to be occluded by the visible mesh (in the case with 
modifiers).

===

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

===

diff --git a/source/blender/draw/engines/select/select_draw_utils.c 
b/source/blender/draw/engines/select/select_draw_utils.c
index 745c55405de..026fd52aa58 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -90,9 +90,10 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList 
*stl,
 
   BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
 
-  struct GPUBatch *geom_faces = 
DRW_mesh_batch_cache_get_triangles_with_select_id(me);
+  struct GPUBatch *geom_faces;
   DRWShadingGroup *face_shgrp;
   if (select_mode & SCE_SELECT_FACE) {
+geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
 face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat);
 DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int 
*)_offset);
 
@@ -103,6 +104,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList 
*stl,
 *r_face_offset = initial_offset + em->bm->totface;
   }
   else {
+geom_faces = DRW_mesh_batch_cache_get_surface(me);
 face_shgrp = stl->g_data->shgrp_face_unif;
 DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0);
 *r_face_offset = initial_offset;

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


[Bf-blender-cvs] [58a2b2dd7e7] master: Cleanup: spelling

2019-08-01 Thread Campbell Barton
Commit: 58a2b2dd7e733766514e207bb876ad2c3391b107
Author: Campbell Barton
Date:   Fri Aug 2 12:00:07 2019 +1000
Branches: master
https://developer.blender.org/rB58a2b2dd7e733766514e207bb876ad2c3391b107

Cleanup: spelling

===

M   intern/cycles/blender/blender_session.cpp
M   source/blender/blenkernel/intern/anim_sys.c
M   source/blender/blenkernel/intern/mesh_convert.c
M   source/blender/blenkernel/intern/rigidbody.c
M   source/blender/collada/AnimationExporter.cpp
M   source/blender/collada/AnimationImporter.cpp
M   source/blender/compositor/intern/COM_ExecutionGroup.h
M   source/blender/compositor/intern/COM_ExecutionSystem.h
M   source/blender/compositor/operations/COM_BokehImageOperation.h
M   source/blender/editors/sound/sound_ops.c
M   source/blender/modifiers/intern/MOD_laplaciandeform.c
M   source/blender/modifiers/intern/MOD_screw.c

===

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index dcbb101b01d..d38a97dc4ea 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -527,7 +527,7 @@ void BlenderSession::render(BL::Depsgraph _depsgraph_)
 builtin_images_load();
 
 /* Attempt to free all data which is held by Blender side, since at this
- * point we knwo that we've got everything to render current view layer.
+ * point we know that we've got everything to render current view layer.
  */
 /* At the moment we only free if we are not doing multi-view
  * (or if we are rendering the last view). See T58142/D4239 for discussion.
diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 26a2018f015..1a34c5376f6 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -3940,7 +3940,7 @@ void BKE_animsys_evaluate_all_animation(Main *main,
* - this is like EVAL_ANIM_IDS, but this handles the case "embedded 
nodetrees"
*   (i.e. scene/material/texture->nodetree) which we need a special 
exception
*   for, otherwise they'd get skipped
-   * - ntp = "node tree parent" = data-block where node tree stuff resides
+   * - 'ntp' stands for "node tree parent" = data-block where node tree stuff 
resides
*/
 #define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
   for (id = first; id; id = id->next) { \
diff --git a/source/blender/blenkernel/intern/mesh_convert.c 
b/source/blender/blenkernel/intern/mesh_convert.c
index fec83ebc899..ae9cf874676 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1233,14 +1233,14 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
   BKE_library_foreach_ID_link(
   NULL, >id, foreach_libblock_make_original_callback, NULL, 
IDWALK_NOP);
 
-  /* Append the mesh to bmain.
-   * We do it a bit longer way since there is no simple and clear way of 
adding existing datablock
-   * to the bmain. So we allocate new empty mesh in the bmain (which 
guarantess all the naming and
-   * orders and flags) and move the temporary mesh in place there. */
+  /* Append the mesh to 'bmain'.
+   * We do it a bit longer way since there is no simple and clear way of 
adding existing data-block
+   * to the 'bmain'. So we allocate new empty mesh in the 'bmain' (which 
guarantees all the naming
+   * and orders and flags) and move the temporary mesh in place there. */
   Mesh *mesh_in_bmain = BKE_mesh_add(bmain, mesh->id.name + 2);
 
   /* NOTE: BKE_mesh_nomain_to_mesh() does not copy materials and instead it 
preserves them in the
-   * destinaion mesh. So we "steal" all related fields before calling it.
+   * destination mesh. So we "steal" all related fields before calling it.
*
* TODO(sergey): We really better have a function which gets and ID and 
accepts it for the bmain.
*/
diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index c9b18dfc7e6..ec73406c14c 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1607,7 +1607,7 @@ static void rigidbody_update_sim_ob(
 
   /* create dummy 'point' which represents last known position of object 
as result of sim */
   /* XXX: this can create some inaccuracies with sim position,
-   * but is probably better than using unsimulated vals? */
+   * but is probably better than using un-simulated values? */
   RB_body_get_position(rbo->shared->physics_object, eff_loc);
   RB_body_get_linear_velocity(rbo->shared->physics_object, eff_vel);
 
diff --git a/source/blender/collada/AnimationExporter.cpp 
b/source/blender/collada/AnimationExporter.cpp
index a2c629bd0f1..a15c215d2e2 100644
--- 

[Bf-blender-cvs] [9be956c326d] master: Cleanup: unused variable

2019-08-01 Thread Campbell Barton
Commit: 9be956c326d4cc68cf93a08fb8c8c7e09dcd5eb7
Author: Campbell Barton
Date:   Fri Aug 2 12:04:59 2019 +1000
Branches: master
https://developer.blender.org/rB9be956c326d4cc68cf93a08fb8c8c7e09dcd5eb7

Cleanup: unused variable

===

M   source/blender/editors/space_view3d/view3d_draw_legacy.c

===

diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c 
b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 3fdc17c571e..39cbc67f996 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -155,12 +155,8 @@ void ED_view3d_clipping_enable(void)
 /**
  * \note Only use in object mode.
  */
-static void validate_object_select_id(struct Depsgraph *depsgraph,
-  Scene *scene,
-  ViewLayer *view_layer,
-  ARegion *ar,
-  View3D *v3d,
-  Object *obact)
+static void validate_object_select_id(
+struct Depsgraph *depsgraph, ViewLayer *view_layer, ARegion *ar, View3D 
*v3d, Object *obact)
 {
   Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
 
@@ -223,8 +219,7 @@ void ED_view3d_select_id_validate(ViewContext *vc)
   /* TODO: Create a flag in `DRW_manager` because the drawing is no longer
*   made on the backbuffer in this case. */
   if (vc->v3d->flag & V3D_INVALID_BACKBUF) {
-validate_object_select_id(
-vc->depsgraph, vc->scene, vc->view_layer, vc->ar, vc->v3d, vc->obact);
+validate_object_select_id(vc->depsgraph, vc->view_layer, vc->ar, vc->v3d, 
vc->obact);
   }
 }

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


[Bf-blender-cvs] [abebb276448] master: DRW: Select Engine: remove unnecessary DRWShadingGroup creations

2019-08-01 Thread mano-wii
Commit: abebb27644813c8ccda6555c6cdd8b60b58a0930
Author: mano-wii
Date:   Thu Aug 1 22:24:07 2019 -0300
Branches: master
https://developer.blender.org/rBabebb27644813c8ccda6555c6cdd8b60b58a0930

DRW: Select Engine: remove unnecessary DRWShadingGroup creations

===

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

===

diff --git a/source/blender/draw/engines/select/select_draw_utils.c 
b/source/blender/draw/engines/select/select_draw_utils.c
index 08c6c2ac865..2da61c835d8 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -84,9 +84,8 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList 
*stl,
 *r_face_offset = initial_offset + em->bm->totface;
   }
   else {
-face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif);
+face_shgrp = stl->g_data->shgrp_face_unif;
 DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0);
-
 *r_face_offset = initial_offset;
   }
   DRW_shgroup_call(face_shgrp, geom_faces, ob);
@@ -137,7 +136,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
   }
   else {
 /* Only draw faces to mask out verts, we don't want their selection ID's. 
*/
-face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_unif);
+face_shgrp = stl->g_data->shgrp_face_unif;
 DRW_shgroup_uniform_int_copy(face_shgrp, "id", 0);
 *r_face_offset = initial_offset;
   }

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


[Bf-blender-cvs] [eff91da4dfb] master: DRW: Select Engine: Use specified offset.

2019-08-01 Thread mano-wii
Commit: eff91da4dfb602dddc092bfe125e96f97f815e76
Author: mano-wii
Date:   Thu Aug 1 22:27:04 2019 -0300
Branches: master
https://developer.blender.org/rBeff91da4dfb602dddc092bfe125e96f97f815e76

DRW: Select Engine: Use specified offset.

Due to current uses, this does not bring functional changes.

===

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

===

diff --git a/source/blender/draw/engines/select/select_draw_utils.c 
b/source/blender/draw/engines/select/select_draw_utils.c
index 2da61c835d8..241a05d0feb 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -156,7 +156,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
   if (select_mode & SCE_SELECT_VERTEX) {
 struct GPUBatch *geom_verts = 
DRW_mesh_batch_cache_get_verts_with_select_id(me);
 DRWShadingGroup *vert_shgrp = 
DRW_shgroup_create_sub(stl->g_data->shgrp_vert);
-DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", 1);
+DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", *r_edge_offset);
 DRW_shgroup_call(vert_shgrp, geom_verts, ob);
 *r_vert_offset = *r_edge_offset + me->totvert;
   }

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


[Bf-blender-cvs] [65b6d4a34dd] master: Edit Mesh Select: Remove redundant and deprecated `FAKE_SELECT_MODE_...`

2019-08-01 Thread mano-wii
Commit: 65b6d4a34dd8d3572f95a35a468c51c9cc6b2868
Author: mano-wii
Date:   Thu Aug 1 22:58:46 2019 -0300
Branches: master
https://developer.blender.org/rB65b6d4a34dd8d3572f95a35a468c51c9cc6b2868

Edit Mesh Select: Remove redundant and deprecated `FAKE_SELECT_MODE_...`

===

M   source/blender/editors/mesh/editmesh_select.c

===

diff --git a/source/blender/editors/mesh/editmesh_select.c 
b/source/blender/editors/mesh/editmesh_select.c
index 12b5a36c510..844811390ea 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -238,20 +238,6 @@ static BMElem *edbm_select_id_bm_elem_get(Base **bases, 
const uint sel_id, uint
  * to avoid the bias interfering with distance comparisons when mixing types.
  * \{ */
 
-#define FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, 
select_mode_required) \
-  short select_mode = select_mode_required; \
-  bool fake_select_mode = (select_mode & 
(vc)->scene->toolsettings->selectmode) == 0; \
-  if (fake_select_mode) { \
-(vc)->v3d->flag |= V3D_INVALID_BACKBUF; \
-  } \
-  ((void)0)
-
-#define FAKE_SELECT_MODE_END(vc, fake_select_mode) \
-  if (fake_select_mode) { \
-(vc)->v3d->flag |= V3D_INVALID_BACKBUF; \
-  } \
-  ((void)0)
-
 #define FIND_NEAR_SELECT_BIAS 5
 #define FIND_NEAR_CYCLE_THRESHOLD_MIN 3
 
@@ -331,9 +317,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
 
 /* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs 
indices are bad. */
 {
-  FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, 
SCE_SELECT_VERTEX);
-
-  DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, 
select_mode);
+  DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, 
SCE_SELECT_VERTEX);
 
   index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, 
_px);
 
@@ -343,8 +327,6 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
   else {
 eve = NULL;
   }
-
-  FAKE_SELECT_MODE_END(vc, fake_select_mode);
 }
 
 if (eve) {
@@ -557,9 +539,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
 
 /* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs 
indices are bad. */
 {
-  FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, 
SCE_SELECT_EDGE);
-
-  DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, 
select_mode);
+  DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, 
SCE_SELECT_EDGE);
 
   index = ED_select_buffer_find_nearest_to_point(vc->mval, 1, UINT_MAX, 
_px);
 
@@ -569,8 +549,6 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
   else {
 eed = NULL;
   }
-
-  FAKE_SELECT_MODE_END(vc, fake_select_mode);
 }
 
 if (r_eed_zbuf) {
@@ -767,9 +745,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
 BMFace *efa;
 
 {
-  FAKE_SELECT_MODE_BEGIN(vc, fake_select_mode, select_mode, 
SCE_SELECT_FACE);
-
-  DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, 
select_mode);
+  DRW_draw_select_id(vc->depsgraph, vc->ar, vc->v3d, bases, bases_len, 
SCE_SELECT_FACE);
 
   index = ED_select_buffer_sample_point(vc->mval);
 
@@ -779,8 +755,6 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
   else {
 efa = NULL;
   }
-
-  FAKE_SELECT_MODE_END(vc, fake_select_mode);
 }
 
 if (r_efa_zbuf) {

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


[Bf-blender-cvs] [53a09166369] master: DRW: Select Engine: Add a utility to detect `select_node`

2019-08-01 Thread mano-wii
Commit: 53a091663694a8d24e6b97d269f5e21b980bd6a1
Author: mano-wii
Date:   Thu Aug 1 23:00:16 2019 -0300
Branches: master
https://developer.blender.org/rB53a091663694a8d24e6b97d269f5e21b980bd6a1

DRW: Select Engine: Add a utility to detect `select_node`

===

M   source/blender/draw/engines/select/select_draw_utils.c
M   source/blender/draw/engines/select/select_engine.c
M   source/blender/draw/engines/select/select_private.h
M   source/blender/editors/space_view3d/view3d_draw_legacy.c
M   source/blender/editors/space_view3d/view3d_select.c

===

diff --git a/source/blender/draw/engines/select/select_draw_utils.c 
b/source/blender/draw/engines/select/select_draw_utils.c
index 241a05d0feb..745c55405de 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -40,6 +40,25 @@
 /** \name Draw Utilities
  * \{ */
 
+short select_id_get_object_select_mode(Scene *scene, Object *ob)
+{
+  short r_select_mode = 0;
+  if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | 
OB_MODE_TEXTURE_PAINT)) {
+Mesh *me_orig = DEG_get_original_object(ob)->data;
+if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) {
+  r_select_mode = SCE_SELECT_FACE;
+}
+if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) {
+  r_select_mode |= SCE_SELECT_VERTEX;
+}
+  }
+  else {
+r_select_mode = scene->toolsettings->selectmode;
+  }
+
+  return r_select_mode;
+}
+
 static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char 
dt)
 {
   if (select_mode & SCE_SELECT_FACE) {
@@ -189,16 +208,6 @@ void select_id_draw_object(void *vedata,
  r_face_offset);
   }
   else {
-if (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | 
OB_MODE_TEXTURE_PAINT)) {
-  Mesh *me_orig = DEG_get_original_object(ob)->data;
-  select_mode = 0;
-  if (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) {
-select_mode = SCE_SELECT_FACE;
-  }
-  if (me_orig->editflag & ME_EDIT_PAINT_VERT_SEL) {
-select_mode |= SCE_SELECT_VERTEX;
-  }
-}
 draw_select_id_mesh(
 stl, ob, select_mode, initial_offset, r_vert_offset, 
r_edge_offset, r_face_offset);
   }
diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index 68b4a8084f0..20b04d0a659 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -191,8 +191,7 @@ static void select_cache_populate(void *vedata, Object *ob)
   short select_mode = e_data.context.select_mode;
 
   if (select_mode == -1) {
-ToolSettings *ts = draw_ctx->scene->toolsettings;
-select_mode = ts->selectmode;
+select_mode = select_id_get_object_select_mode(draw_ctx->scene, ob);
   }
 
   struct BaseOffset *base_ofs =
diff --git a/source/blender/draw/engines/select/select_private.h 
b/source/blender/draw/engines/select/select_private.h
index 9b0addb0fb8..e2b5163c88a 100644
--- a/source/blender/draw/engines/select/select_private.h
+++ b/source/blender/draw/engines/select/select_private.h
@@ -79,6 +79,8 @@ struct BaseOffset {
   uint vert;
 };
 
+short select_id_get_object_select_mode(Scene *scene, Object *ob);
+
 void select_id_draw_object(void *vedata,
View3D *v3d,
Object *ob,
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c 
b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 4c03995307a..3fdc17c571e 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -188,8 +188,7 @@ static void validate_object_select_id(struct Depsgraph 
*depsgraph,
   }
 
   if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
-DRW_draw_select_id_object(
-depsgraph, view_layer, ar, v3d, obact, 
scene->toolsettings->selectmode);
+DRW_draw_select_id_object(depsgraph, view_layer, ar, v3d, obact, -1);
   }
 
   /* TODO: Create a flag in `DRW_manager` because the drawing is no longer
diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index 36eb07e9a2f..0fd76b2d6fd 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -220,12 +220,9 @@ static void editselect_buf_cache_init(struct 
EditSelectBuf_Cache *esel, ViewCont
   esel->bases_len = 0;
 }
   }
-  DRW_draw_select_id(vc->depsgraph,
- vc->ar,
- vc->v3d,
- esel->bases,
- esel->bases_len,
- vc->scene->toolsettings->selectmode);
+
+  

[Bf-blender-cvs] [7a47c0031fe] master: Cleanup: quiet maybe-unused warnings

2019-08-01 Thread Campbell Barton
Commit: 7a47c0031fe407123975ebaabfbe932dc1f077c0
Author: Campbell Barton
Date:   Fri Aug 2 11:18:07 2019 +1000
Branches: master
https://developer.blender.org/rB7a47c0031fe407123975ebaabfbe932dc1f077c0

Cleanup: quiet maybe-unused warnings

While harmless, use flow control that always sets the variable.

===

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

===

diff --git a/source/blender/editors/transform/transform_gizmo_2d.c 
b/source/blender/editors/transform/transform_gizmo_2d.c
index 1015b47c304..4ae64c7ca5f 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -114,6 +114,10 @@ static void gizmo2d_get_axis_color(const int axis_idx, 
float *r_col, float *r_co
 case MAN2D_AXIS_TRANS_Y:
   col_id = TH_AXIS_Y;
   break;
+default:
+  BLI_assert(0);
+  col_id = TH_AXIS_Y;
+  break;
   }
 
   UI_GetThemeColor4fv(col_id, r_col);

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


[Bf-blender-cvs] [ec131e2d537] master: Object Mode: add back non '_ex' versions of mode-switching functions

2019-08-01 Thread Campbell Barton
Commit: ec131e2d53770b44299ebb9bebcdf3130852ab5d
Author: Campbell Barton
Date:   Fri Aug 2 11:33:57 2019 +1000
Branches: master
https://developer.blender.org/rBec131e2d53770b44299ebb9bebcdf3130852ab5d

Object Mode: add back non '_ex' versions of mode-switching functions

While these aren't currently used, its strange to have
extended versions of a function without the non-extended versions
it also avoids callers needing to add them back if they need -
or duplicating the same boiler plate when calling the '_ex' versions.

Reverts 11da3b132aff1, 11da3b132aff1, adds depsgraph argument
so the caller is responsible for the evaluation state.

===

M   source/blender/editors/include/ED_object.h
M   source/blender/editors/object/object_modes.c
M   source/blender/editors/sculpt_paint/paint_vertex.c
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/editors/include/ED_object.h 
b/source/blender/editors/include/ED_object.h
index 5f9534a1f1c..3a74bdc59ff 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -166,11 +166,13 @@ void ED_object_vpaintmode_enter_ex(struct Main *bmain,
struct wmWindowManager *wm,
struct Scene *scene,
struct Object *ob);
+void ED_object_vpaintmode_enter(struct bContext *C, struct Depsgraph 
*depsgraph);
 void ED_object_wpaintmode_enter_ex(struct Main *bmain,
struct Depsgraph *depsgraph,
struct wmWindowManager *wm,
struct Scene *scene,
struct Object *ob);
+void ED_object_wpaintmode_enter(struct bContext *C, struct Depsgraph 
*depsgraph);
 
 void ED_object_vpaintmode_exit_ex(struct Object *ob);
 void ED_object_vpaintmode_exit(struct bContext *C);
@@ -183,10 +185,14 @@ void ED_object_sculptmode_enter_ex(struct Main *bmain,
struct Object *ob,
const bool force_dyntopo,
struct ReportList *reports);
+void ED_object_sculptmode_enter(struct bContext *C,
+struct Depsgraph *depsgraph,
+struct ReportList *reports);
 void ED_object_sculptmode_exit_ex(struct Main *bmain,
   struct Depsgraph *depsgraph,
   struct Scene *scene,
   struct Object *ob);
+void ED_object_sculptmode_exit(struct bContext *C, struct Depsgraph 
*depsgraph);
 
 void ED_object_location_from_view(struct bContext *C, float loc[3]);
 void ED_object_rotation_from_quat(float rot[3], const float quat[4], const 
char align_axis);
@@ -267,6 +273,7 @@ bool ED_object_mode_compat_set(struct bContext *C,
struct ReportList *reports);
 void ED_object_mode_toggle(struct bContext *C, eObjectMode mode);
 void ED_object_mode_set(struct bContext *C, eObjectMode mode);
+void ED_object_mode_exit(struct bContext *C, struct Depsgraph *depsgraph);
 
 bool ED_object_mode_generic_enter(struct bContext *C, eObjectMode object_mode);
 void ED_object_mode_generic_exit(struct Main *bmain,
diff --git a/source/blender/editors/object/object_modes.c 
b/source/blender/editors/object/object_modes.c
index 271d8effd30..80e7e6312aa 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -186,6 +186,19 @@ void ED_object_mode_set(bContext *C, eObjectMode mode)
   wm->op_undo_depth--;
 }
 
+void ED_object_mode_exit(bContext *C, Depsgraph *depsgraph)
+{
+  struct Main *bmain = CTX_data_main(C);
+  Scene *scene = CTX_data_scene(C);
+  ViewLayer *view_layer = CTX_data_view_layer(C);
+  FOREACH_OBJECT_BEGIN (view_layer, ob) {
+if (ob->mode & OB_MODE_ALL_MODE_DATA) {
+  ED_object_mode_generic_exit(bmain, depsgraph, scene, ob);
+}
+  }
+  FOREACH_OBJECT_END;
+}
+
 /** \} */
 
 /*  */
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index 9215a90c446..32b89f5676f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1171,11 +1171,28 @@ void ED_object_vpaintmode_enter_ex(
 {
   ed_vwpaintmode_enter_generic(bmain, depsgraph, wm, scene, ob, 
OB_MODE_VERTEX_PAINT);
 }
+void ED_object_vpaintmode_enter(struct bContext *C, Depsgraph *depsgraph)
+{
+  Main *bmain = CTX_data_main(C);
+  wmWindowManager *wm = CTX_wm_manager(C);
+  Scene *scene = CTX_data_scene(C);
+  Object *ob = CTX_data_active_object(C);
+  ED_object_vpaintmode_enter_ex(bmain, 

[Bf-blender-cvs] [7f9b1fe73c7] master: Cleanup: quiet maybe-unused warning

2019-08-01 Thread Campbell Barton
Commit: 7f9b1fe73c720ecbcef67432850bbcfab8f128df
Author: Campbell Barton
Date:   Fri Aug 2 11:18:07 2019 +1000
Branches: master
https://developer.blender.org/rB7f9b1fe73c720ecbcef67432850bbcfab8f128df

Cleanup: quiet maybe-unused warning

While harmless, use flow control that always sets the variable.

===

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

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index a2138a1b3a5..f9c65249918 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -932,12 +932,7 @@ static bool ui_but_is_rna_undo(const uiBut *but)
  * (underline key in menu) */
 static void ui_menu_block_set_keyaccels(uiBlock *block)
 {
-  uiBut *but;
-
   uint menu_key_mask = 0;
-  uchar menu_key;
-  const char *str_pt;
-  int pass;
   int tot_missing = 0;
 
   /* only do it before bounding */
@@ -945,11 +940,11 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 return;
   }
 
-  for (pass = 0; pass < 2; pass++) {
+  for (int pass = 0; pass < 2; pass++) {
 /* 2 Passes, on for first letter only, second for any letter if first fails
  * fun first pass on all buttons so first word chars always get first 
priority */
 
-for (but = block->buttons.first; but; but = but->next) {
+for (uiBut *but = block->buttons.first; but; but = but->next) {
   if (!ELEM(but->type,
 UI_BTYPE_BUT,
 UI_BTYPE_BUT_MENU,
@@ -960,8 +955,10 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 /* pass */
   }
   else if (but->menu_key == '\0') {
-if (but->str) {
-  for (str_pt = but->str; *str_pt;) {
+if (but->str && but->str[0]) {
+  const char *str_pt = but->str;
+  uchar menu_key;
+  do {
 menu_key = tolower(*str_pt);
 if ((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1 << 
(menu_key - 'a'))) {
   menu_key_mask |= 1 << (menu_key - 'a');
@@ -982,7 +979,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
   /* just step over every char second pass and find first usable 
key */
   str_pt++;
 }
-  }
+  } while (*str_pt);
 
   if (*str_pt) {
 but->menu_key = menu_key;

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


[Bf-blender-cvs] [11975d5d956] temp-vr-draw-thread: Merge branch 'soc-2019-openxr' into temp-vr-draw-thread

2019-08-01 Thread Julian Eisel
Commit: 11975d5d95679c369716d4856a586ea9638a33d7
Author: Julian Eisel
Date:   Thu Aug 1 23:23:59 2019 +0200
Branches: temp-vr-draw-thread
https://developer.blender.org/rB11975d5d95679c369716d4856a586ea9638a33d7

Merge branch 'soc-2019-openxr' into temp-vr-draw-thread

===



===



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


[Bf-blender-cvs] [7922bd26a25] temp-vr-draw-thread: Fix objects not visible

2019-08-01 Thread Julian Eisel
Commit: 7922bd26a2517a9b2ad9496c0e6e7324a4dd8a4b
Author: Julian Eisel
Date:   Fri Aug 2 02:24:36 2019 +0200
Branches: temp-vr-draw-thread
https://developer.blender.org/rB7922bd26a2517a9b2ad9496c0e6e7324a4dd8a4b

Fix objects not visible

Object.base_flag was not updated correctly so objects were hidden.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_xr.c 
b/source/blender/windowmanager/intern/wm_xr.c
index 646b44eeb52..a0d6f5f9dc6 100644
--- a/source/blender/windowmanager/intern/wm_xr.c
+++ b/source/blender/windowmanager/intern/wm_xr.c
@@ -22,6 +22,7 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
 #include "BKE_screen.h"
 
 #include "BLI_math_geom.h"
@@ -313,13 +314,11 @@ static GHOST_ContextHandle wm_xr_draw_view(const 
GHOST_XrDrawViewInfo *draw_view
 
   wm_xr_draw_matrices_create(CTX_data_scene(C), draw_view, clip_start, 
clip_end, viewmat, winmat);
 
+  BKE_scene_graph_evaluated_ensure(g_depsgraph, CTX_data_main(C));
+
   DRW_opengl_render_context_enable(g_xr_surface->ghost_ctx);
   DRW_gawain_render_context_enable(g_xr_surface->gpu_ctx);
 
-  DEG_graph_relations_update(
-  g_depsgraph, CTX_data_main(C), CTX_data_scene(C), 
CTX_data_view_layer(C));
-  DEG_evaluate_on_refresh(g_depsgraph);
-
   if (!wm_xr_session_surface_offscreen_ensure(draw_view)) {
 // TODO disable correctly.
 return NULL;
@@ -420,18 +419,26 @@ static void wm_xr_session_gpu_binding_context_destroy(
   wm_window_reset_drawable();
 }
 
+static Depsgraph *wm_xr_session_depsgraph_create(Main *bmain, Scene *scene, 
ViewLayer *viewlayer)
+{
+  Depsgraph *deg = DEG_graph_new(scene, viewlayer, DAG_EVAL_VIEWPORT);
+
+  DEG_debug_name_set(deg, "VR SESSION");
+  DEG_graph_build_from_view_layer(deg, bmain, scene, viewlayer);
+  BKE_scene_graph_evaluated_ensure(deg, bmain);
+  /* XXX Why do we have to call this? Depsgraph should handle. */
+  BKE_scene_base_flag_to_objects(DEG_get_evaluated_view_layer(deg));
+
+  return deg;
+}
+
 static void *wm_xr_session_drawthread_main(void *data)
 {
   bContext *C = data;
   wmWindowManager *wm = CTX_wm_manager(C);
-  Main *bmain = CTX_data_main(C);
-  Scene *scene = CTX_data_scene(C);
 
-  g_depsgraph = DEG_graph_new(scene, CTX_data_view_layer(C), 
DAG_EVAL_VIEWPORT);
-  DEG_debug_name_set(g_depsgraph, "VR SESSION");
-  DEG_graph_build_from_view_layer(g_depsgraph, bmain, scene, 
CTX_data_view_layer(C));
-  //  DEG_evaluate_on_framechange(bmain, g_depsgraph, CFRA);
-  DEG_graph_tag_relations_update(g_depsgraph);
+  g_depsgraph = wm_xr_session_depsgraph_create(
+  CTX_data_main(C), CTX_data_scene(C), CTX_data_view_layer(C));
 
   WM_opengl_context_activate(g_xr_surface->ghost_ctx);
   g_xr_surface->gpu_ctx = GPU_context_create(

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


[Bf-blender-cvs] [9b6ce439bbb] temp-vr-draw-thread: Fix race condition in state changes + related cleanup + add assert

2019-08-01 Thread Julian Eisel
Commit: 9b6ce439bbbf5ce2a06f772d6168164bc87e5e3f
Author: Julian Eisel
Date:   Fri Aug 2 00:38:22 2019 +0200
Branches: temp-vr-draw-thread
https://developer.blender.org/rB9b6ce439bbbf5ce2a06f772d6168164bc87e5e3f

Fix race condition in state changes + related cleanup + add assert

===

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

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index e9fb3373a4b..557503783e5 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -1002,7 +1002,7 @@ void GHOST_XrSessionStart(GHOST_XrContextHandle 
xr_context,
   const GHOST_XrSessionBeginInfo *begin_info);
 void GHOST_XrSessionEnd(GHOST_XrContextHandle xr_context);
 int GHOST_XrHasSession(const GHOST_XrContextHandle xr_contexthandle);
-int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_context);
+int GHOST_XrSessionShouldRunDrawLoop(const GHOST_XrContextHandle xr_context);
 void GHOST_XrSessionDrawViews(GHOST_XrContextHandle xr_context, void 
*customdata);
 
 /* events */
diff --git a/intern/ghost/GHOST_IXrContext.h b/intern/ghost/GHOST_IXrContext.h
index 3b8455e6e86..968c98ad42e 100644
--- a/intern/ghost/GHOST_IXrContext.h
+++ b/intern/ghost/GHOST_IXrContext.h
@@ -30,7 +30,7 @@ class GHOST_IXrContext {
   virtual void startSession(const GHOST_XrSessionBeginInfo *begin_info) = 0;
   virtual void endSession() = 0;
   virtual bool hasSession() const = 0;
-  virtual bool isSessionRunning() const = 0;
+  virtual bool shouldRunSessionDrawLoop() const = 0;
   virtual void drawSessionViews(void *draw_customdata) = 0;
 
   virtual void dispatchErrorMessage(const class GHOST_XrException *) const = 0;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index c188cc8e819..98579985693 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -944,10 +944,10 @@ int GHOST_XrHasSession(const GHOST_XrContextHandle 
xr_contexthandle)
   return 0;  // Only reached if exception is thrown.
 }
 
-int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_contexthandle)
+int GHOST_XrSessionShouldRunDrawLoop(const GHOST_XrContextHandle 
xr_contexthandle)
 {
   const GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
-  GHOST_XR_CAPI_CALL_RET(xr_context->isSessionRunning(), xr_context);
+  GHOST_XR_CAPI_CALL_RET(xr_context->shouldRunSessionDrawLoop(), xr_context);
   return 0;  // Only reached if exception is thrown.
 }
 
diff --git a/intern/ghost/intern/GHOST_XrContext.cpp 
b/intern/ghost/intern/GHOST_XrContext.cpp
index 51b39bcc193..813fdf19f5a 100644
--- a/intern/ghost/intern/GHOST_XrContext.cpp
+++ b/intern/ghost/intern/GHOST_XrContext.cpp
@@ -446,9 +446,9 @@ bool GHOST_XrContext::hasSession() const
   return m_session != nullptr;
 }
 
-bool GHOST_XrContext::isSessionRunning() const
+bool GHOST_XrContext::shouldRunSessionDrawLoop() const
 {
-  return m_session && m_session->isRunning();
+  return m_session && m_session->shouldRunDrawLoop();
 }
 
 void GHOST_XrContext::drawSessionViews(void *draw_customdata)
diff --git a/intern/ghost/intern/GHOST_XrContext.h 
b/intern/ghost/intern/GHOST_XrContext.h
index bd189f39491..3cf33fb6950 100644
--- a/intern/ghost/intern/GHOST_XrContext.h
+++ b/intern/ghost/intern/GHOST_XrContext.h
@@ -51,7 +51,7 @@ class GHOST_XrContext : public GHOST_IXrContext {
   void startSession(const GHOST_XrSessionBeginInfo *begin_info) override;
   void endSession() override;
   bool hasSession() const override;
-  bool isSessionRunning() const override;
+  bool shouldRunSessionDrawLoop() const override;
   void drawSessionViews(void *draw_customdata) override;
 
   static void setErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void 
*customdata);
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp 
b/intern/ghost/intern/GHOST_XrSession.cpp
index dee175632b5..a5eb7a891d7 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -193,16 +193,13 @@ void GHOST_XrSession::end()
 GHOST_XrSession::eLifeExpectancy GHOST_XrSession::handleStateChangeEvent(
 const XrEventDataSessionStateChanged *lifecycle)
 {
-  m_oxr->session_state = lifecycle->state;
-
   /* Runtime may send events for apparently destroyed session. Our handle 
should be NULL then. */
   assert((m_oxr->session == XR_NULL_HANDLE) || (m_oxr->session == 
lifecycle->session));
 
   switch (lifecycle->state) {
 case XR_SESSION_STATE_READY: {
-  XrSessionBeginInfo begin_info{};
+  XrSessionBeginInfo 

[Bf-blender-cvs] [cfaef2db301] master: Cleanup: padding in windowmanager

2019-08-01 Thread Nathan Craddock
Commit: cfaef2db301f7b4e9f41e377f81187fbb52595a8
Author: Nathan Craddock
Date:   Thu Aug 1 18:32:12 2019 -0600
Branches: master
https://developer.blender.org/rBcfaef2db301f7b4e9f41e377f81187fbb52595a8

Cleanup: padding in windowmanager

===

M   source/blender/makesdna/DNA_windowmanager_types.h

===

diff --git a/source/blender/makesdna/DNA_windowmanager_types.h 
b/source/blender/makesdna/DNA_windowmanager_types.h
index 4ccb23045df..8dcae41aaa2 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -174,7 +174,7 @@ typedef struct wmWindowManager {
 
   /** Indicates whether interface is locked for user interaction. */
   char is_interface_locked;
-  char par[7];
+  char _pad[7];
 
   struct wmMsgBus *message_bus;

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


[Bf-blender-cvs] [066a7173c06] master: Keymap: add fractional zoom shortcuts for sequencer preview

2019-08-01 Thread Campbell Barton
Commit: 066a7173c068ae2c9760ea2534ca656d7fc7f524
Author: Campbell Barton
Date:   Fri Aug 2 08:36:03 2019 +1000
Branches: master
https://developer.blender.org/rB066a7173c068ae2c9760ea2534ca656d7fc7f524

Keymap: add fractional zoom shortcuts for sequencer preview

Matches shortcuts from the image editor.

D5341 by @tintwotin

===

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 3f0d02f0b9b..a2e36fa4424 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2424,8 +2424,20 @@ def km_sequencerpreview(params):
 ("sequencer.view_all_preview", {"type": 'HOME', "value": 'PRESS'}, 
None),
 ("sequencer.view_all_preview", {"type": 'NDOF_BUTTON_FIT', "value": 
'PRESS'}, None),
 ("sequencer.view_ghost_border", {"type": 'O', "value": 'PRESS'}, None),
+("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS', 
"ctrl": True},
+ {"properties": [("ratio", 8.0)]}),
+("sequencer.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS', 
"ctrl": True},
+ {"properties": [("ratio", 4.0)]}),
+("sequencer.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS', 
"ctrl": True},
+ {"properties": [("ratio", 2.0)]}),
 ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_1', "value": 'PRESS'},
  {"properties": [("ratio", 1.0)]}),
+("sequencer.view_zoom_ratio", {"type": 'NUMPAD_2', "value": 'PRESS'},
+ {"properties": [("ratio", 0.5)]}),
+("sequencer.view_zoom_ratio", {"type": 'NUMPAD_4', "value": 'PRESS'},
+ {"properties": [("ratio", 0.25)]}),
+("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS'},
+ {"properties": [("ratio", 0.125)]}),
 ("sequencer.sample", {"type": params.action_mouse, "value": 'PRESS'}, 
None),
 ])

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


[Bf-blender-cvs] [e38e8f1f712] soc-2019-bevel-profiles: Profile Widget: Dynamic Hi-Res table size

2019-08-01 Thread Hans Goudey
Commit: e38e8f1f712475719dc72f7a9a19ef3abc2f0f5e
Author: Hans Goudey
Date:   Thu Aug 1 14:19:25 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBe38e8f1f712475719dc72f7a9a19ef3abc2f0f5e

Profile Widget: Dynamic Hi-Res table size

The table for the sampled, curved path is a multiple of the number of
control points up until a maximum size. This should speed up drawing
and evaluation functions when there is a smaller number of control points.

===

M   source/blender/blenkernel/intern/profile_widget.c
M   source/blender/editors/interface/interface_draw.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/makesdna/DNA_profilewidget_types.h

===

diff --git a/source/blender/blenkernel/intern/profile_widget.c 
b/source/blender/blenkernel/intern/profile_widget.c
index ce117dd3d18..dbac816dea6 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_widget.c
@@ -227,7 +227,8 @@ ProfilePoint *profilewidget_insert(ProfileWidget *prwdgt, 
float x, float y)
   printf("PROFILEPATH INSERT\n");
 #endif
 
-  if (prwdgt->totpoint == PROF_TABLE_SIZE - 1) {
+  /* Don't add more control points  than the maximum size of the higher 
resolution table */
+  if (prwdgt->totpoint == PROF_TABLE_MAX - 1) {
 return NULL;
   }
 
@@ -732,7 +733,7 @@ static void profilewidget_make_table(ProfileWidget *prwdgt)
   int i, n_samples;
 
   /* Get locations of samples from the sampling function */
-  n_samples = PROF_TABLE_SIZE;
+  n_samples = PROF_N_TABLE(prwdgt->totpoint);
   locations = MEM_callocN((size_t)n_samples * 2 * sizeof(float), "temp loc 
storage");
   profilewidget_create_samples(prwdgt, locations, n_samples - 1, false);
 
@@ -897,7 +898,7 @@ float profilewidget_total_length(const ProfileWidget 
*prwdgt)
   float loc1[2], loc2[2];
   float total_length = 0;
 
-  for (int i = 0; i < PROF_TABLE_SIZE; i++) {
+  for (int i = 0; i < PROF_N_TABLE(prwdgt->totpoint); i++) {
 loc1[0] = prwdgt->table[i].x;
 loc1[1] = prwdgt->table[i].y;
 loc2[0] = prwdgt->table[i].x;
@@ -970,7 +971,7 @@ void profilewidget_evaluate_portion(const ProfileWidget 
*prwdgt,
   float length_travelled = 0.0f;
   while (length_travelled < requested_length) {
 /* Check if we reached the last point before the final one */
-if (i == PROF_TABLE_SIZE - 2) {
+if (i == PROF_N_TABLE(prwdgt->totpoint) - 2) {
   break;
 }
 float new_length = profilewidget_distance_to_next_point(prwdgt, i);
diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index 3868131231c..4262e54eaed 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -2209,12 +2209,12 @@ void ui_draw_but_PROFILE(ARegion *ar, uiBut *but, const 
uiWidgetColors *wcol, co
   /* Also add the last points on the right and bottom edges to close off the 
fill polygon */
   bool add_left_tri = prwdgt->view_rect.xmin < 0.0f;
   bool add_bottom_tri = prwdgt->view_rect.ymin < 0.0f;
-  uint tot_points = (uint)PROF_TABLE_SIZE + 1 + add_left_tri + add_bottom_tri;
+  uint tot_points = (uint)PROF_N_TABLE(prwdgt->totpoint) + 1 + add_left_tri + 
add_bottom_tri;
   uint tot_triangles = tot_points - 2;
 
   /* Create array of the positions of the table's points */
   float (*table_coords)[2] = MEM_mallocN(sizeof(*table_coords) * tot_points, 
"table x coords");
-  for (i = 0; i < PROF_TABLE_SIZE; i++) { /* Only add the points from the 
table here */
+  for (i = 0; i < (uint)PROF_N_TABLE(prwdgt->totpoint); i++) { /* Only add the 
points from the table here */
 table_coords[i][0] = pts[i].x;
 table_coords[i][1] = pts[i].y;
   }
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index e4d9bbe241e..9b953ad002e 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6917,7 +6917,7 @@ static int ui_do_but_PROFILE(bContext *C,
 dist_min_sq = SQUARE(U.dpi_fac * 8.0f);
 
 /* loop through the curve segment table and find what's near the 
mouse. */
-for (i = 1; i <= PROF_TABLE_SIZE; i++) {
+for (i = 1; i <= PROF_N_TABLE(prwdgt->totpoint); i++) {
   copy_v2_v2(f_xy_prev, f_xy);
   BLI_rctf_transform_pt_v(>rect, >view_rect, f_xy, 
[i].x);
 
diff --git a/source/blender/makesdna/DNA_profilewidget_types.h 
b/source/blender/makesdna/DNA_profilewidget_types.h
index f9250397936..ad4a9d2807c 100644
--- a/source/blender/makesdna/DNA_profilewidget_types.h
+++ b/source/blender/makesdna/DNA_profilewidget_types.h
@@ -26,11 +26,10 @@
 
 #include "DNA_vec_types.h"
 
-#define PROF_TABLE_SIZE 256
-/* HANS-TODO: Switch to variable table size based on 

[Bf-blender-cvs] [219573de22f] functions: Fix: Build error with MSVC

2019-08-01 Thread Lazydodo
Commit: 219573de22fa13300278c2b018f1258564973455
Author: Lazydodo
Date:   Thu Aug 1 15:25:07 2019 -0600
Branches: functions
https://developer.blender.org/rB219573de22fa13300278c2b018f1258564973455

Fix: Build error with MSVC

Zero sized arrays not being at the end of struct/class makes MSVC sad

===

M   source/blender/blenkernel/BKE_node_tree.hpp
M   source/blender/functions/core/data_graph_builder.hpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp

===

diff --git a/source/blender/blenkernel/BKE_node_tree.hpp 
b/source/blender/blenkernel/BKE_node_tree.hpp
index 3d50766f89f..baaf596f0a6 100644
--- a/source/blender/blenkernel/BKE_node_tree.hpp
+++ b/source/blender/blenkernel/BKE_node_tree.hpp
@@ -38,8 +38,8 @@ class VirtualNodeTree {
   Vector m_links;
   Vector m_inputs_with_links;
   MultiMap m_nodes_by_idname;
-  MonotonicAllocator<> m_allocator;
   uint m_socket_counter = 0;
+  MonotonicAllocator<> m_allocator;
 
  public:
   void add_all_of_tree(bNodeTree *btree);
diff --git a/source/blender/functions/core/data_graph_builder.hpp 
b/source/blender/functions/core/data_graph_builder.hpp
index fc3de824585..78a57b0f777 100644
--- a/source/blender/functions/core/data_graph_builder.hpp
+++ b/source/blender/functions/core/data_graph_builder.hpp
@@ -140,13 +140,13 @@ class BuilderNode {
 
 class DataGraphBuilder {
  private:
-  MonotonicAllocator<> m_allocator;
-  std::unique_ptr> m_source_info_allocator;
   Vector m_nodes;
   uint m_link_counter = 0;
   uint m_input_socket_counter = 0;
   uint m_output_socket_counter = 0;
-
+  std::unique_ptr> m_source_info_allocator;
+  MonotonicAllocator<> m_allocator;
+  
  public:
   DataGraphBuilder();
   DataGraphBuilder(DataGraphBuilder ) = delete;
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
index 7a03131f8ca..900207cc4f3 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
@@ -19,12 +19,12 @@ using BKE::VirtualSocket;
 class VTreeDataGraphBuilder {
  private:
   VirtualNodeTree _vtree;
-  DataGraphBuilder m_graph_builder;
   Vector m_socket_map;
   Vector m_type_by_vsocket;
   StringMap _type_by_idname;
   StringMap _type_by_data_type;
   StringMap _data_type_by_idname;
+  DataGraphBuilder m_graph_builder;
 
  public:
   VTreeDataGraphBuilder(VirtualNodeTree );

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


[Bf-blender-cvs] [f66b5edf98c] master: VSE: Use sequencer boundbox for view_all operator

2019-08-01 Thread Richard Antalik
Commit: f66b5edf98c98fcf04f99d962647db54f17b79e4
Author: Richard Antalik
Date:   Thu Aug 1 12:43:15 2019 -0700
Branches: master
https://developer.blender.org/rBf66b5edf98c98fcf04f99d962647db54f17b79e4

VSE: Use sequencer boundbox for view_all operator

Fix T67279
Fix T59954

Reviewed By: brecht

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

===

M   source/blender/editors/space_sequencer/sequencer_edit.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index bf138e5bc91..ed0303564c6 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2813,10 +2813,12 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
 static int sequencer_view_all_exec(bContext *C, wmOperator *op)
 {
   ARegion *ar = CTX_wm_region(C);
-  View2D *v2d = UI_view2d_fromcontext(C);
+  rctf box;
+
   const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
 
-  UI_view2d_smooth_view(C, ar, >tot, smooth_viewtx);
+  boundbox_seq(CTX_data_scene(C), );
+  UI_view2d_smooth_view(C, ar, , smooth_viewtx);
   return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [2c4dfbb0024] master: Fix T66028: Move sequence, movieclip and text editor progressbars to status bar

2019-08-01 Thread Richard Antalik
Commit: 2c4dfbb00246ff59cac424392588d55363aa2400
Author: Richard Antalik
Date:   Thu Aug 1 12:40:57 2019 -0700
Branches: master
https://developer.blender.org/rB2c4dfbb00246ff59cac424392588d55363aa2400

Fix T66028: Move sequence, movieclip and text editor progressbars to status bar

Reviewed By: brecht

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

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/editors/interface/interface_templates.c
M   source/blender/editors/space_clip/clip_editor.c
M   source/blender/editors/space_clip/clip_ops.c
M   source/blender/editors/space_clip/tracking_ops_solve.c
M   source/blender/editors/space_clip/tracking_ops_track.c
M   source/blender/editors/space_file/filelist.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/editors/space_sequencer/sequencer_preview.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index b0fc5716f89..ff2dfca6cf8 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -180,8 +180,6 @@ class CLIP_HT_header(Header):
 active_object = tracking.objects.active
 
 if sc.view == 'CLIP':
-layout.template_running_jobs()
-
 r = active_object.reconstruction
 
 if r.is_valid and sc.view == 'CLIP':
diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 1fc1af9815f..654483c2182 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6057,13 +6057,13 @@ static void do_running_jobs(bContext *C, void 
*UNUSED(arg), int event)
   WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
   break;
 case B_STOPSEQ:
-  WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+  WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
   break;
 case B_STOPCLIP:
-  WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+  WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
   break;
 case B_STOPFILE:
-  WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+  WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
   break;
 case B_STOPOTHER:
   G.is_break = true;
@@ -6116,80 +6116,96 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext 
*C)
 
   UI_block_func_handle_set(block, do_running_jobs, NULL);
 
-  if (sa->spacetype == SPACE_SEQ) {
-if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY)) {
-  owner = sa;
+  Scene *scene;
+  /* another scene can be rendering too, for example via compositor */
+  for (scene = CTX_data_main(C)->scenes.first; scene; scene = scene->id.next) {
+if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) {
+  handle_event = B_STOPOTHER;
+  icon = ICON_NONE;
+  owner = scene;
 }
-handle_event = B_STOPSEQ;
-icon = ICON_SEQUENCE;
-  }
-  else if (sa->spacetype == SPACE_CLIP) {
-if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY)) {
-  owner = sa;
+else {
+  continue;
 }
-handle_event = B_STOPCLIP;
-icon = ICON_TRACKER;
-  }
-  else if (sa->spacetype == SPACE_FILE) {
-if (WM_jobs_test(wm, sa, WM_JOB_TYPE_FILESEL_READDIR)) {
-  owner = sa;
+
+if (WM_jobs_test(wm, scene, WM_JOB_TYPE_SEQ_BUILD_PROXY)) {
+  handle_event = B_STOPSEQ;
+  icon = ICON_SEQUENCE;
+  owner = scene;
+  break;
 }
-handle_event = B_STOPFILE;
-icon = ICON_FILEBROWSER;
-  }
-  else {
-Scene *scene;
-/* another scene can be rendering too, for example via compositor */
-for (scene = CTX_data_main(C)->scenes.first; scene; scene = 
scene->id.next) {
-  if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
-handle_event = B_STOPRENDER;
-icon = ICON_SCENE;
-break;
-  }
-  else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
-handle_event = B_STOPCOMPO;
-icon = ICON_RENDERLAYERS;
-break;
-  }
-  else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE) ||
-   WM_jobs_test(wm, scene, WM_JOB_TYPE_OBJECT_BAKE)) {
-/* Skip bake jobs in compositor to avoid compo header displaying
- * progress bar which is not being updated (bake jobs only need
- * to update NC_IMAGE context.
- */
-if (sa->spacetype != SPACE_NODE) {
-  handle_event = B_STOPOTHER;
-  icon = ICON_IMAGE;
-  break;
-}
-  }
-  else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_DPAINT_BAKE)) {
-handle_event = B_STOPOTHER;
-icon = ICON_MOD_DYNAMICPAINT;
-break;
-  }
-  else if (WM_jobs_test(wm, scene, 

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

2019-08-01 Thread Julian Eisel
Commit: f04a5ad1e44c389f260d6c36ead72abac9b22384
Author: Julian Eisel
Date:   Thu Aug 1 21:27:08 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rBf04a5ad1e44c389f260d6c36ead72abac9b22384

Merge branch 'master' into soc-2019-openxr

===



===

diff --cc source/blender/editors/include/ED_view3d.h
index 72efea32c38,081bcbf4746..9bf85b8268a
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@@ -564,27 -568,9 +568,27 @@@ void ED_view3d_draw_offscreen(struct De
bool do_sky,
bool is_persp,
const char *viewname,
-   const bool do_color_managment,
+   const bool do_color_management,
struct GPUOffScreen *ofs,
struct GPUViewport *viewport);
 +void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph,
 + struct Scene *scene,
 + struct View3DShading *shading_override,
 + int drawtype,
 + int winx,
 + int winy,
 + unsigned int draw_flags,
 + float viewmat[4][4],
 + float winmat[4][4],
 + float clip_start,
 + float clip_end,
 + float lens,
 + bool do_sky,
 + bool is_persp,
 + const char *viewname,
 + const bool do_color_management,
 + struct GPUOffScreen *ofs,
 + struct GPUViewport *viewport);
  void ED_view3d_draw_setup_view(struct wmWindow *win,
 struct Depsgraph *depsgraph,
 struct Scene *scene,

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


[Bf-blender-cvs] [03b09dbe320] soc-2019-openxr: Fix compile error after merge and warning

2019-08-01 Thread Julian Eisel
Commit: 03b09dbe3208294a1efbb3762c1496cd399bab2b
Author: Julian Eisel
Date:   Thu Aug 1 21:53:57 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB03b09dbe3208294a1efbb3762c1496cd399bab2b

Fix compile error after merge and warning

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_xr.c 
b/source/blender/windowmanager/intern/wm_xr.c
index 4f7d2430ba9..22e6fb7b3bf 100644
--- a/source/blender/windowmanager/intern/wm_xr.c
+++ b/source/blender/windowmanager/intern/wm_xr.c
@@ -164,7 +164,8 @@ static void wm_xr_session_free_data(wmSurface *surface)
   g_xr_surface = NULL;
 }
 
-static wmSurface *wm_xr_session_surface_create(wmWindowManager *wm, unsigned 
int gpu_binding_type)
+static wmSurface *wm_xr_session_surface_create(wmWindowManager *UNUSED(wm),
+   unsigned int gpu_binding_type)
 {
   if (g_xr_surface) {
 BLI_assert(false);
@@ -308,7 +309,7 @@ static GHOST_ContextHandle wm_xr_draw_view(const 
GHOST_XrDrawViewInfo *draw_view
   BKE_screen_view3d_shading_init();
   shading.flag |= V3D_SHADING_WORLD_ORIENTATION;
   shading.background_type = V3D_SHADING_BACKGROUND_WORLD;
-  ED_view3d_draw_offscreen_simple(CTX_data_depsgraph(C),
+  ED_view3d_draw_offscreen_simple(CTX_data_ensure_evaluated_depsgraph(C),
   CTX_data_scene(C),
   ,
   OB_SOLID,

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


[Bf-blender-cvs] [aa0322524ea] master: GPU: more complete coverage of drivers for Intel shader compilation workaround

2019-08-01 Thread Brecht Van Lommel
Commit: aa0322524ea6f59068dc4ea9cef5e6f3e2a7979a
Author: Brecht Van Lommel
Date:   Thu Aug 1 20:43:13 2019 +0200
Branches: master
https://developer.blender.org/rBaa0322524ea6f59068dc4ea9cef5e6f3e2a7979a

GPU: more complete coverage of drivers for Intel shader compilation workaround

===

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

===

diff --git a/source/blender/gpu/intern/gpu_extensions.c 
b/source/blender/gpu/intern/gpu_extensions.c
index 61f7ba6da7c..99dbff05453 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -387,11 +387,8 @@ void gpu_extensions_init(void)
   GG.dfdyfactors[1] = 1.0;
 }
 
-if (strstr(version, "Build 10.18.10.3379") || strstr(version, "Build 
10.18.10.3574") ||
-strstr(version, "Build 10.18.10.4252") || strstr(version, "Build 
10.18.10.4358") ||
-strstr(version, "Build 10.18.10.4653") || strstr(version, "Build 
10.18.10.5069") ||
-strstr(version, "Build 10.18.14.4264") || strstr(version, "Build 
10.18.14.4432") ||
-strstr(version, "Build 10.18.14.5067")) {
+if (strstr(version, "Build 10.18.10.3") || strstr(version, "Build 
10.18.10.4") ||
+strstr(version, "Build 10.18.14.4") || strstr(version, "Build 
10.18.14.5")) {
   /* Maybe not all of these drivers have problems with 
`GLEW_ARB_base_instance`.
* But it's hard to test each case. */
   GG.glew_arb_base_instance_is_supported = false;

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


[Bf-blender-cvs] [22fa50793c3] soc-2019-cycles-procedural: Fix Math node backward compatibility. Update single operand operators.

2019-08-01 Thread OmarSquircleArt
Commit: 22fa50793c36d5aff2a43c5c5419b73a2a05773c
Author: OmarSquircleArt
Date:   Thu Aug 1 20:40:14 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB22fa50793c36d5aff2a43c5c5419b73a2a05773c

Fix Math node backward compatibility. Update single operand operators.

===

M   source/blender/blenloader/intern/versioning_cycles.c

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 5436eb9a5d5..36695a38b0a 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -408,6 +408,48 @@ static void 
update_math_socket_names_and_identifiers(bNodeTree *ntree)
   }
 }
 
+/* The B input of the Math node is no longer used for single-operand operators.
+ * Previously, if the B input was linked and the A input was not, the B input
+ * was used as the input of the operator. To correct this, we move the link
+ * from B to A if B is linked and A is not.
+ */
+static void update_single_operand_math_operators(bNodeTree *ntree)
+{
+  bool need_update = false;
+
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_MATH) {
+  switch (node->custom1) {
+case NODE_MATH_SINE:
+case NODE_MATH_CEIL:
+case NODE_MATH_SQRT:
+case NODE_MATH_ROUND:
+case NODE_MATH_FLOOR:
+case NODE_MATH_COSINE:
+case NODE_MATH_TANGENT:
+case NODE_MATH_ARCSINE:
+case NODE_MATH_FRACTION:
+case NODE_MATH_ABSOLUTE:
+case NODE_MATH_ARCCOSINE:
+case NODE_MATH_ARCTANGENT: {
+  bNodeSocket *sockA = nodeFindSocket(node, SOCK_IN, "A");
+  bNodeSocket *sockB = nodeFindSocket(node, SOCK_IN, "B");
+  if (!sockA->link && sockB->link) {
+nodeAddLink(ntree, sockB->link->fromnode, sockB->link->fromsock, 
node, sockA);
+nodeRemLink(ntree, sockB->link);
+need_update = true;
+  }
+  break;
+}
+  }
+}
+  }
+
+  if (need_update) {
+ntreeUpdateTree(NULL, ntree);
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -559,4 +601,14 @@ void do_versions_after_linking_cycles(Main *bmain)
   }
 }
   }
+
+  if (1) {
+FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+  if (ntree->type != NTREE_SHADER) {
+continue;
+  }
+  update_single_operand_math_operators(ntree);
+}
+FOREACH_NODETREE_END;
+  }
 }

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


[Bf-blender-cvs] [3e0c405efcf] soc-2019-cycles-procedural: Fix Math node backward compatibility. Update socket names and identifiers.

2019-08-01 Thread OmarSquircleArt
Commit: 3e0c405efcf9574d7df3fc166c60c8bd6e50419a
Author: OmarSquircleArt
Date:   Thu Aug 1 20:21:01 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB3e0c405efcf9574d7df3fc166c60c8bd6e50419a

Fix Math node backward compatibility. Update socket names and identifiers.

===

M   source/blender/blenloader/intern/versioning_cycles.c

===

diff --git a/source/blender/blenloader/intern/versioning_cycles.c 
b/source/blender/blenloader/intern/versioning_cycles.c
index 5174da4d1f8..5436eb9a5d5 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -385,6 +385,29 @@ static void light_emission_unify(Light *light, const char 
*engine)
   }
 }
 
+/* The names of the sockets of the Math node were changed. So we have to update
+ * them here. The sockets' identifiers needs to be updated as well since they
+ * are autmatically generated from the name.
+ */
+static void update_math_socket_names_and_identifiers(bNodeTree *ntree)
+{
+  for (bNode *node = ntree->nodes.first; node; node = node->next) {
+if (node->type == SH_NODE_MATH) {
+  bNodeSocket *sockA = node->inputs.first;
+  bNodeSocket *sockB = sockA->next;
+  bNodeSocket *sockResult = node->outputs.first;
+
+  strcpy(sockA->name, "A");
+  strcpy(sockB->name, "B");
+  strcpy(sockResult->name, "Result");
+
+  strcpy(sockA->identifier, "A");
+  strcpy(sockB->identifier, "B");
+  strcpy(sockResult->identifier, "Result");
+}
+  }
+}
+
 void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main 
*bmain)
 {
   /* Particle shape shared with Eevee. */
@@ -417,6 +440,16 @@ void blo_do_versions_cycles(FileData *UNUSED(fd), Library 
*UNUSED(lib), Main *bm
   }
 }
   }
+
+  if (1) {
+FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
+  if (ntree->type != NTREE_SHADER) {
+continue;
+  }
+  update_math_socket_names_and_identifiers(ntree);
+}
+FOREACH_NODETREE_END;
+  }
 }
 
 void do_versions_after_linking_cycles(Main *bmain)

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


[Bf-blender-cvs] [b0034576fd3] soc-2019-bevel-profiles: Merge branch 'master' into soc-2019-bevel-profiles

2019-08-01 Thread Hans Goudey
Commit: b0034576fd3cc9f2b30bf8956fd130d2b7ac74ac
Author: Hans Goudey
Date:   Thu Aug 1 09:33:09 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBb0034576fd3cc9f2b30bf8956fd130d2b7ac74ac

Merge branch 'master' into soc-2019-bevel-profiles

===



===

diff --cc source/blender/blenloader/intern/versioning_280.c
index 153eb37e6aa,1a79b7c9b5a..181c2a129b0
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -3534,32 -3533,23 +3534,48 @@@ void blo_do_versions_280(FileData *fd, 
  }
}
  
+   if (!MAIN_VERSION_ATLEAST(bmain, 281, 1)) {
+ LISTBASE_FOREACH (Object *, ob, >objects) {
+   for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_DataTransfer) {
+   /* Now datatransfer's mix factor is multiplied with weights when 
any,
+* instead of being ignored,
+* we need to take care of that to keep 'old' files compatible. */
+   DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
+   if (dtmd->defgrp_name[0] != '\0') {
+ dtmd->mix_factor = 1.0f;
+   }
+ }
+   }
+ }
+   }
+ 
{
  /* Versioning code until next subversion bump goes here. */
 +
 +/* Add custom profile widget to toolsettings for bevel tool */
 +if (!DNA_struct_elem_find(
 +fd->filesdna, "ToolSettings", "ProfileWidget", "prwdgt")) {
 +  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) 
{
 +ToolSettings *ts = scene->toolsettings;
 +if ((ts) && (ts->prwdgt == NULL)) {
 +  ts->prwdgt = profilewidget_add(PROF_PRESET_LINE);
 +}
 +  }
 +}
 +
 +/* Add custom profile widget to bevel modifier */
 +if (!DNA_struct_elem_find(fd->filesdna, "BevelModifier", "ProfileWidget", 
"prwdgt")) {
 +  for (Object *object = bmain->objects.first; object != NULL; object = 
object->id.next) {
 +for (ModifierData *md = object->modifiers.first; md; md = md->next) {
 +  if (md->type == eModifierType_Bevel) {
 +BevelModifierData *bmd = (BevelModifierData *)md;
 +if (!bmd->prwdgt) {
 +  bmd->prwdgt = profilewidget_add(PROF_PRESET_LINE);
 +}
 +  }
 +}
 +  }
 +}
}
  }
diff --cc source/blender/blenloader/intern/versioning_defaults.c
index 16cbf06bb1b,14230752d1f..e6e4764959a
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@@ -47,11 -45,8 +45,9 @@@
  #include "BKE_library.h"
  #include "BKE_main.h"
  #include "BKE_node.h"
- #include "BKE_paint.h"
  #include "BKE_screen.h"
- #include "BKE_studiolight.h"
  #include "BKE_workspace.h"
 +#include "BKE_profile_widget.h"
  
  #include "BLO_readfile.h"
  
@@@ -360,10 -286,19 +287,24 @@@ static void blo_update_defaults_scene(M
 CURVEMAP_SLOPE_POSITIVE);
}
  
+   /* Correct default startup UV's. */
+   Mesh *me = BLI_findstring(>meshes, "Cube", offsetof(ID, name) + 2);
+   if (me && (me->totloop == 24) && (me->mloopuv != NULL)) {
+ const float uv_values[24][2] = {
+ {0.625, 0.50}, {0.875, 0.50}, {0.875, 0.75}, {0.625, 0.75}, {0.375, 
0.75}, {0.625, 0.75},
+ {0.625, 1.00}, {0.375, 1.00}, {0.375, 0.00}, {0.625, 0.00}, {0.625, 
0.25}, {0.375, 0.25},
+ {0.125, 0.50}, {0.375, 0.50}, {0.375, 0.75}, {0.125, 0.75}, {0.375, 
0.50}, {0.625, 0.50},
+ {0.625, 0.75}, {0.375, 0.75}, {0.375, 0.25}, {0.625, 0.25}, {0.625, 
0.50}, {0.375, 0.50},
+ };
+ for (int i = 0; i < ARRAY_SIZE(uv_values); i++) {
+   copy_v2_v2(me->mloopuv[i].uv, uv_values[i]);
+ }
+   }
++
 +  /* Make sure that the profile widget is initialized */
 +  if (ts->prwdgt == NULL) {
 +ts->prwdgt = profilewidget_add(PROF_PRESET_LINE);
 +  }
  }
  
  /**
diff --cc source/blender/bmesh/tools/bmesh_bevel.c
index 3d42501f320,94935f2090b..d78870c7106
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@@ -2390,12 -2295,14 +2390,12 @@@ static void build_boundary_terminal_edg
  else {
adjust_bound_vert(e->rightv, co);
  }
- /* make artifical extra point along unbeveled edge, and form triangle */
+ /* make artificial extra point along unbeveled edge, and form triangle */
  slide_dist(e->next, bv->v, e->offset_l, co);
  if (construct) {
 -  v = add_new_bound_vert(mem_arena, vm, co);
 -  v->efirst = v->elast = e->next;
 -  e->next->leftv = e->next->rightv = v;
 -  /* could use M_POLY too, but tri-fan looks nicer)*/
 -  vm->mesh_kind = M_TRI_FAN;
 +  bndv = add_new_bound_vert(mem_arena, vm, co);
 +  bndv->efirst = bndv->elast = e->next;
 +  e->next->leftv = e->next->rightv = bndv;

[Bf-blender-cvs] [d35c6cb5071] soc-2019-bevel-profiles: Profile Widget: Sometimes disable move / delete buttons

2019-08-01 Thread Hans Goudey
Commit: d35c6cb50716b7104d0094e10f9de2d766bd3d22
Author: Hans Goudey
Date:   Thu Aug 1 09:27:16 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBd35c6cb50716b7104d0094e10f9de2d766bd3d22

Profile Widget: Sometimes disable move / delete buttons

The position and delete sliders are disabled for the last and first buttons.

===

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

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 5e6e90f8a57..47bf88119aa 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -4531,7 +4531,7 @@ static void profilewidget_buttons_layout(uiLayout 
*layout, PointerRNA *ptr, RNAU
   uiBlock *block;
   uiBut *bt;
   int i, icon, path_width, path_height;
-  bool point_last_or_first;
+  bool point_last_or_first = false;
   rctf bounds;
 
   block = uiLayoutGetBlock(layout);
@@ -4618,6 +4618,7 @@ static void profilewidget_buttons_layout(uiLayout 
*layout, PointerRNA *ptr, RNAU
 }
 
 uiLayoutRow(layout, true);
+UI_block_funcN_set(block, profilewidget_buttons_update, MEM_dupallocN(cb), 
prwdgt);
 
 /* Sharp / Smooth */
 bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LINCURVE, 0, 0, UI_UNIT_X, 
UI_UNIT_X, NULL,
@@ -4627,25 +4628,26 @@ static void profilewidget_buttons_layout(uiLayout 
*layout, PointerRNA *ptr, RNAU
   0.0, 0.0, 0.0, 0.0, TIP_("Set the point's handle type to 
sharp."));
 UI_but_funcN_set(bt, profilewidget_buttons_setcurved, MEM_dupallocN(cb), 
prwdgt);
 
+/* Position */
+bt = uiDefButF(block, UI_BTYPE_NUM, 0, "X:", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 
10, UI_UNIT_Y,
+  >x, bounds.xmin, bounds.xmax, 1, 5, "");
+if (point_last_or_first) {
+  UI_but_flag_enable(bt, UI_BUT_DISABLED);
+}
 
-UI_block_funcN_set(block, profilewidget_buttons_update, MEM_dupallocN(cb), 
prwdgt);
-/* HANS-QUESTION: I haven't been able to find out how to disable these 
buttons instead of
- * not drawing them. */
-if (!point_last_or_first) {
-
-  /* Position */
-  bt = uiDefButF(block, UI_BTYPE_NUM, 0, "X:", 0, 2 * UI_UNIT_Y, UI_UNIT_X 
* 10, UI_UNIT_Y,
->x, bounds.xmin, bounds.xmax, 1, 5, "");
-
-  uiDefButF(block, UI_BTYPE_NUM, 0, "Y:", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 
10, UI_UNIT_Y,
->y, bounds.ymin, bounds.ymax, 1, 5, "");
-
-  /* Delete points */
-  bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, 
UI_UNIT_X, NULL, 0.0, 0.0,
-0.0, 0.0, TIP_("Delete points"));
-  UI_but_funcN_set(bt, profilewidget_buttons_delete, MEM_dupallocN(cb), 
prwdgt);
+bt = uiDefButF(block, UI_BTYPE_NUM, 0, "Y:", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 
10, UI_UNIT_Y,
+  >y, bounds.ymin, bounds.ymax, 1, 5, "");
+if (point_last_or_first) {
+  UI_but_flag_enable(bt, UI_BUT_DISABLED);
 }
 
+/* Delete points */
+bt = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, 
UI_UNIT_X, NULL, 0.0, 0.0,
+  0.0, 0.0, TIP_("Delete points"));
+UI_but_funcN_set(bt, profilewidget_buttons_delete, MEM_dupallocN(cb), 
prwdgt);
+if (point_last_or_first) {
+  UI_but_flag_enable(bt, UI_BUT_DISABLED);
+}
   }
 
   uiItemR(layout, ptr, "sample_straight_edges", 0, NULL, ICON_NONE);

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


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

2019-08-01 Thread Jacques Lucke
Commit: 480e284250ba1e657111c4f25d073706a2794f67
Author: Jacques Lucke
Date:   Thu Aug 1 18:24:20 2019 +0200
Branches: functions
https://developer.blender.org/rB480e284250ba1e657111c4f25d073706a2794f67

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] [f0b74997504] functions: support for default values for vectorized inputs

2019-08-01 Thread Jacques Lucke
Commit: f0b74997504af337114b7699d4022caa6a912665
Author: Jacques Lucke
Date:   Thu Aug 1 18:19:58 2019 +0200
Branches: functions
https://developer.blender.org/rBf0b74997504af337114b7699d4022caa6a912665

support for default values for vectorized inputs

===

M   release/scripts/startup/nodes/declaration/__init__.py
M   release/scripts/startup/nodes/declaration/base.py
M   release/scripts/startup/nodes/declaration/fixed_type.py
M   release/scripts/startup/nodes/declaration/vectorized.py
M   release/scripts/startup/nodes/function_nodes/color.py
M   release/scripts/startup/nodes/node_builder.py

===

diff --git a/release/scripts/startup/nodes/declaration/__init__.py 
b/release/scripts/startup/nodes/declaration/__init__.py
index b37d1770832..c8488f5db96 100644
--- a/release/scripts/startup/nodes/declaration/__init__.py
+++ b/release/scripts/startup/nodes/declaration/__init__.py
@@ -1,4 +1,5 @@
-from . fixed_type import FixedSocketDecl, NoDefaultValue
+from . base import NoDefaultValue
+from . fixed_type import FixedSocketDecl
 from . dynamic_list import ListSocketDecl
 from . pack_list import PackListDecl
 from . tree_interface import TreeInterfaceDecl
diff --git a/release/scripts/startup/nodes/declaration/base.py 
b/release/scripts/startup/nodes/declaration/base.py
index e1c0caad845..54900b460ea 100644
--- a/release/scripts/startup/nodes/declaration/base.py
+++ b/release/scripts/startup/nodes/declaration/base.py
@@ -1,3 +1,5 @@
+NoDefaultValue = object()
+
 class SocketDeclBase:
 def init(self):
 pass
diff --git a/release/scripts/startup/nodes/declaration/fixed_type.py 
b/release/scripts/startup/nodes/declaration/fixed_type.py
index 5008c4949e5..22dec2cde85 100644
--- a/release/scripts/startup/nodes/declaration/fixed_type.py
+++ b/release/scripts/startup/nodes/declaration/fixed_type.py
@@ -1,8 +1,6 @@
-from . base import SocketDeclBase
+from . base import SocketDeclBase, NoDefaultValue
 from .. types import type_infos
 
-NoDefaultValue = object()
-
 class FixedSocketDecl(SocketDeclBase):
 def __init__(self, node, identifier: str, display_name: str, data_type: 
str, default):
 self.node = node
diff --git a/release/scripts/startup/nodes/declaration/vectorized.py 
b/release/scripts/startup/nodes/declaration/vectorized.py
index bced5287882..439dc463205 100644
--- a/release/scripts/startup/nodes/declaration/vectorized.py
+++ b/release/scripts/startup/nodes/declaration/vectorized.py
@@ -1,6 +1,6 @@
 import bpy
 from bpy.props import *
-from . base import SocketDeclBase
+from . base import SocketDeclBase, NoDefaultValue
 from .. types import type_infos
 
 class VectorizedDeclBase:
@@ -33,7 +33,7 @@ class VectorizedInputDecl(VectorizedDeclBase, SocketDeclBase):
 def __init__(self,
 node, identifier, prop_name,
 base_name, list_name,
-base_type):
+base_type, default):
 self.node = node
 self.identifier = identifier
 self.prop_name = prop_name
@@ -41,6 +41,12 @@ class VectorizedInputDecl(VectorizedDeclBase, 
SocketDeclBase):
 self.list_name = list_name
 self.base_type = base_type
 self.list_type = type_infos.to_list(base_type)
+self.default = default
+
+def init_default(self, node_sockets):
+if self.default is not NoDefaultValue:
+socket = node_sockets[0]
+socket.restore_state(self.default)
 
 def is_vectorized(self):
 stored = getattr(self.node, self.prop_name)
diff --git a/release/scripts/startup/nodes/function_nodes/color.py 
b/release/scripts/startup/nodes/function_nodes/color.py
index fd4cc1f3a2e..1125f8dcd28 100644
--- a/release/scripts/startup/nodes/function_nodes/color.py
+++ b/release/scripts/startup/nodes/function_nodes/color.py
@@ -50,7 +50,8 @@ class CombineColorNode(bpy.types.Node, FunctionNode):
 "Blue", "Blue", "Float")
 builder.vectorized_input(
 "alpha", "use_list__alpha",
-"Alpha", "Alpha", "Float")
+"Alpha", "Alpha", "Float",
+default=1.0)
 
 builder.vectorized_output(
 "color", ["use_list__red", "use_list__green", "use_list__blue", 
"use_list__alpha"],
diff --git a/release/scripts/startup/nodes/node_builder.py 
b/release/scripts/startup/nodes/node_builder.py
index 57b767a4b9f..cd462c710b4 100644
--- a/release/scripts/startup/nodes/node_builder.py
+++ b/release/scripts/startup/nodes/node_builder.py
@@ -176,10 +176,11 @@ class NodeBuilder:
 def VectorizedProperty():
 return VectorizedInputDecl.Property()
 
-def vectorized_input(self, identifier, prop_name, base_name, list_name, 
base_type):
+def vectorized_input(self, identifier, prop_name, base_name, list_name, 
base_type, *, default=NoDefaultValue):
 decl = VectorizedInputDecl(
 self.node, 

[Bf-blender-cvs] [d63f673e05e] functions: move input handlers to separate file

2019-08-01 Thread Jacques Lucke
Commit: d63f673e05e161de3c09914743e65cf7ca4acd4f
Author: Jacques Lucke
Date:   Thu Aug 1 17:55:47 2019 +0200
Branches: functions
https://developer.blender.org/rBd63f673e05e161de3c09914743e65cf7ca4acd4f

move input handlers to separate file

===

M   source/blender/functions/CMakeLists.txt
M   source/blender/functions/FN_data_flow_nodes.hpp
M   source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
A   source/blender/functions/frontends/data_flow_nodes/input_handlers.cpp
A   source/blender/functions/frontends/data_flow_nodes/input_handlers.hpp

===

diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index bcf39703021..6ec6c000303 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -155,6 +155,8 @@ set(SRC
   frontends/data_flow_nodes/type_mappings.cpp
   frontends/data_flow_nodes/vtree_data_graph.hpp
   frontends/data_flow_nodes/vtree_data_graph.cpp
+  frontends/data_flow_nodes/input_handlers.hpp
+  frontends/data_flow_nodes/input_handlers.cpp
   frontends/data_flow_nodes/data_flow_nodes-c.h
   frontends/data_flow_nodes/data_flow_nodes-c.cpp
 )
diff --git a/source/blender/functions/FN_data_flow_nodes.hpp 
b/source/blender/functions/FN_data_flow_nodes.hpp
index 62e0063b4ea..994f8216055 100644
--- a/source/blender/functions/FN_data_flow_nodes.hpp
+++ b/source/blender/functions/FN_data_flow_nodes.hpp
@@ -4,3 +4,4 @@
 #include "frontends/data_flow_nodes/function_generation.hpp"
 #include "frontends/data_flow_nodes/graph_generation.hpp"
 #include "frontends/data_flow_nodes/vtree_data_graph.hpp"
+#include "frontends/data_flow_nodes/input_handlers.hpp"
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp 
b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
index d935a57fbe5..13a04fbd01f 100644
--- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
@@ -1,9 +1,6 @@
 #include "DNA_node_types.h"
 
-#include "FN_types.hpp"
-#include "FN_dependencies.hpp"
 #include "FN_data_flow_nodes.hpp"
-#include "FN_llvm.hpp"
 
 #include "inserters.hpp"
 
@@ -114,194 +111,6 @@ static void insert_unlinked_inputs(VTreeDataGraphBuilder 
,
   }
 }
 
-class SocketLoaderBody : public TupleCallBody {
- private:
-  Vector m_btrees;
-  Vector m_bsockets;
-  Vector m_loaders;
-
- public:
-  SocketLoaderBody(ArrayRef btrees,
-   ArrayRef bsockets,
-   Vector )
-  : m_btrees(btrees), m_bsockets(bsockets), m_loaders(loaders)
-  {
-  }
-
-  void call(Tuple (fn_in), Tuple _out, ExecutionContext 
(ctx)) const override
-  {
-for (uint i = 0; i < m_bsockets.size(); i++) {
-  PointerRNA rna;
-  bNodeSocket *bsocket = m_bsockets[i];
-  auto loader = m_loaders[i];
-  bNodeTree *btree = m_btrees[i];
-
-  RNA_pointer_create(>id, _NodeSocket, bsocket, );
-  loader(, fn_out, i);
-}
-  }
-};
-
-class SocketLoaderDependencies : public DepsBody {
- private:
-  Vector m_btrees;
-  Vector m_bsockets;
-
- public:
-  SocketLoaderDependencies(ArrayRef btrees, ArrayRef bsockets)
-  : m_btrees(btrees), m_bsockets(bsockets)
-  {
-  }
-
-  void build_deps(FunctionDepsBuilder ) const
-  {
-for (uint i = 0; i < m_bsockets.size(); i++) {
-  bNodeSocket *bsocket = m_bsockets[i];
-  bNodeTree *btree = m_btrees[i];
-  if (STREQ(bsocket->idname, "fn_ObjectSocket")) {
-PointerRNA rna;
-RNA_pointer_create(>id, _NodeSocket, bsocket, );
-Object *value = (Object *)RNA_pointer_get(, "value").id.data;
-if (value != nullptr) {
-  builder.add_output_objects(i, {value});
-}
-  }
-}
-  }
-};
-
-class DynamicSocketLoader : public UnlinkedInputsHandler {
- public:
-  DynamicSocketLoader() = default;
-
-  void insert(VTreeDataGraphBuilder ,
-  ArrayRef unlinked_inputs,
-  ArrayRef r_new_origins) override
-  {
-auto _loader_map = get_socket_loader_map();
-
-Vector loaders;
-Vector bsockets;
-Vector btrees;
-
-FunctionBuilder fn_builder;
-for (uint i = 0; i < unlinked_inputs.size(); i++) {
-  VirtualSocket *vsocket = unlinked_inputs[i];
-
-  SocketLoader loader = socket_loader_map.lookup(vsocket->idname());
-  loaders.append(loader);
-  fn_builder.add_output(vsocket->name(), 
builder.query_socket_type(vsocket));
-
-  bsockets.append(vsocket->bsocket());
-  btrees.append(vsocket->btree());
-}
-
-auto fn = fn_builder.build("Input Sockets");
-fn->add_body(btrees, bsockets, loaders);
-fn->add_body(btrees, bsockets);
-BuilderNode *node = builder.insert_function(fn);
-
-r_new_origins.copy_from(node->outputs());
-  }
-};
-
-class ConstantOutput : public 

[Bf-blender-cvs] [79b85c14263] functions: add ability to store socket values as constants in IR

2019-08-01 Thread Jacques Lucke
Commit: 79b85c14263de84386c77dd4ba913e9a96d8ac71
Author: Jacques Lucke
Date:   Thu Aug 1 17:18:34 2019 +0200
Branches: functions
https://developer.blender.org/rB79b85c14263de84386c77dd4ba913e9a96d8ac71

add ability to store socket values as constants in IR

===

M   source/blender/functions/backends/llvm/builder.hpp
M   source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp

===

diff --git a/source/blender/functions/backends/llvm/builder.hpp 
b/source/blender/functions/backends/llvm/builder.hpp
index 6026a47c82f..3c25135e687 100644
--- a/source/blender/functions/backends/llvm/builder.hpp
+++ b/source/blender/functions/backends/llvm/builder.hpp
@@ -6,10 +6,14 @@
  */
 
 #include "FN_core.hpp"
+#include "BLI_math.hpp"
+
 #include 
 
 namespace FN {
 
+using BLI::float3;
+
 class LLVMTypeInfo;
 class IRConstruct_ForLoop;
 class IRConstruct_IterationsLoop;
@@ -164,6 +168,12 @@ class CodeBuilder {
 return llvm::ConstantFP::get(this->getFloatTy(), value);
   }
 
+  llvm::Constant *getFloat3(float3 value)
+  {
+return llvm::ConstantVector::get(
+{this->getFloat(value.x), this->getFloat(value.y), 
this->getFloat(value.z)});
+  }
+
   llvm::Constant *getDouble(double value)
   {
 return llvm::ConstantFP::get(this->getDoubleTy(), value);
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp 
b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
index 329bbcbaa30..d935a57fbe5 100644
--- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
@@ -3,6 +3,7 @@
 #include "FN_types.hpp"
 #include "FN_dependencies.hpp"
 #include "FN_data_flow_nodes.hpp"
+#include "FN_llvm.hpp"
 
 #include "inserters.hpp"
 
@@ -204,15 +205,11 @@ class DynamicSocketLoader : public UnlinkedInputsHandler {
   }
 };
 
-class ConstantTupleOutput : public TupleCallBody {
+class ConstantOutput : public TupleCallBody {
  private:
   std::unique_ptr m_tuple;
 
  public:
-  ConstantTupleOutput()
-  {
-  }
-
   void set_tuple(std::unique_ptr tuple)
   {
 m_tuple = std::move(tuple);
@@ -228,6 +225,48 @@ class ConstantTupleOutput : public TupleCallBody {
   }
 };
 
+class ConstantOutputGen : public LLVMBuildIRBody {
+ private:
+  std::unique_ptr m_tuple;
+
+ public:
+  void set_tuple(std::unique_ptr tuple)
+  {
+m_tuple = std::move(tuple);
+  }
+
+  void build_ir(CodeBuilder ,
+CodeInterface ,
+const BuildIRSettings (settings)) const override
+  {
+TupleMeta  = m_tuple->meta();
+SharedType _type = Types::GET_TYPE_float();
+SharedType _type = Types::GET_TYPE_int32();
+SharedType _type = Types::GET_TYPE_float3();
+
+for (uint i = 0; i < m_tuple->size(); i++) {
+  SharedType  = meta.types()[i];
+  llvm::Value *value = nullptr;
+  if (type == float_type) {
+value = builder.getFloat(m_tuple->get(i));
+  }
+  else if (type == int32_type) {
+value = builder.getInt32(m_tuple->get(i));
+  }
+  else if (type == float3_type) {
+value = builder.getFloat3(m_tuple->get(i));
+  }
+  else {
+void *ptr = m_tuple->element_ptr(i);
+LLVMTypeInfo _info = type->extension();
+value = type_info.build_load_ir__copy(builder, builder.getAnyPtr(ptr));
+  }
+  BLI_assert(value != nullptr);
+  interface.set_output(i, value);
+}
+  }
+};
+
 class ConstantInputsHandler : public UnlinkedInputsHandler {
   void insert(VTreeDataGraphBuilder ,
   ArrayRef unlinked_inputs,
@@ -237,22 +276,26 @@ class ConstantInputsHandler : public 
UnlinkedInputsHandler {
 
 FunctionBuilder fn_builder;
 for (VirtualSocket *vsocket : unlinked_inputs) {
-  fn_builder.add_output(vsocket->name(), 
builder.query_socket_type(vsocket));
+  SharedType  = builder.query_socket_type(vsocket);
+  fn_builder.add_output(vsocket->name(), type);
 }
 SharedFunction fn = fn_builder.build("Unlinked Inputs");
-fn->add_body();
-ConstantTupleOutput  = fn->body();
+ConstantOutput _call_body = *fn->add_body();
+ConstantOutputGen _ir_body = *fn->add_body();
 
-Tuple *tuple = new Tuple(*body.meta_out().ptr());
+Tuple *tuple1 = new Tuple(tuple_call_body.meta_out());
+Tuple *tuple2 = new Tuple(tuple_call_body.meta_out());
 
 for (uint i = 0; i < unlinked_inputs.size(); i++) {
   VirtualSocket *vsocket = unlinked_inputs[i];
   SocketLoader loader = socket_loader_map.lookup(vsocket->idname());
   PointerRNA rna = vsocket->rna();
-  loader(, *tuple, i);
+  loader(, *tuple1, i);
+  Tuple::copy_element(*tuple1, i, *tuple2, i);
 }
 
-body.set_tuple(std::unique_ptr(tuple));
+tuple_call_body.set_tuple(std::unique_ptr(tuple1));
+

[Bf-blender-cvs] [b07626e48be] functions: fix use after free in python

2019-08-01 Thread Jacques Lucke
Commit: b07626e48becea3fbc4934635b2457fbb86504eb
Author: Jacques Lucke
Date:   Thu Aug 1 17:25:54 2019 +0200
Branches: functions
https://developer.blender.org/rBb07626e48becea3fbc4934635b2457fbb86504eb

fix use after free in python

===

M   release/scripts/startup/nodes/base.py

===

diff --git a/release/scripts/startup/nodes/base.py 
b/release/scripts/startup/nodes/base.py
index c58de89a276..c2d20b2570c 100644
--- a/release/scripts/startup/nodes/base.py
+++ b/release/scripts/startup/nodes/base.py
@@ -175,6 +175,10 @@ class BaseNode:
 _socket_value_states_per_node[self] = SocketValueStates(self)
 return _socket_value_states_per_node[self]
 
+def free(self):
+if self in _decl_map_per_node:
+del _decl_map_per_node[self]
+
 
 
 class BaseSocket:

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


[Bf-blender-cvs] [13dce85083a] functions: fix float math node inputs

2019-08-01 Thread Jacques Lucke
Commit: 13dce85083a0e2537e99526a3748abe02feb0abf
Author: Jacques Lucke
Date:   Thu Aug 1 14:55:20 2019 +0200
Branches: functions
https://developer.blender.org/rB13dce85083a0e2537e99526a3748abe02feb0abf

fix float math node inputs

===

M   release/scripts/startup/nodes/function_nodes/float_math.py

===

diff --git a/release/scripts/startup/nodes/function_nodes/float_math.py 
b/release/scripts/startup/nodes/function_nodes/float_math.py
index 6c50de360e7..4967860873c 100644
--- a/release/scripts/startup/nodes/function_nodes/float_math.py
+++ b/release/scripts/startup/nodes/function_nodes/float_math.py
@@ -37,13 +37,17 @@ class FloatMathNode(bpy.types.Node, FunctionNode):
 builder.vectorized_input(
 "a", "use_list__a",
 "A", "A", "Float")
+prop_names = ["use_list__a"]
+
 if self.operation not in single_value_operations:
 builder.vectorized_input(
 "b", "use_list__b",
 "B", "B", "Float")
+prop_names.append("use_list__b")
+
 
 builder.vectorized_output(
-"result", ["use_list__a", "use_list__b"],
+"result", prop_names,
 "Result", "Result", "Float")
 
 def draw(self, layout):

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


[Bf-blender-cvs] [faeb98b48eb] functions: compute type of every socket only once

2019-08-01 Thread Jacques Lucke
Commit: faeb98b48eb94e51a9a17a8652d6fe24a8e90f6d
Author: Jacques Lucke
Date:   Thu Aug 1 15:36:37 2019 +0200
Branches: functions
https://developer.blender.org/rBfaeb98b48eb94e51a9a17a8652d6fe24a8e90f6d

compute type of every socket only once

===

M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp

===

diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
index 62cf96094f0..056378bc900 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
@@ -34,6 +34,20 @@ VTreeDataGraphBuilder::VTreeDataGraphBuilder(VirtualNodeTree 
)
   m_type_by_data_type(get_type_by_data_type_map()),
   m_data_type_by_idname(get_data_type_by_idname_map())
 {
+  this->initialize_type_by_vsocket_map();
+}
+
+BLI_NOINLINE void VTreeDataGraphBuilder::initialize_type_by_vsocket_map()
+{
+  m_type_by_vsocket = Vector(m_vtree.socket_count(), SharedType());
+  for (VirtualNode *vnode : m_vtree.nodes()) {
+for (VirtualSocket *vsocket : vnode->inputs()) {
+  m_type_by_vsocket[vsocket->id()] = 
m_type_by_idname.lookup_default(vsocket->idname(), {});
+}
+for (VirtualSocket *vsocket : vnode->outputs()) {
+  m_type_by_vsocket[vsocket->id()] = 
m_type_by_idname.lookup_default(vsocket->idname(), {});
+}
+  }
 }
 
 VTreeDataGraph VTreeDataGraphBuilder::build()
@@ -240,7 +254,7 @@ VirtualNodeTree ::vtree() const
 
 bool VTreeDataGraphBuilder::is_data_socket(VirtualSocket *vsocket) const
 {
-  return m_type_by_idname.contains(vsocket->bsocket()->idname);
+  return m_type_by_vsocket[vsocket->id()].ptr() != nullptr;
 }
 
 SharedType ::type_by_name(StringRef data_type) const
@@ -250,12 +264,8 @@ SharedType ::type_by_name(StringRef 
data_type) const
 
 SharedType ::query_socket_type(VirtualSocket *vsocket) 
const
 {
-  return m_type_by_idname.lookup_ref(vsocket->bsocket()->idname);
-}
-
-StringRef VTreeDataGraphBuilder::query_socket_data_type(VirtualSocket 
*vsocket) const
-{
-  return m_data_type_by_idname.lookup_ref(vsocket->bsocket()->idname);
+  BLI_assert(this->is_data_socket(vsocket));
+  return m_type_by_vsocket[vsocket->id()];
 }
 
 SharedType ::query_type_property(VirtualNode *vnode,
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
index 2a148b7573b..7a03131f8ca 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
@@ -21,6 +21,7 @@ class VTreeDataGraphBuilder {
   VirtualNodeTree _vtree;
   DataGraphBuilder m_graph_builder;
   Vector m_socket_map;
+  Vector m_type_by_vsocket;
   StringMap _type_by_idname;
   StringMap _type_by_data_type;
   StringMap _data_type_by_idname;
@@ -62,7 +63,6 @@ class VTreeDataGraphBuilder {
 
   /* Query Socket Information */
   bool is_data_socket(VirtualSocket *vsocket) const;
-  StringRef query_socket_data_type(VirtualSocket *vsocket) const;
   SharedType _socket_type(VirtualSocket *vsocket) const;
 
   /* Query Node Information */
@@ -73,6 +73,7 @@ class VTreeDataGraphBuilder {
   SharedType _from_rna(PointerRNA , StringRefNull prop_name) const;
 
  private:
+  void initialize_type_by_vsocket_map();
   bool check_if_sockets_are_mapped(VirtualNode *vnode, ArrayRef vsockets) const;
 };

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


[Bf-blender-cvs] [787e97057ae] functions: return function body instead of bool

2019-08-01 Thread Jacques Lucke
Commit: 787e97057aea759ee56b2a210a19ad0c553a8ab3
Author: Jacques Lucke
Date:   Thu Aug 1 17:18:07 2019 +0200
Branches: functions
https://developer.blender.org/rB787e97057aea759ee56b2a210a19ad0c553a8ab3

return function body instead of bool

===

M   source/blender/functions/core/function.hpp

===

diff --git a/source/blender/functions/core/function.hpp 
b/source/blender/functions/core/function.hpp
index 1d798de78d1..b1c9fa34183 100644
--- a/source/blender/functions/core/function.hpp
+++ b/source/blender/functions/core/function.hpp
@@ -85,8 +85,9 @@ class Function final : public RefCountedBase {
   /**
* Add another implementation to the function. Every type of implementation 
can only be added
* once. Future calls with the same type are ignored.
+   * Returns the pointer to the body when it was newly created, nullptr 
otherwise.
*/
-  template bool add_body(Args &&... args);
+  template T *add_body(Args &&... args);
 
   /**
* Get the number of inputs.
@@ -185,7 +186,7 @@ template inline T ::body() const
   return *(T *)m_bodies[T::FUNCTION_BODY_ID];
 }
 
-template inline bool Function::add_body(Args 
&&... args)
+template inline T *Function::add_body(Args &&... 
args)
 {
   STATIC_ASSERT_BODY_TYPE(T);
 
@@ -194,10 +195,10 @@ template inline bool 
Function::add_body(Args &&...
 T *new_body = new T(std::forward(args)...);
 new_body->set_owner(this);
 m_bodies[T::FUNCTION_BODY_ID] = new_body;
-return true;
+return new_body;
   }
   else {
-return false;
+return nullptr;
   }
 }

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


[Bf-blender-cvs] [eb403083c67] functions: support that tuples own their meta data

2019-08-01 Thread Jacques Lucke
Commit: eb403083c67fbecaad7c8bed525fea4e77929bdc
Author: Jacques Lucke
Date:   Thu Aug 1 17:17:36 2019 +0200
Branches: functions
https://developer.blender.org/rBeb403083c67fbecaad7c8bed525fea4e77929bdc

support that tuples own their meta data

===

M   source/blender/functions/backends/tuple/tuple.hpp

===

diff --git a/source/blender/functions/backends/tuple/tuple.hpp 
b/source/blender/functions/backends/tuple/tuple.hpp
index 89e46e0b019..e042b9194af 100644
--- a/source/blender/functions/backends/tuple/tuple.hpp
+++ b/source/blender/functions/backends/tuple/tuple.hpp
@@ -133,9 +133,16 @@ class Tuple {
 m_initialized = (bool *)MEM_calloc_arrayN(m_meta->element_amount(), 
sizeof(bool), __func__);
 m_data = MEM_mallocN(m_meta->size_of_data(), __func__);
 m_owns_mem = true;
+m_owns_meta = false;
 m_run_destructors = true;
   }
 
+  Tuple(SharedTupleMeta meta) : Tuple(*meta.ptr())
+  {
+meta->incref();
+m_owns_meta = true;
+  }
+
   Tuple(TupleMeta ,
 void *data,
 bool *initialized,
@@ -148,6 +155,7 @@ class Tuple {
 m_data = data;
 m_initialized = initialized;
 m_owns_mem = false;
+m_owns_meta = false;
 m_run_destructors = run_destructors;
 if (!was_initialized) {
   this->set_all_uninitialized();
@@ -180,6 +188,9 @@ class Tuple {
   MEM_freeN(m_data);
   MEM_freeN(m_initialized);
 }
+if (m_owns_meta) {
+  m_meta->decref();
+}
   }
 
   /**
@@ -531,14 +542,14 @@ class Tuple {
 return *m_meta;
   }
 
-  void print_initialized(std::string name = "");
-
- private:
   inline void *element_ptr(uint index) const
   {
 return (void *)((char *)m_data + m_meta->offsets()[index]);
   }
 
+  void print_initialized(std::string name = "");
+
+ private:
   template inline T _ref(uint index) const
   {
 return *(T *)this->element_ptr(index);
@@ -546,8 +557,9 @@ class Tuple {
 
   void *m_data;
   bool *m_initialized;
-  bool m_owns_mem;
-  bool m_run_destructors;
+  uint8_t m_owns_mem : 1;
+  uint8_t m_owns_meta : 1;
+  uint8_t m_run_destructors : 1;
   TupleMeta *m_meta;
 };

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


[Bf-blender-cvs] [0b970bc1601] functions: fix fill constructor of vector

2019-08-01 Thread Jacques Lucke
Commit: 0b970bc16015d8d564ef2cd3ab1336fde68e6780
Author: Jacques Lucke
Date:   Thu Aug 1 15:36:16 2019 +0200
Branches: functions
https://developer.blender.org/rB0b970bc16015d8d564ef2cd3ab1336fde68e6780

fix fill constructor of vector

===

M   source/blender/blenlib/BLI_vector.hpp

===

diff --git a/source/blender/blenlib/BLI_vector.hpp 
b/source/blender/blenlib/BLI_vector.hpp
index 8557b91f49f..c53931612f9 100644
--- a/source/blender/blenlib/BLI_vector.hpp
+++ b/source/blender/blenlib/BLI_vector.hpp
@@ -87,7 +87,7 @@ template class Vector {
   Vector(uint size, const T ) : Vector()
   {
 this->reserve(size);
-std::fill_n(m_elements, size, value);
+std::uninitialized_fill_n(m_elements, size, value);
 m_size = size;
   }

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


[Bf-blender-cvs] [46bd09b7893] functions: cleanup

2019-08-01 Thread Jacques Lucke
Commit: 46bd09b7893bb57ce6ca4fbf953e4a894a11e740
Author: Jacques Lucke
Date:   Thu Aug 1 15:56:00 2019 +0200
Branches: functions
https://developer.blender.org/rB46bd09b7893bb57ce6ca4fbf953e4a894a11e740

cleanup

===

M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
M   source/blender/simulations/bparticles/simulate.cpp

===

diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
index 056378bc900..b5825d1002d 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
@@ -52,7 +52,6 @@ BLI_NOINLINE void 
VTreeDataGraphBuilder::initialize_type_by_vsocket_map()
 
 VTreeDataGraph VTreeDataGraphBuilder::build()
 {
-  m_graph_builder.to_dot__clipboard();
   auto data_graph = m_graph_builder.build();
 
   Vector r_socket_map(m_vtree.socket_count(), DataSocket::None());
diff --git a/source/blender/simulations/bparticles/simulate.cpp 
b/source/blender/simulations/bparticles/simulate.cpp
index 922570637db..877058b01a6 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -636,6 +636,8 @@ BLI_NOINLINE static void 
emit_and_simulate_particles(ParticlesState ,
 
 void simulate_step(ParticlesState , StepDescription _description)
 {
+  SCOPED_TIMER(__func__);
+
   float start_time = state.current_time();
   state.increase_time(step_description.step_duration());
   TimeSpan time_span(start_time, step_description.step_duration());

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


[Bf-blender-cvs] [e606316ed6f] functions: rename refresh to sync_tree

2019-08-01 Thread Jacques Lucke
Commit: e606316ed6ffa09e45b05f41f07a9ef532ab181b
Author: Jacques Lucke
Date:   Thu Aug 1 14:55:55 2019 +0200
Branches: functions
https://developer.blender.org/rBe606316ed6ffa09e45b05f41f07a9ef532ab181b

rename refresh to sync_tree

===

M   release/scripts/startup/nodes/base.py
M   release/scripts/startup/nodes/bparticle_nodes/custom_emitter.py
M   release/scripts/startup/nodes/declaration/pack_list.py
M   release/scripts/startup/nodes/declaration/variadic.py
M   release/scripts/startup/nodes/function_nodes/call.py
M   release/scripts/startup/nodes/function_nodes/compare.py
M   release/scripts/startup/nodes/function_nodes/float_math.py
M   release/scripts/startup/nodes/function_nodes/list.py
M   release/scripts/startup/nodes/function_nodes/switch.py
M   release/scripts/startup/nodes/function_nodes/vector.py
M   release/scripts/startup/nodes/node_operators.py

===

diff --git a/release/scripts/startup/nodes/base.py 
b/release/scripts/startup/nodes/base.py
index a1f94330b17..c58de89a276 100644
--- a/release/scripts/startup/nodes/base.py
+++ b/release/scripts/startup/nodes/base.py
@@ -12,6 +12,9 @@ class BaseTree:
 self.links.new(b, a)
 
 def update(self):
+self.sync()
+
+def sync(self):
 from . sync import sync_trees_and_dependent_trees
 sync_trees_and_dependent_trees({self})
 
@@ -55,10 +58,8 @@ class BaseNode:
 yield (cls.bl_label, dict())
 yield from cls.search_terms
 
-def refresh(self, context=None):
-from . sync import sync_trees_and_dependent_trees
-sync_trees_and_dependent_trees({self.tree})
-pass
+def sync_tree(self, context=None):
+self.tree.sync()
 
 def rebuild(self):
 from . sync import skip_syncing
diff --git a/release/scripts/startup/nodes/bparticle_nodes/custom_emitter.py 
b/release/scripts/startup/nodes/bparticle_nodes/custom_emitter.py
index 40823439d18..9c5d950b815 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/custom_emitter.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/custom_emitter.py
@@ -11,7 +11,7 @@ class CustomEmitterNode(bpy.types.Node, FunctionNode):
 function_tree: PointerProperty(
 name="Function Tree",
 type=bpy.types.NodeTree,
-update=FunctionNode.refresh,
+update=FunctionNode.sync_tree,
 )
 
 def declaration(self, builder: NodeBuilder):
diff --git a/release/scripts/startup/nodes/declaration/pack_list.py 
b/release/scripts/startup/nodes/declaration/pack_list.py
index 15f6b0baf57..908bda99683 100644
--- a/release/scripts/startup/nodes/declaration/pack_list.py
+++ b/release/scripts/startup/nodes/declaration/pack_list.py
@@ -132,8 +132,7 @@ class NewPackListInputOperator(bpy.types.Operator):
 item.state = "BASE"
 item.identifier_prefix = str(uuid.uuid4())
 
-node.refresh()
-
+tree.sync()
 return {'FINISHED'}
 
 class RemovePackListInputOperator(bpy.types.Operator):
@@ -151,5 +150,5 @@ class RemovePackListInputOperator(bpy.types.Operator):
 node = tree.nodes[self.node_name]
 collection = getattr(node, self.prop_name)
 collection.remove(self.index)
-node.refresh()
+tree.sync()
 return {'FINISHED'}
diff --git a/release/scripts/startup/nodes/declaration/variadic.py 
b/release/scripts/startup/nodes/declaration/variadic.py
index d5ed8500ac7..be889b9104c 100644
--- a/release/scripts/startup/nodes/declaration/variadic.py
+++ b/release/scripts/startup/nodes/declaration/variadic.py
@@ -85,7 +85,7 @@ class AnyVariadicDecl(SocketDeclBase):
 item.data_type = data_type
 item.display_name = display_name
 item.identifier_prefix = str(uuid.uuid4())
-self.node.refresh()
+self.node.sync_tree()
 return item
 
 @classmethod
@@ -127,7 +127,7 @@ class AppendAnyVariadicOperator(bpy.types.Operator):
 item.display_name = data_type
 item.identifier_prefix = str(uuid.uuid4())
 
-node.refresh()
+tree.sync()
 return {'FINISHED'}
 
 class RemoveAnyVariadicOperator(bpy.types.Operator):
@@ -145,5 +145,5 @@ class RemoveAnyVariadicOperator(bpy.types.Operator):
 node = tree.nodes[self.node_name]
 collection = getattr(node, self.prop_name)
 collection.remove(self.index)
-node.refresh()
+tree.sync()
 return {'FINISHED'}
diff --git a/release/scripts/startup/nodes/function_nodes/call.py 
b/release/scripts/startup/nodes/function_nodes/call.py
index 9efb3f71218..6b24d646a47 100644
--- a/release/scripts/startup/nodes/function_nodes/call.py
+++ b/release/scripts/startup/nodes/function_nodes/call.py
@@ -9,7 +9,7 @@ class CallNode(bpy.types.Node, FunctionNode):
 function_tree: PointerProperty(
 name="Function Tree",
 

[Bf-blender-cvs] [795bae3410d] functions: cleanup type mappings

2019-08-01 Thread Jacques Lucke
Commit: 795bae3410dd681c399307b7179b16d8e2562216
Author: Jacques Lucke
Date:   Thu Aug 1 15:07:04 2019 +0200
Branches: functions
https://developer.blender.org/rB795bae3410dd681c399307b7179b16d8e2562216

cleanup type mappings

===

M   source/blender/functions/frontends/data_flow_nodes/inserters.hpp
M   
source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
M   source/blender/functions/frontends/data_flow_nodes/type_mappings.cpp
M   source/blender/functions/frontends/data_flow_nodes/type_mappings.hpp

===

diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters.hpp 
b/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
index 5b0ef78d0b8..c45ae79649d 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
@@ -7,6 +7,7 @@
 #include "FN_tuple_call.hpp"
 
 #include "vtree_data_graph_builder.hpp"
+#include "type_mappings.hpp"
 
 struct PointerRNA;
 
@@ -71,15 +72,19 @@ class SocketLoaderRegistry {
 class ConversionInserterRegistry {
  private:
   Map _map;
+  StringMap _idname_by_data_type;
 
  public:
-  ConversionInserterRegistry(Map ) : 
m_map(map)
+  ConversionInserterRegistry(Map )
+  : m_map(map), m_idname_by_data_type(get_idname_by_data_type_map())
   {
   }
 
   void inserter(StringRef from_type, StringRef to_type, ConversionInserter 
inserter)
   {
-m_map.add_new(StringPair(from_type.to_std_string(), 
to_type.to_std_string()), inserter);
+std::string _idname = m_idname_by_data_type.lookup_ref(from_type);
+std::string _idname = m_idname_by_data_type.lookup_ref(to_type);
+m_map.add_new(StringPair(from_idname, to_idname), inserter);
   }
   void function(StringRef from_type, StringRef to_type, FunctionGetter getter)
   {
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp 
b/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
index 79f0b932b8b..54dcf125f8b 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
@@ -18,32 +18,26 @@ static void INSERT_base_to_list(VTreeDataGraphBuilder 
,
 
 void register_conversion_inserters(ConversionInserterRegistry )
 {
-  registry.function("fn_BooleanSocket", "fn_IntegerSocket", 
Functions::GET_FN_bool_to_int32);
-  registry.function("fn_BooleanSocket", "fn_FloatSocket", 
Functions::GET_FN_bool_to_float);
-  registry.function("fn_IntegerSocket", "fn_BooleanSocket", 
Functions::GET_FN_int32_to_bool);
-  registry.function("fn_IntegerSocket", "fn_FloatSocket", 
Functions::GET_FN_int32_to_float);
-  registry.function("fn_FloatSocket", "fn_BooleanSocket", 
Functions::GET_FN_float_to_bool);
-  registry.function("fn_FloatSocket", "fn_IntegerSocket", 
Functions::GET_FN_float_to_int32);
+  registry.function("Boolean", "Integer", Functions::GET_FN_bool_to_int32);
+  registry.function("Boolean", "Float", Functions::GET_FN_bool_to_float);
+  registry.function("Integer", "Boolean", Functions::GET_FN_int32_to_bool);
+  registry.function("Integer", "Float", Functions::GET_FN_int32_to_float);
+  registry.function("Float", "Boolean", Functions::GET_FN_float_to_bool);
+  registry.function("Float", "Integer", Functions::GET_FN_float_to_int32);
 
-  registry.function(
-  "fn_BooleanListSocket", "fn_IntegerListSocket", 
Functions::GET_FN_bool_list_to_int32_list);
-  registry.function(
-  "fn_BooleanListSocket", "fn_FloatListSocket", 
Functions::GET_FN_bool_list_to_float_list);
-  registry.function(
-  "fn_IntegerListSocket", "fn_BooleanListSocket", 
Functions::GET_FN_int32_list_to_bool_list);
-  registry.function(
-  "fn_IntegerListSocket", "fn_FloatListSocket", 
Functions::GET_FN_int32_list_to_float_list);
-  registry.function(
-  "fn_FloatListSocket", "fn_BooleanListSocket", 
Functions::GET_FN_float_list_to_bool_list);
-  registry.function(
-  "fn_FloatListSocket", "fn_IntegerListSocket", 
Functions::GET_FN_float_list_to_int32_list);
+  registry.function("Boolean List", "Integer List", 
Functions::GET_FN_bool_list_to_int32_list);
+  registry.function("Boolean List", "Float List", 
Functions::GET_FN_bool_list_to_float_list);
+  registry.function("Integer List", "Boolean List", 
Functions::GET_FN_int32_list_to_bool_list);
+  registry.function("Integer List", "Float List", 
Functions::GET_FN_int32_list_to_float_list);
+  registry.function("Float List", "Boolean List", 
Functions::GET_FN_float_list_to_bool_list);
+  registry.function("Float List", "Integer List", 
Functions::GET_FN_float_list_to_int32_list);
 
-  registry.inserter("fn_FloatSocket", "fn_FloatListSocket", 
INSERT_base_to_list);
-  registry.inserter("fn_VectorSocket", "fn_VectorListSocket", 
INSERT_base_to_list);
-  

[Bf-blender-cvs] [d3763513ffc] functions: remove timer

2019-08-01 Thread Jacques Lucke
Commit: d3763513ffca10141babe51a290c1a47d36ebe24
Author: Jacques Lucke
Date:   Thu Aug 1 16:35:23 2019 +0200
Branches: functions
https://developer.blender.org/rBd3763513ffca10141babe51a290c1a47d36ebe24

remove timer

===

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

===

diff --git a/source/blender/simulations/bparticles/particles_container.cpp 
b/source/blender/simulations/bparticles/particles_container.cpp
index 8ea0d0e363e..23c432eaf20 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -28,8 +28,6 @@ ParticlesContainer::~ParticlesContainer()
 
 ParticlesBlock ::new_block()
 {
-  SCOPED_TIMER(__func__);
-
   std::lock_guard lock(m_blocks_mutex);
 
   if (!m_cached_blocks.empty()) {

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


[Bf-blender-cvs] [f9a555a60ad] functions: don't load socket values dynamically

2019-08-01 Thread Jacques Lucke
Commit: f9a555a60ad80a9b5a9d0275f042f2403bb5a8dd
Author: Jacques Lucke
Date:   Thu Aug 1 16:35:06 2019 +0200
Branches: functions
https://developer.blender.org/rBf9a555a60ad80a9b5a9d0275f042f2403bb5a8dd

don't load socket values dynamically

===

M   source/blender/functions/backends/tuple/tuple.hpp
M   source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp

===

diff --git a/source/blender/functions/backends/tuple/tuple.hpp 
b/source/blender/functions/backends/tuple/tuple.hpp
index 4e5fdd91e45..89e46e0b019 100644
--- a/source/blender/functions/backends/tuple/tuple.hpp
+++ b/source/blender/functions/backends/tuple/tuple.hpp
@@ -526,6 +526,11 @@ class Tuple {
 return m_meta->element_amount();
   }
 
+  TupleMeta () const
+  {
+return *m_meta;
+  }
+
   void print_initialized(std::string name = "");
 
  private:
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp 
b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
index cff58b7b954..329bbcbaa30 100644
--- a/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
@@ -169,9 +169,9 @@ class SocketLoaderDependencies : public DepsBody {
   }
 };
 
-class BasicUnlinkedInputsHandler : public UnlinkedInputsHandler {
+class DynamicSocketLoader : public UnlinkedInputsHandler {
  public:
-  BasicUnlinkedInputsHandler() = default;
+  DynamicSocketLoader() = default;
 
   void insert(VTreeDataGraphBuilder ,
   ArrayRef unlinked_inputs,
@@ -187,7 +187,7 @@ class BasicUnlinkedInputsHandler : public 
UnlinkedInputsHandler {
 for (uint i = 0; i < unlinked_inputs.size(); i++) {
   VirtualSocket *vsocket = unlinked_inputs[i];
 
-  SocketLoader loader = 
socket_loader_map.lookup(vsocket->bsocket()->idname);
+  SocketLoader loader = socket_loader_map.lookup(vsocket->idname());
   loaders.append(loader);
   fn_builder.add_output(vsocket->name(), 
builder.query_socket_type(vsocket));
 
@@ -200,9 +200,62 @@ class BasicUnlinkedInputsHandler : public 
UnlinkedInputsHandler {
 fn->add_body(btrees, bsockets);
 BuilderNode *node = builder.insert_function(fn);
 
-for (uint i = 0; i < node->outputs().size(); i++) {
-  r_new_origins[i] = node->output(i);
+r_new_origins.copy_from(node->outputs());
+  }
+};
+
+class ConstantTupleOutput : public TupleCallBody {
+ private:
+  std::unique_ptr m_tuple;
+
+ public:
+  ConstantTupleOutput()
+  {
+  }
+
+  void set_tuple(std::unique_ptr tuple)
+  {
+m_tuple = std::move(tuple);
+  }
+
+  void call(Tuple (fn_in), Tuple _out, ExecutionContext 
(ctx)) const override
+  {
+BLI_assert(m_tuple->size() == fn_out.size());
+uint size = m_tuple->size();
+for (uint i = 0; i < size; i++) {
+  Tuple::copy_element(*m_tuple, i, fn_out, i);
+}
+  }
+};
+
+class ConstantInputsHandler : public UnlinkedInputsHandler {
+  void insert(VTreeDataGraphBuilder ,
+  ArrayRef unlinked_inputs,
+  ArrayRef r_new_origins) override
+  {
+auto _loader_map = get_socket_loader_map();
+
+FunctionBuilder fn_builder;
+for (VirtualSocket *vsocket : unlinked_inputs) {
+  fn_builder.add_output(vsocket->name(), 
builder.query_socket_type(vsocket));
 }
+SharedFunction fn = fn_builder.build("Unlinked Inputs");
+fn->add_body();
+ConstantTupleOutput  = fn->body();
+
+Tuple *tuple = new Tuple(*body.meta_out().ptr());
+
+for (uint i = 0; i < unlinked_inputs.size(); i++) {
+  VirtualSocket *vsocket = unlinked_inputs[i];
+  SocketLoader loader = socket_loader_map.lookup(vsocket->idname());
+  PointerRNA rna = vsocket->rna();
+  loader(, *tuple, i);
+}
+
+body.set_tuple(std::unique_ptr(tuple));
+
+BuilderNode *node = builder.insert_function(fn);
+r_new_origins.copy_from(node->outputs());
   }
 };
 
@@ -218,7 +271,7 @@ ValueOrError generate_graph(VirtualNodeTree 
)
 return BLI_ERROR_CREATE("error inserting links");
   }
 
-  BasicUnlinkedInputsHandler unlinked_inputs_handler;
+  ConstantInputsHandler unlinked_inputs_handler;
   insert_unlinked_inputs(builder, unlinked_inputs_handler);
 
   return builder.build();

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


[Bf-blender-cvs] [d91a5b69d99] functions: cleanup socket loaders

2019-08-01 Thread Jacques Lucke
Commit: d91a5b69d995b069543ce9b12713382fbfd5705e
Author: Jacques Lucke
Date:   Thu Aug 1 16:06:25 2019 +0200
Branches: functions
https://developer.blender.org/rBd91a5b69d995b069543ce9b12713382fbfd5705e

cleanup socket loaders

===

M   source/blender/functions/frontends/data_flow_nodes/inserters.hpp
M   source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp

===

diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters.hpp 
b/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
index c45ae79649d..2b4d3050aaf 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/inserters.hpp
@@ -57,14 +57,17 @@ class NodeInserterRegistry {
 class SocketLoaderRegistry {
  private:
   StringMap _map;
+  StringMap _idname_by_data_type;
 
  public:
-  SocketLoaderRegistry(StringMap ) : m_map(map)
+  SocketLoaderRegistry(StringMap )
+  : m_map(map), m_idname_by_data_type(get_idname_by_data_type_map())
   {
   }
 
-  void loader(StringRef idname, SocketLoader loader)
+  void loader(StringRef data_type, SocketLoader loader)
   {
+std::string  = m_idname_by_data_type.lookup_ref(data_type);
 m_map.add_new(idname, loader);
   }
 };
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp 
b/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp
index 6b523684ce3..fddc382bf83 100644
--- a/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/inserters/sockets.cpp
@@ -57,18 +57,18 @@ template static void LOAD_empty_list(PointerRNA 
*UNUSED(rna), Tuple
 
 void register_socket_loaders(SocketLoaderRegistry )
 {
-  registry.loader("fn_FloatSocket", LOAD_float);
-  registry.loader("fn_VectorSocket", LOAD_vector);
-  registry.loader("fn_IntegerSocket", LOAD_integer);
-  registry.loader("fn_BooleanSocket", LOAD_boolean);
-  registry.loader("fn_ObjectSocket", LOAD_object);
-  registry.loader("fn_ColorSocket", LOAD_color);
-  registry.loader("fn_FloatListSocket", LOAD_empty_list);
-  registry.loader("fn_VectorListSocket", LOAD_empty_list);
-  registry.loader("fn_IntegerListSocket", LOAD_empty_list);
-  registry.loader("fn_BooleanListSocket", LOAD_empty_list);
-  registry.loader("fn_ObjectListSocket", LOAD_empty_list);
-  registry.loader("fn_ColorListSocket", LOAD_empty_list);
+  registry.loader("Float", LOAD_float);
+  registry.loader("Vector", LOAD_vector);
+  registry.loader("Integer", LOAD_integer);
+  registry.loader("Boolean", LOAD_boolean);
+  registry.loader("Object", LOAD_object);
+  registry.loader("Color", LOAD_color);
+  registry.loader("Float List", LOAD_empty_list);
+  registry.loader("Vector List", LOAD_empty_list);
+  registry.loader("Integer List", LOAD_empty_list);
+  registry.loader("Boolean List", LOAD_empty_list);
+  registry.loader("Object List", LOAD_empty_list);
+  registry.loader("Color List", LOAD_empty_list);
 }
 
 }  // namespace DataFlowNodes

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


[Bf-blender-cvs] [104df5f5f24] functions: support color in Custom Emitter node

2019-08-01 Thread Jacques Lucke
Commit: 104df5f5f2477e3b6b2a1563c4a70e6644a1664d
Author: Jacques Lucke
Date:   Thu Aug 1 14:16:12 2019 +0200
Branches: functions
https://developer.blender.org/rB104df5f5f2477e3b6b2a1563c4a70e6644a1664d

support color in Custom Emitter node

===

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

===

diff --git a/source/blender/simulations/bparticles/emitters.cpp 
b/source/blender/simulations/bparticles/emitters.cpp
index e1e8e64f05f..2dc9957c61b 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -16,6 +16,7 @@ namespace BParticles {
 
 using FN::Types::SharedFloat3List;
 using FN::Types::SharedFloatList;
+using FN::Types::SharedFloatRGBAList;
 using FN::Types::SharedInt32List;
 
 static float random_float()
@@ -142,9 +143,11 @@ void CustomFunctionEmitter::emit(EmitterInterface 
)
   auto _list_type = FN::Types::GET_TYPE_float_list();
   auto _list_type = FN::Types::GET_TYPE_float3_list();
   auto _list_type = FN::Types::GET_TYPE_int32_list();
+  auto _f_list_type = FN::Types::GET_TYPE_rgba_f_list();
   auto _type = FN::Types::GET_TYPE_float();
   auto _type = FN::Types::GET_TYPE_float3();
   auto _type = FN::Types::GET_TYPE_int32();
+  auto _f_type = FN::Types::GET_TYPE_rgba_f();
 
   uint new_particle_amount = 0;
   for (uint i = 0; i < m_function->output_amount(); i++) {
@@ -185,6 +188,10 @@ void CustomFunctionEmitter::emit(EmitterInterface 
)
   auto list = fn_out.relocate_out(i);
   new_particles.set_repeated(attribute_index, *list.ptr());
 }
+else if (type == rgba_f_list_type) {
+  auto list = fn_out.relocate_out(i);
+  new_particles.set_repeated(attribute_index, *list.ptr());
+}
 else if (type == float_type) {
   new_particles.fill(attribute_index, fn_out.get(i));
 }
@@ -194,6 +201,9 @@ void CustomFunctionEmitter::emit(EmitterInterface 
)
 else if (type == int32_type) {
   new_particles.fill(attribute_index, fn_out.get(i));
 }
+else if (type == rgba_f_type) {
+  new_particles.fill(attribute_index, fn_out.get(i));
+}
   }
 }

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


[Bf-blender-cvs] [0ef25d80018] functions: cleanup

2019-08-01 Thread Jacques Lucke
Commit: 0ef25d800189f41e1b604a7f766c649a5a9ac847
Author: Jacques Lucke
Date:   Thu Aug 1 14:36:52 2019 +0200
Branches: functions
https://developer.blender.org/rB0ef25d800189f41e1b604a7f766c649a5a9ac847

cleanup

===

M   source/blender/functions/core/data_graph_builder.hpp
M   source/blender/simulations/bparticles/inserters.cpp

===

diff --git a/source/blender/functions/core/data_graph_builder.hpp 
b/source/blender/functions/core/data_graph_builder.hpp
index 107a2c4e15e..fc3de824585 100644
--- a/source/blender/functions/core/data_graph_builder.hpp
+++ b/source/blender/functions/core/data_graph_builder.hpp
@@ -102,6 +102,26 @@ class BuilderNode {
 return m_outputs;
   }
 
+  Vector built_inputs()
+  {
+Vector sockets;
+sockets.reserve(m_inputs.size());
+for (BuilderInputSocket *socket : m_inputs) {
+  sockets.append_unchecked(DataSocket::FromInput(socket->input_id()));
+}
+return sockets;
+  }
+
+  Vector built_outputs()
+  {
+Vector sockets;
+sockets.reserve(m_outputs.size());
+for (BuilderOutputSocket *socket : m_outputs) {
+  sockets.append_unchecked(DataSocket::FromOutput(socket->output_id()));
+}
+return sockets;
+  }
+
   BuilderInputSocket *input(uint index)
   {
 return m_inputs[index];
diff --git a/source/blender/simulations/bparticles/inserters.cpp 
b/source/blender/simulations/bparticles/inserters.cpp
index a70e2a66f8a..f6f6405b28b 100644
--- a/source/blender/simulations/bparticles/inserters.cpp
+++ b/source/blender/simulations/bparticles/inserters.cpp
@@ -352,15 +352,8 @@ static FN::FunctionGraph 
link_inputs_to_function(SharedFunction _fn,
 
   SharedDataGraph data_graph = builder.build();
 
-  SetVector final_inputs;
-  for (FN::BuilderOutputSocket *socket : reserved_node->outputs()) {
-final_inputs.add_new(DataSocket::FromOutput(socket->output_id()));
-  }
-  SetVector final_outputs;
-  for (FN::BuilderOutputSocket *socket : main_node->outputs()) {
-final_outputs.add_new(DataSocket::FromOutput(socket->output_id()));
-  }
-
+  auto final_inputs = reserved_node->built_outputs();
+  auto final_outputs = main_node->built_outputs();
   return FN::FunctionGraph(data_graph, final_inputs, final_outputs);
 }

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


[Bf-blender-cvs] [3d1de1e44e8] functions: cache enum items in python

2019-08-01 Thread Jacques Lucke
Commit: 3d1de1e44e8cd67a2463f795e965916449bf63ca
Author: Jacques Lucke
Date:   Thu Aug 1 14:15:28 2019 +0200
Branches: functions
https://developer.blender.org/rB3d1de1e44e8cd67a2463f795e965916449bf63ca

cache enum items in python

===

M   release/scripts/startup/nodes/declaration/variadic.py
M   release/scripts/startup/nodes/search.py
A   release/scripts/startup/nodes/utils/enum_items_cache.py

===

diff --git a/release/scripts/startup/nodes/declaration/variadic.py 
b/release/scripts/startup/nodes/declaration/variadic.py
index 5f7e3ab3a10..d5ed8500ac7 100644
--- a/release/scripts/startup/nodes/declaration/variadic.py
+++ b/release/scripts/startup/nodes/declaration/variadic.py
@@ -5,6 +5,7 @@ from . base import SocketDeclBase
 from .. types import type_infos
 from .. base import DataSocket
 from .. sockets import OperatorSocket
+from .. utils.enum_items_cache import cache_enum_items
 
 class AnyVariadicDecl(SocketDeclBase):
 def __init__(self, node, identifier: str, prop_name: str, message: str):
@@ -94,12 +95,9 @@ class AnyVariadicDecl(SocketDeclBase):
 class DataTypeGroup(bpy.types.PropertyGroup):
 bl_idname = "fn_DataTypeGroup"
 
-def tree_update(self, context):
-self.id_data.update()
-
-data_type: StringProperty(update=tree_update)
-display_name: StringProperty(update=tree_update)
-identifier_prefix: StringProperty(update=tree_update)
+data_type: StringProperty()
+display_name: StringProperty()
+identifier_prefix: StringProperty()
 
 class AppendAnyVariadicOperator(bpy.types.Operator):
 bl_idname = "fn.append_any_variadic"
@@ -111,7 +109,7 @@ class AppendAnyVariadicOperator(bpy.types.Operator):
 node_name: StringProperty()
 prop_name: StringProperty()
 
-item: EnumProperty(items=type_infos.get_data_type_items_cb())
+item: 
EnumProperty(items=cache_enum_items(type_infos.get_data_type_items_cb()))
 
 def invoke(self, context, event):
 context.window_manager.invoke_search_popup(self)
diff --git a/release/scripts/startup/nodes/search.py 
b/release/scripts/startup/nodes/search.py
index ff8263d69b9..a57756e38b7 100644
--- a/release/scripts/startup/nodes/search.py
+++ b/release/scripts/startup/nodes/search.py
@@ -1,6 +1,7 @@
 import bpy
 from bpy.props import *
 from . base import BaseNode
+from . utils.enum_items_cache import cache_enum_items
 
 class NodeSearch(bpy.types.Operator):
 bl_idname = "fn.node_search"
@@ -16,7 +17,7 @@ class NodeSearch(bpy.types.Operator):
 items.append(item)
 return items
 
-item: EnumProperty(items=get_search_items)
+item: EnumProperty(items=cache_enum_items(get_search_items))
 
 @classmethod
 def poll(cls, context):
diff --git a/release/scripts/startup/nodes/utils/enum_items_cache.py 
b/release/scripts/startup/nodes/utils/enum_items_cache.py
new file mode 100644
index 000..fcba1539dac
--- /dev/null
+++ b/release/scripts/startup/nodes/utils/enum_items_cache.py
@@ -0,0 +1,11 @@
+import functools
+
+cached_items = set()
+
+def cache_enum_items(items_cb):
+@functools.wraps(items_cb)
+def wrapper(self, context):
+items = items_cb(self, context)
+cached_items.update(items)
+return items
+return wrapper

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


[Bf-blender-cvs] [218fcf4473b] functions: replace another map with a vector

2019-08-01 Thread Jacques Lucke
Commit: 218fcf4473bcbba4c48ecc062be197763484bfd9
Author: Jacques Lucke
Date:   Thu Aug 1 10:28:30 2019 +0200
Branches: functions
https://developer.blender.org/rB218fcf4473bcbba4c48ecc062be197763484bfd9

replace another map with a vector

===

M   source/blender/functions/core/data_flow_graph_builder.hpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp

===

diff --git a/source/blender/functions/core/data_flow_graph_builder.hpp 
b/source/blender/functions/core/data_flow_graph_builder.hpp
index 2c0eda027aa..04168faff25 100644
--- a/source/blender/functions/core/data_flow_graph_builder.hpp
+++ b/source/blender/functions/core/data_flow_graph_builder.hpp
@@ -31,6 +31,16 @@ class DFGB_Socket {
   {
   }
 
+  static DFGB_Socket None()
+  {
+return DFGB_Socket(nullptr, false, (uint)-1);
+  }
+
+  bool is_none()
+  {
+return m_index == (uint)-1;
+  }
+
   inline DFGB_Node *node() const;
   inline bool is_input() const;
   inline bool is_output() const;
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
index e31a89779a8..0f7ed485ddb 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
@@ -29,6 +29,7 @@ namespace DataFlowNodes {
 
 VTreeDataGraphBuilder::VTreeDataGraphBuilder(VirtualNodeTree )
 : m_vtree(vtree),
+  m_socket_map(vtree.socket_count(), DFGB_Socket::None()),
   m_type_by_idname(get_type_by_idname_map()),
   m_type_by_data_type(get_type_by_data_type_map()),
   m_data_type_by_idname(get_data_type_by_idname_map())
@@ -37,14 +38,16 @@ 
VTreeDataGraphBuilder::VTreeDataGraphBuilder(VirtualNodeTree )
 
 static Vector build_mapping_for_original_sockets(
 VirtualNodeTree ,
-Map _map,
+Vector _map,
 DataFlowGraph::ToBuilderMapping _mapping)
 {
   Vector original_socket_mapping(vtree.socket_count(), 
DFGraphSocket::None());
-  for (auto item : socket_map.items()) {
-VirtualSocket *vsocket = item.key;
-DFGraphSocket socket = builder_mapping.map_socket(item.value);
-original_socket_mapping[vsocket->id()] = socket;
+  for (uint vsocket_id = 0; vsocket_id < socket_map.size(); vsocket_id++) {
+DFGB_Socket socket = socket_map[vsocket_id];
+if (socket.is_none()) {
+  continue;
+}
+original_socket_mapping[vsocket_id] = builder_mapping.map_socket(socket);
   }
   return original_socket_mapping;
 }
@@ -131,7 +134,7 @@ void VTreeDataGraphBuilder::map_socket(DFGB_Socket socket, 
VirtualSocket *vsocke
 {
   BLI_assert(this->is_data_socket(vsocket) ? socket.type() == 
this->query_socket_type(vsocket) :
  true);
-  m_socket_map.add(vsocket, socket);
+  m_socket_map[vsocket->id()] = socket;
 }
 
 void VTreeDataGraphBuilder::map_sockets(DFGB_Node *node, VirtualNode *vnode)
@@ -187,8 +190,8 @@ void VTreeDataGraphBuilder::map_output(DFGB_Socket socket, 
VirtualNode *vnode, u
 
 DFGB_Socket VTreeDataGraphBuilder::lookup_socket(VirtualSocket *vsocket)
 {
-  BLI_assert(m_socket_map.contains(vsocket));
-  return m_socket_map.lookup(vsocket);
+  BLI_assert(!m_socket_map[vsocket->id()].is_none());
+  return m_socket_map[vsocket->id()];
 }
 
 bool VTreeDataGraphBuilder::check_if_sockets_are_mapped(VirtualNode *vnode,
@@ -197,7 +200,7 @@ bool 
VTreeDataGraphBuilder::check_if_sockets_are_mapped(VirtualNode *vnode,
   int index = 0;
   for (VirtualSocket *vsocket : vsockets) {
 if (this->is_data_socket(vsocket)) {
-  if (!m_socket_map.contains(vsocket)) {
+  if (m_socket_map[vsocket->id()].is_none()) {
 std::cout << "Data DFGB_Socket not mapped: " << std::endl;
 std::cout << "Tree: " << vnode->btree_id()->name << std::endl;
 std::cout << "DFGB_Node: " << vnode->name() << std::endl;
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
index b315baaa898..6ba1d5913a4 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
@@ -20,7 +20,7 @@ class VTreeDataGraphBuilder {
  private:
   VirtualNodeTree _vtree;
   DataFlowGraphBuilder m_graph_builder;
-  Map m_socket_map;
+  Vector m_socket_map;
   StringMap _type_by_idname;
   StringMap _type_by_data_type;
   StringMap _data_type_by_idname;
@@ -30,7 +30,7 @@ class VTreeDataGraphBuilder {
 
   VTreeDataGraph build();
 
-  Map _map()
+  Vector _map()
   {
 return m_socket_map;
   }


[Bf-blender-cvs] [3d2e279b3d8] functions: rename DataFlowGraph to just DataGraph

2019-08-01 Thread Jacques Lucke
Commit: 3d2e279b3d83dbee08c1c9f6d108ec080b4093b6
Author: Jacques Lucke
Date:   Thu Aug 1 13:30:13 2019 +0200
Branches: functions
https://developer.blender.org/rB3d2e279b3d83dbee08c1c9f6d108ec080b4093b6

rename DataFlowGraph to just DataGraph

===

M   source/blender/functions/CMakeLists.txt
M   source/blender/functions/FN_core.hpp
M   source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
M   source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
R076source/blender/functions/core/data_flow_graph.cpp   
source/blender/functions/core/data_graph.cpp
R096source/blender/functions/core/data_flow_graph.hpp   
source/blender/functions/core/data_graph.hpp
M   source/blender/functions/core/data_graph_builder.cpp
M   source/blender/functions/core/data_graph_builder.hpp
M   source/blender/functions/core/function_builder.cpp
M   source/blender/functions/core/function_builder.hpp
M   source/blender/functions/core/function_graph.hpp
M   source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp
M   source/blender/simulations/bparticles/inserters.cpp
M   source/blender/simulations/bparticles/particle_function_builder.cpp

===

diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index 33fd6a662e4..bcf39703021 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -42,8 +42,8 @@ set(SRC
   core/function.cpp
   core/function_builder.hpp
   core/function_builder.cpp
-  core/data_flow_graph.hpp
-  core/data_flow_graph.cpp
+  core/data_graph.hpp
+  core/data_graph.cpp
   core/data_graph_builder.hpp
   core/data_graph_builder.cpp
   core/function_graph.hpp
diff --git a/source/blender/functions/FN_core.hpp 
b/source/blender/functions/FN_core.hpp
index 0804084ea3a..856a4f64813 100644
--- a/source/blender/functions/FN_core.hpp
+++ b/source/blender/functions/FN_core.hpp
@@ -6,5 +6,5 @@
 #include "core/function_builder.hpp"
 #include "core/source_info.hpp"
 #include "core/function_graph.hpp"
-#include "core/data_flow_graph.hpp"
+#include "core/data_graph.hpp"
 #include "core/data_graph_builder.hpp"
diff --git 
a/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp 
b/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
index 00d337eaf9c..a55f14a3f09 100644
--- a/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
+++ b/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
@@ -5,7 +5,7 @@ namespace FN {
 class FGraphDependencies : public DepsBody {
  private:
   FunctionGraph m_fgraph;
-  SharedDataFlowGraph m_graph;
+  SharedDataGraph m_graph;
 
  public:
   FGraphDependencies(FunctionGraph _graph)
diff --git a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp 
b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
index f49dc1d90ab..209d1e557a8 100644
--- a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
+++ b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
@@ -7,7 +7,7 @@ namespace FN {
 class BuildGraphIR : public LLVMBuildIRBody {
  private:
   FunctionGraph m_fgraph;
-  DataFlowGraph *m_graph;
+  DataGraph *m_graph;
   Set m_required_sockets;
 
  public:
diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp 
b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 634e6fa8117..888bde78b16 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -7,7 +7,7 @@ namespace FN {
 
 using BLI::VectorAdaptor;
 
-static void try_ensure_tuple_call_bodies(SharedDataFlowGraph )
+static void try_ensure_tuple_call_bodies(SharedDataGraph )
 {
   for (uint node_id : graph->node_ids()) {
 SharedFunction  = graph->function_of_node(node_id);
@@ -28,7 +28,7 @@ static void try_ensure_tuple_call_bodies(SharedDataFlowGraph 
)
 class ExecuteFGraph : public TupleCallBody {
  private:
   FunctionGraph m_fgraph;
-  DataFlowGraph *m_graph;
+  DataGraph *m_graph;
 
   struct NodeInfo {
 TupleCallBodyBase *body;
@@ -555,7 +555,7 @@ class ExecuteFGraph_Simple : public TupleCallBody {
  private:
   FunctionGraph m_fgraph;
   /* Just for easy access. */
-  DataFlowGraph *m_graph;
+  DataGraph *m_graph;
 
  public:
   ExecuteFGraph_Simple(FunctionGraph _graph)
diff --git a/source/blender/functions/core/data_flow_graph.cpp 
b/source/blender/functions/core/data_graph.cpp
similarity index 76%
rename from source/blender/functions/core/data_flow_graph.cpp
rename to source/blender/functions/core/data_graph.cpp
index 8ec4b46ba0e..ffe65393970 100644
--- a/source/blender/functions/core/data_flow_graph.cpp

[Bf-blender-cvs] [6dc48fd18d6] functions: replace DataFlowGraphBuilder implementation

2019-08-01 Thread Jacques Lucke
Commit: 6dc48fd18d682b778477f2ad5e70cf578a2ba4f1
Author: Jacques Lucke
Date:   Thu Aug 1 13:26:34 2019 +0200
Branches: functions
https://developer.blender.org/rB6dc48fd18d682b778477f2ad5e70cf578a2ba4f1

replace DataFlowGraphBuilder implementation

===

M   source/blender/blenlib/BLI_vector_adaptor.hpp
M   source/blender/functions/CMakeLists.txt
M   source/blender/functions/FN_core.hpp
M   source/blender/functions/backends/dependencies/dependencies.hpp
M   source/blender/functions/core/data_flow_graph.cpp
M   source/blender/functions/core/data_flow_graph.hpp
D   source/blender/functions/core/data_flow_graph_builder.cpp
D   source/blender/functions/core/data_flow_graph_builder.hpp
A   source/blender/functions/core/data_graph_builder.cpp
A   source/blender/functions/core/data_graph_builder.hpp
M   source/blender/functions/core/dot_export.cpp
M   source/blender/functions/core/function_graph.hpp
M   source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
M   source/blender/functions/frontends/data_flow_nodes/graph_generation.hpp
M   source/blender/functions/frontends/data_flow_nodes/inserters.hpp
M   
source/blender/functions/frontends/data_flow_nodes/inserters/conversions.cpp
M   source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.hpp
M   source/blender/simulations/bparticles/inserters.cpp

===

diff --git a/source/blender/blenlib/BLI_vector_adaptor.hpp 
b/source/blender/blenlib/BLI_vector_adaptor.hpp
index 11352f3e73c..a2827a9ce7e 100644
--- a/source/blender/blenlib/BLI_vector_adaptor.hpp
+++ b/source/blender/blenlib/BLI_vector_adaptor.hpp
@@ -47,13 +47,6 @@ template class VectorAdaptor {
   {
   }
 
-  /**
-   * Disable creating copies of the vector, because it would not be
-   * clear, where the new adaptor should take the memory from.
-   */
-  VectorAdaptor(VectorAdaptor ) = delete;
-  VectorAdaptor(VectorAdaptor &) = delete;
-
   /**
* Construct using any pointer and a capacity.
* The initial size is set to zero.
@@ -130,6 +123,11 @@ template class VectorAdaptor {
 return m_end - m_start;
   }
 
+  bool is_full() const
+  {
+return m_capacity == this->size();
+  }
+
   operator ArrayRef() const
   {
 return ArrayRef(m_start, this->size());
diff --git a/source/blender/functions/CMakeLists.txt 
b/source/blender/functions/CMakeLists.txt
index 85972fec3dd..33fd6a662e4 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -44,8 +44,8 @@ set(SRC
   core/function_builder.cpp
   core/data_flow_graph.hpp
   core/data_flow_graph.cpp
-  core/data_flow_graph_builder.hpp
-  core/data_flow_graph_builder.cpp
+  core/data_graph_builder.hpp
+  core/data_graph_builder.cpp
   core/function_graph.hpp
   core/function_graph.cpp
   core/source_info.hpp
diff --git a/source/blender/functions/FN_core.hpp 
b/source/blender/functions/FN_core.hpp
index 191d3aaecd5..0804084ea3a 100644
--- a/source/blender/functions/FN_core.hpp
+++ b/source/blender/functions/FN_core.hpp
@@ -7,4 +7,4 @@
 #include "core/source_info.hpp"
 #include "core/function_graph.hpp"
 #include "core/data_flow_graph.hpp"
-#include "core/data_flow_graph_builder.hpp"
+#include "core/data_graph_builder.hpp"
diff --git a/source/blender/functions/backends/dependencies/dependencies.hpp 
b/source/blender/functions/backends/dependencies/dependencies.hpp
index 95acef230c6..7c6482be5ba 100644
--- a/source/blender/functions/backends/dependencies/dependencies.hpp
+++ b/source/blender/functions/backends/dependencies/dependencies.hpp
@@ -2,11 +2,15 @@
 
 #include "FN_core.hpp"
 
+#include "BLI_multimap.hpp"
+
 struct ID;
 struct Object;
 
 namespace FN {
 
+using BLI::MultiMap;
+
 struct DependencyComponents {
   SetVector transform_dependencies;
   SetVector geometry_dependencies;
diff --git a/source/blender/functions/core/data_flow_graph.cpp 
b/source/blender/functions/core/data_flow_graph.cpp
index 394b5444124..8ec4b46ba0e 100644
--- a/source/blender/functions/core/data_flow_graph.cpp
+++ b/source/blender/functions/core/data_flow_graph.cpp
@@ -2,69 +2,22 @@
 
 namespace FN {
 
-DataFlowGraph::BuildResult DataFlowGraph::FromBuilder(DataFlowGraphBuilder 
)
+DataFlowGraph::DataFlowGraph(Vector nodes,
+ Vector inputs,
+ Vector outputs,
+ Vector targets,
+ std::unique_ptr> 
source_info_allocator)
+: m_nodes(std::move(nodes)),
+  m_inputs(std::move(inputs)),
+  m_outputs(std::move(outputs)),
+  m_targets(std::move(targets)),
+  

[Bf-blender-cvs] [69a8699b541] functions: fix use-after-free crash from python

2019-08-01 Thread Jacques Lucke
Commit: 69a8699b541b2bc6fdcd8084d06f5c6b97d81294
Author: Jacques Lucke
Date:   Thu Aug 1 14:15:56 2019 +0200
Branches: functions
https://developer.blender.org/rB69a8699b541b2bc6fdcd8084d06f5c6b97d81294

fix use-after-free crash from python

===

M   release/scripts/startup/nodes/sockets.py

===

diff --git a/release/scripts/startup/nodes/sockets.py 
b/release/scripts/startup/nodes/sockets.py
index 6796b4273e9..5aea26a3774 100644
--- a/release/scripts/startup/nodes/sockets.py
+++ b/release/scripts/startup/nodes/sockets.py
@@ -129,7 +129,7 @@ class ColorSocket(bpy.types.NodeSocket, DataSocket):
 layout.prop(self, "value", text=text)
 
 def get_state(self):
-return self.value
+return tuple(self.value)
 
 def restore_state(self, state):
 self.value = state

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


[Bf-blender-cvs] [1fd26737b52] functions: use virtual socket index to replace a map with a vector

2019-08-01 Thread Jacques Lucke
Commit: 1fd26737b527aa3108c1f715eadce9c5c8bbd336
Author: Jacques Lucke
Date:   Thu Aug 1 10:16:56 2019 +0200
Branches: functions
https://developer.blender.org/rB1fd26737b527aa3108c1f715eadce9c5c8bbd336

use virtual socket index to replace a map with a vector

===

M   source/blender/functions/core/data_flow_graph.hpp
M   source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp

===

diff --git a/source/blender/functions/core/data_flow_graph.hpp 
b/source/blender/functions/core/data_flow_graph.hpp
index 769e1cd2ff2..8cc713b8d93 100644
--- a/source/blender/functions/core/data_flow_graph.hpp
+++ b/source/blender/functions/core/data_flow_graph.hpp
@@ -42,6 +42,16 @@ struct DFGraphSocket {
   {
   }
 
+  static DFGraphSocket None()
+  {
+return DFGraphSocket(false, (uint)-1);
+  }
+
+  bool is_none() const
+  {
+return m_id == (uint)-1;
+  }
+
   static DFGraphSocket FromInput(uint id)
   {
 return DFGraphSocket(false, id);
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp
index 3e335f19d2e..79b4b378366 100644
--- a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp
+++ b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp
@@ -15,10 +15,10 @@ using BLI::ValueOrError;
 class VTreeDataGraph {
  private:
   SharedDataFlowGraph m_graph;
-  Map m_socket_map;
+  Vector m_socket_map;
 
  public:
-  VTreeDataGraph(SharedDataFlowGraph graph, Map mapping)
+  VTreeDataGraph(SharedDataFlowGraph graph, Vector mapping)
   : m_graph(std::move(graph)), m_socket_map(std::move(mapping))
   {
   }
@@ -30,17 +30,21 @@ class VTreeDataGraph {
 
   DFGraphSocket *lookup_socket_ptr(VirtualSocket *vsocket)
   {
-return m_socket_map.lookup_ptr(vsocket);
+DFGraphSocket *socket = _socket_map[vsocket->id()];
+if (socket->is_none()) {
+  return nullptr;
+}
+return socket;
   }
 
   DFGraphSocket lookup_socket(VirtualSocket *vsocket)
   {
-return m_socket_map.lookup(vsocket);
+return m_socket_map[vsocket->id()];
   }
 
   bool uses_socket(VirtualSocket *vsocket)
   {
-return m_socket_map.contains(vsocket);
+return !m_socket_map[vsocket->id()].is_none();
   }
 
   struct PlaceholderDependencies {
diff --git 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
index 172da8b..e31a89779a8 100644
--- 
a/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
+++ 
b/source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
@@ -35,15 +35,16 @@ 
VTreeDataGraphBuilder::VTreeDataGraphBuilder(VirtualNodeTree )
 {
 }
 
-static Map build_mapping_for_original_sockets(
+static Vector build_mapping_for_original_sockets(
+VirtualNodeTree ,
 Map _map,
 DataFlowGraph::ToBuilderMapping _mapping)
 {
-  Map original_socket_mapping;
+  Vector original_socket_mapping(vtree.socket_count(), 
DFGraphSocket::None());
   for (auto item : socket_map.items()) {
 VirtualSocket *vsocket = item.key;
 DFGraphSocket socket = builder_mapping.map_socket(item.value);
-original_socket_mapping.add_new(vsocket, socket);
+original_socket_mapping[vsocket->id()] = socket;
   }
   return original_socket_mapping;
 }
@@ -52,8 +53,9 @@ VTreeDataGraph VTreeDataGraphBuilder::build()
 {
   m_graph_builder.to_dot__clipboard();
   auto build_result = DataFlowGraph::FromBuilder(m_graph_builder);
-  return VTreeDataGraph(std::move(build_result.graph),
-build_mapping_for_original_sockets(m_socket_map, 
build_result.mapping));
+  return VTreeDataGraph(
+  std::move(build_result.graph),
+  build_mapping_for_original_sockets(m_vtree, m_socket_map, 
build_result.mapping));
 }
 
 class NodeSource : public SourceInfo {

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


[Bf-blender-cvs] [ffbe506a559] functions: rename DFGraphSocket to DataSocket

2019-08-01 Thread Jacques Lucke
Commit: ffbe506a55915542216ef0ea9182c0f17d92f726
Author: Jacques Lucke
Date:   Thu Aug 1 13:33:40 2019 +0200
Branches: functions
https://developer.blender.org/rBffbe506a55915542216ef0ea9182c0f17d92f726

rename DFGraphSocket to DataSocket

===

M   source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
M   source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
M   source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M   source/blender/functions/core/data_graph.cpp
M   source/blender/functions/core/data_graph.hpp
M   source/blender/functions/core/function_builder.cpp
M   source/blender/functions/core/function_builder.hpp
M   source/blender/functions/core/function_graph.cpp
M   source/blender/functions/core/function_graph.hpp
M   
source/blender/functions/frontends/data_flow_nodes/function_generation.cpp
M   source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.cpp
M   source/blender/functions/frontends/data_flow_nodes/vtree_data_graph.hpp
M   
source/blender/functions/frontends/data_flow_nodes/vtree_data_graph_builder.cpp
M   source/blender/simulations/bparticles/inserters.cpp
M   source/blender/simulations/bparticles/particle_function_builder.cpp
M   source/blender/simulations/bparticles/particle_function_builder.hpp

===

diff --git 
a/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp 
b/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
index a55f14a3f09..c71ccbd3b65 100644
--- a/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
+++ b/source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
@@ -16,14 +16,13 @@ class FGraphDependencies : public DepsBody {
   void build_deps(FunctionDepsBuilder ) const override
   {
 for (uint i = 0; i < m_fgraph.outputs().size(); i++) {
-  DFGraphSocket socket = m_fgraph.outputs()[i];
+  DataSocket socket = m_fgraph.outputs()[i];
   Vector outputs = this->find_deps_and_outputs(socket, builder);
   builder.add_output_ids(i, outputs);
 }
   }
 
-  Vector find_deps_and_outputs(DFGraphSocket socket,
- FunctionDepsBuilder _builder) const
+  Vector find_deps_and_outputs(DataSocket socket, FunctionDepsBuilder 
_builder) const
   {
 if (m_fgraph.inputs().contains(socket)) {
   return parent_builder.get_input_ids(m_fgraph.inputs().index(socket));
diff --git a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp 
b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
index 209d1e557a8..f286246ef5d 100644
--- a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
+++ b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
@@ -8,7 +8,7 @@ class BuildGraphIR : public LLVMBuildIRBody {
  private:
   FunctionGraph m_fgraph;
   DataGraph *m_graph;
-  Set m_required_sockets;
+  Set m_required_sockets;
 
  public:
   BuildGraphIR(FunctionGraph ) : m_fgraph(fgraph), 
m_graph(fgraph.graph().ptr())
@@ -35,14 +35,14 @@ class BuildGraphIR : public LLVMBuildIRBody {
 CodeInterface ,
 const BuildIRSettings ) const override
   {
-Map values;
+Map values;
 for (uint i = 0; i < m_fgraph.inputs().size(); i++) {
   values.add(m_fgraph.inputs()[i], interface.get_input(i));
 }
 
-Set forwarded_sockets;
+Set forwarded_sockets;
 for (uint i = 0; i < m_fgraph.outputs().size(); i++) {
-  DFGraphSocket socket = m_fgraph.outputs()[i];
+  DataSocket socket = m_fgraph.outputs()[i];
   this->generate_for_socket(builder, interface, settings, socket, values, 
forwarded_sockets);
 
   interface.set_output(i, values.lookup(socket));
@@ -53,22 +53,22 @@ class BuildGraphIR : public LLVMBuildIRBody {
   void generate_for_socket(CodeBuilder ,
CodeInterface ,
const BuildIRSettings ,
-   DFGraphSocket socket,
-   Map ,
-   Set _sockets) const
+   DataSocket socket,
+   Map ,
+   Set _sockets) const
   {
 if (values.contains(socket)) {
   /* do nothing */
 }
 else if (socket.is_input()) {
-  DFGraphSocket origin = m_graph->origin_of_input(socket);
+  DataSocket origin = m_graph->origin_of_input(socket);
   this->generate_for_socket(builder, interface, settings, origin, values, 
forwarded_sockets);
   this->forward_output_if_necessary(builder, origin, values, 
forwarded_sockets);
 }
 else if (socket.is_output()) {
   uint node_id = m_graph->node_id_of_output(socket);
   Vector input_values;
-  for (DFGraphSocket input_socket : m_graph->inputs_of_node(node_id)) {
+  for 

[Bf-blender-cvs] [f6ef23ebe7e] functions: remove IndexedNodeTree data structure in favor of VirtualNodeTree

2019-08-01 Thread Jacques Lucke
Commit: f6ef23ebe7eaf3077f774ffa8593da9b055f228a
Author: Jacques Lucke
Date:   Thu Aug 1 09:59:55 2019 +0200
Branches: functions
https://developer.blender.org/rBf6ef23ebe7eaf3077f774ffa8593da9b055f228a

remove IndexedNodeTree data structure in favor of VirtualNodeTree

===

M   source/blender/blenkernel/BKE_node_tree.hpp
M   source/blender/blenkernel/intern/node_tree.cpp
M   source/blender/simulations/bparticles/c_wrapper.cpp
M   source/blender/simulations/bparticles/inserters.hpp

===

diff --git a/source/blender/blenkernel/BKE_node_tree.hpp 
b/source/blender/blenkernel/BKE_node_tree.hpp
index a2ba409f3d0..59807d701e6 100644
--- a/source/blender/blenkernel/BKE_node_tree.hpp
+++ b/source/blender/blenkernel/BKE_node_tree.hpp
@@ -27,99 +27,6 @@ using bNodeList = ListBaseWrapper;
 using bLinkList = ListBaseWrapper;
 using bSocketList = ListBaseWrapper;
 
-struct SocketWithNode {
-  bNodeSocket *socket;
-  bNode *node;
-};
-
-struct SingleOriginLink {
-  bNodeSocket *from;
-  bNodeSocket *to;
-  bNodeLink *source_link;
-};
-
-/**
- * The DNA structure of a node tree is difficult to parse, since it does not 
support e.g. the
- * following queries efficiently:
- *   - Which nodes have a specific type?
- *   - Which node corresponds to a socket?
- *   - Which other sockets are connected to a socket (with and without 
reroutes)?
- *
- * This data structure does some preprocessing to make these queries more 
efficient. It is only
- * valid as long as the underlying node tree is not modified.
- */
-class IndexedNodeTree {
- public:
-  IndexedNodeTree(bNodeTree *btree);
-
-  bNodeTree *btree() const
-  {
-return m_btree;
-  }
-
-  ID *btree_id() const
-  {
-return _btree->id;
-  }
-
-  PointerRNA rna(bNode *bnode) const
-  {
-PointerRNA rna;
-RNA_pointer_create(this->btree_id(), _Node, bnode, );
-return rna;
-  }
-
-  /**
-   * Get all nodes that are in the btree->nodes list.
-   */
-  ArrayRef original_nodes() const
-  {
-return m_original_nodes;
-  }
-
-  /**
-   * Get all links that are in the btree->links list.
-   */
-  ArrayRef original_links() const
-  {
-return m_original_links;
-  }
-
-  /**
-   * Get all nodes that are not reroutes or frames.
-   */
-  ArrayRef actual_nodes() const
-  {
-return m_actual_nodes;
-  }
-
-  bNode *node_of_socket(bNodeSocket *bsocket) const
-  {
-return m_node_by_socket.lookup(bsocket);
-  }
-
-  ArrayRef single_origin_links() const;
-  ArrayRef nodes_with_idname(StringRef idname) const;
-  ArrayRef linked(bNodeSocket *bsocket) const;
-
- private:
-  bool is_reroute(bNode *bnode) const;
-  bool is_frame(bNode *bnode) const;
-
-  void find_connected_sockets_left(bNodeSocket *bsocket, 
Vector _sockets) const;
-  void find_connected_sockets_right(bNodeSocket *bsocket, 
Vector _sockets) const;
-
-  bNodeTree *m_btree;
-  Vector m_original_nodes;
-  Vector m_original_links;
-  Vector m_actual_nodes;
-  Map m_node_by_socket;
-  MultiMap m_direct_links;
-  MultiMap m_links;
-  MultiMap m_nodes_by_idname;
-  Vector m_single_origin_links;
-};
-
 class VirtualNode;
 class VirtualSocket;
 class VirtualLink;
diff --git a/source/blender/blenkernel/intern/node_tree.cpp 
b/source/blender/blenkernel/intern/node_tree.cpp
index f2c78a61988..a50eb9f3e54 100644
--- a/source/blender/blenkernel/intern/node_tree.cpp
+++ b/source/blender/blenkernel/intern/node_tree.cpp
@@ -3,107 +3,6 @@
 
 namespace BKE {
 
-IndexedNodeTree::IndexedNodeTree(bNodeTree *btree)
-: m_btree(btree), m_original_nodes(btree->nodes, true), 
m_original_links(btree->links, true)
-{
-  for (bNode *bnode : m_original_nodes) {
-for (bNodeSocket *bsocket : bSocketList(bnode->inputs)) {
-  m_node_by_socket.add(bsocket, bnode);
-}
-for (bNodeSocket *bsocket : bSocketList(bnode->outputs)) {
-  m_node_by_socket.add(bsocket, bnode);
-}
-  }
-
-  for (bNode *bnode : m_original_nodes) {
-m_nodes_by_idname.add(bnode->idname, bnode);
-if (!this->is_reroute(bnode) && !this->is_frame(bnode)) {
-  m_actual_nodes.append(bnode);
-}
-  }
-
-  for (bNodeLink *blink : m_original_links) {
-m_direct_links.add(blink->tosock, {blink->fromsock, blink->fromnode});
-m_direct_links.add(blink->fromsock, {blink->tosock, blink->tonode});
-  }
-
-  for (bNodeLink *blink : m_original_links) {
-if (!this->is_reroute(blink->fromnode) && 
!m_links.contains(blink->fromsock)) {
-  Vector connected;
-  this->find_connected_sockets_right(blink->fromsock, connected);
-  m_links.add_multiple_new(blink->fromsock, connected);
-}
-if (!this->is_reroute(blink->tonode) && !m_links.contains(blink->tosock)) {
-  Vector connected;
-  this->find_connected_sockets_left(blink->tosock, connected);
-  m_links.add_multiple_new(blink->tosock, connected);
-  if (connected.size() == 1) {
-

[Bf-blender-cvs] [2f948952b5e] functions: store an index per virtual socket

2019-08-01 Thread Jacques Lucke
Commit: 2f948952b5eacb166eeaa97c3c4c95d886833a9f
Author: Jacques Lucke
Date:   Thu Aug 1 10:16:36 2019 +0200
Branches: functions
https://developer.blender.org/rB2f948952b5eacb166eeaa97c3c4c95d886833a9f

store an index per virtual socket

===

M   source/blender/blenkernel/BKE_node_tree.hpp
M   source/blender/blenkernel/intern/node_tree.cpp

===

diff --git a/source/blender/blenkernel/BKE_node_tree.hpp 
b/source/blender/blenkernel/BKE_node_tree.hpp
index 59807d701e6..3d50766f89f 100644
--- a/source/blender/blenkernel/BKE_node_tree.hpp
+++ b/source/blender/blenkernel/BKE_node_tree.hpp
@@ -39,6 +39,7 @@ class VirtualNodeTree {
   Vector m_inputs_with_links;
   MultiMap m_nodes_by_idname;
   MonotonicAllocator<> m_allocator;
+  uint m_socket_counter = 0;
 
  public:
   void add_all_of_tree(bNodeTree *btree);
@@ -74,6 +75,11 @@ class VirtualNodeTree {
 return m_frozen;
   }
 
+  uint socket_count()
+  {
+return m_socket_counter;
+  }
+
  private:
   void initialize_direct_links();
   void initialize_links();
@@ -152,6 +158,7 @@ class VirtualSocket {
   VirtualNode *m_vnode;
   bNodeTree *m_btree;
   bNodeSocket *m_bsocket;
+  uint m_id;
 
   ArrayRef m_direct_links;
   ArrayRef m_links;
@@ -177,6 +184,11 @@ class VirtualSocket {
 return m_btree;
   }
 
+  uint id()
+  {
+return m_id;
+  }
+
   ID *btree_id()
   {
 return _btree->id;
diff --git a/source/blender/blenkernel/intern/node_tree.cpp 
b/source/blender/blenkernel/intern/node_tree.cpp
index a50eb9f3e54..7802a1c12db 100644
--- a/source/blender/blenkernel/intern/node_tree.cpp
+++ b/source/blender/blenkernel/intern/node_tree.cpp
@@ -11,19 +11,19 @@ void VirtualNodeTree::add_all_of_tree(bNodeTree *btree)
 node_mapping.add_new(bnode, vnode);
   }
   for (bNodeLink *blink : BKE::bLinkList(btree->links)) {
-VirtualNode *from_node = node_mapping.lookup(blink->fromnode);
-VirtualNode *to_node = node_mapping.lookup(blink->tonode);
+VirtualNode *from_vnode = node_mapping.lookup(blink->fromnode);
+VirtualNode *to_vnode = node_mapping.lookup(blink->tonode);
 VirtualSocket *from_vsocket = nullptr;
 VirtualSocket *to_vsocket = nullptr;
 
-for (VirtualSocket *output : from_node->outputs()) {
+for (VirtualSocket *output : from_vnode->outputs()) {
   if (output->bsocket() == blink->fromsock) {
 from_vsocket = output;
 break;
   }
 }
 
-for (VirtualSocket *input : to_node->inputs()) {
+for (VirtualSocket *input : to_vnode->inputs()) {
   if (input->bsocket() == blink->tosock) {
 to_vsocket = input;
 break;
@@ -60,6 +60,7 @@ VirtualNode *VirtualNodeTree::add_bnode(bNodeTree *btree, 
bNode *bnode)
 vsocket.m_vnode = vnode;
 vsocket.m_btree = btree;
 vsocket.m_bsocket = original_inputs[i];
+vsocket.m_id = m_socket_counter++;
 vnode->m_inputs[i] = 
   }
   for (uint i = 0; i < original_outputs.size(); i++) {
@@ -68,6 +69,7 @@ VirtualNode *VirtualNodeTree::add_bnode(bNodeTree *btree, 
bNode *bnode)
 vsocket.m_vnode = vnode;
 vsocket.m_btree = btree;
 vsocket.m_bsocket = original_outputs[i];
+vsocket.m_id = m_socket_counter++;
 vnode->m_outputs[i] = 
   }

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


[Bf-blender-cvs] [80123efc5fc] master: Fix T67939: GPencil Noise modifier wrong random calculation

2019-08-01 Thread Antonioya
Commit: 80123efc5fc258ef8b27efba67d6ad2a0efb7edd
Author: Antonioya
Date:   Thu Aug 1 17:54:51 2019 +0200
Branches: master
https://developer.blender.org/rB80123efc5fc258ef8b27efba67d6ad2a0efb7edd

Fix T67939: GPencil Noise modifier wrong random calculation

There were several problems in the old random calculation:

* Different result in the viewport and render.
* Noise "pop" in some frames. 
* Random number was calculated every time the file was opened, so get different 
results.

Now, instead to calculate the random numbers when n number of frames changed, 
the random values are calculated using a unique seed by stroke.

Also, a new Seed parameter has been added and this adds more control in the 
noise generated. This value can be animated and get more variations.

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

===

M   release/scripts/startup/bl_ui/properties_data_modifier.py
M   source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 0a4c166d0f7..66e96199b08 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1685,6 +1685,9 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, 
Panel):
 row = col.row()
 row.enabled = md.random
 row.prop(md, "step")
+row = col.row()
+row.enabled = md.random
+row.prop(md, "seed")
 col.prop(md, "full_stroke")
 col.prop(md, "move_extreme")
 
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index e0139eac6b2..e891b6dea12 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -26,10 +26,9 @@
 #include "BLI_utildefines.h"
 
 #include "BLI_math_vector.h"
+#include "BLI_hash.h"
 #include "BLI_rand.h"
 
-#include "PIL_time.h"
-
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
@@ -58,20 +57,7 @@ static void initData(GpencilModifierData *md)
   gpmd->layername[0] = '\0';
   gpmd->vgname[0] = '\0';
   gpmd->step = 1;
-  gpmd->scene_frame = -99;
-  gpmd->gp_frame = -99;
-
-  gpmd->vrand1 = 1.0;
-  gpmd->vrand2 = 1.0;
-}
-
-static void freeData(GpencilModifierData *md)
-{
-  NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
-
-  if (mmd->rng != NULL) {
-BLI_rng_free(mmd->rng);
-  }
+  gpmd->seed = 0;
 }
 
 static void copyData(const GpencilModifierData *md, GpencilModifierData 
*target)
@@ -85,21 +71,6 @@ static bool dependsOnTime(GpencilModifierData *md)
   return (mmd->flag & GP_NOISE_USE_RANDOM) != 0;
 }
 
-/* Get the lower number of frame for all layers. */
-static int get_lower_frame(bGPdata *gpd)
-{
-  int init = 9;
-  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-if (gpl->frames.first) {
-  bGPDframe *gpf = gpl->frames.first;
-  if (gpf->framenum < init) {
-init = gpf->framenum;
-  }
-}
-  }
-  return init;
-}
-
 /* aply noise effect based on stroke direction */
 static void deformStroke(
 GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, 
bGPDstroke *gps)
@@ -111,26 +82,10 @@ static void deformStroke(
   float normal[3];
   float vec1[3], vec2[3];
   int sc_frame = 0;
-  int sc_diff = 0;
+  int stroke_seed = 0;
   const int def_nr = defgroup_name_index(ob, mmd->vgname);
   const float unit_v3[3] = {1.0f, 1.0f, 1.0f};
 
-  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
-  GpencilModifierData *md_eval = BKE_gpencil_modifiers_findByName(object_eval, 
md->name);
-  NoiseGpencilModifierData *mmd_eval = (NoiseGpencilModifierData *)md_eval;
-  bGPdata *gpd = (bGPdata *)ob->data;
-
-  /* Random generator, only init once. (it uses eval to get same value in 
render) */
-  if (mmd_eval->rng == NULL) {
-uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
-rng_seed ^= POINTER_AS_UINT(mmd);
-mmd_eval->rng = BLI_rng_new(rng_seed);
-mmd->rng = mmd_eval->rng;
-/* Get lower frame number */
-mmd_eval->scene_frame = get_lower_frame(gpd);
-mmd->scene_frame = mmd_eval->scene_frame;
-  }
-
   if (!is_stroke_affected_by_modifier(ob,
   mmd->layername,
   mmd->pass_index,
@@ -200,22 +155,14 @@ static void deformStroke(
 normalize_v3(vec2);
 /* Use random noise */
 if (mmd->flag & GP_NOISE_USE_RANDOM) {
-  sc_diff = abs(sc_frame - mmd->scene_frame) % mmd->step;
-  /* Only recalc 

[Bf-blender-cvs] [f7526d327b8] soc-2019-bevel-profiles: Rest of rename from previous commit PROF_HANDLE_AUTO_ANIM to PROF_HANDLE_AUTO

2019-08-01 Thread Hans Goudey
Commit: f7526d327b8b8efbeacbef775fe3f8ebb042542b
Author: Hans Goudey
Date:   Thu Aug 1 07:45:04 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rBf7526d327b8b8efbeacbef775fe3f8ebb042542b

Rest of rename from previous commit
PROF_HANDLE_AUTO_ANIM to PROF_HANDLE_AUTO

===

M   source/blender/makesdna/DNA_profilewidget_types.h
M   source/blender/makesrna/intern/rna_profile.c

===

diff --git a/source/blender/makesdna/DNA_profilewidget_types.h 
b/source/blender/makesdna/DNA_profilewidget_types.h
index dbddeca89a6..f9250397936 100644
--- a/source/blender/makesdna/DNA_profilewidget_types.h
+++ b/source/blender/makesdna/DNA_profilewidget_types.h
@@ -44,7 +44,7 @@ typedef struct ProfilePoint {
 enum {
   PROF_SELECT = (1 << 0),
   PROF_HANDLE_VECTOR = (1 << 1),
-  PROF_HANDLE_AUTO_ANIM = (1 << 2),
+  PROF_HANDLE_AUTO = (1 << 2),
 };
 
 typedef struct ProfileWidget {
diff --git a/source/blender/makesrna/intern/rna_profile.c 
b/source/blender/makesrna/intern/rna_profile.c
index b8bb8cd0fb1..a740ad67d2f 100644
--- a/source/blender/makesrna/intern/rna_profile.c
+++ b/source/blender/makesrna/intern/rna_profile.c
@@ -127,7 +127,7 @@ static void rna_def_profilepoint(BlenderRNA *brna)
   PropertyRNA *prop;
 
   static const EnumPropertyItem prop_handle_type_items[] = {
-  {PROF_HANDLE_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped Handle", ""},
+  {PROF_HANDLE_AUTO, "AUTO_CLAMPED", 0, "Auto Clamped Handle", ""},
   {PROF_HANDLE_VECTOR, "VECTOR", 0, "Vector Handle", ""},
   {0, NULL, 0, NULL, NULL},
   };
@@ -176,7 +176,7 @@ static void rna_def_profilewidget_points_api(BlenderRNA 
*brna, PropertyRNA *cpro
   func = RNA_def_function(srna, "remove", "rna_ProfileWidget_remove_point");
   RNA_def_function_flag(func, FUNC_USE_REPORTS);
   RNA_def_function_ui_description(func, "Delete point from profile widget");
-  parm = RNA_def_pointer(func, "point", "ProfilePoint", "", "PointElement to 
remove");
+  parm = RNA_def_pointer(func, "point", "ProfilePoint", "", "Point to remove");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
   RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
 }

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


[Bf-blender-cvs] [8f2b006052a] soc-2019-bevel-profiles: Profile Widget Curves: Further reduced complexity

2019-08-01 Thread Hans Goudey
Commit: 8f2b006052a0db4093e40137b937186adc71c05e
Author: Hans Goudey
Date:   Thu Aug 1 07:39:41 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB8f2b006052a0db4093e40137b937186adc71c05e

Profile Widget Curves: Further reduced complexity

- Removed the HD_AUTO_ANIM so the code only uses HD_AUTO curve type. This
  resolves some asymmetry between X and Y in the sampled curves
- Removed first and last handle correction left over from the CurveMapping 
widget.
- Simplified calchandle_profile to reflect the first change.

===

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

===

diff --git a/source/blender/blenkernel/intern/profile_widget.c 
b/source/blender/blenkernel/intern/profile_widget.c
index 5f86406ab8a..ce117dd3d18 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_widget.c
@@ -274,7 +274,7 @@ ProfilePoint *profilewidget_insert(ProfileWidget *prwdgt, 
float x, float y)
 }
 
 /** Sets the handle type of the selected control points.
- * \param type: Either HD_VECT or HD_AUTO_ANIM
+ * \param type: Either HD_VECT or HD_AUTO
  * \note: Requiress profilewidget_changed call after. */
 void profilewidget_handle_set(ProfileWidget *prwdgt, int type)
 {
@@ -283,12 +283,12 @@ void profilewidget_handle_set(ProfileWidget *prwdgt, int 
type)
 #endif
   for (int i = 0; i < prwdgt->totpoint; i++) {
 if (prwdgt->path[i].flag & PROF_SELECT) {
-  prwdgt->path[i].flag &= ~(PROF_HANDLE_VECTOR | PROF_HANDLE_AUTO_ANIM);
+  prwdgt->path[i].flag &= ~(PROF_HANDLE_VECTOR | PROF_HANDLE_AUTO);
   if (type == HD_VECT) {
 prwdgt->path[i].flag |= PROF_HANDLE_VECTOR;
   }
-  else if (type == HD_AUTO_ANIM) {
-prwdgt->path[i].flag |= PROF_HANDLE_AUTO_ANIM;
+  else if (type == HD_AUTO) {
+prwdgt->path[i].flag |= PROF_HANDLE_AUTO;
   }
 }
   }
@@ -445,9 +445,6 @@ static bool is_curved_edge(BezTriple * bezt, int i)
 }
 
 /** Used in the sample creation process. Reduced copy of 
#calchandleNurb_intern code in curve.c */
-/* HANS-TODO: Depending on the orientation of a profile the location of the 
bezier handles are
- * different, which means there is some different dependence on X vs Y, but it 
should be direction
- * agnostic */
 static void calchandle_profile(BezTriple *bezt, const BezTriple *prev, const 
BezTriple *next)
 {
 #define p2_handle1 ((p2)-3)
@@ -498,7 +495,7 @@ static void calchandle_profile(BezTriple *bezt, const 
BezTriple *prev, const Bez
 len_b = 1.0f;
   }
 
-  if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, 
HD_AUTO_ANIM)) { /* auto */
+  if (bezt->h1 == HD_AUTO || bezt->h2 == HD_AUTO) { /* auto */
 float tvec[2];
 tvec[0] = dvec_b[0] / len_b + dvec_a[0] / len_a;
 tvec[1] = dvec_b[1] / len_b + dvec_a[1] / len_a;
@@ -506,53 +503,13 @@ static void calchandle_profile(BezTriple *bezt, const 
BezTriple *prev, const Bez
 len = len_v2(tvec) * 2.5614f;
 if (len != 0.0f) {
 
-  if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {
+  if (bezt->h1 == HD_AUTO) {
 len_a /= len;
 madd_v2_v2v2fl(p2_handle1, p2, tvec, -len_a);
-
-if ((bezt->h1 == HD_AUTO_ANIM) && next && prev) { /* keep horizontal 
if extrema */
-  const float ydiff1 = prev->vec[1][1] - bezt->vec[1][1];
-  const float ydiff2 = next->vec[1][1] - bezt->vec[1][1];
-  if ((ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 
>= 0.0f)) {
-bezt->vec[0][1] = bezt->vec[1][1];
-  }
-  else { /* handles should not be beyond y coord of two others */
-if (ydiff1 <= 0.0f) {
-  if (prev->vec[1][1] > bezt->vec[0][1]) {
-bezt->vec[0][1] = prev->vec[1][1];
-  }
-}
-else {
-  if (prev->vec[1][1] < bezt->vec[0][1]) {
-bezt->vec[0][1] = prev->vec[1][1];
-  }
-}
-  }
-}
   }
-  if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
+  if (bezt->h2 == HD_AUTO) {
 len_b /= len;
 madd_v2_v2v2fl(p2_handle2, p2, tvec, len_b);
-
-if ((bezt->h2 == HD_AUTO_ANIM) && next && prev) { /* keep horizontal 
if extrema */
-  const float ydiff1 = prev->vec[1][1] - bezt->vec[1][1];
-  const float ydiff2 = next->vec[1][1] - bezt->vec[1][1];
-  if ((ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 
>= 0.0f)) {
-bezt->vec[2][1] = bezt->vec[1][1];
-  }
-  else { /* handles should not be beyond y coord of two others */
-if (ydiff1 <= 0.0f) {
-  if (next->vec[1][1] < bezt->vec[2][1]) {
-bezt->vec[2][1] = next->vec[1][1];
-  }
-}
-else {
-  if (next->vec[1][1] > bezt->vec[2][1]) {
-

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

2019-08-01 Thread Antonio Vazquez
Commit: 03bbd5f9dedf7b3dfea7119c172c61f0b50ae28c
Author: Antonio Vazquez
Date:   Thu Aug 1 17:05:53 2019 +0200
Branches: temp-gpencil-drw-engine
https://developer.blender.org/rB03bbd5f9dedf7b3dfea7119c172c61f0b50ae28c

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] [49b2162309d] master: Cleanup: remove unnecessary include

2019-08-01 Thread mano-wii
Commit: 49b2162309da6abf66764d41d9fc4c45ad01936c
Author: mano-wii
Date:   Thu Aug 1 11:31:17 2019 -0300
Branches: master
https://developer.blender.org/rB49b2162309da6abf66764d41d9fc4c45ad01936c

Cleanup: remove unnecessary include

===

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

===

diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index 53a83e495ca..68b4a8084f0 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -29,8 +29,6 @@
 #include "GPU_shader.h"
 #include "GPU_select.h"
 
-#include "DEG_depsgraph.h"
-
 #include "UI_resources.h"
 
 #include "DRW_engine.h"

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


[Bf-blender-cvs] [895201808c5] master: Fix T66040: Make Data Transfer' Mix Factor multiply with vgroup weights when given, instead of ignoring it.

2019-08-01 Thread Bastien Montagne
Commit: 895201808c5714f82a86a059c7c533edb6c9b2fe
Author: Bastien Montagne
Date:   Thu Aug 1 16:00:37 2019 +0200
Branches: master
https://developer.blender.org/rB895201808c5714f82a86a059c7c533edb6c9b2fe

Fix T66040: Make Data Transfer' Mix Factor multiply with vgroup weights when 
given, instead of ignoring it.

Brings behavior of those options in line with the VGroup editing
modifiers ones e.g.

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenloader/intern/versioning_280.c
M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 062e185eb23..ced9f4a3153 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
  * \note Use #STRINGIFY() rather than defining with quotes.
  */
 #define BLENDER_VERSION 281
-#define BLENDER_SUBVERSION 0
+#define BLENDER_SUBVERSION 1
 /** Several breakages with 280, e.g. collections vs layers. */
 #define BLENDER_MINVERSION 280
 #define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index 1fb29745dba..3c7ac5d8d2e 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -4756,7 +4756,8 @@ void CustomData_data_transfer(const MeshPairRemap 
*me_remap,
 
   for (i = 0; i < totelem; i++, data_dst = POINTER_OFFSET(data_dst, 
data_step), mapit++) {
 const int sources_num = mapit->sources_num;
-const float mix_factor = laymap->mix_weights ? laymap->mix_weights[i] : 
laymap->mix_factor;
+const float mix_factor = laymap->mix_factor *
+ (laymap->mix_weights ? laymap->mix_weights[i] : 
1.0f);
 int j;
 
 if (!sources_num) {
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index cb2b64957f0..1a79b7c9b5a 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3533,6 +3533,22 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 
+  if (!MAIN_VERSION_ATLEAST(bmain, 281, 1)) {
+LISTBASE_FOREACH (Object *, ob, >objects) {
+  for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+if (md->type == eModifierType_DataTransfer) {
+  /* Now datatransfer's mix factor is multiplied with weights when any,
+   * instead of being ignored,
+   * we need to take care of that to keep 'old' files compatible. */
+  DataTransferModifierData *dtmd = (DataTransferModifierData *)md;
+  if (dtmd->defgrp_name[0] != '\0') {
+dtmd->mix_factor = 1.0f;
+  }
+}
+  }
+}
+  }
+
   {
 /* Versioning code until next subversion bump goes here. */
   }
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index a04e0e6422f..7e1ff01a7c3 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5668,7 +5668,8 @@ static void rna_def_modifier_datatransfer(BlenderRNA 
*brna)
   0.0f,
   1.0f,
   "Mix Factor",
-  "Factor to use when applying data to destination (exact behavior depends 
on mix mode)",
+  "Factor to use when applying data to destination (exact behavior depends 
on mix mode, "
+  "multiplied with weights from vertex group when defined)",
   0.0f,
   1.0f);
   RNA_def_property_update(prop, 0, "rna_Modifier_update");

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


[Bf-blender-cvs] [862075bcb93] soc-2019-bevel-profiles: Bevel Custom Profile: Fixed sampling too many segments from widget.

2019-08-01 Thread Hans Goudey
Commit: 862075bcb930fc27758c441b7cbf05081cfa5cee
Author: Hans Goudey
Date:   Thu Aug 1 05:46:29 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB862075bcb930fc27758c441b7cbf05081cfa5cee

Bevel Custom Profile: Fixed sampling too many segments from widget.

Sampling too many segments meant the last one wasn't included which made
the last segment too long.

===

M   source/blender/blenkernel/intern/profile_widget.c
M   source/blender/bmesh/tools/bmesh_bevel.c

===

diff --git a/source/blender/blenkernel/intern/profile_widget.c 
b/source/blender/blenkernel/intern/profile_widget.c
index 6580ea907a3..5f86406ab8a 100644
--- a/source/blender/blenkernel/intern/profile_widget.c
+++ b/source/blender/blenkernel/intern/profile_widget.c
@@ -83,7 +83,6 @@ struct ProfileWidget *profilewidget_add(int preset)
   return prwdgt;
 }
 
-/* HANS-TODO: Double free error here with the prwdgt->table */
 void profilewidget_free_data(ProfileWidget *prwdgt)
 {
 #if DEBUG_PRWDGT
@@ -572,7 +571,6 @@ static void calchandle_profile(BezTriple *bezt, const 
BezTriple *prev, const Bez
  * curvature of the edge after each of them in the table. Works by comparing 
the angle between the
  * handles that make up the edge: the secong handle of the first point and the 
first handle
  * of the second. */
-/* HANS-TODO: This doesn't work so well, so maybe just assign the remainders 
to the longest edges */
 static int compare_curvature_bezt_edge_i(const BezTriple *bezt, const int i_a, 
const int i_b)
 {
   float handle_angle_a, handle_angle_b;
@@ -617,10 +615,6 @@ static int compare_curvature_bezt_edge_i(const BezTriple 
*bezt, const int i_a, c
  *number of points used to define the profile (prwdgt->totpoint).
  * \param sample_straight_edges: Whether to sample points between vector 
handle control points. If
   this is true and there are only vector edges the straight edges will 
still be sampled. */
-/* HANS-TODO: The last segment is always a little too long. And in the 
non-sample_straight_edges
- * case the second to last point can sometimes be forgotten for the sampling. 
*/
-/* HANS-TODO: Enable proper sampling with fewer segments than points, probably 
using older sampling
- * algorithms */
 void profilewidget_create_samples(const ProfileWidget *prwdgt,
   float *locations,
   int n_segments,
@@ -767,7 +761,7 @@ void profilewidget_create_samples(const ProfileWidget 
*prwdgt,
 n_added++;
   }
 
-  BLI_assert(n_added == n_segments); /* HANS-TODO: Remove n_added check */
+  BLI_assert(n_added == n_segments); /* n_added is just used for this assert, 
could remove */
 
   /* Sample the points and add them to the locations table */
   for (i_segment = 0, i = 0; i < totedges; i++) {
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c 
b/source/blender/bmesh/tools/bmesh_bevel.c
index d7f5567d4f1..3d42501f320 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -7028,7 +7028,6 @@ static void set_profile_spacing(BevelParams *bp, 
ProfileSpacing *pro_spacing, bo
   int seg, seg_2;
   float *temp_locs = NULL;
 
-
   /* Sample the input number of segments */
   seg = bp->seg;
   seg_2 = power_of_2_max_i(bp->seg);
@@ -7038,8 +7037,8 @@ static void set_profile_spacing(BevelParams *bp, 
ProfileSpacing *pro_spacing, bo
 pro_spacing->yvals = (double *)BLI_memarena_alloc(bp->mem_arena,
  (size_t)(seg + 1) * 
sizeof(double));
 if (custom) {
-  temp_locs = BLI_memarena_alloc(bp->mem_arena, (size_t)(2 * (seg_2 + 1)) 
* sizeof(float));
-  profilewidget_create_samples(bp->prwdgt, temp_locs, seg + 1,
+  temp_locs = BLI_memarena_alloc(bp->mem_arena, (size_t)(2 * (seg_2)) * 
sizeof(float));
+  profilewidget_create_samples(bp->prwdgt, temp_locs, seg,
bp->prwdgt->flag & 
PROF_SAMPLE_STRAIGHT_EDGES);
   for (int i = 0; i < seg + 1; i++) {
 pro_spacing->xvals[i] = (double)temp_locs[2 * i + 1];

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


[Bf-blender-cvs] [33141cff0f4] soc-2019-bevel-profiles: Bevel Cutoff Method: Don't use the cutoff method in the pipe case.

2019-08-01 Thread Hans Goudey
Commit: 33141cff0f4ac0e8f86d5fd733da4e4af08e7c98
Author: Hans Goudey
Date:   Thu Aug 1 05:36:30 2019 -0400
Branches: soc-2019-bevel-profiles
https://developer.blender.org/rB33141cff0f4ac0e8f86d5fd733da4e4af08e7c98

Bevel Cutoff Method: Don't use the cutoff method in the pipe case.

When it's clear that the vertex mesh is just a continuation of the profile
it doesn't make sense to put a cutoff at the intersection, and it doesn't
look good anyway.

===

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 abb35cfdc08..d7f5567d4f1 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1716,7 +1716,7 @@ static void calculate_profile(BevelParams *bp, BoundVert 
*bndv, bool reversed, b
 }
   }
   r = pro->super_r;
-  if (r == PRO_LINE_R) {
+  if (!bp->use_custom_profile && r == PRO_LINE_R) {
 map_ok = false;
   }
   else {
@@ -4985,7 +4985,7 @@ static VMesh *square_out_adj_vmesh(BevelParams *bp, 
BevVert *bv)
  * Given that the boundary is built and the boundary BMVerts have been made,
  * calculate the positions of the interior mesh points for the M_ADJ pattern,
  * using cubic subdivision, then make the BMVerts and the new faces. */
-static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv)
+static void bevel_build_rings(BevelParams *bp, BMesh *bm, BevVert *bv, 
BoundVert *vpipe)
 {
 #if DEBUG_CUSTOM_PROFILE_ADJ | DEBUG_CUSTOM_PROFILE_CUTOFF
   printf("BEVEL BUILD RINGS\n");
@@ -4997,7 +4997,6 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, 
BevVert *bv)
   BMFace *f, *f2, *r_f;
   BMEdge *bme, *bme1, *bme2, *bme3;
   EdgeHalf *e;
-  BoundVert *vpipe;
   int mat_nr = bp->mat_nr;
 
   n_bndv = bv->vmesh->count;
@@ -5018,8 +5017,6 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, 
BevVert *bv)
 } while (v != bv->vmesh->boundstart);
   }
 
-  vpipe = pipe_test(bv);
-
   if (bp->pro_super_r == PRO_SQUARE_R && bv->selcount >= 3 && !odd && 
!bp->use_custom_profile) {
 vm1 = square_out_adj_vmesh(bp, bv);
   }
@@ -5171,7 +5168,6 @@ static void bevel_build_rings(BevelParams *bp, BMesh *bm, 
BevVert *bv)
 /* HANS-TODO: When the profile is 0 for a non-custom profile this looks 
glitchy. It probably
  * shouldn't build the cut-off faces in some special cases, but this looks 
like a more general
  * issue with profile == 0 cases. */
-/* HANS-TODO: Don't use the cutoff vertex mesh method in the pipe case */
 static void bevel_build_cutoff(BevelParams *bp, BMesh *bm, BevVert *bv)
 {
 #if DEBUG_CUSTOM_PROFILE_CUTOFF
@@ -5556,7 +5552,7 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, 
BevVert *bv)
 #endif
   MemArena *mem_arena = bp->mem_arena;
   VMesh *vm = bv->vmesh;
-  BoundVert *bndv, *weld1, *weld2;
+  BoundVert *bndv, *weld1, *weld2, *vpipe;
   int n, ns, ns2, i, k, weld;
   float *va, *vb, co[3];
 
@@ -5580,7 +5576,7 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, 
BevVert *bv)
 #endif
   weld1 = weld2 = NULL; /* will hold two BoundVerts involved in weld */
 
-  /* make (i, 0, 0) mesh verts for all i */
+  /* make (i, 0, 0) mesh verts for all i (boundverts)*/
   bndv = vm->boundstart;
   do {
 i = bndv->index;
@@ -5691,6 +5687,16 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, 
BevVert *bv)
 }
   }
 #endif
+
+  /* Make sure the pipe case ADJ mesh is used for both the "Grid Fill" (ADJ) 
and cutoff options */
+  if (vm->count == 3 || vm->count == 4) {
+/* Overhead of running pipe_test again is avoided by passing the result to 
bevel_build_rings */
+vpipe = pipe_test(bv);
+if (vpipe) {
+  vm->mesh_kind = M_ADJ;
+}
+  }
+
   /* HANS-QUESTION: Maybe it would make sense to make the weld case a 
mesh_kind option. It would
* simplify this function a fair amount and help with consistency. */
   switch (vm->mesh_kind) {
@@ -5703,7 +5709,7 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, 
BevVert *bv)
   bevel_build_poly(bp, bm, bv);
   break;
 case M_ADJ:
-  bevel_build_rings(bp, bm, bv);
+  bevel_build_rings(bp, bm, bv, vpipe);
   break;
 case M_TRI_FAN:
   bevel_build_trifan(bp, bm, bv);

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


[Bf-blender-cvs] [21c039f6ef3] master: Alembic: fix heap-use-after-free error

2019-08-01 Thread Sybren A. Stüvel
Commit: 21c039f6ef3fb10c0439b096ed7e89d59e3997b3
Author: Sybren A. Stüvel
Date:   Thu Aug 1 15:14:57 2019 +0200
Branches: master
https://developer.blender.org/rB21c039f6ef3fb10c0439b096ed7e89d59e3997b3

Alembic: fix heap-use-after-free error

The mesh can be freed by BKE_mesh_nomain_to_mesh(), so we need to get
the `ME_AUTOSMOOTH` flag before that call, and not after.

===

M   source/blender/alembic/intern/abc_mesh.cc

===

diff --git a/source/blender/alembic/intern/abc_mesh.cc 
b/source/blender/alembic/intern/abc_mesh.cc
index 9e6f2dd6b52..6647ca83bd6 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -1093,10 +1093,11 @@ void AbcMeshReader::readObjectData(Main *bmain, const 
Alembic::Abc::ISampleSelec
 
   Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, 
NULL);
   if (read_mesh != mesh) {
-BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, _MASK_MESH, true);
-
 /* XXX fixme after 2.80; mesh->flag isn't copied by 
BKE_mesh_nomain_to_mesh() */
-mesh->flag |= (read_mesh->flag & ME_AUTOSMOOTH);
+/* read_mesh can be freed by BKE_mesh_nomain_to_mesh(), so get the flag 
before that happens. */
+short autosmooth = (read_mesh->flag & ME_AUTOSMOOTH);
+BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, _MASK_MESH, true);
+mesh->flag |= autosmooth;
   }
 
   if (m_settings->validate_meshes) {

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


[Bf-blender-cvs] [2741992f660] master: Fix T61935: load camera transforms from Alembic files written by Meshroom

2019-08-01 Thread Sybren A. Stüvel
Commit: 2741992f6608c0f76e1bc95ca5d6e05a63348c7f
Author: Sybren A. Stüvel
Date:   Thu Aug 1 14:54:22 2019 +0200
Branches: master
https://developer.blender.org/rB2741992f6608c0f76e1bc95ca5d6e05a63348c7f

Fix T61935: load camera transforms from Alembic files written by Meshroom

Meshroom writes two hierarchies to Alembic, one rooted at
`/mvgRoot/mvgCameras` and the other at `/mvgRoot/mvgCamerasUndefined`.
These paths have no schema definition, and thus are ignored by Blender.
The cameras themselves have those schemaless paths as parent, and have
their transforms marked as "inherited", e.g. relative to their parent.
As these cameras have no valid parent, there is no Blender object to use
to convert their local matrices to world matrices, and Blender just
decided to reset them to the unit matrix.

Now "inherited" transforms without a parent in Blender are interpreted
as world transforms. Reparenting those objects to a Blender object will
re-interpret the transforms as local to the parent again.

===

M   source/blender/alembic/intern/abc_object.cc

===

diff --git a/source/blender/alembic/intern/abc_object.cc 
b/source/blender/alembic/intern/abc_object.cc
index 7b0d94a2305..f863fe4fee7 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -335,8 +335,10 @@ void AbcObjectReader::read_matrix(float r_mat[4][4],
   mul_m4_m4m4(r_mat, m_object->parent->obmat, r_mat);
 }
 else {
-  /* This can happen if the user deleted the parent object. */
-  unit_m4(r_mat);
+  /* This can happen if the user deleted the parent object, but also if 
the Alembic parent was
+   * not imported (because of unknown/unsupported schema, for example). In 
that case just use
+   * the local matrix as if it is the world matrix. This allows us to 
import Alembic files from
+   * MeshRoom, see T61935. */
 }
   }
   else {

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


[Bf-blender-cvs] [08a63215018] master: FFmpeg pixel format conversion improvements

2019-08-01 Thread Sybren A. Stüvel
Commit: 08a63215018222062e6d669f9ac4de3980722042
Author: Sybren A. Stüvel
Date:   Thu Aug 1 13:01:53 2019 +0200
Branches: master
https://developer.blender.org/rB08a63215018222062e6d669f9ac4de3980722042

FFmpeg pixel format conversion improvements

FFmpeg expects Blender to feed it pixels in the output pixel format. If
the output pixel format is different than Blender's RGBA, a conversion
is needed (via FFmpeg's `sws_scale()` function). There were a few issues
with this conversion (and surrounding code) that are fixed in this
commit:

- When conversion was necessary a temporary buffer was allocated and
  deallocated for every frame. This is now allocated once and re-used.
- Copying data to the buffer was done byte-for-byte. On little-endian
  machines it is now done line-by-line using `memcpy` for a little speedup.
- The decision whether pixel format conversion is necessary is now
  correctly done based on the pixel format Blender is actually using.
- The pixel format of the buffer sent to FFmpeg is no longer hard-coded
  incorrectly to a fixed pixel format, but uses the actual output pixel
  format. This is fixes T53058 properly, making RGB QTRLE export possible.
- I added some comments to make it clear which pixel format is referred
  to (either Blender's internal format or the FFmpeg output format).

Combined these improvements not only correct a bug (T53058) but also
results in approximately 5% speed improvement (tested with a 117-frame
shot from Spring, loaded as PNGs in the VSE, encoding to h.264 with
preset 'realtime').

Reviewed By: brecht, sergey

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

===

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

===

diff --git a/source/blender/blenkernel/intern/writeffmpeg.c 
b/source/blender/blenkernel/intern/writeffmpeg.c
index 203cafb75dd..5152643aaa1 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -54,6 +54,7 @@
  * like M_SQRT1_2 leading to warnings with MSVC */
 #  include 
 #  include 
+#  include 
 #  include 
 #  include 
 #  include 
@@ -80,7 +81,10 @@ typedef struct FFMpegContext {
   AVFormatContext *outfile;
   AVStream *video_stream;
   AVStream *audio_stream;
-  AVFrame *current_frame;
+  AVFrame *current_frame; /* Image frame in output pixel format. */
+
+  /* Image frame in Blender's own pixel format, may need conversion to the 
output pixel format. */
+  AVFrame *img_convert_frame;
   struct SwsContext *img_convert_ctx;
 
   uint8_t *audio_input_buffer;
@@ -264,6 +268,10 @@ static AVFrame *alloc_picture(int pix_fmt, int width, int 
height)
 return NULL;
   }
   avpicture_fill((AVPicture *)f, buf, pix_fmt, width, height);
+  f->format = pix_fmt;
+  f->width = width;
+  f->height = height;
+
   return f;
 }
 
@@ -375,67 +383,52 @@ static int write_video_frame(
 }
 
 /* read and encode a frame of audio from the buffer */
-static AVFrame *generate_video_frame(FFMpegContext *context, uint8_t *pixels, 
ReportList *reports)
+static AVFrame *generate_video_frame(FFMpegContext *context,
+ const uint8_t *pixels,
+ ReportList *reports)
 {
-  uint8_t *rendered_frame;
-
   AVCodecContext *c = context->video_stream->codec;
-  int width = c->width;
   int height = c->height;
   AVFrame *rgb_frame;
 
-  if (c->pix_fmt != AV_PIX_FMT_BGR32) {
-rgb_frame = alloc_picture(AV_PIX_FMT_BGR32, width, height);
-if (!rgb_frame) {
-  BKE_report(reports, RPT_ERROR, "Could not allocate temporary frame");
-  return NULL;
-}
+  if (context->img_convert_frame != NULL) {
+/* Pixel format conversion is needed. */
+rgb_frame = context->img_convert_frame;
   }
   else {
+/* The output pixel format is Blender's internal pixel format. */
 rgb_frame = context->current_frame;
   }
 
-  rendered_frame = pixels;
+  /* Copy the Blender pixels into the FFmpeg datastructure, taking care of 
endianness and flipping
+   * the image vertically. */
+  int linesize = rgb_frame->linesize[0];
+  for (int y = 0; y < height; y++) {
+uint8_t *target = rgb_frame->data[0] + linesize * (height - y - 1);
+const uint8_t *src = pixels + linesize * y;
 
-  /* Do RGBA-conversion and flipping in one step depending
-   * on CPU-Endianess */
+#  if ENDIAN_ORDER == L_ENDIAN
+memcpy(target, src, linesize);
 
-  if (ENDIAN_ORDER == L_ENDIAN) {
-int y;
-for (y = 0; y < height; y++) {
-  uint8_t *target = rgb_frame->data[0] + width * 4 * (height - y - 1);
-  uint8_t *src = rendered_frame + width * 4 * y;
-  uint8_t *end = src + width * 4;
-  while (src != end) {
-target[3] = src[3];
-target[2] = src[2];
-target[1] = src[1];
-target[0] = src[0];
+#  elif ENDIAN_ORDER == B_ENDIAN
+const uint8_t *end = src + linesize;
+

[Bf-blender-cvs] [eb7fe7546c1] master: Fix T68055: mesh selection issues, once blend is loaded second time in a Blender session

2019-08-01 Thread mano-wii
Commit: eb7fe7546c1410f3cd82298491edcae3a3e70c1d
Author: mano-wii
Date:   Thu Aug 1 08:30:57 2019 -0300
Branches: master
https://developer.blender.org/rBeb7fe7546c1410f3cd82298491edcae3a3e70c1d

Fix T68055: mesh selection issues, once blend is loaded second time in a 
Blender session

The depth attachment of the framebuffer was missing.

===

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

===

diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index b910f59c432..53a83e495ca 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -86,10 +86,12 @@ static void draw_select_framebuffer_select_id_setup(void)
 e_data.texture_u32 = NULL;
   }
 
+  /* Make sure the depth texture is attached.
+   * It may disappear when loading another Blender session. */
+  GPU_framebuffer_texture_attach(e_data.framebuffer_select_id, dtxl->depth, 0, 
0);
+
   if (e_data.texture_u32 == NULL) {
 e_data.texture_u32 = GPU_texture_create_2d(size[0], size[1], GPU_R32UI, 
NULL, NULL);
-
-GPU_framebuffer_texture_attach(e_data.framebuffer_select_id, dtxl->depth, 
0, 0);
 GPU_framebuffer_texture_attach(e_data.framebuffer_select_id, 
e_data.texture_u32, 0, 0);
 GPU_framebuffer_check_valid(e_data.framebuffer_select_id, NULL);
   }

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


[Bf-blender-cvs] [6786c336bd5] master: Added FFmpeg preset for WebM + VP9 video + Opus audio

2019-08-01 Thread Sybren A. Stüvel
Commit: 6786c336bd58370e5a37db352975000e60ae5ba5
Author: Sybren A. Stüvel
Date:   Thu Aug 1 11:52:02 2019 +0200
Branches: master
https://developer.blender.org/rB6786c336bd58370e5a37db352975000e60ae5ba5

Added FFmpeg preset for WebM + VP9 video + Opus audio

This is a standard combination (VP9 video, Opus audio, in WebM container),
so it's nice to have as a preset.

===

A   release/scripts/presets/ffmpeg/WebM_(VP9+Opus).py

===

diff --git a/release/scripts/presets/ffmpeg/WebM_(VP9+Opus).py 
b/release/scripts/presets/ffmpeg/WebM_(VP9+Opus).py
new file mode 100644
index 000..9723fc3617c
--- /dev/null
+++ b/release/scripts/presets/ffmpeg/WebM_(VP9+Opus).py
@@ -0,0 +1,9 @@
+# WebM container, VP9 video, Opus audio.
+import bpy
+
+ffmpeg = bpy.context.scene.render.ffmpeg
+ffmpeg.format = "WEBM"
+ffmpeg.codec = "WEBM"
+ffmpeg.audio_codec = "OPUS"
+ffmpeg.constant_rate_factor = 'MEDIUM'
+ffmpeg.use_max_b_frames = False

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


[Bf-blender-cvs] [4cbcbacc6a8] master: I18n messages extraction: do not report multi-lines messages anymore.

2019-08-01 Thread Bastien Montagne
Commit: 4cbcbacc6a8aba1a0a38a4eb4a221e0a436b2bdb
Author: Bastien Montagne
Date:   Thu Aug 1 12:52:10 2019 +0200
Branches: master
https://developer.blender.org/rB4cbcbacc6a8aba1a0a38a4eb4a221e0a436b2bdb

I18n messages extraction: do not report multi-lines messages anymore.

Those are now supported for tooltips.

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py 
b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index 0efb24003e7..fdd36589d4d 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -174,8 +174,9 @@ def print_info(reports, pot):
 _print("\tThe following operators are undocumented!")
 else:
 _print("\t“{}”|“{}”:".format(*key))
-if multi_lines and key in multi_lines:
-_print("\t\t-> newline in this message!")
+# We support multi-lines tooltips now...
+# ~ if multi_lines and key in multi_lines:
+# ~ _print("\t\t-> newline in this message!")
 if not_capitalized and key in not_capitalized:
 _print("\t\t-> message not capitalized!")
 if end_point and key in end_point:

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


[Bf-blender-cvs] [4b37abd61f8] master: Cleanup a bit i18n message extraction code.

2019-08-01 Thread Bastien Montagne
Commit: 4b37abd61f8e4164f3f34fffa7140414dffa7a49
Author: Bastien Montagne
Date:   Thu Aug 1 12:26:21 2019 +0200
Branches: master
https://developer.blender.org/rB4b37abd61f8e4164f3f34fffa7140414dffa7a49

Cleanup a bit i18n message extraction code.

===

M   release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
M   release/scripts/modules/bl_i18n_utils/utils.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py 
b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index 9ea19da2160..0efb24003e7 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -232,59 +232,6 @@ def dump_rna_messages(msgs, reports, settings, 
verbose=False):
 # More builtin classes we don't need to parse.
 blacklist_rna_class |= {cls for cls in 
bpy.types.Property.__subclasses__()}
 
-# None of this seems needed anymore, and it's broken anyway with 
current master (blender 2.79.1)...
-"""
-_rna = {getattr(bpy.types, cls) for cls in dir(bpy.types)}
-
-# Classes which are attached to collections can be skipped too, these 
are api access only.
-# XXX This is not true, some of those show in UI, see e.g. tooltip of 
KeyingSets.active...
-#~ for cls in _rna:
-#~ for prop in cls.bl_rna.properties:
-#~ if prop.type == 'COLLECTION':
-#~ prop_cls = prop.srna
-#~ if prop_cls is not None:
-#~ blacklist_rna_class.add(prop_cls.__class__)
-
-# Now here is the *ugly* hack!
-# Unfortunately, all classes we want to access are not available from 
bpy.types (OperatorProperties subclasses
-# are not here, as they have the same name as matching Operator ones 
:( ). So we use __subclasses__() calls
-# to walk through all rna hierarchy.
-# But unregistered classes remain listed by relevant __subclasses__() 
calls (be it a Py or BPY/RNA bug),
-# and obviously the matching RNA struct exists no more, so trying to 
access their data (even the identifier)
-# quickly leads to segfault!
-# To address this, we have to blacklist classes which __name__ does 
not match any __name__ from bpy.types
-# (we can't use only RNA identifiers, as some py-defined classes has a 
different name that rna id,
-# and we can't use class object themselves, because OperatorProperties 
subclasses are not in bpy.types!)...
-
-_rna_clss_ids = {cls.__name__ for cls in _rna} | 
{cls.bl_rna.identifier for cls in _rna}
-
-# All registrable types.
-blacklist_rna_class |= {cls for cls in 
bpy.types.OperatorProperties.__subclasses__() +
-   
bpy.types.Operator.__subclasses__() +
-   
bpy.types.OperatorMacro.__subclasses__() +
-   
bpy.types.Header.__subclasses__() +
-   
bpy.types.Panel.__subclasses__() +
-   bpy.types.Menu.__subclasses__() 
+
-   
bpy.types.UIList.__subclasses__()
-if cls.__name__ not in _rna_clss_ids}
-
-# Collect internal operators
-# extend with all internal operators
-# note that this uses internal api introspection functions
-# XXX Do not skip INTERNAL's anymore, some of those ops show up in UI 
now!
-# all possible operator names
-#op_ids = (set(cls.bl_rna.identifier for cls in 
bpy.types.OperatorProperties.__subclasses__()) |
-#  set(cls.bl_rna.identifier for cls in 
bpy.types.Operator.__subclasses__()) |
-#  set(cls.bl_rna.identifier for cls in 
bpy.types.OperatorMacro.__subclasses__()))
-
-#get_instance = __import__("_bpy").ops.get_instance
-#path_resolve = type(bpy.context).__base__.path_resolve
-#for idname in op_ids:
-#op = get_instance(idname)
-#if 'INTERNAL' in path_resolve(op, "bl_options"):
-#blacklist_rna_class.add(idname)
-"""
-
 return blacklist_rna_class
 
 check_ctxt_rna = check_ctxt_rna_tip = None
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py 
b/release/scripts/modules/bl_i18n_utils/utils.py
index 13758b4f45c..bbc0c5c8405 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -180,9 +180,8 @@ def enable_addons(addons=None, support=None, disable=False, 
check_only=False):
 
 prefs = bpy.context.preferences
 used_ext = {ext.module for ext in prefs.addons}
-# XXX TEMP WORKAROUND
-black_list = 

[Bf-blender-cvs] [433eb3f35d5] master: Text: toggle comment operator

2019-08-01 Thread Campbell Barton
Commit: 433eb3f35d5cf3933801027e33399923609c6539
Author: Campbell Barton
Date:   Thu Aug 1 20:31:57 2019 +1000
Branches: master
https://developer.blender.org/rB433eb3f35d5cf3933801027e33399923609c6539

Text: toggle comment operator

===

M   release/scripts/startup/bl_ui/space_text.py
M   source/blender/blenkernel/BKE_text.h
M   source/blender/blenkernel/intern/text.c
M   source/blender/editors/space_text/space_text.c
M   source/blender/editors/space_text/text_intern.h
M   source/blender/editors/space_text/text_ops.c

===

diff --git a/release/scripts/startup/bl_ui/space_text.py 
b/release/scripts/startup/bl_ui/space_text.py
index d1976894653..1c37e028199 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -288,6 +288,7 @@ class TEXT_MT_format(Menu):
 
 layout.operator("text.comment")
 layout.operator("text.uncomment")
+layout.operator("text.toggle_comment")
 
 layout.separator()
 
diff --git a/source/blender/blenkernel/BKE_text.h 
b/source/blender/blenkernel/BKE_text.h
index 6509788932c..f018e912945 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -90,10 +90,10 @@ void txt_backspace_word(struct Text *text);
 bool txt_add_char(struct Text *text, unsigned int add);
 bool txt_add_raw_char(struct Text *text, unsigned int add);
 bool txt_replace_char(struct Text *text, unsigned int add);
-void txt_unindent(struct Text *text);
+bool txt_unindent(struct Text *text);
 void txt_comment(struct Text *text);
 void txt_indent(struct Text *text);
-void txt_uncomment(struct Text *text);
+bool txt_uncomment(struct Text *text);
 void txt_move_lines(struct Text *text, const int direction);
 void txt_duplicate_line(struct Text *text);
 int txt_setcurr_tab_spaces(struct Text *text, int space);
diff --git a/source/blender/blenkernel/intern/text.c 
b/source/blender/blenkernel/intern/text.c
index 056229ceb1c..29aa3ca1659 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2045,11 +2045,12 @@ static void txt_select_prefix(Text *text, const char 
*add)
  *
  * \note caller must handle undo.
  */
-static void txt_select_unprefix(Text *text, const char *remove)
+static bool txt_select_unprefix(Text *text, const char *remove)
 {
   int num = 0;
   const int indentlen = strlen(remove);
   bool unindented_first = false;
+  bool changed_any = false;
 
   BLI_assert(!ELEM(NULL, text->curl, text->sell));
 
@@ -2062,6 +2063,7 @@ static void txt_select_unprefix(Text *text, const char 
*remove)
   text->curl->len -= indentlen;
   memmove(text->curl->line, text->curl->line + indentlen, text->curl->len 
+ 1);
   changed = true;
+  changed_any = true;
 }
 
 txt_make_dirty(text);
@@ -2089,6 +2091,7 @@ static void txt_select_unprefix(Text *text, const char 
*remove)
   }
 
   /* caller must handle undo */
+  return changed_any;
 }
 
 void txt_comment(Text *text)
@@ -2102,15 +2105,15 @@ void txt_comment(Text *text)
   txt_select_prefix(text, prefix);
 }
 
-void txt_uncomment(Text *text)
+bool txt_uncomment(Text *text)
 {
   const char *prefix = "#";
 
   if (ELEM(NULL, text->curl, text->sell)) {
-return;
+return false;
   }
 
-  txt_select_unprefix(text, prefix);
+  return txt_select_unprefix(text, prefix);
 }
 
 void txt_indent(Text *text)
@@ -2124,15 +2127,15 @@ void txt_indent(Text *text)
   txt_select_prefix(text, prefix);
 }
 
-void txt_unindent(Text *text)
+bool txt_unindent(Text *text)
 {
   const char *prefix = (text->flags & TXT_TABSTOSPACES) ? tab_to_spaces : "\t";
 
   if (ELEM(NULL, text->curl, text->sell)) {
-return;
+return false;
   }
 
-  txt_select_unprefix(text, prefix);
+  return txt_select_unprefix(text, prefix);
 }
 
 void txt_move_lines(struct Text *text, const int direction)
diff --git a/source/blender/editors/space_text/space_text.c 
b/source/blender/editors/space_text/space_text.c
index c5e90cf247d..7d8424a5996 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -199,6 +199,7 @@ static void text_operatortypes(void)
   WM_operatortype_append(TEXT_OT_convert_whitespace);
   WM_operatortype_append(TEXT_OT_uncomment);
   WM_operatortype_append(TEXT_OT_comment);
+  WM_operatortype_append(TEXT_OT_toggle_comment);
   WM_operatortype_append(TEXT_OT_unindent);
   WM_operatortype_append(TEXT_OT_indent);
 
diff --git a/source/blender/editors/space_text/text_intern.h 
b/source/blender/editors/space_text/text_intern.h
index aab5069f919..400405155f8 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -121,6 +121,7 @@ void TEXT_OT_duplicate_line(struct wmOperatorType *ot);
 void TEXT_OT_convert_whitespace(struct wmOperatorType *ot);
 

[Bf-blender-cvs] [3a47fbfac52] master: Cleanup: quiet gcc warning 'alloc-size-larger-than'

2019-08-01 Thread Campbell Barton
Commit: 3a47fbfac520f6a9c0aaef19e351a1a00cb83af5
Author: Campbell Barton
Date:   Thu Aug 1 20:28:39 2019 +1000
Branches: master
https://developer.blender.org/rB3a47fbfac520f6a9c0aaef19e351a1a00cb83af5

Cleanup: quiet gcc warning 'alloc-size-larger-than'

===

M   source/blender/modifiers/intern/MOD_skin.c

===

diff --git a/source/blender/modifiers/intern/MOD_skin.c 
b/source/blender/modifiers/intern/MOD_skin.c
index b6ab3f5b4fe..1a541f9fc5a 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -864,7 +864,7 @@ static Mesh *subdivide_base(Mesh *orig)
   }
 
   /* Per edge, store how many subdivisions are needed */
-  edge_subd = MEM_calloc_arrayN(totorigedge, sizeof(int), "edge_subd");
+  edge_subd = MEM_calloc_arrayN((uint)totorigedge, sizeof(int), "edge_subd");
   for (i = 0, totsubd = 0; i < totorigedge; i++) {
 edge_subd[i] += calc_edge_subdivisions(origvert, orignode, [i], 
degree);
 BLI_assert(edge_subd[i] >= 0);

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


[Bf-blender-cvs] [5fde4494f65] master: Keymap: use Ctrl-/ to toggle comments

2019-08-01 Thread Campbell Barton
Commit: 5fde4494f6542739ec4184312d0a937c500e0595
Author: Campbell Barton
Date:   Thu Aug 1 20:32:19 2019 +1000
Branches: master
https://developer.blender.org/rB5fde4494f6542739ec4184312d0a937c500e0595

Keymap: use Ctrl-/ to toggle comments

Consistent with many code editors, see: D5175

===

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 fc45c0b7a69..3f0d02f0b9b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2189,7 +2189,7 @@ def km_text(params):
  {"properties": [("direction", 'DOWN')]}),
 ("text.indent", {"type": 'TAB', "value": 'PRESS'}, None),
 ("text.unindent", {"type": 'TAB', "value": 'PRESS', "shift": True}, 
None),
-("text.uncomment", {"type": 'D', "value": 'PRESS', "shift": True, 
"ctrl": True}, None),
+("text.toggle_comment", {"type": 'SLASH', "value": 'PRESS', "ctrl": 
True}, None),
 ("text.move", {"type": 'HOME', "value": 'PRESS'},
  {"properties": [("type", 'LINE_BEGIN')]}),
 ("text.move", {"type": 'END', "value": 'PRESS'},

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


[Bf-blender-cvs] [84421b39738] soc-2019-adaptive-cloth: Cloth: changes in matrices

2019-08-01 Thread ishbosamiya
Commit: 84421b39738b1c4631251636e6ed29022bef9a7f
Author: ishbosamiya
Date:   Thu Aug 1 15:27:54 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB84421b39738b1c4631251636e6ed29022bef9a7f

Cloth: changes in matrices

Some matrices were transposed than what they should be leading to logical 
errors. There still might be more, but a lot of it has been fixed.

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index 08735d722e7..55c5aa03fa5 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -91,7 +91,7 @@ class ClothPlane {
 #define FACE_SIZING_DEBUG_COMP 0
 #define FACE_SIZING_DEBUG_OBS 0
 #define FACE_SIZING_DEBUG_SIZE 0
-#define SKIP_COMP_METRIC 1
+#define SKIP_COMP_METRIC 0
 
 #define INVERT_EPSILON 0.1f
 #define EIGEN_EPSILON 1e-3f
@@ -1805,17 +1805,17 @@ static void cloth_remeshing_eigen_decomposition(float 
mat[2][2], float r_mat[2][
 v1 = b;
 vn = sqrtf(v0 * v0 + b2);
 r_mat[0][0] = v0 / vn;
-r_mat[1][0] = v1 / vn;
+r_mat[0][1] = v1 / vn;
 
 v0 = l2 - d;
 vn = sqrtf(v0 * v0 + b2);
-r_mat[0][1] = v0 / vn;
+r_mat[1][0] = v0 / vn;
 r_mat[1][1] = v1 / vn;
   }
   else {
 r_mat[0][0] = 0;
-r_mat[1][0] = 1;
 r_mat[0][1] = 1;
+r_mat[1][0] = 1;
 r_mat[1][1] = 0;
   }
 }
@@ -1845,8 +1845,8 @@ static void cloth_remeshing_compression_metric(float 
mat[2][2], float r_mat[2][2
   float temp_mat[2][2];
   float diag_l[2][2];
   diag_m2_v2(diag_l, l);
-  mul_m2_m2m2(temp_mat, q, diag_l);
-  mul_m2_m2m2(r_mat, temp_mat, q_t);
+  mul_m2_m2m2(temp_mat, q_t, diag_l);
+  mul_m2_m2m2(r_mat, temp_mat, q);
 #if FACE_SIZING_DEBUG
 #  if FACE_SIZING_DEBUG_COMP
   printf("comp- l: ");
@@ -1942,6 +1942,15 @@ static void transpose_m32_m23(float r_mat[3][2], float 
mat[2][3])
   r_mat[2][1] = mat[1][2];
 }
 
+static void zero_m23(float r[2][3])
+{
+  for (int i = 0; i < 2; i++) {
+for (int j = 0; j < 3; j++) {
+  r[i][j] = 0.0f;
+}
+  }
+}
+
 static void zero_m32(float r[3][2])
 {
   for (int i = 0; i < 3; i++) {
@@ -1951,6 +1960,18 @@ static void zero_m32(float r[3][2])
   }
 }
 
+static void mul_m23_m22m23(float r[2][3], float a[2][2], float b[2][3])
+{
+  zero_m23(r);
+  for (int i = 0; i < 2; i++) {
+for (int j = 0; j < 3; j++) {
+  for (int k = 0; k < 2; k++) {
+r[i][j] += a[i][k] * b[k][j];
+  }
+}
+  }
+}
+
 static void mul_m32_m32m22(float r[3][2], float a[3][2], float b[2][2])
 {
   zero_m32(r);
@@ -1991,26 +2012,11 @@ static void cloth_remeshing_derivative(
 }
 
 static void cloth_remeshing_derivative(
-BMesh *bm, float m_01[3], float m_02[3], float m_03[3], BMFace *f, float 
r_mat[3][2])
+BMesh *bm, float m_01[3], float m_02[3], float m_03[3], BMFace *f, float 
r_mat[2][3])
 {
-#if 1
   float mat[2][3];
   sub_v3_v3v3(mat[0], m_02, m_01);
   sub_v3_v3v3(mat[1], m_03, m_01);
-  float mat_t[3][2];
-  transpose_m32_m23(mat_t, mat);
-#else
-  float mat_t[3][2];
-  float temp_v3[3];
-  sub_v3_v3v3(temp_v3, m_02, m_01);
-  mat_t[0][0] = temp_v3[0];
-  mat_t[1][0] = temp_v3[1];
-  mat_t[2][0] = temp_v3[2];
-  sub_v3_v3v3(temp_v3, m_03, m_01);
-  mat_t[0][1] = temp_v3[0];
-  mat_t[1][1] = temp_v3[1];
-  mat_t[2][1] = temp_v3[2];
-#endif
 
   float face_dm[2][2];
   float face_dm_inv[2][2];
@@ -2019,7 +2025,8 @@ static void cloth_remeshing_derivative(
 zero_m2(face_dm_inv);
   }
 
-  mul_m32_m32m22(r_mat, mat_t, face_dm_inv);
+  /* mul_m32_m32m22(r_mat, mat_t, face_dm_inv); */
+  mul_m23_m22m23(r_mat, face_dm_inv, mat);
 }
 
 static void transpose_m23_m32(float r_mat[2][3], float mat[3][2])
@@ -2270,25 +2277,26 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
 
   float sizing_s[2][2];
   cloth_remeshing_curvature(bm, f, sizing_s);
-  float sizing_f[3][2];
+  float sizing_f[2][3];
   cloth_remeshing_derivative(bm, cv[0]->x, cv[1]->x, cv[2]->x, f, sizing_f);
-  float sizing_v[3][2];
+  float sizing_v[2][3];
   cloth_remeshing_derivative(bm, cv[0]->v, cv[1]->v, cv[2]->v, f, sizing_v);
 
   float sizing_s_t[2][2];
   copy_m2_m2(sizing_s_t, sizing_s);
   transpose_m2(sizing_s_t);
-  float sizing_f_t[2][3];
-  transpose_m23_m32(sizing_f_t, sizing_f);
-  float sizing_v_t[2][3];
-  transpose_m23_m32(sizing_v_t, sizing_v);
+  float sizing_f_t[3][2];
+  transpose_m32_m23(sizing_f_t, sizing_f);
+  float sizing_v_t[3][2];
+  transpose_m32_m23(sizing_v_t, sizing_v);
 
   float curv[2][2];
-  mul_m2_m2m2(curv, sizing_s_t, sizing_s);
+  /* mul_m2_m2m2(curv, sizing_s_t, sizing_s); */
+  mul_m2_m2m2(curv, sizing_s, sizing_s_t);
 
   float comp[2][2];
   float f_x_ft[2][2];
-  mul_m2_m23m32(f_x_ft, sizing_f_t, sizing_f);
+  

[Bf-blender-cvs] [54cd8de4daa] soc-2019-adaptive-cloth: Cloth: fix in eigen decomposition, b now refers to correct element of mat

2019-08-01 Thread ishbosamiya
Commit: 54cd8de4daa4590af432bb610c609c919817dd04
Author: ishbosamiya
Date:   Thu Aug 1 14:01:40 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB54cd8de4daa4590af432bb610c609c919817dd04

Cloth: fix in eigen decomposition, b now refers to correct element of mat

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index b2bb760a6c9..08735d722e7 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -87,7 +87,7 @@ class ClothPlane {
 
 #define REMESHING_DATA_DEBUG 0 /* split and collapse edge count */
 #define COLLAPSE_EDGES_DEBUG 0
-#define FACE_SIZING_DEBUG 0
+#define FACE_SIZING_DEBUG 1
 #define FACE_SIZING_DEBUG_COMP 0
 #define FACE_SIZING_DEBUG_OBS 0
 #define FACE_SIZING_DEBUG_SIZE 0
@@ -1788,56 +1788,30 @@ static float cloth_remeshing_calc_area(BMesh *bm, 
BMVert *v)
 
 static void cloth_remeshing_eigen_decomposition(float mat[2][2], float 
r_mat[2][2], float r_vec[2])
 {
-  float a = mat[0][0];
-  float b = mat[1][0];
-  float d = mat[1][1];
-
+  float a = mat[0][0], b = mat[0][1], d = mat[1][1];
   float amd = a - d;
   float apd = a + d;
   float b2 = b * b;
   float det = sqrtf(4 * b2 + amd * amd);
   float l1 = 0.5 * (apd + det);
   float l2 = 0.5 * (apd - det);
+  float v0, v1, vn;
 
   r_vec[0] = l1;
   r_vec[1] = l2;
 
-  float v0, v1, vn;
-  /* EIGEN_EPSILON is used due to floating point precision errors */
-  /* TODO(Ish): It might be possible to just use fabsf(b2) instead of
-   * fabsf(b), this would eliminate the need for the nested if */
-  if (fabsf(b) < EIGEN_EPSILON) {
+  if (b) {
 v0 = l1 - d;
 v1 = b;
 vn = sqrtf(v0 * v0 + b2);
-if (fabsf(vn) < EIGEN_EPSILON) {
-  r_mat[0][0] = 0;
-  r_mat[1][0] = 1;
-  r_mat[0][1] = 1;
-  r_mat[1][1] = 0;
-  return;
-}
 r_mat[0][0] = v0 / vn;
 r_mat[1][0] = v1 / vn;
 
 v0 = l2 - d;
 vn = sqrtf(v0 * v0 + b2);
-if (fabsf(vn) < EIGEN_EPSILON) {
-  r_mat[0][0] = 0;
-  r_mat[1][0] = 1;
-  r_mat[0][1] = 1;
-  r_mat[1][1] = 0;
-  return;
-}
 r_mat[0][1] = v0 / vn;
 r_mat[1][1] = v1 / vn;
   }
-  else if (a >= d) {
-r_mat[0][0] = 1;
-r_mat[1][0] = 0;
-r_mat[0][1] = 0;
-r_mat[1][1] = 1;
-  }
   else {
 r_mat[0][0] = 0;
 r_mat[1][0] = 1;

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


[Bf-blender-cvs] [51c57993d92] soc-2019-adaptive-cloth: Cloth: more debugging statements for face sizing

2019-08-01 Thread ishbosamiya
Commit: 51c57993d92dbb72e2299c3625fe01cdc13a2f08
Author: ishbosamiya
Date:   Thu Aug 1 02:19:44 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB51c57993d92dbb72e2299c3625fe01cdc13a2f08

Cloth: more debugging statements for face sizing

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index aa8899e8e09..caaa6be4b37 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -87,16 +87,22 @@ class ClothPlane {
 
 #define REMESHING_DATA_DEBUG 0 /* split and collapse edge count */
 #define COLLAPSE_EDGES_DEBUG 0
-#define FACE_SIZING_DEBUG 1
-#define FACE_SIZING_DEBUG_COMP 1
+#define FACE_SIZING_DEBUG 0
+#define FACE_SIZING_DEBUG_COMP 0
 #define FACE_SIZING_DEBUG_OBS 0
 #define FACE_SIZING_DEBUG_SIZE 0
+#define SKIP_COMP_METRIC 1
 
 #define INVERT_EPSILON 0.1f
 #define EIGEN_EPSILON 1e-3f
 #define NEXT(x) ((x) < 2 ? (x) + 1 : (x)-2)
 #define PREV(x) ((x) > 0 ? (x)-1 : (x) + 2)
 
+static void print_m32(float m[3][2])
+{
+  printf("{{%f, %f}, {%f, %f}, {%f, %f}}\n", m[0][0], m[0][1], m[1][0], 
m[1][1], m[2][0], m[2][1]);
+}
+
 static void print_m2(float m[2][2])
 {
   printf("{{%f, %f}, {%f, %f}}\n", m[0][0], m[0][1], m[1][0], m[1][1]);
@@ -2013,11 +2019,24 @@ static void cloth_remeshing_derivative(
 static void cloth_remeshing_derivative(
 BMesh *bm, float m_01[3], float m_02[3], float m_03[3], BMFace *f, float 
r_mat[3][2])
 {
+#if 1
   float mat[2][3];
   sub_v3_v3v3(mat[0], m_02, m_01);
   sub_v3_v3v3(mat[1], m_03, m_01);
   float mat_t[3][2];
   transpose_m32_m23(mat_t, mat);
+#else
+  float mat_t[3][2];
+  float temp_v3[3];
+  sub_v3_v3v3(temp_v3, m_02, m_01);
+  mat_t[0][0] = temp_v3[0];
+  mat_t[1][0] = temp_v3[1];
+  mat_t[2][0] = temp_v3[2];
+  sub_v3_v3v3(temp_v3, m_03, m_01);
+  mat_t[0][1] = temp_v3[0];
+  mat_t[1][1] = temp_v3[1];
+  mat_t[2][1] = temp_v3[2];
+#endif
 
   float face_dm[2][2];
   float face_dm_inv[2][2];
@@ -2189,7 +2208,8 @@ static void cloth_remeshing_find_planes(Depsgraph 
*depsgraph,
 collision_move_object(collmd, step + dt, step);
 
 /*Now, actual obstacle metric calculation */
-cloth_remeshing_find_nearest_planes(bm, collmd, 
clmd->coll_parms->epsilon, r_planes);
+cloth_remeshing_find_nearest_planes(
+bm, collmd, 10.0f * clmd->coll_parms->epsilon, r_planes);
   }
   BKE_collision_objects_free(collobjs);
 }
@@ -2212,6 +2232,7 @@ static void 
cloth_remeshing_obstacle_metric_calculation(BMesh *bm,
 #if FACE_SIZING_DEBUG_OBS
   printf("continuing since len_squared_v3(plane.no) == 0.0f\n");
   printf("plane.co: {%f %f %f}\n", plane.co[0], plane.co[1], plane.co[2]);
+  printf("v[i]->co: {%f %f %f}\n", v[i]->co[0], v[i]->co[1], v[i]->co[2]);
 #endif
   continue;
 }
@@ -2250,7 +2271,9 @@ static void cloth_remeshing_obstacle_metric(BMesh *bm,
 {
   if (planes.empty()) {
 zero_m2(r_mat);
-/* printf("planes is empty, returning\n"); */
+#if FACE_SIZING_DEBUG_OBS
+printf("planes is empty, returning\n");
+#endif
 return;
   }
   cloth_remeshing_obstacle_metric_calculation(bm, f, planes, r_mat);
@@ -2292,6 +2315,14 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   float comp[2][2];
   float f_x_ft[2][2];
   mul_m2_m23m32(f_x_ft, sizing_f_t, sizing_f);
+#if FACE_SIZING_DEBUG
+#  if FACE_SIZING_DEBUG_COMP
+  printf("sizing_f: ");
+  print_m32(sizing_f);
+  printf("comp- input mat (f_x_ft): ");
+  print_m2(f_x_ft);
+#  endif
+#endif
   cloth_remeshing_compression_metric(f_x_ft, comp);
 
   float dvel[2][2];
@@ -2314,6 +2345,11 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
 1.0f / (clmd->sim_parms->refine_velocity * 
clmd->sim_parms->refine_velocity));
 
   /* Adding curv_temp, comp_temp, dvel_temp, obs */
+
+#if SKIP_COMP_METRIC
+  zero_m2(comp_temp);
+  mul_m2_fl(obs, 1.0f / sqr_fl(clmd->sim_parms->refine_compression));
+#endif
   add_m2_m2m2(m, curv_temp, comp_temp);
   add_m2_m2m2(m, m, dvel_temp);
   add_m2_m2m2(m, m, obs);
@@ -2331,6 +2367,15 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   print_m2(m);
 #endif
 
+#if FACE_SIZING_DEBUG_OBS
+#  if FACE_SIZING_DEBUG
+#  else
+  printf("obs: ");
+  print_m2(obs);
+  printf("\n");
+#  endif
+#endif
+
   /* eigen decomposition on m */
   float l[2];/* Eigen values */
   float q[2][2]; /* Eigen Matrix */
@@ -2364,6 +2409,7 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   print_m2(q);
   printf("result: ");
   print_m2(result);
+  printf("\n");
 #endif
 
   return ClothSizing(result);


[Bf-blender-cvs] [9953a1015d9] soc-2019-cycles-procedural: Remove duplicate float4_to_float3 function.

2019-08-01 Thread OmarSquircleArt
Commit: 9953a1015d9056b9041b450845e483acf1a96da5
Author: OmarSquircleArt
Date:   Thu Aug 1 12:14:08 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB9953a1015d9056b9041b450845e483acf1a96da5

Remove duplicate float4_to_float3 function.

===

M   intern/cycles/util/util_math.h

===

diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index a1b909ff25d..7b0a967f8bb 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -368,11 +368,6 @@ ccl_device_inline float4 float3_to_float4(const float3 a)
   return make_float4(a.x, a.y, a.z, 1.0f);
 }
 
-ccl_device_inline float3 float4_to_float3(const float3 a)
-{
-  return make_float3(a.x, a.y, a.z);
-}
-
 ccl_device_inline float inverse_lerp(float a, float b, float x)
 {
   return (x - a) / (b - a);

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


[Bf-blender-cvs] [58a80eb44e6] soc-2019-adaptive-cloth: Cloth: multiply object matrix with bmesh vertices

2019-08-01 Thread ishbosamiya
Commit: 58a80eb44e6c33b8462c4a6719ad7892fc96c1cd
Author: ishbosamiya
Date:   Wed Jul 31 21:28:09 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB58a80eb44e6c33b8462c4a6719ad7892fc96c1cd

Cloth: multiply object matrix with bmesh vertices

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index 8e6222fb914..d527a82e27b 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -87,7 +87,7 @@ class ClothPlane {
 
 #define REMESHING_DATA_DEBUG 0 /* split and collapse edge count */
 #define COLLAPSE_EDGES_DEBUG 0
-#define FACE_SIZING_DEBUG 1
+#define FACE_SIZING_DEBUG 0
 #define FACE_SIZING_DEBUG_COMP 0
 #define FACE_SIZING_DEBUG_OBS 0
 #define FACE_SIZING_DEBUG_SIZE 0
@@ -191,6 +191,7 @@ static void cloth_remeshing_init_bmesh(Object *ob,
 BMIter viter;
 int i = 0;
 BM_ITER_MESH_INDEX (v, , clmd->clothObject->bm_prev, 
BM_VERTS_OF_MESH, i) {
+  mul_m4_v3(ob->obmat, v->co);
   if (!equals_v3v3(v->co, clmd->clothObject->verts[i].x)) {
 printf("copying %f %f %f into %f %f %f\n",
clmd->clothObject->verts[i].x[0],

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


[Bf-blender-cvs] [7e26b28e2ba] soc-2019-adaptive-cloth: Cloth: added refine obstacle metric parameter

2019-08-01 Thread ishbosamiya
Commit: 7e26b28e2bad21cf9d7c9f0fd5238128cec6578f
Author: ishbosamiya
Date:   Thu Aug 1 13:06:08 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB7e26b28e2bad21cf9d7c9f0fd5238128cec6578f

Cloth: added refine obstacle metric parameter

===

M   release/scripts/startup/bl_ui/properties_physics_cloth.py
M   source/blender/blenkernel/intern/cloth.c
M   source/blender/blenkernel/intern/cloth_remeshing.cpp
M   source/blender/makesdna/DNA_cloth_types.h
M   source/blender/makesrna/intern/rna_cloth.c

===

diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py 
b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index 658df38c6c7..14a8e1d7e5f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -333,6 +333,8 @@ class PHYSICS_PT_cloth_remeshing(PhysicButtonsPanel, Panel):
 col = flow.column()
 col.prop(cloth, "refine_velocity", text="Refine Velocity")
 col = flow.column()
+col.prop(cloth, "refine_obstacle", text="Refine Obstacle")
+col = flow.column()
 col.prop(cloth, "size_min", text="Size Minimum")
 col = flow.column()
 col.prop(cloth, "size_max", text="Size Maximum")
diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 430887e1c0e..c624d286da8 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -159,6 +159,7 @@ void cloth_init(ClothModifierData *clmd)
   clmd->sim_parms->refine_angle = 0.3f;
   clmd->sim_parms->refine_compression = 0.005f;
   clmd->sim_parms->refine_velocity = 0.5f;
+  clmd->sim_parms->refine_obstacle = 1.0f;
   clmd->sim_parms->size_min = 100e-3f;
   clmd->sim_parms->size_max = 200e-3f;
   clmd->sim_parms->aspect_min = 1.0f;
diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index caaa6be4b37..b2bb760a6c9 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -2335,6 +2335,7 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   float curv_temp[2][2];
   float comp_temp[2][2];
   float dvel_temp[2][2];
+  float obs_temp[2][2];
   copy_m2_m2(curv_temp, curv);
   mul_m2_fl(curv_temp, 1.0f / (clmd->sim_parms->refine_angle * 
clmd->sim_parms->refine_angle));
   copy_m2_m2(comp_temp, comp);
@@ -2343,16 +2344,17 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   copy_m2_m2(dvel_temp, dvel);
   mul_m2_fl(dvel_temp,
 1.0f / (clmd->sim_parms->refine_velocity * 
clmd->sim_parms->refine_velocity));
+  copy_m2_m2(obs_temp, obs);
+  mul_m2_fl(obs_temp, 1.0f / sqr_fl(clmd->sim_parms->refine_obstacle));
 
   /* Adding curv_temp, comp_temp, dvel_temp, obs */
 
 #if SKIP_COMP_METRIC
   zero_m2(comp_temp);
-  mul_m2_fl(obs, 1.0f / sqr_fl(clmd->sim_parms->refine_compression));
 #endif
   add_m2_m2m2(m, curv_temp, comp_temp);
   add_m2_m2m2(m, m, dvel_temp);
-  add_m2_m2m2(m, m, obs);
+  add_m2_m2m2(m, m, obs_temp);
 
 #if FACE_SIZING_DEBUG
   printf("curv_temp: ");
@@ -2361,8 +2363,8 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   print_m2(comp_temp);
   printf("dvel_temp: ");
   print_m2(dvel_temp);
-  printf("obs: ");
-  print_m2(obs);
+  printf("obs_temp: ");
+  print_m2(obs_temp);
   printf("m: ");
   print_m2(m);
 #endif
@@ -2372,6 +2374,8 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
 #  else
   printf("obs: ");
   print_m2(obs);
+  printf("obs_temp: ");
+  print_m2(obs_temp);
   printf("\n");
 #  endif
 #endif
diff --git a/source/blender/makesdna/DNA_cloth_types.h 
b/source/blender/makesdna/DNA_cloth_types.h
index 0437bc24308..e7af83005f6 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -153,9 +153,11 @@ typedef struct ClothSimSettings {
   float refine_angle;
   float refine_compression;
   float refine_velocity;
+  float refine_obstacle;
   float size_min;
   float size_max;
   float aspect_min;
+  char _pad1[4];
 } ClothSimSettings;
 
 typedef struct ClothCollSettings {
diff --git a/source/blender/makesrna/intern/rna_cloth.c 
b/source/blender/makesrna/intern/rna_cloth.c
index 755b8fc6574..05425010f3f 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -799,6 +799,12 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Remeshing Refine Velocity", "Remeshing 
refine velocity");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
 
+  prop = RNA_def_property(srna, "refine_obstacle", PROP_FLOAT, PROP_NONE);
+  

[Bf-blender-cvs] [0916ed8dbe6] soc-2019-adaptive-cloth: Cloth: fixed eigen decomposition floating point errors

2019-08-01 Thread ishbosamiya
Commit: 0916ed8dbe66cbbb982aea37363b167462de1adc
Author: ishbosamiya
Date:   Thu Aug 1 00:11:11 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB0916ed8dbe66cbbb982aea37363b167462de1adc

Cloth: fixed eigen decomposition floating point errors

This should generally work but needs further testing. Currently, the plan to 
check for floating point errors in compression metric.

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index d527a82e27b..aa8899e8e09 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -87,12 +87,13 @@ class ClothPlane {
 
 #define REMESHING_DATA_DEBUG 0 /* split and collapse edge count */
 #define COLLAPSE_EDGES_DEBUG 0
-#define FACE_SIZING_DEBUG 0
-#define FACE_SIZING_DEBUG_COMP 0
+#define FACE_SIZING_DEBUG 1
+#define FACE_SIZING_DEBUG_COMP 1
 #define FACE_SIZING_DEBUG_OBS 0
 #define FACE_SIZING_DEBUG_SIZE 0
 
 #define INVERT_EPSILON 0.1f
+#define EIGEN_EPSILON 1e-3f
 #define NEXT(x) ((x) < 2 ? (x) + 1 : (x)-2)
 #define PREV(x) ((x) > 0 ? (x)-1 : (x) + 2)
 
@@ -1796,15 +1797,32 @@ static void cloth_remeshing_eigen_decomposition(float 
mat[2][2], float r_mat[2][
   r_vec[1] = l2;
 
   float v0, v1, vn;
-  if (b) {
+  /* EIGEN_EPSILON is used due to floating point precision errors */
+  /* TODO(Ish): It might be possible to just use fabsf(b2) instead of
+   * fabsf(b), this would eliminate the need for the nested if */
+  if (fabsf(b) < EIGEN_EPSILON) {
 v0 = l1 - d;
 v1 = b;
 vn = sqrtf(v0 * v0 + b2);
+if (fabsf(vn) < EIGEN_EPSILON) {
+  r_mat[0][0] = 0;
+  r_mat[1][0] = 1;
+  r_mat[0][1] = 1;
+  r_mat[1][1] = 0;
+  return;
+}
 r_mat[0][0] = v0 / vn;
 r_mat[1][0] = v1 / vn;
 
 v0 = l2 - d;
 vn = sqrtf(v0 * v0 + b2);
+if (fabsf(vn) < EIGEN_EPSILON) {
+  r_mat[0][0] = 0;
+  r_mat[1][0] = 1;
+  r_mat[0][1] = 1;
+  r_mat[1][1] = 0;
+  return;
+}
 r_mat[0][1] = v0 / vn;
 r_mat[1][1] = v1 / vn;
   }

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


[Bf-blender-cvs] [15ba172e160] soc-2019-adaptive-cloth: Cloth: preserve count, labeled edges and improved debug statements

2019-08-01 Thread ishbosamiya
Commit: 15ba172e1607574d6120aa04999d6b4ec00c7372
Author: ishbosamiya
Date:   Wed Jul 31 16:30:00 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB15ba172e1607574d6120aa04999d6b4ec00c7372

Cloth: preserve count, labeled edges and improved debug statements

===

M   source/blender/blenkernel/intern/cloth_remeshing.cpp

===

diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index a612934123f..8e6222fb914 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -85,8 +85,9 @@ class ClothPlane {
   float no[3];
 };
 
+#define REMESHING_DATA_DEBUG 0 /* split and collapse edge count */
 #define COLLAPSE_EDGES_DEBUG 0
-#define FACE_SIZING_DEBUG 0
+#define FACE_SIZING_DEBUG 1
 #define FACE_SIZING_DEBUG_COMP 0
 #define FACE_SIZING_DEBUG_OBS 0
 #define FACE_SIZING_DEBUG_SIZE 0
@@ -309,7 +310,7 @@ static Mesh 
*cloth_remeshing_update_cloth_object_bmesh(Object *ob, ClothModifier
* reindexing */
 
   if (clmd->clothObject->mvert_num_prev == clmd->clothObject->mvert_num) {
-printf("returning because mvert_num_prev == mvert_num\n");
+/* printf("returning because mvert_num_prev == mvert_num\n"); */
 clmd->clothObject->bm_prev = BM_mesh_copy(clmd->clothObject->bm);
 BM_mesh_free(clmd->clothObject->bm);
 clmd->clothObject->bm = NULL;
@@ -987,7 +988,9 @@ static bool cloth_remeshing_split_edges(ClothModifierData 
*clmd, ClothVertMap 
   static int prev_num_bad_edges = 0;
   vector bad_edges;
   cloth_remeshing_find_bad_edges(bm, cvm, bad_edges);
+#if REMESHING_DATA_DEBUG
   printf("split edges tagged: %d\n", (int)bad_edges.size());
+#endif
   if (prev_num_bad_edges == bad_edges.size()) {
 bad_edges.clear();
 return false;
@@ -1606,7 +1609,9 @@ static void cloth_remeshing_static(ClothModifierData 
*clmd, ClothVertMap )
   while (cloth_remeshing_collapse_edges(clmd, cvm, active_faces, count)) {
 /* empty while */
   }
+#  if REMESHING_DATA_DEBUG
   printf("collapse edges count: %d\n", count);
+#  endif
 
 #endif
 
@@ -1689,7 +1694,9 @@ static void cloth_remeshing_dynamic(Depsgraph *depsgraph,
   while (cloth_remeshing_collapse_edges(clmd, cvm, active_faces, count)) {
 /* empty while */
   }
+#  if REMESHING_DATA_DEBUG
   printf("collapse edges count: %d\n", count);
+#  endif
 
 #endif
 
@@ -1717,6 +1724,28 @@ static void cloth_remeshing_dynamic(Depsgraph *depsgraph,
   sprintf(file_name, "/tmp/objs/%03d.obj", file_no);
   cloth_remeshing_export_obj(clmd->clothObject->bm, file_name);
 #endif
+
+#if 0
+  BMVert *v;
+  BMIter viter;
+  int preserve_count = 0;
+  BM_ITER_MESH (v, , clmd->clothObject->bm, BM_VERTS_OF_MESH) {
+if (cvm[v].flags & CLOTH_VERT_FLAG_PRESERVE) {
+  preserve_count++;
+}
+  }
+  printf("Preserve Count: %d\n", preserve_count);
+
+  BMEdge *e;
+  BMIter eiter;
+  int label_count = 0;
+  BM_ITER_MESH (e, , clmd->clothObject->bm, BM_EDGES_OF_MESH) {
+if (cloth_remeshing_edge_label_test(e)) {
+  label_count++;
+}
+  }
+  printf("Label Count: %d\n", label_count);
+#endif
 }
 
 static void cloth_remeshing_face_data(BMesh *bm, BMFace *f, float r_mat[2][2])
@@ -1826,8 +1855,8 @@ static void cloth_remeshing_compression_metric(float 
mat[2][2], float r_mat[2][2
   printf("comp- q: ");
   print_m2(q);
   printf("comp- diagl: ");
-#  endif
   print_m2(diag_l);
+#  endif
 #endif
 }
 
@@ -2202,7 +2231,7 @@ static void cloth_remeshing_obstacle_metric(BMesh *bm,
 {
   if (planes.empty()) {
 zero_m2(r_mat);
-printf("planes is empty, returning\n");
+/* printf("planes is empty, returning\n"); */
 return;
   }
   cloth_remeshing_obstacle_metric_calculation(bm, f, planes, r_mat);
@@ -2312,6 +2341,8 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
 #if FACE_SIZING_DEBUG
   printf("l: ");
   print_v2(l);
+  printf("q: ");
+  print_m2(q);
   printf("result: ");
   print_m2(result);
 #endif

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


[Bf-blender-cvs] [431082c6366] soc-2019-cycles-procedural: Fix OpenCL Kernels. Allow average(float4) in OpenCL.

2019-08-01 Thread OmarSquircleArt
Commit: 431082c6366a277937732617b5e91f45ff778172
Author: OmarSquircleArt
Date:   Thu Aug 1 12:12:11 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB431082c6366a277937732617b5e91f45ff778172

Fix OpenCL Kernels. Allow average(float4) in OpenCL.

===

M   intern/cycles/kernel/osl/osl_services.cpp
M   intern/cycles/kernel/svm/svm_attribute.h
M   intern/cycles/util/util_math_float4.h

===

diff --git a/intern/cycles/kernel/osl/osl_services.cpp 
b/intern/cycles/kernel/osl/osl_services.cpp
index 399712ad5f1..0cdaf379045 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -531,11 +531,11 @@ static bool set_attribute_float4(float4 f[3], TypeDesc 
type, bool derivatives, v
 return true;
   }
   else if (type == TypeDesc::TypeFloat) {
-fval[0] = average(f[0]);
+fval[0] = average_float4(f[0]);
 
 if (derivatives) {
-  fval[1] = average(f[1]);
-  fval[2] = average(f[2]);
+  fval[1] = average_float4(f[1]);
+  fval[2] = average_float4(f[2]);
 }
 return true;
   }
diff --git a/intern/cycles/kernel/svm/svm_attribute.h 
b/intern/cycles/kernel/svm/svm_attribute.h
index 2a08b5e126d..84e17fabd62 100644
--- a/intern/cycles/kernel/svm/svm_attribute.h
+++ b/intern/cycles/kernel/svm/svm_attribute.h
@@ -72,7 +72,7 @@ ccl_device void svm_node_attr(KernelGlobals *kg, ShaderData 
*sd, float *stack, u
   else if (desc.type == NODE_ATTR_RGBA) {
 float4 f = primitive_attribute_float4(kg, sd, desc, NULL, NULL);
 if (type == NODE_ATTR_FLOAT) {
-  stack_store_float(stack, out_offset, average(f));
+  stack_store_float(stack, out_offset, average_float4(f));
 }
 else {
   stack_store_float3(stack, out_offset, float4_to_float3(f));
@@ -126,7 +126,7 @@ ccl_device_noinline
 float4 dx;
 float4 f = primitive_attribute_float4(kg, sd, desc, , NULL);
 if (type == NODE_ATTR_FLOAT) {
-  stack_store_float(stack, out_offset, average(f + dx));
+  stack_store_float(stack, out_offset, average_float4(f + dx));
 }
 else {
   stack_store_float3(stack, out_offset, float4_to_float3(f + dx));
@@ -181,7 +181,7 @@ ccl_device_noinline
 float4 dy;
 float4 f = primitive_attribute_float4(kg, sd, desc, NULL, );
 if (type == NODE_ATTR_FLOAT) {
-  stack_store_float(stack, out_offset, average(f + dy));
+  stack_store_float(stack, out_offset, average_float4(f + dy));
 }
 else {
   stack_store_float3(stack, out_offset, float4_to_float3(f + dy));
diff --git a/intern/cycles/util/util_math_float4.h 
b/intern/cycles/util/util_math_float4.h
index f0d850cf574..0624dadf5ad 100644
--- a/intern/cycles/util/util_math_float4.h
+++ b/intern/cycles/util/util_math_float4.h
@@ -54,7 +54,6 @@ ccl_device_inline float4 sqrt(const float4 );
 ccl_device_inline float4 sqr(const float4 );
 ccl_device_inline float4 cross(const float4 , const float4 );
 ccl_device_inline bool is_zero(const float4 );
-ccl_device_inline float average(const float4 );
 ccl_device_inline float len(const float4 );
 ccl_device_inline float4 normalize(const float4 );
 ccl_device_inline float4 safe_normalize(const float4 );
@@ -66,6 +65,7 @@ ccl_device_inline float4 fabs(const float4 );
 ccl_device_inline float4 floor(const float4 );
 #endif /* !__KERNEL_OPENCL__*/
 
+ccl_device_inline float average_float4(const float4 a);
 ccl_device_inline float4 safe_divide_float4_float(const float4 a, const float 
b);
 
 #ifdef __KERNEL_SSE__
@@ -296,11 +296,6 @@ ccl_device_inline float4 reduce_add(const float4 )
 #  endif
 }
 
-ccl_device_inline float average(const float4 )
-{
-  return reduce_add(a).x * 0.25f;
-}
-
 ccl_device_inline float len(const float4 )
 {
   return sqrtf(dot(a, a));
@@ -365,6 +360,11 @@ ccl_device_inline float4 floor(const float4 )
 
 #endif /* !__KERNEL_OPENCL__*/
 
+ccl_device_inline float average_float4(const float4 a)
+{
+  return (a.x + a.y + a.z + a.w) * 0.25f;
+}
+
 ccl_device_inline float4 safe_divide_float4_float(const float4 a, const float 
b)
 {
   return make_float4((b != 0.0f) ? a.x / b : 0.0f,

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


[Bf-blender-cvs] [fec8263c2b6] soc-2019-cycles-procedural: Refactor svm_math. Early return inside switch case.

2019-08-01 Thread OmarSquircleArt
Commit: fec8263c2b6f5022d7d9ab913310f92c6be1ec2e
Author: OmarSquircleArt
Date:   Thu Aug 1 12:02:32 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rBfec8263c2b6f5022d7d9ab913310f92c6be1ec2e

Refactor svm_math. Early return inside switch case.

===

M   intern/cycles/kernel/svm/svm_math_util.h

===

diff --git a/intern/cycles/kernel/svm/svm_math_util.h 
b/intern/cycles/kernel/svm/svm_math_util.h
index 9e8c1a7178e..3405adbae16 100644
--- a/intern/cycles/kernel/svm/svm_math_util.h
+++ b/intern/cycles/kernel/svm/svm_math_util.h
@@ -104,84 +104,58 @@ ccl_device void svm_vector_math(
 
 ccl_device float svm_math(NodeMathType type, float a, float b)
 {
-  float result;
   switch (type) {
 case NODE_MATH_ADD:
-  result = a + b;
-  break;
+  return a + b;
 case NODE_MATH_SUBTRACT:
-  result = a - b;
-  break;
+  return a - b;
 case NODE_MATH_MULTIPLY:
-  result = a * b;
-  break;
+  return a * b;
 case NODE_MATH_DIVIDE:
-  result = safe_divide(a, b);
-  break;
+  return safe_divide(a, b);
 case NODE_MATH_POWER:
-  result = safe_powf(a, b);
-  break;
+  return safe_powf(a, b);
 case NODE_MATH_LOGARITHM:
-  result = safe_logf(a, b);
-  break;
+  return safe_logf(a, b);
 case NODE_MATH_SQRT:
-  result = safe_sqrtf(a);
-  break;
+  return safe_sqrtf(a);
 case NODE_MATH_ABSOLUTE:
-  result = fabsf(a);
-  break;
+  return fabsf(a);
 case NODE_MATH_MINIMUM:
-  result = fminf(a, b);
-  break;
+  return fminf(a, b);
 case NODE_MATH_MAXIMUM:
-  result = fmaxf(a, b);
-  break;
+  return fmaxf(a, b);
 case NODE_MATH_LESS_THAN:
-  result = a < b;
-  break;
+  return a < b;
 case NODE_MATH_GREATER_THAN:
-  result = a > b;
-  break;
+  return a > b;
 case NODE_MATH_ROUND:
-  result = floorf(a + 0.5f);
-  break;
+  return floorf(a + 0.5f);
 case NODE_MATH_FLOOR:
-  result = floorf(a);
-  break;
+  return floorf(a);
 case NODE_MATH_CEIL:
-  result = ceilf(a);
-  break;
+  return ceilf(a);
 case NODE_MATH_FRACTION:
-  result = a - floorf(a);
-  break;
+  return a - floorf(a);
 case NODE_MATH_MODULO:
-  result = safe_modulo(a, b);
-  break;
+  return safe_modulo(a, b);
 case NODE_MATH_SINE:
-  result = sinf(a);
-  break;
+  return sinf(a);
 case NODE_MATH_COSINE:
-  result = cosf(a);
-  break;
+  return cosf(a);
 case NODE_MATH_TANGENT:
-  result = tanf(a);
-  break;
+  return tanf(a);
 case NODE_MATH_ARCSINE:
-  result = safe_asinf(a);
-  break;
+  return safe_asinf(a);
 case NODE_MATH_ARCCOSINE:
-  result = safe_acosf(a);
-  break;
+  return safe_acosf(a);
 case NODE_MATH_ARCTANGENT:
-  result = atanf(a);
-  break;
+  return atanf(a);
 case NODE_MATH_ARCTAN2:
-  result = atan2f(a, b);
-  break;
+  return atan2f(a, b);
 default:
-  result = 0.0f;
+  return 0.0f;
   }
-  return result;
 }
 
 /* Calculate color in range 800..12000 using an approximation

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


[Bf-blender-cvs] [3ac88508360] soc-2019-cycles-procedural: Add missing SVM header.

2019-08-01 Thread OmarSquircleArt
Commit: 3ac88508360f39090f07dc86388661711b996758
Author: OmarSquircleArt
Date:   Thu Aug 1 11:59:10 2019 +0200
Branches: soc-2019-cycles-procedural
https://developer.blender.org/rB3ac88508360f39090f07dc86388661711b996758

Add missing SVM header.

===

M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index ca618cdd945..3fc92525821 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -223,6 +223,7 @@ set(SRC_SVM_HEADERS
   svm/svm_voxel.h
   svm/svm_wave.h
   svm/svm_white_noise.h
+  svm/svm_vertex_color.h
 )
 
 set(SRC_GEOM_HEADERS

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


[Bf-blender-cvs] [7c5838cfd66] master: Cleanup: use doxy sections for text operators

2019-08-01 Thread Campbell Barton
Commit: 7c5838cfd66a656e3ad422ddbe0f23b31dcff1e3
Author: Campbell Barton
Date:   Thu Aug 1 19:27:25 2019 +1000
Branches: master
https://developer.blender.org/rB7c5838cfd66a656e3ad422ddbe0f23b31dcff1e3

Cleanup: use doxy sections for text operators

===

M   source/blender/editors/space_text/text_ops.c

===

diff --git a/source/blender/editors/space_text/text_ops.c 
b/source/blender/editors/space_text/text_ops.c
index 8f7bd83cbf4..0c180dc150c 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -61,7 +61,9 @@
 
 static void txt_screen_clamp(SpaceText *st, ARegion *ar);
 
-/ util ***/
+/*  */
+/** \name Util
+ * \{ */
 
 /**
  * Tests if the given character represents a start of a new line or the
@@ -138,14 +140,18 @@ static char *buf_tabs_to_spaces(const char *in_buf, const 
int tab_size)
   return out_buf;
 }
 
-/ poll ***/
-
 BLI_INLINE int text_pixel_x_to_column(SpaceText *st, const int x)
 {
   /* add half the char width so mouse cursor selection is inbetween letters */
   return (x + (st->cwidth / 2)) / st->cwidth;
 }
 
+/** \} */
+
+/*  */
+/** \name Operator Poll
+ * \{ */
+
 static bool text_new_poll(bContext *UNUSED(C))
 {
   return 1;
@@ -206,7 +212,11 @@ static bool text_region_edit_poll(bContext *C)
   return 1;
 }
 
-/** updates */
+/** \} */
+
+/*  */
+/** \name Updates
+ * \{ */
 
 void text_update_line_edited(TextLine *line)
 {
@@ -230,7 +240,11 @@ void text_update_edited(Text *text)
   }
 }
 
-/*** new operator */
+/** \} */
+
+/*  */
+/** \name New Operator
+ * \{ */
 
 static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -281,7 +295,11 @@ void TEXT_OT_new(wmOperatorType *ot)
   ot->flag = OPTYPE_UNDO;
 }
 
-/*** open operator */
+/** \} */
+
+/*  */
+/** \name Open Operator
+ * \{ */
 
 static void text_open_init(bContext *C, wmOperator *op)
 {
@@ -392,7 +410,11 @@ void TEXT_OT_open(wmOperatorType *ot)
   ot->srna, "internal", 0, "Make internal", "Make text file internal after 
loading");
 }
 
-/*** reload operator */
+/** \} */
+
+/*  */
+/** \name Reload Operator
+ * \{ */
 
 static int text_reload_exec(bContext *C, wmOperator *op)
 {
@@ -443,7 +465,11 @@ void TEXT_OT_reload(wmOperatorType *ot)
   ot->poll = text_edit_poll;
 }
 
-/*** delete operator */
+/** \} */
+
+/*  */
+/** \name Delete Operator
+ * \{ */
 
 static bool text_unlink_poll(bContext *C)
 {
@@ -495,7 +521,11 @@ void TEXT_OT_unlink(wmOperatorType *ot)
   ot->flag = OPTYPE_UNDO;
 }
 
-/*** make internal operator */
+/** \} */
+
+/*  */
+/** \name Make Internal Operator
+ * \{ */
 
 static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -529,7 +559,11 @@ void TEXT_OT_make_internal(wmOperatorType *ot)
   ot->flag = OPTYPE_UNDO;
 }
 
-/*** save operator */
+/** \} */
+
+/*  */
+/** \name Save Operator
+ * \{ */
 
 static bool text_save_poll(bContext *C)
 {
@@ -614,7 +648,11 @@ void TEXT_OT_save(wmOperatorType *ot)
   ot->poll = text_save_poll;
 }
 
-/*** save as operator */
+/** \} */
+
+/*  */
+/** \name Save As Operator
+ * \{ */
 
 static int text_save_as_exec(bContext *C, wmOperator *op)
 {
@@ -690,7 +728,11 @@ void TEXT_OT_save_as(wmOperatorType *ot)
  FILE_SORT_ALPHA);  // XXX TODO, relative_path
 }
 
-/*** run script operator */
+/** \} */
+
+/*  */
+/** \name Run Script Operator
+ * \{ */
 
 static bool text_run_script_poll(bContext *C)
 {
@@ -765,7 +807,11 @@ void TEXT_OT_run_script(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-/*** refresh pyconstraints operator */
+/** \} */
+
+/* 

[Bf-blender-cvs] [765ed6ffb9d] master: Fix T68036: VSE: 'Remove Gaps' causes audio to go out of sync

2019-08-01 Thread Philipp Oeser
Commit: 765ed6ffb9dd9837aec063226bdfa06d07a1b624
Author: Philipp Oeser
Date:   Thu Aug 1 10:19:19 2019 +0200
Branches: master
https://developer.blender.org/rB765ed6ffb9dd9837aec063226bdfa06d07a1b624

Fix T68036: VSE: 'Remove Gaps' causes audio to go out of sync

Reviewers: sergey

Maniphest Tasks: T68036

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

===

M   source/blender/editors/space_sequencer/sequencer_edit.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index 611b233eed0..2cdadfbd2ab 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1135,6 +1135,7 @@ static int sequencer_gap_remove_exec(bContext *C, 
wmOperator *op)
   }
 
   WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+  DEG_id_tag_update(>id, ID_RECALC_SEQUENCER_STRIPS);
 
   return OPERATOR_FINISHED;
 }

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


[Bf-blender-cvs] [3cc60bbbc14] soc-2019-npr: LANPR: Fix GPU texture init errors.

2019-08-01 Thread YimingWu
Commit: 3cc60bbbc14612b1d63c8f00a006efb4d059f8ff
Author: YimingWu
Date:   Thu Aug 1 17:21:44 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB3cc60bbbc14612b1d63c8f00a006efb4d059f8ff

LANPR: Fix GPU texture init errors.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index 96b0b90bf08..cc10c060694 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -59,15 +59,6 @@ static void lanpr_engine_init(void *ved)
   }
 
 #if 0 /* Deprecated: snake mode */
-  DRW_texture_ensure_fullscreen_2D_multisample(>depth, 
GPU_DEPTH_COMPONENT32F, 8, 0);
-  DRW_texture_ensure_fullscreen_2D_multisample(>color, GPU_RGBA32F, 8, 0);
-  DRW_texture_ensure_fullscreen_2D_multisample(>normal, GPU_RGBA32F, 8, 
0);
-  DRW_texture_ensure_fullscreen_2D_multisample(>edge_intermediate, 
GPU_RGBA32F, 8, 0);
-
-  GPU_framebuffer_ensure_config(>edge_intermediate,
-{GPU_ATTACHMENT_TEXTURE(txl->depth),
- 
GPU_ATTACHMENT_TEXTURE(txl->edge_intermediate)});
-
   GPU_framebuffer_ensure_config(>edge_thinning,
 {GPU_ATTACHMENT_LEAVE,
  GPU_ATTACHMENT_TEXTURE(txl->color)});
@@ -89,6 +80,11 @@ static void lanpr_engine_init(void *ved)
   }
 #endif
 
+  DRW_texture_ensure_fullscreen_2D_multisample(>depth, 
GPU_DEPTH_COMPONENT32F, 8, 0);
+  DRW_texture_ensure_fullscreen_2D_multisample(>color, GPU_RGBA32F, 8, 0);
+  DRW_texture_ensure_fullscreen_2D_multisample(>normal, GPU_RGBA32F, 8, 
0);
+  DRW_texture_ensure_fullscreen_2D_multisample(>edge_intermediate, 
GPU_RGBA32F, 8, 0);
+
   DRW_texture_ensure_fullscreen_2D_multisample(
   >ms_resolve_depth, GPU_DEPTH_COMPONENT32F, 8, 0);
   DRW_texture_ensure_fullscreen_2D_multisample(>ms_resolve_color, 
GPU_RGBA32F, 8, 0);
@@ -98,6 +94,10 @@ static void lanpr_engine_init(void *ved)
  GPU_ATTACHMENT_TEXTURE(txl->color),
  GPU_ATTACHMENT_TEXTURE(txl->normal)});
 
+  GPU_framebuffer_ensure_config(>edge_intermediate,
+{GPU_ATTACHMENT_TEXTURE(txl->depth),
+ 
GPU_ATTACHMENT_TEXTURE(txl->edge_intermediate)});
+
   if (!lanpr_share.multichannel_shader) {
 lanpr_share.multichannel_shader = DRW_shader_create(
 datatoc_gpu_shader_3D_smooth_color_vert_glsl,

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


[Bf-blender-cvs] [eb0902243e2] master: Linux: resolve issue compiling on mint 18.3

2019-08-01 Thread Campbell Barton
Commit: eb0902243e2cfe30e5ea302658dcb8ddf5fb1504
Author: Campbell Barton
Date:   Thu Aug 1 19:14:48 2019 +1000
Branches: master
https://developer.blender.org/rBeb0902243e2cfe30e5ea302658dcb8ddf5fb1504

Linux: resolve issue compiling on mint 18.3

size_t wasn't declared. While this could be resolved differently,
convention is to include BKE after BLI.

===

M   source/blender/depsgraph/intern/eval/deg_eval_flush.cc

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index b03da157e7c..2479373b687 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -29,15 +29,15 @@
 #include 
 #include 
 
-#include "BKE_object.h"
-#include "BKE_scene.h"
-
 #include "BLI_utildefines.h"
 #include "BLI_listbase.h"
 #include "BLI_math_vector.h"
 #include "BLI_task.h"
 #include "BLI_ghash.h"
 
+#include "BKE_object.h"
+#include "BKE_scene.h"
+
 extern "C" {
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"

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


[Bf-blender-cvs] [c6587efffef] soc-2019-npr: LANPR: Fix shader assert error in deprecated NormalMatrix.

2019-08-01 Thread YimingWu
Commit: c6587efffef649439cbdbc3e56feb89d3c94db86
Author: YimingWu
Date:   Thu Aug 1 17:16:03 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBc6587efffef649439cbdbc3e56feb89d3c94db86

LANPR: Fix shader assert error in deprecated NormalMatrix.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index fc2cb8205b2..96b0b90bf08 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -28,6 +28,8 @@
 #include 
 
 extern char datatoc_common_fullscreen_vert_glsl[];
+extern char datatoc_gpu_shader_3D_smooth_color_vert_glsl[];
+extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
 extern char datatoc_lanpr_snake_multichannel_frag_glsl[];
 extern char datatoc_lanpr_snake_edge_frag_glsl[];
 extern char datatoc_lanpr_snake_image_peel_frag_glsl[];
@@ -62,15 +64,6 @@ static void lanpr_engine_init(void *ved)
   DRW_texture_ensure_fullscreen_2D_multisample(>normal, GPU_RGBA32F, 8, 
0);
   DRW_texture_ensure_fullscreen_2D_multisample(>edge_intermediate, 
GPU_RGBA32F, 8, 0);
 
-  DRW_texture_ensure_fullscreen_2D_multisample(
-  >ms_resolve_depth, GPU_DEPTH_COMPONENT32F, 8, 0);
-  DRW_texture_ensure_fullscreen_2D_multisample(>ms_resolve_color, 
GPU_RGBA32F, 8, 0);
-
-  GPU_framebuffer_ensure_config(>passes,
-{GPU_ATTACHMENT_TEXTURE(txl->depth),
- GPU_ATTACHMENT_TEXTURE(txl->color),
- GPU_ATTACHMENT_TEXTURE(txl->normal)});
-
   GPU_framebuffer_ensure_config(>edge_intermediate,
 {GPU_ATTACHMENT_TEXTURE(txl->depth),
  
GPU_ATTACHMENT_TEXTURE(txl->edge_intermediate)});
@@ -79,13 +72,6 @@ static void lanpr_engine_init(void *ved)
 {GPU_ATTACHMENT_LEAVE,
  GPU_ATTACHMENT_TEXTURE(txl->color)});
 
-  if (!lanpr_share.multichannel_shader) {
-lanpr_share.multichannel_shader = DRW_shader_create(
-datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
-NULL,
-datatoc_lanpr_snake_multichannel_frag_glsl,
-NULL);
-  }
   if (!lanpr_share.edge_detect_shader) {
 lanpr_share.edge_detect_shader = DRW_shader_create(
 datatoc_common_fullscreen_vert_glsl, NULL, 
datatoc_lanpr_snake_edge_frag_glsl, NULL);
@@ -103,6 +89,23 @@ static void lanpr_engine_init(void *ved)
   }
 #endif
 
+  DRW_texture_ensure_fullscreen_2D_multisample(
+  >ms_resolve_depth, GPU_DEPTH_COMPONENT32F, 8, 0);
+  DRW_texture_ensure_fullscreen_2D_multisample(>ms_resolve_color, 
GPU_RGBA32F, 8, 0);
+
+  GPU_framebuffer_ensure_config(>passes,
+{GPU_ATTACHMENT_TEXTURE(txl->depth),
+ GPU_ATTACHMENT_TEXTURE(txl->color),
+ GPU_ATTACHMENT_TEXTURE(txl->normal)});
+
+  if (!lanpr_share.multichannel_shader) {
+lanpr_share.multichannel_shader = DRW_shader_create(
+datatoc_gpu_shader_3D_smooth_color_vert_glsl,
+NULL,
+datatoc_gpu_shader_3D_smooth_color_frag_glsl,
+NULL);
+  }
+
   /* DPIX */
   lanpr_init_atlas_inputs(ved);

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


[Bf-blender-cvs] [cb7e9d79780] soc-2019-npr: LANPR: Remove image filter shader inits.

2019-08-01 Thread YimingWu
Commit: cb7e9d797806072804f17988c6db11c993bc6c8d
Author: YimingWu
Date:   Thu Aug 1 16:45:18 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBcb7e9d797806072804f17988c6db11c993bc6c8d

LANPR: Remove image filter shader inits.

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index ab410c14d7b..fc2cb8205b2 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -28,7 +28,6 @@
 #include 
 
 extern char datatoc_common_fullscreen_vert_glsl[];
-extern char datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl[];
 extern char datatoc_lanpr_snake_multichannel_frag_glsl[];
 extern char datatoc_lanpr_snake_edge_frag_glsl[];
 extern char datatoc_lanpr_snake_image_peel_frag_glsl[];
@@ -57,8 +56,7 @@ static void lanpr_engine_init(void *ved)
 BLI_spin_init(_share.render_flag_lock);
   }
 
-  /* SNAKE */
-
+#if 0 /* Deprecated: snake mode */
   DRW_texture_ensure_fullscreen_2D_multisample(>depth, 
GPU_DEPTH_COMPONENT32F, 8, 0);
   DRW_texture_ensure_fullscreen_2D_multisample(>color, GPU_RGBA32F, 8, 0);
   DRW_texture_ensure_fullscreen_2D_multisample(>normal, GPU_RGBA32F, 8, 
0);
@@ -103,6 +101,7 @@ static void lanpr_engine_init(void *ved)
 datatoc_lanpr_snake_line_connection_frag_glsl,
 NULL);
   }
+#endif
 
   /* DPIX */
   lanpr_init_atlas_inputs(ved);

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


[Bf-blender-cvs] [b5b0804c5a3] master: Cleanup: use _ex suffix instead of _ext

2019-08-01 Thread Campbell Barton
Commit: b5b0804c5a3bc20e39bddeb052f5f671c8dbc497
Author: Campbell Barton
Date:   Thu Aug 1 18:34:52 2019 +1000
Branches: master
https://developer.blender.org/rBb5b0804c5a3bc20e39bddeb052f5f671c8dbc497

Cleanup: use _ex suffix instead of _ext

Convention is to use ex, not ext for extended
versions of a functions.

===

M   source/blender/python/intern/bpy_interface_atexit.c
M   source/blender/python/mathutils/mathutils_Vector.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_init_exit.c
M   source/creator/creator.c

===

diff --git a/source/blender/python/intern/bpy_interface_atexit.c 
b/source/blender/python/intern/bpy_interface_atexit.c
index 1c48dc1baae..4a43d4e6853 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -36,7 +36,7 @@ static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject 
*UNUSED(args), PyOb
   /* close down enough of blender at least not to crash */
   struct bContext *C = BPy_GetContext();
 
-  WM_exit_ext(C, 0);
+  WM_exit_ex(C, false);
 
   Py_RETURN_NONE;
 }
diff --git a/source/blender/python/mathutils/mathutils_Vector.c 
b/source/blender/python/mathutils/mathutils_Vector.c
index 2c9a25d24bc..1f17d1eebf2 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -47,7 +47,7 @@
 
 static PyObject *Vector_copy(VectorObject *self);
 static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args);
-static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits);
+static PyObject *Vector_to_tuple_ex(VectorObject *self, int ndigits);
 static int row_vector_multiplication(float rvec[MAX_DIMENSIONS],
  VectorObject *vec,
  MatrixObject *mat);
@@ -630,7 +630,7 @@ PyDoc_STRVAR(Vector_to_tuple_doc,
  "   :return: the values of the vector rounded by *precision*\n"
  "   :rtype: tuple\n");
 /* note: BaseMath_ReadCallback must be called beforehand */
-static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
+static PyObject *Vector_to_tuple_ex(VectorObject *self, int ndigits)
 {
   PyObject *ret;
   int i;
@@ -674,7 +674,7 @@ static PyObject *Vector_to_tuple(VectorObject *self, 
PyObject *args)
 return NULL;
   }
 
-  return Vector_to_tuple_ext(self, ndigits);
+  return Vector_to_tuple_ex(self, ndigits);
 }
 
 PyDoc_STRVAR(Vector_to_track_quat_doc,
@@ -1338,7 +1338,7 @@ static PyObject *Vector_repr(VectorObject *self)
 return NULL;
   }
 
-  tuple = Vector_to_tuple_ext(self, -1);
+  tuple = Vector_to_tuple_ex(self, -1);
   ret = PyUnicode_FromFormat("Vector(%R)", tuple);
   Py_DECREF(tuple);
   return ret;
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 9722f98d535..5d6e405dd5d 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -93,7 +93,7 @@ void WM_init_native_pixels(bool do_it);
 void WM_init_tablet_api(void);
 
 void WM_init(struct bContext *C, int argc, const char **argv);
-void WM_exit_ext(struct bContext *C, const bool do_python);
+void WM_exit_ex(struct bContext *C, const bool do_python);
 
 void WM_exit(struct bContext *C) ATTR_NORETURN;
 
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c 
b/source/blender/windowmanager/intern/wm_init_exit.c
index 763bdbb9cf0..29cb02888ac 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -467,7 +467,7 @@ void wm_exit_schedule_delayed(const bContext *C)
 /**
  * \note doesn't run exit() call #WM_exit() for that.
  */
-void WM_exit_ext(bContext *C, const bool do_python)
+void WM_exit_ex(bContext *C, const bool do_python)
 {
   wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
 
@@ -666,7 +666,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
  */
 void WM_exit(bContext *C)
 {
-  WM_exit_ext(C, 1);
+  WM_exit_ex(C, true);
 
   printf("\nBlender quit\n");
 
diff --git a/source/creator/creator.c b/source/creator/creator.c
index afcde70670a..d6e1d7e7f5f 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -496,7 +496,7 @@ int main(int argc,
 #ifdef WITH_PYTHON_MODULE
 void main_python_exit(void)
 {
-  WM_exit_ext((bContext *)evil_C, true);
+  WM_exit_ex((bContext *)evil_C, true);
   evil_C = NULL;
 }
 #endif

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


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

2019-08-01 Thread Sybren A. Stüvel
Commit: 5fe840fb6ff9700bc219b95f50f803ddc1ffc002
Author: Sybren A. Stüvel
Date:   Thu Aug 1 10:21:39 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB5fe840fb6ff9700bc219b95f50f803ddc1ffc002

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] [2787c369564] soc-2019-npr: Cleanup: lanpr_chain_draw.c

2019-08-01 Thread YimingWu
Commit: 2787c3695646d04cb8ca65af6cbf05fd33676c99
Author: YimingWu
Date:   Thu Aug 1 16:27:49 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB2787c3695646d04cb8ca65af6cbf05fd33676c99

Cleanup: lanpr_chain_draw.c

===

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

===

diff --git a/source/blender/draw/engines/lanpr/lanpr_all.h 
b/source/blender/draw/engines/lanpr/lanpr_all.h
index e7c8034dca2..426c3449332 100644
--- a/source/blender/draw/engines/lanpr/lanpr_all.h
+++ b/source/blender/draw/engines/lanpr/lanpr_all.h
@@ -255,4 +255,6 @@ void lanpr_software_draw_scene(void *vedata, GPUFrameBuffer 
*dfb, int is_render)
 
 int lanpr_dpix_texture_size(SceneLANPR *lanpr);
 
+void lanpr_chain_generate_draw_command(struct LANPR_RenderBuffer *rb);
+
 #endif
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index 4e2b57fa831..3d252e4e56a 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -54,8 +54,6 @@
 extern LANPR_SharedResource lanpr_share;
 extern const char *RE_engine_id_BLENDER_LANPR;
 
-void lanpr_chain_generate_draw_command(LANPR_RenderBuffer *rb);
-
 static void lanpr_rebuild_render_draw_command(LANPR_RenderBuffer *rb, 
LANPR_LineLayer *ll)
 {
   int Count = 0;

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


[Bf-blender-cvs] [6df67f026cd] soc-2019-npr: LANPR: Remove edge detection mode file from compiling.

2019-08-01 Thread YimingWu
Commit: 6df67f026cdfe32cc7f9556fc2e9978f4b5fc51a
Author: YimingWu
Date:   Thu Aug 1 16:23:48 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB6df67f026cdfe32cc7f9556fc2e9978f4b5fc51a

LANPR: Remove edge detection mode file from compiling.

===

M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/lanpr/lanpr_engine.c

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 6e508684210..1c325723963 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -128,7 +128,7 @@ set(SRC
   engines/gpencil/gpencil_shader_fx.c
engines/lanpr/lanpr_dpix.c
engines/lanpr/lanpr_engine.c
-   engines/lanpr/lanpr_snake.c
+   # engines/lanpr/lanpr_snake.c  deprecated for now.
engines/lanpr/lanpr_cpu.c
   engines/lanpr/lanpr_chain_draw.c
   engines/select/select_engine.c
diff --git a/source/blender/draw/engines/lanpr/lanpr_engine.c 
b/source/blender/draw/engines/lanpr/lanpr_engine.c
index c4ce65f87c2..ab410c14d7b 100644
--- a/source/blender/draw/engines/lanpr/lanpr_engine.c
+++ b/source/blender/draw/engines/lanpr/lanpr_engine.c
@@ -559,10 +559,12 @@ static void lanpr_draw_scene_exec(void *vedata, 
GPUFrameBuffer *dfb, int is_rend
 DRW_draw_pass(psl->color_pass);
 lanpr_dpix_draw_scene(txl, fbl, psl, stl->g_data, lanpr, dfb, is_render);
   }
+  /* Deprecated
   else if (lanpr->master_mode == LANPR_MASTER_MODE_SNAKE) {
 DRW_draw_pass(psl->color_pass);
 lanpr_snake_draw_scene(txl, fbl, psl, stl->g_data, lanpr, dfb, is_render);
   }
+  */
   else if (lanpr->master_mode == LANPR_MASTER_MODE_SOFTWARE) {
 /*  should isolate these into a seperate function. */
 lanpr_software_draw_scene(vedata, dfb, is_render);

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


[Bf-blender-cvs] [93ab22f3088] soc-2019-npr: Cleanup: Fix warnings in lanpr_util.c.

2019-08-01 Thread YimingWu
Commit: 93ab22f308808cc5e07d84034ba73286ced80bba
Author: YimingWu
Date:   Thu Aug 1 16:20:24 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB93ab22f308808cc5e07d84034ba73286ced80bba

Cleanup: Fix warnings in lanpr_util.c.

===

M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/editors/lanpr/lanpr_util.c

===

diff --git a/source/blender/editors/include/ED_lanpr.h 
b/source/blender/editors/include/ED_lanpr.h
index ae4ed133ceb..24cd32578da 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -752,6 +752,7 @@ real tmat_dist_2dv(tnsVector2d l, tnsVector2d r);
 
 real tmat_length_3d(tnsVector3d l);
 real tmat_length_2d(tnsVector3d l);
+void tmat_normalize_2d(tnsVector2d result, tnsVector2d l);
 void tmat_normalize_3d(tnsVector3d result, tnsVector3d l);
 void tmat_normalize_3f(tnsVector3f result, tnsVector3f l);
 void tmat_normalize_self_3d(tnsVector3d result);
@@ -759,6 +760,7 @@ real tmat_dot_3d(tnsVector3d l, tnsVector3d r, int 
normalize);
 real tmat_dot_3df(tnsVector3d l, tnsVector3f r, int normalize);
 real tmat_dot_2d(tnsVector2d l, tnsVector2d r, int normalize);
 real tmat_vector_cross_3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
+void tmat_vector_cross_only_3d(tnsVector3d result, tnsVector3d l, tnsVector3d 
r);
 real tmat_angle_rad_3d(tnsVector3d from, tnsVector3d to, tnsVector3d 
PositiveReference);
 void tmat_apply_rotation_33d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d 
v);
 void tmat_apply_rotation_43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d 
v);
diff --git a/source/blender/editors/lanpr/lanpr_cpu.c 
b/source/blender/editors/lanpr/lanpr_cpu.c
index 2e953310c71..13ba79d3364 100644
--- a/source/blender/editors/lanpr/lanpr_cpu.c
+++ b/source/blender/editors/lanpr/lanpr_cpu.c
@@ -1695,7 +1695,7 @@ static void lanpr_make_render_geometry_buffers_object(
   tMatVectorAccum3d(rt->gc, rt->v[2]->fbcoord);
   tMatVectorMultiSelf3d(rt->gc, 1.0f / 3.0f);
   tmat_apply_normal_transform_43df(rt->gn, Normal, f->no);
-  tmat_normalize_self_3d(rt->gn);
+  normalize_v3_d(rt->gn);
   lanpr_assign_render_line_with_triangle(rt);
   /*  m = tnsGetIndexedMaterial(rb->scene, f->material_id); */
   /*  if(m) m->Previewv_count += (f->triangle_count*3); */
diff --git a/source/blender/editors/lanpr/lanpr_util.c 
b/source/blender/editors/lanpr/lanpr_util.c
index 0266afcc30c..be126681670 100644
--- a/source/blender/editors/lanpr/lanpr_util.c
+++ b/source/blender/editors/lanpr/lanpr_util.c
@@ -578,14 +578,12 @@ void tmat_apply_transform_43d(tnsVector3d result, 
tnsMatrix44d mat, tnsVector3d
 }
 void tmat_apply_normal_transform_43d(tnsVector3d result, tnsMatrix44d mat, 
tnsVector3d v)
 {
-  real w;
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
 }
 void tmat_apply_normal_transform_43df(tnsVector3d result, tnsMatrix44d mat, 
tnsVector3f v)
 {
-  real w;
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
@@ -599,7 +597,6 @@ void tmat_apply_transform_44d(tnsVector4d result, 
tnsMatrix44d mat, tnsVector4d
 }
 void tmat_apply_transform_43dfND(tnsVector4d result, tnsMatrix44d mat, 
tnsVector3f v)
 {
-  real w;
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
@@ -610,7 +607,7 @@ void tmat_apply_transform_43df(tnsVector4d result, 
tnsMatrix44d mat, tnsVector3f
   result[0] = mat[0] * v[0] + mat[4] * v[1] + mat[8] * v[2] + mat[12] * 1;
   result[1] = mat[1] * v[0] + mat[5] * v[1] + mat[9] * v[2] + mat[13] * 1;
   result[2] = mat[2] * v[0] + mat[6] * v[1] + mat[10] * v[2] + mat[14] * 1;
-  real w = mat[3] * v[0] + mat[7] * v[1] + mat[11] * v[2] + mat[15] * 1;
+  /* real w = mat[3] * v[0] + mat[7] * v[1] + mat[11] * v[2] + mat[15] * 1; */
   /*  result[0] /= w; */
   /*  result[1] /= w; */
   /*  result[2] /= w; */
@@ -643,59 +640,10 @@ void tmat_clear_translation_44d(tnsMatrix44d mat)
   mat[11] = 0;
 }
 
-void tmat_extract_xyz_euler_44d(tnsMatrix44d mat, real *x_result, real 
*y_result, real *z_result)
-{
-  real xRot, yRot, zRot;
-
-  if (mat[2] < 1) {
-if (mat[2] > -1) {
-  yRot = asin(mat[2]);
-  xRot = atan2(-mat[6], mat[10]);
-  zRot = atan2(-mat[1], mat[0]);
-}
-else {
-  yRot = -M_PI / 2;
-  xRot = -atan2(-mat[4], mat[5]);
-  zRot = 0;
-}
-  

[Bf-blender-cvs] [214978376e6] soc-2019-npr: Cleanup: Fixed many warnings.

2019-08-01 Thread YimingWu
Commit: 214978376e6d08b03c0f220aa03d4435a41c46e1
Author: YimingWu
Date:   Thu Aug 1 16:08:26 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB214978376e6d08b03c0f220aa03d4435a41c46e1

Cleanup: Fixed many warnings.

===

M   source/blender/draw/engines/lanpr/lanpr_chain_draw.c
M   source/blender/draw/engines/lanpr/lanpr_cpu.c
M   source/blender/draw/engines/lanpr/lanpr_dpix.c
M   source/blender/draw/engines/lanpr/lanpr_engine.c
M   source/blender/draw/modes/object_mode.c
M   source/blender/editors/include/ED_lanpr.h
M   source/blender/editors/lanpr/lanpr_chain.c
M   source/blender/editors/lanpr/lanpr_cpu.c
M   source/blender/editors/lanpr/lanpr_ops.c
M   source/blender/editors/lanpr/lanpr_util.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_chain_draw.c 
b/source/blender/draw/engines/lanpr/lanpr_chain_draw.c
index 370ff9cfdda..e0f6876a790 100644
--- a/source/blender/draw/engines/lanpr/lanpr_chain_draw.c
+++ b/source/blender/draw/engines/lanpr/lanpr_chain_draw.c
@@ -26,7 +26,7 @@
 
 #include 
 
-static float lanpr_compute_chain_length_draw(LANPR_RenderLineChain *rlc, float 
*lengths, int begin_index)
+static float ED_lanpr_compute_chain_length_draw(LANPR_RenderLineChain *rlc, 
float *lengths, int begin_index)
 {
   LANPR_RenderLineChainItem *rlci;
   int i = 0;
@@ -104,7 +104,7 @@ void lanpr_chain_generate_draw_command(LANPR_RenderBuffer 
*rb)
 
   for (rlc = rb->chains.first; rlc; rlc = rlc->next) {
 
-total_length = lanpr_compute_chain_length_draw(rlc, lengths, i);
+total_length = ED_lanpr_compute_chain_length_draw(rlc, lengths, i);
 
 for (rlci = rlc->chain.first; rlci; rlci = rlci->next) {
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_cpu.c 
b/source/blender/draw/engines/lanpr/lanpr_cpu.c
index b8bb78c9713..4e2b57fa831 100644
--- a/source/blender/draw/engines/lanpr/lanpr_cpu.c
+++ b/source/blender/draw/engines/lanpr/lanpr_cpu.c
@@ -138,7 +138,7 @@ static void 
lanpr_rebuild_render_draw_command(LANPR_RenderBuffer *rb, LANPR_Line
   /*  later implement  */
   /* } */
 }
-void lanpr_rebuild_all_command(SceneLANPR *lanpr)
+void ED_lanpr_rebuild_all_command(SceneLANPR *lanpr)
 {
   LANPR_LineLayer *ll;
   if (!lanpr || !lanpr_share.render_buffer_shared) {
@@ -160,59 +160,7 @@ void lanpr_rebuild_all_command(SceneLANPR *lanpr)
   DEG_id_tag_update(_share.render_buffer_shared->scene->id, 
ID_RECALC_COPY_ON_WRITE);
 }
 
-void lanpr_viewport_draw_offline_result(LANPR_TextureList *txl,
-LANPR_FramebufferList *fbl,
-LANPR_PassList *psl,
-LANPR_PrivateData *pd,
-SceneLANPR *lanpr)
-{
-  float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-  float clear_depth = 1.0f;
-  uint clear_stencil = 0xFF;
-  float use_background_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
-
-  DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
-  DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
-
-  int texw = GPU_texture_width(dtxl->color), texh = 
GPU_texture_height(dtxl->color);
-  int tsize = texw * texh;
-
-  const DRWContextState *draw_ctx = DRW_context_state_get();
-  Scene *scene = DEG_get_evaluated_scene(draw_ctx->depsgraph);
-  View3D *v3d = draw_ctx->v3d;
-  Object *camera;
-  if (v3d) {
-RegionView3D *rv3d = draw_ctx->rv3d;
-camera = (rv3d->persp == RV3D_CAMOB) ? v3d->camera : NULL;
-  }
-  else {
-camera = scene->camera;
-  }
-
-  if (lanpr->use_world_background) {
-copy_v3_v3(use_background_color, >world->horr);
-use_background_color[3] = 1;
-  }
-  else {
-copy_v4_v4(use_background_color, lanpr->background_color);
-  }
-
-  GPU_framebuffer_bind(fbl->dpix_transform);
-  DRW_draw_pass(psl->dpix_transform_pass);
-
-  GPU_framebuffer_bind(fbl->dpix_preview);
-  eGPUFrameBufferBits clear_bits = GPU_COLOR_BIT;
-  GPU_framebuffer_clear(
-  fbl->dpix_preview, clear_bits, use_background_color, clear_depth, 
clear_stencil);
-  DRW_draw_pass(psl->dpix_preview_pass);
-
-  GPU_framebuffer_bind(dfbl->default_fb);
-  GPU_framebuffer_clear(
-  dfbl->default_fb, clear_bits, use_background_color, clear_depth, 
clear_stencil);
-  DRW_multisamples_resolve(txl->depth, txl->color, 1);
-}
-
-void lanpr_calculate_normal_object_vector(LANPR_LineLayer *ll, float 
*normal_object_direction)
+void ED_lanpr_calculate_normal_object_vector(LANPR_LineLayer *ll, float 
*normal_object_direction)
 {
   Object *ob;
   switch (ll->normal_mode) {
@@ -265,10 +213,9 @@ void lanpr_software_draw_scene(void *vedata, 
GPUFrameBuffer *dfb, int is_render)
   static float camdx, camdy, camzoom;
 
   if (is_render) {
-

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

2019-08-01 Thread Jacques Lucke
Commit: fe5356bf2595cb272f08ab1715071dc90db8f572
Author: Jacques Lucke
Date:   Thu Aug 1 09:52:03 2019 +0200
Branches: functions
https://developer.blender.org/rBfe5356bf2595cb272f08ab1715071dc90db8f572

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] [502c2c233d1] master: Cleanup: misc spelling fixes in variable names & defines

2019-08-01 Thread Campbell Barton
Commit: 502c2c233d1741a5288f0d4a52df9173d850348c
Author: Campbell Barton
Date:   Thu Aug 1 17:32:42 2019 +1000
Branches: master
https://developer.blender.org/rB502c2c233d1741a5288f0d4a52df9173d850348c

Cleanup: misc spelling fixes in variable names & defines

T68045 by @luzpaz

===

M   source/blender/blenkernel/intern/softbody.c
M   source/blender/editors/include/ED_view3d.h
M   source/blender/gpu/intern/gpu_codegen.c
M   source/blender/gpu/intern/gpu_material.c
M   source/blender/imbuf/IMB_imbuf.h
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c

===

diff --git a/source/blender/blenkernel/intern/softbody.c 
b/source/blender/blenkernel/intern/softbody.c
index d46ef0e452a..2024a507ebb 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -258,7 +258,7 @@ static float _final_mass(Object *ob, BodyPoint *bp)
 /* just an ID here to reduce the prob for killing objects
  * ob->sumohandle points to we should not kill :)
  */
-static const int CCD_SAVETY = 190561;
+static const int CCD_SAFETY = 190561;
 
 typedef struct ccdf_minmax {
   float minx, miny, minz, maxx, maxy, maxz;
@@ -269,7 +269,7 @@ typedef struct ccd_Mesh {
   const MVert *mvert;
   const MVert *mprevvert;
   const MVertTri *tri;
-  int savety;
+  int safety;
   ccdf_minmax *mima;
   /* Axis Aligned Bounding Box AABB */
   float bbmin[3];
@@ -298,7 +298,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
   pccd_M = MEM_mallocN(sizeof(ccd_Mesh), "ccd_Mesh");
   pccd_M->mvert_num = cmd->mvert_num;
   pccd_M->tri_num = cmd->tri_num;
-  pccd_M->savety = CCD_SAVETY;
+  pccd_M->safety = CCD_SAFETY;
   pccd_M->bbmin[0] = pccd_M->bbmin[1] = pccd_M->bbmin[2] = 1e30f;
   pccd_M->bbmax[0] = pccd_M->bbmax[1] = pccd_M->bbmax[2] = -1e30f;
   pccd_M->mprevvert = NULL;
@@ -486,7 +486,8 @@ static void ccd_mesh_update(Object *ob, ccd_Mesh *pccd_M)
 
 static void ccd_mesh_free(ccd_Mesh *ccdm)
 {
-  if (ccdm && (ccdm->savety == CCD_SAVETY)) { /*make sure we're not nuking 
objects we don't know*/
+  /* Make sure we're not nuking objects we don't know. */
+  if (ccdm && (ccdm->safety == CCD_SAFETY)) {
 MEM_freeN((void *)ccdm->mvert);
 MEM_freeN((void *)ccdm->tri);
 if (ccdm->mprevvert) {
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 14e18c8bec5..081bcbf4746 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -568,7 +568,7 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
   bool do_sky,
   bool is_persp,
   const char *viewname,
-  const bool do_color_managment,
+  const bool do_color_management,
   struct GPUOffScreen *ofs,
   struct GPUViewport *viewport);
 void ED_view3d_draw_setup_view(struct wmWindow *win,
diff --git a/source/blender/gpu/intern/gpu_codegen.c 
b/source/blender/gpu/intern/gpu_codegen.c
index 0c751808489..51b73c93c86 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -2138,7 +2138,7 @@ static bool gpu_pass_shader_validate(GPUPass *pass, 
GPUShader *shader)
 
 bool GPU_pass_compile(GPUPass *pass, const char *shname)
 {
-  bool sucess = true;
+  bool success = true;
   if (!pass->compiled) {
 GPUShader *shader = GPU_shader_create(
 pass->vertexcode, pass->fragmentcode, pass->geometrycode, NULL, 
pass->defines, shname);
@@ -2146,7 +2146,7 @@ bool GPU_pass_compile(GPUPass *pass, const char *shname)
 /* NOTE: Some drivers / gpu allows more active samplers than the opengl 
limit.
  * We need to make sure to count active samplers to avoid undefined 
behavior. */
 if (!gpu_pass_shader_validate(pass, shader)) {
-  sucess = false;
+  success = false;
   if (shader != NULL) {
 fprintf(stderr, "GPUShader: error: too many samplers in shader.\n");
 GPU_shader_free(shader);
@@ -2169,7 +2169,7 @@ bool GPU_pass_compile(GPUPass *pass, const char *shname)
 MEM_SAFE_FREE(pass->binary.content);
   }
 
-  return sucess;
+  return success;
 }
 
 void GPU_pass_release(GPUPass *pass)
diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 6f1b8d2d0c6..20b91c0c95d 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -733,7 +733,7 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene,
 
 void GPU_material_compile(GPUMaterial *mat)
 {
-  bool sucess;
+  bool success;
 
   BLI_assert(mat->status == GPU_MAT_QUEUED);
   BLI_assert(mat->pass);
@@ -741,12 +741,12 @@ void 

  1   2   >