[Bf-blender-cvs] [8916a04df89] xr-actions-D9124: XR: Restore XR object transforms at session end

2020-11-25 Thread Peter Kim
Commit: 8916a04df8924d0af843a92cfaacafb945b563fa
Author: Peter Kim
Date:   Wed Nov 25 22:51:58 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB8916a04df8924d0af843a92cfaacafb945b563fa

XR: Restore XR object transforms at session end

If an object was constrained to a headset/controller pose during the
session, then its original transform will be restored at session end
to prevent unwanted changes to the scene. This will also occur when
toggling the constraint or changing the constrained object.

===

M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/rna_xr.c
M   source/blender/windowmanager/xr/intern/wm_xr_intern.h
M   source/blender/windowmanager/xr/intern/wm_xr_session.c

===

diff --git a/source/blender/makesrna/intern/CMakeLists.txt 
b/source/blender/makesrna/intern/CMakeLists.txt
index d638d6f66cc..16a7864c0d1 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -351,6 +351,9 @@ if(WITH_INPUT_NDOF)
 endif()
 
 if(WITH_XR_OPENXR)
+  list(APPEND INC
+../../windowmanager/xr
+  )
   add_definitions(-DWITH_XR_OPENXR)
 endif()
 
diff --git a/source/blender/makesrna/intern/rna_xr.c 
b/source/blender/makesrna/intern/rna_xr.c
index 06ba291f229..7a2b80c5402 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -41,6 +41,8 @@
 #  include "WM_api.h"
 
 #  ifdef WITH_XR_OPENXR
+#include "xr/intern/wm_xr_intern.h"
+
 static wmXrData *rna_XrSession_wm_xr_data_get(PointerRNA *ptr)
 {
   /* Callers could also get XrSessionState pointer through ptr->data, but 
prefer if we just
@@ -107,6 +109,30 @@ static void 
rna_XrSessionSettings_use_absolute_tracking_set(PointerRNA *ptr, boo
 #  endif
 }
 
+static void rna_XrSessionSettings_headset_object_set(PointerRNA *ptr,
+ PointerRNA value,
+ struct ReportList 
*UNUSED(reports))
+{
+#  ifdef WITH_XR_OPENXR
+  wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
+  Object *ob = value.data;
+  if (WM_xr_session_exists(xr)) {
+if (xr->session_settings.headset_object) {
+  /* Restore previous object's original pose. */
+  
wm_xr_session_object_pose_set(>runtime->session_state.headset_object_orig_pose,
+xr->session_settings.headset_object);
+}
+if (ob) {
+  /* Store new object's original pose. */
+  wm_xr_session_object_pose_get(ob, 
>runtime->session_state.headset_object_orig_pose);
+}
+  }
+  xr->session_settings.headset_object = ob;
+#  else
+  UNUSED_VARS(ptr, value);
+#  endif
+}
+
 static bool rna_XrSessionSettings_headset_object_enable_get(PointerRNA *ptr)
 {
 #  ifdef WITH_XR_OPENXR
@@ -128,6 +154,17 @@ static void 
rna_XrSessionSettings_headset_object_enable_set(PointerRNA *ptr, boo
   else {
 xr->session_settings.headset_flag &= (~XR_OBJECT_ENABLE);
   }
+
+  /* Store/restore object's original pose. */
+  Object *ob = xr->session_settings.headset_object;
+  if (ob && WM_xr_session_exists(xr)) {
+if (value) {
+  wm_xr_session_object_pose_get(ob, 
>runtime->session_state.headset_object_orig_pose);
+}
+else {
+  
wm_xr_session_object_pose_set(>runtime->session_state.headset_object_orig_pose,
 ob);
+}
+  }
 #  else
   UNUSED_VARS(ptr, value);
 #  endif
@@ -159,6 +196,30 @@ static void 
rna_XrSessionSettings_headset_object_autokey_set(PointerRNA *ptr, bo
 #  endif
 }
 
+static void rna_XrSessionSettings_controller0_object_set(PointerRNA *ptr,
+ PointerRNA value,
+ struct ReportList 
*UNUSED(reports))
+{
+#  ifdef WITH_XR_OPENXR
+  wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
+  Object *ob = value.data;
+  if (WM_xr_session_exists(xr)) {
+if (xr->session_settings.controller0_object) {
+  /* Restore previous object's original pose. */
+  
wm_xr_session_object_pose_set(>runtime->session_state.controller0_object_orig_pose,
+xr->session_settings.controller0_object);
+}
+if (ob) {
+  /* Store new object's original pose. */
+  wm_xr_session_object_pose_get(ob, 
>runtime->session_state.controller0_object_orig_pose);
+}
+  }
+  xr->session_settings.controller0_object = ob;
+#  else
+  UNUSED_VARS(ptr, value);
+#  endif
+}
+
 static bool rna_XrSessionSettings_controller0_object_enable_get(PointerRNA 
*ptr)
 {
 #  ifdef WITH_XR_OPENXR
@@ -180,6 +241,17 @@ static void 
rna_XrSessionSettings_controller0_object_enable_set(PointerRNA *ptr,
   else {
 xr->session_settings.controller0_flag &= (~XR_OBJECT_ENABLE);
   }
+
+  /* Store/restore object's original pose. */
+  Object *ob = 

[Bf-blender-cvs] [78563e9bf12] xr-actions-D9124: XR: Add "controller draw style" session setting

2020-11-25 Thread Peter Kim
Commit: 78563e9bf12a83d22083645a36ea61d370afaad8
Author: Peter Kim
Date:   Wed Nov 25 22:57:33 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB78563e9bf12a83d22083645a36ea61d370afaad8

XR: Add "controller draw style" session setting

Allows users to choose their preferred controller visualization
(controller local axes or -Z axis ray). The enum can be extended in
the future for additional visualizations.

===

M   source/blender/makesdna/DNA_xr_types.h
M   source/blender/makesrna/intern/rna_xr.c
M   source/blender/windowmanager/xr/intern/wm_xr_actions.c
M   source/blender/windowmanager/xr/intern/wm_xr_draw.c
M   source/blender/windowmanager/xr/intern/wm_xr_intern.h
M   source/blender/windowmanager/xr/intern/wm_xr_operators.c
M   source/blender/windowmanager/xr/intern/wm_xr_session.c

===

diff --git a/source/blender/makesdna/DNA_xr_types.h 
b/source/blender/makesdna/DNA_xr_types.h
index 49eeeabcd09..9bcd539a8b0 100644
--- a/source/blender/makesdna/DNA_xr_types.h
+++ b/source/blender/makesdna/DNA_xr_types.h
@@ -40,11 +40,12 @@ typedef struct XrSessionSettings {
 
   /** View3D draw flags (V3D_OFSDRAW_NONE, V3D_OFSDRAW_SHOW_ANNOTATION, ...). 
*/
   char draw_flags;
-
-  /** The eye (view) that will be used when projecting 3D to 2D (e.g. when 
performing GPU select).
-   */
+  /** Draw style for controller visualization. */
+  char controller_draw_style;
+  /** The eye (view) used when projecting 3D to 2D (e.g. when performing GPU 
select). */
   char selection_eye;
-  char _pad2[2];
+
+  char _pad2;
 
   /** Clipping distance. */
   float clip_start, clip_end;
@@ -74,6 +75,11 @@ typedef enum eXRSessionBasePoseType {
   XR_BASE_POSE_CUSTOM = 2,
 } eXRSessionBasePoseType;
 
+typedef enum eXrSessionControllerDrawStyle {
+  XR_CONTROLLER_DRAW_AXES = 0,
+  XR_CONTROLLER_DRAW_RAY = 1,
+} eXrSessionControllerDrawStyle;
+
 typedef enum eXrSessionEye {
   XR_EYE_LEFT = 0,
   XR_EYE_RIGHT = 1,
diff --git a/source/blender/makesrna/intern/rna_xr.c 
b/source/blender/makesrna/intern/rna_xr.c
index 7a2b80c5402..6c010f0304c 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -790,6 +790,12 @@ static void rna_def_xr_session_settings(BlenderRNA *brna)
   {0, NULL, 0, NULL, NULL},
   };
 
+  static const EnumPropertyItem controller_draw_styles[] = {
+  {XR_CONTROLLER_DRAW_AXES, "AXES", 0, "Axes", "Draw controller's local 
axes"},
+  {XR_CONTROLLER_DRAW_RAY, "RAY", 0, "Ray", "Draw a ray along controller's 
-Z axis "},
+  {0, NULL, 0, NULL, NULL},
+  };
+
   static const EnumPropertyItem selection_eyes[] = {
   {XR_EYE_LEFT, "EYE_LEFT", 0, "Left Eye", "Use the left eye's perspective 
for VR selection"},
   {XR_EYE_RIGHT,
@@ -866,6 +872,13 @@ static void rna_def_xr_session_settings(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Show Custom Overlays", "Show custom VR 
overlays");
   RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
 
+  prop = RNA_def_property(srna, "controller_draw_style", PROP_ENUM, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_enum_items(prop, controller_draw_styles);
+  RNA_def_property_ui_text(
+  prop, "Controller Draw Style", "Style to use when drawing VR 
controllers");
+  RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
+
   prop = RNA_def_property(srna, "selection_eye", PROP_ENUM, PROP_NONE);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_enum_items(prop, selection_eyes);
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_actions.c 
b/source/blender/windowmanager/xr/intern/wm_xr_actions.c
index 70d46f3faf9..12bcc845d2d 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_actions.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_actions.c
@@ -355,8 +355,7 @@ bool WM_xr_active_action_set_set(wmXrData *xr, const char 
*action_set_name)
   xr->runtime->session_state.active_action_set = action_set;
 
   if (action_set->controller_pose_action) {
-wm_xr_session_controller_data_populate(action_set->controller_pose_action,
-   >runtime->session_state);
+wm_xr_session_controller_data_populate(action_set->controller_pose_action, 
xr);
   }
 
   return true;
@@ -379,7 +378,7 @@ bool WM_xr_controller_pose_action_set(wmXrData *xr,
   action_set->controller_pose_action = action;
 
   if (action_set == xr->runtime->session_state.active_action_set) {
-wm_xr_session_controller_data_populate(action, 
>runtime->session_state);
+wm_xr_session_controller_data_populate(action, xr);
   }
 
   return true;
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c 
b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
index ef13d0ca320..14d07af0be0 100644
--- 

[Bf-blender-cvs] [c9f0da5b200] xr-actions-D9124: XR: Adjust raycast select property behavior

2020-11-25 Thread Peter Kim
Commit: c9f0da5b20035922379bcb26b1bbf058bf688f8d
Author: Peter Kim
Date:   Wed Nov 25 22:32:43 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rBc9f0da5b20035922379bcb26b1bbf058bf688f8d

XR: Adjust raycast select property behavior

Combinations of properties (extend/deselect/toggle/deselect on empty)
now match view3d.select behavior.

===

M   source/blender/windowmanager/xr/intern/wm_xr_operators.c

===

diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c 
b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
index 54aede1b01a..56a0847fcea 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
@@ -422,7 +422,7 @@ static bool wm_xr_select_raycast(bContext *C,
 }
 
 if (!hit) {
-  if (deselect_all && (select_op == SEL_OP_SET)) {
+  if (deselect_all) {
 changed = EDBM_mesh_deselect_all_multi(C);
   }
 }
@@ -461,7 +461,7 @@ static bool wm_xr_select_raycast(bContext *C,
 }
   }
   else if (vc.em) {
-if (deselect_all && (select_op == SEL_OP_SET)) {
+if (deselect_all) {
   changed = EDBM_mesh_deselect_all_multi(C);
 }
 
@@ -476,7 +476,7 @@ static bool wm_xr_select_raycast(bContext *C,
 }
 
 if (!hit) {
-  if (deselect_all && (select_op == SEL_OP_SET)) {
+  if (deselect_all) {
 changed = object_deselect_all_except(vc.view_layer, NULL);
   }
 }
@@ -564,17 +564,17 @@ static int wm_xr_select_raycast_modal_3d(bContext *C, 
wmOperator *op, const wmEv
 prop = RNA_struct_find_property(op->ptr, "distance");
 ray_dist = prop ? RNA_property_float_get(op->ptr, prop) : 
BVH_RAYCAST_DIST_MAX;
 
-prop = RNA_struct_find_property(op->ptr, "extend");
+prop = RNA_struct_find_property(op->ptr, "toggle");
 if (prop && RNA_property_boolean_get(op->ptr, prop)) {
-  select_op = SEL_OP_ADD;
+  select_op = SEL_OP_XOR;
 }
 prop = RNA_struct_find_property(op->ptr, "deselect");
 if (prop && RNA_property_boolean_get(op->ptr, prop)) {
   select_op = SEL_OP_SUB;
 }
-prop = RNA_struct_find_property(op->ptr, "toggle");
+prop = RNA_struct_find_property(op->ptr, "extend");
 if (prop && RNA_property_boolean_get(op->ptr, prop)) {
-  select_op = SEL_OP_XOR;
+  select_op = SEL_OP_ADD;
 }
 
 prop = RNA_struct_find_property(op->ptr, "deselect_all");

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


[Bf-blender-cvs] [29ed6a68723] xr-actions-D9124: Merge branch 'master' into xr-actions-D9124

2020-11-25 Thread Peter Kim
Commit: 29ed6a6872366bd7c1c8aecbd420920e99e69e23
Author: Peter Kim
Date:   Thu Nov 26 13:32:35 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB29ed6a6872366bd7c1c8aecbd420920e99e69e23

Merge branch 'master' into xr-actions-D9124

===



===



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


[Bf-blender-cvs] [f7223d5f722] master: UI: Allow theming the alternate row color in the sequencer

2020-11-25 Thread Erik Abrahamsson
Commit: f7223d5f722ac430041a748248b45c8590c3ffad
Author: Erik Abrahamsson
Date:   Wed Nov 25 16:37:33 2020 -0500
Branches: master
https://developer.blender.org/rBf7223d5f722ac430041a748248b45c8590c3ffad

UI: Allow theming the alternate row color in the sequencer

Previously, the alternate row color in the Video Sequence Editor was
just a shaded version of the editor's background color. This makes it
theme-able just like in the file browser and outliner, although the
default color is very slightly different.

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

===

M   release/datafiles/userdef/userdef_default_theme.c
M   release/scripts/presets/interface_theme/blender_light.xml
M   source/blender/blenloader/intern/versioning_userdef.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/release/datafiles/userdef/userdef_default_theme.c 
b/release/datafiles/userdef/userdef_default_theme.c
index bdbd8386856..bd0c1fccb98 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -663,6 +663,7 @@ const bTheme U_theme_default = {
 .gp_vertex_select = RGBA(0xff8500ff),
 .anim_preview_range = RGBA(0xa14d0066),
 .metadatatext = RGBA(0x),
+.row_alternate = RGBA(0xff0d),
   },
   .space_image = {
 .back = RGBA(0x4400),
diff --git a/release/scripts/presets/interface_theme/blender_light.xml 
b/release/scripts/presets/interface_theme/blender_light.xml
index 7c9b769e806..fd80c6b27a5 100644
--- a/release/scripts/presets/interface_theme/blender_light.xml
+++ b/release/scripts/presets/interface_theme/blender_light.xml
@@ -818,6 +818,7 @@
 metadatabg="#00"
 metadatatext="#ff"
 preview_range="#a14d0066"
+row_alternate = "#ff0d"
 >
 
   cur.xmin, -1.0, v2d->cur.xmax, 1.0);
 
   /* Alternating horizontal stripes. */
   i = max_ii(1, ((int)v2d->cur.ymin) - 1);
 
+  float col_alternating[4];
+  UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
+
   while (i < v2d->cur.ymax) {
 if (i & 1) {
-  immUniformThemeColorShade(TH_BACK, -15);
+  immUniformThemeColorBlendShade(TH_BACK, TH_ROW_ALTERNATE, 
col_alternating[3], -25);
 }
 else {
   immUniformThemeColorShade(TH_BACK, -25);
@@ -1879,7 +1881,7 @@ static void draw_seq_backdrop(View2D *v2d)
 i++;
   }
 
-  /* Darker lines separating the horizontal bands. */
+  /* Lines separating the horizontal bands. */
   i = max_ii(1, ((int)v2d->cur.ymin) - 1);
   int line_len = (int)v2d->cur.ymax - i + 1;
   immUniformThemeColor(TH_GRID);
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 6ddc2e3ef57..08912e11146 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3246,6 +3246,11 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA 
*brna)
   RNA_def_property_array(prop, 4);
   RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range 
overlay");
   RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+  prop = RNA_def_property(srna, "row_alternate", PROP_FLOAT, PROP_COLOR_GAMMA);
+  RNA_def_property_array(prop, 4);
+  RNA_def_property_ui_text(prop, "Alternate Rows", "Overlay color on every 
other row");
+  RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
 }
 
 static void rna_def_userdef_theme_space_action(BlenderRNA *brna)

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


[Bf-blender-cvs] [05c4efc9b19] master: Fix Edit Face Set operator not being cancelled when the cursor is not over the mesh

2020-11-25 Thread Pablo Dobarro
Commit: 05c4efc9b1993f4d11a7d749fe4a9e9d80cc1f2e
Author: Pablo Dobarro
Date:   Thu Nov 12 23:01:51 2020 +0100
Branches: master
https://developer.blender.org/rB05c4efc9b1993f4d11a7d749fe4a9e9d80cc1f2e

Fix Edit Face Set operator not being cancelled when the cursor is not over the 
mesh

If the cursor is not over the mesh, the operator was still using the
last Face Set ID updated by the drawing cursor code when the cursor was
over the mesh.

This now cancels the operator instead of modifying a Face Set that will
look random to the user.

Reviewed By: sergey

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c 
b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index f67c8f701f7..7c8a4c5a857 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -1306,7 +1306,10 @@ static int sculpt_face_set_edit_invoke(bContext *C, 
wmOperator *op, const wmEven
* tool without brush cursor. */
   SculptCursorGeometryInfo sgi;
   const float mouse[2] = {event->mval[0], event->mval[1]};
-  SCULPT_cursor_geometry_info_update(C, , mouse, false);
+  if (!SCULPT_cursor_geometry_info_update(C, , mouse, false)) {
+  /* The cursor is not over the mesh. Cancel to avoid editing the last 
updated Face Set ID. */
+  return OPERATOR_CANCELLED;
+  }
   const int active_face_set = SCULPT_active_face_set_get(ss);
 
   switch (mode) {

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


[Bf-blender-cvs] [8b9b3d98e01] master: Rename use paint symmetry to use mesh symmetry in quadriflow

2020-11-25 Thread Pablo Dobarro
Commit: 8b9b3d98e015d49e3dbb587e4f4886f458f106a8
Author: Pablo Dobarro
Date:   Sat Nov 21 15:52:12 2020 +0100
Branches: master
https://developer.blender.org/rB8b9b3d98e015d49e3dbb587e4f4886f458f106a8

Rename use paint symmetry to use mesh symmetry in quadriflow

The original name was chosen because symmetry was a property of
the Paint struct. Now symmetry is a property of meshes, which
also makes the name of the property easier to understand.

Reviewed By: sergey, dbystedt

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

===

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

===

diff --git a/source/blender/editors/object/object_remesh.c 
b/source/blender/editors/object/object_remesh.c
index cc3230dff7b..57122e5c22e 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.c
@@ -647,7 +647,7 @@ typedef struct QuadriFlowJob {
 
   int target_faces;
   int seed;
-  bool use_paint_symmetry;
+  bool use_mesh_symmetry;
   eSymmetryAxes symmetry_axes;
 
   bool use_preserve_sharp;
@@ -849,7 +849,7 @@ static void quadriflow_start_job(void *customdata, short 
*stop, short *do_update
   qj->target_faces,
   qj->seed,
   qj->use_preserve_sharp,
-  (qj->use_preserve_boundary || qj->use_paint_symmetry),
+  (qj->use_preserve_boundary || qj->use_mesh_symmetry),
 #ifdef USE_MESH_CURVATURE
   qj->use_mesh_curvature,
 #else
@@ -885,7 +885,7 @@ static void quadriflow_start_job(void *customdata, short 
*stop, short *do_update
   BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, _MASK_MESH, true);
 
   if (qj->smooth_normals) {
-if (qj->use_paint_symmetry) {
+if (qj->use_mesh_symmetry) {
   BKE_mesh_calc_normals(ob->data);
 }
 BKE_mesh_smooth_flag_set(ob->data, true);
@@ -939,7 +939,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator 
*op)
   job->target_faces = RNA_int_get(op->ptr, "target_faces");
   job->seed = RNA_int_get(op->ptr, "seed");
 
-  job->use_paint_symmetry = RNA_boolean_get(op->ptr, "use_paint_symmetry");
+  job->use_mesh_symmetry = RNA_boolean_get(op->ptr, "use_mesh_symmetry");
 
   job->use_preserve_sharp = RNA_boolean_get(op->ptr, "use_preserve_sharp");
   job->use_preserve_boundary = RNA_boolean_get(op->ptr, 
"use_preserve_boundary");
@@ -953,7 +953,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator 
*op)
 
   /* Update the target face count if symmetry is enabled */
   Object *ob = CTX_data_active_object(C);
-  if (ob && job->use_paint_symmetry) {
+  if (ob && job->use_mesh_symmetry) {
 Mesh *mesh = BKE_mesh_from_object(ob);
 job->symmetry_axes = (eSymmetryAxes)mesh->symmetry;
 for (char i = 0; i < 3; i++) {
@@ -964,7 +964,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator 
*op)
 }
   }
   else {
-job->use_paint_symmetry = false;
+job->use_mesh_symmetry = false;
 job->symmetry_axes = 0;
   }
 
@@ -1105,10 +1105,10 @@ void OBJECT_OT_quadriflow_remesh(wmOperatorType *ot)
 
   /* properties */
   RNA_def_boolean(ot->srna,
-  "use_paint_symmetry",
+  "use_mesh_symmetry",
   true,
-  "Use Paint Symmetry",
-  "Generates a symmetrical mesh using the paint symmetry 
configuration");
+  "Use Mesh Symmetry",
+  "Generates a symmetrical mesh using the mesh symmetry 
configuration");
 
   RNA_def_boolean(ot->srna,
   "use_preserve_sharp",

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


[Bf-blender-cvs] [6c241b2dd7f] geometry-nodes: Geometry Nodes: Node editor header interaction with active modifier

2020-11-25 Thread Hans Goudey
Commit: 6c241b2dd7fc48e8981335e7750dd378b5e4f02b
Author: Hans Goudey
Date:   Wed Nov 25 15:34:29 2020 -0500
Branches: geometry-nodes
https://developer.blender.org/rB6c241b2dd7fc48e8981335e7750dd378b5e4f02b

Geometry Nodes: Node editor header interaction with active modifier

This commit makes the way the selector in the middle of the node editor
header interacts with the active modifier much more intuitive.

 - With no active modifier, or when the active modifier is a non-node
   modifier, the "new" operator adds a new nodes modifier.
 - With an active node modifier, the drop-down affects the modifier's
   selected node group.
 - With no active object, there is no drop-down in the header.
 - The node editor's node group always updates, even when there is no
   active modifier.
 - Pinning disables the drop-down and keeps the same node group
   selected, regardless of the context.

This is designed to work similarly to materials and material slots,
which should be familiar to any Blender user. One workflow not allowed
by this design is editing any geometry node group, regardless of the
context, but if that turns out to be an issue it should be solved in a
similar way for all node editors.

===

M   release/scripts/startup/bl_operators/geometry_nodes.py
M   release/scripts/startup/bl_ui/space_node.py
M   source/blender/nodes/geometry/node_geometry_tree.cc

===

diff --git a/release/scripts/startup/bl_operators/geometry_nodes.py 
b/release/scripts/startup/bl_operators/geometry_nodes.py
index 0b8c7814808..0d4eb89494f 100644
--- a/release/scripts/startup/bl_operators/geometry_nodes.py
+++ b/release/scripts/startup/bl_operators/geometry_nodes.py
@@ -18,35 +18,82 @@
 
 import bpy
 
+def geometry_node_group_empty_new(context):
+group = bpy.data.node_groups.new("Geometry Nodes", 'GeometryNodeTree')
+group.inputs.new('NodeSocketGeometry', "Geometry")
+group.outputs.new('NodeSocketGeometry', "Geometry")
+input_node = group.nodes.new('NodeGroupInput')
+output_node = group.nodes.new('NodeGroupOutput')
+output_node.is_active_output = True
 
-class NewGeometryNodeTree(bpy.types.Operator):
-"""Create a new geometry node tree"""
+input_node.location.x = -200 - input_node.width
+output_node.location.x = 200
 
-bl_idname = "node.new_geometry_node_tree"
-bl_label = "New Geometry Node Tree"
+group.links.new(output_node.inputs[0], input_node.outputs[0])
+
+return group
+
+def node_editor_geometry_modifier_poll(context) -> bool:
+if not (context.area.type == 'NODE_EDITOR' and 
context.space_data.tree_type == 'GeometryNodeTree'):
+return False
+
+ob = context.object
+
+# Test object support for geometry node modifier (No volume or hair object 
support yet)
+if not ob or ob.type not in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT', 
'POINTCLOUD'}:
+return False
+
+return True
+
+class NewGeometryNodeModifier(bpy.types.Operator):
+"""Create a new modifier with a new geometry node group"""
+
+bl_idname = "node.new_geometry_node_modifier"
+bl_label = "New Geometry Node Modifier"
 bl_options = {'REGISTER', 'UNDO'}
 
 @classmethod
 def poll(cls, context):
-return context.area.type == 'NODE_EDITOR' and 
context.space_data.tree_type == 'GeometryNodeTree'
+return node_editor_geometry_modifier_poll(context)
 
 def execute(self, context):
-group = bpy.data.node_groups.new("Geometry Nodes", 'GeometryNodeTree')
-group.inputs.new('NodeSocketGeometry', "Geometry")
-group.outputs.new('NodeSocketGeometry', "Geometry")
-input_node = group.nodes.new('NodeGroupInput')
-output_node = group.nodes.new('NodeGroupOutput')
-output_node.is_active_output = True
+modifier = context.object.modifiers.new("Empty", "NODES")
 
-input_node.location.x = -200 - input_node.width
-output_node.location.x = 200
+if not modifier:
+return {'CANCELLED'}
 
-group.links.new(output_node.inputs[0], input_node.outputs[0])
+group = geometry_node_group_empty_new(context)
+modifier.node_group = group
 
 context.space_data.node_tree = group
 return {'FINISHED'}
 
 
+class NewGeometryNodeTreeAssign(bpy.types.Operator):
+"""Create a new geometry node group and assign it the the active 
modifier"""
+
+bl_idname = "node.new_geometry_node_group_assign"
+bl_label = "Assign New Geometry Node Group"
+bl_options = {'REGISTER', 'UNDO'}
+
+@classmethod
+def poll(cls, context):
+return node_editor_geometry_modifier_poll(context)
+
+def execute(self, context):
+modifier = context.object.modifiers.active
+
+if not modifier:
+return {'CANCELLED'}
+
+group = geometry_node_group_empty_new(context)
+modifier.node_group = group

[Bf-blender-cvs] [41a73909dec] master: Cleanup: Typo in `print_default_info` function name.

2020-11-25 Thread Bastien Montagne
Commit: 41a73909dec716642f044e60b40a28335c9fdb10
Author: Bastien Montagne
Date:   Wed Nov 25 20:45:23 2020 +0100
Branches: master
https://developer.blender.org/rB41a73909dec716642f044e60b40a28335c9fdb10

Cleanup: Typo in `print_default_info` function name.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_define.c 
b/source/blender/makesrna/intern/rna_define.c
index 03a61ccaa21..44045dc5d2c 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -87,7 +87,7 @@ static struct {
  */
 static bool debugSRNA_defaults = false;
 
-static void print_defult_info(const PropertyDefRNA *dp)
+static void print_default_info(const PropertyDefRNA *dp)
 {
   fprintf(stderr,
   "dna_type=%s, dna_offset=%d, dna_struct=%s, dna_name=%s, id=%s\n",
@@ -2327,7 +2327,7 @@ void RNA_def_property_boolean_sdna(PropertyRNA *prop,
 
   if (debugSRNA_defaults) {
 fprintf(stderr, "value=%d, ", bprop->defaultvalue);
-print_defult_info(dp);
+print_default_info(dp);
   }
 }
   }
@@ -2465,7 +2465,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const 
char *structname, const
   fprintf(stderr, "%d, ", iprop->defaultarray[i]);
 }
 fprintf(stderr, "), ");
-print_defult_info(dp);
+print_default_info(dp);
   }
 }
   }
@@ -2492,7 +2492,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const 
char *structname, const
 if (has_default) {
   if (debugSRNA_defaults) {
 fprintf(stderr, "value=%d, ", iprop->defaultvalue);
-print_defult_info(dp);
+print_default_info(dp);
   }
 }
   }
@@ -2576,7 +2576,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const 
char *structname, cons
   fprintf(stderr, "%g, ", fprop->defaultarray[i]);
 }
 fprintf(stderr, "), ");
-print_defult_info(dp);
+print_default_info(dp);
   }
 }
   }
@@ -2598,7 +2598,7 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const 
char *structname, cons
 if (has_default) {
   if (debugSRNA_defaults) {
 fprintf(stderr, "value=%g, ", fprop->defaultvalue);
-print_defult_info(dp);
+print_default_info(dp);
   }
 }
   }
@@ -2667,7 +2667,7 @@ void RNA_def_property_enum_sdna(PropertyRNA *prop, const 
char *structname, const
   if (has_default) {
 if (debugSRNA_defaults) {
   fprintf(stderr, "value=%d, ", eprop->defaultvalue);
-  print_defult_info(dp);
+  print_default_info(dp);
 }
   }
 }
@@ -2741,7 +2741,7 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, 
const char *structname, con
 
   if (debugSRNA_defaults) {
 fprintf(stderr, "value=\"%s\", ", sprop->defaultvalue);
-print_defult_info(dp);
+print_default_info(dp);
   }
 }
   }

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


[Bf-blender-cvs] [02a0f6b04a6] master: Fluid Particles: fix viscoelastic spring threading crash again after D7394.

2020-11-25 Thread Alexander Gavrilov
Commit: 02a0f6b04a648b62150a310e67628efc1c0773e8
Author: Alexander Gavrilov
Date:   Mon Nov 23 18:26:54 2020 +0300
Branches: master
https://developer.blender.org/rB02a0f6b04a648b62150a310e67628efc1c0773e8

Fluid Particles: fix viscoelastic spring threading crash again after D7394.

Since D6133 fluid particle code uses thread local storage to collect
springs created during a time step before adding them to the actual
spring array.

Prior to the switch to TBB there was a single finalize callback which
was called on the main thread, so it could use psys_sph_flush_springs
and insert the new entries into the final buffer. However in D7394 it
was replaced with a reduce callback, which is supposed to be thread
safe and have no side effects. This means that the only thing it can
safely do is copy entries to the other temporary buffer.

In addition, careful checking reveals that the 'classical' solver
doesn't actually add springs, so reduce isn't needed there.

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

===

M   source/blender/blenkernel/intern/particle_system.c
M   source/blender/blenlib/BLI_buffer.h
M   source/blender/blenlib/intern/buffer.c

===

diff --git a/source/blender/blenkernel/intern/particle_system.c 
b/source/blender/blenkernel/intern/particle_system.c
index 35ff387c9a6..35265cf8b68 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3694,12 +3694,20 @@ typedef struct DynamicStepSolverTaskData {
 } DynamicStepSolverTaskData;
 
 static void dynamics_step_sphdata_reduce(const void *__restrict 
UNUSED(userdata),
- void *__restrict UNUSED(join_v),
+ void *__restrict join_v,
  void *__restrict chunk_v)
 {
-  SPHData *sphdata = chunk_v;
+  SPHData *sphdata_to = join_v;
+  SPHData *sphdata_from = chunk_v;
 
-  psys_sph_flush_springs(sphdata);
+  if (sphdata_from->new_springs.count > 0) {
+BLI_buffer_append_array(_to->new_springs,
+ParticleSpring,
+_buffer_at(_from->new_springs, 
ParticleSpring, 0),
+sphdata_from->new_springs.count);
+  }
+
+  BLI_buffer_field_free(_from->new_springs);
 }
 
 static void dynamics_step_sph_ddr_task_cb_ex(void *__restrict userdata,
@@ -4020,7 +4028,6 @@ static void dynamics_step(ParticleSimulationData *sim, 
float cfra)
   settings.use_threading = (psys->totpart > 100);
   settings.userdata_chunk = 
   settings.userdata_chunk_size = sizeof(sphdata);
-  settings.func_reduce = dynamics_step_sphdata_reduce;
   BLI_task_parallel_range(0,
   psys->totpart,
   _data,
@@ -4035,7 +4042,6 @@ static void dynamics_step(ParticleSimulationData *sim, 
float cfra)
   settings.use_threading = (psys->totpart > 100);
   settings.userdata_chunk = 
   settings.userdata_chunk_size = sizeof(sphdata);
-  settings.func_reduce = dynamics_step_sphdata_reduce;
   BLI_task_parallel_range(0,
   psys->totpart,
   _data,
diff --git a/source/blender/blenlib/BLI_buffer.h 
b/source/blender/blenlib/BLI_buffer.h
index fc348c25c46..f641c89e53b 100644
--- a/source/blender/blenlib/BLI_buffer.h
+++ b/source/blender/blenlib/BLI_buffer.h
@@ -77,6 +77,16 @@ void BLI_buffer_resize(BLI_Buffer *buffer, const size_t 
new_count);
 /* Ensure size, throwing away old data, respecting BLI_BUFFER_USE_CALLOC */
 void BLI_buffer_reinit(BLI_Buffer *buffer, const size_t new_count);
 
+/* Append an array of elements. */
+void _bli_buffer_append_array(BLI_Buffer *buffer, void *data, size_t count);
+#define BLI_buffer_append_array(buffer_, type_, data_, count_) \
+  { \
+type_ *__tmp = (data_); \
+BLI_assert(sizeof(type_) == (buffer_)->elem_size); \
+_bli_buffer_append_array(buffer_, __tmp, count_); \
+  } \
+  (void)0
+
 /* Does not free the buffer structure itself */
 void _bli_buffer_free(BLI_Buffer *buffer);
 #define BLI_buffer_free(name_) \
diff --git a/source/blender/blenlib/intern/buffer.c 
b/source/blender/blenlib/intern/buffer.c
index bac4786a2e9..74e97d89430 100644
--- a/source/blender/blenlib/intern/buffer.c
+++ b/source/blender/blenlib/intern/buffer.c
@@ -114,6 +114,16 @@ void BLI_buffer_reinit(BLI_Buffer *buffer, const size_t 
new_count)
   buffer->count = new_count;
 }
 
+/* Callers use BLI_buffer_append_array. */
+void _bli_buffer_append_array(BLI_Buffer *buffer, void *new_data, size_t count)
+{
+  size_t size = buffer->count;
+  BLI_buffer_resize(buffer, size + count);
+
+  uint8_t *bytes = (uint8_t *)buffer->data;
+  memcpy(bytes + size * buffer->elem_size, new_data, count * 

[Bf-blender-cvs] [c1b655c06af] geometry-nodes: Geometry Nodes: Improve wording of modifier error messages

2020-11-25 Thread Hans Goudey
Commit: c1b655c06af9c259701db338a80f580ac0f4c278
Author: Hans Goudey
Date:   Wed Nov 25 13:32:36 2020 -0500
Branches: geometry-nodes
https://developer.blender.org/rBc1b655c06af9c259701db338a80f580ac0f4c278

Geometry Nodes: Improve wording of modifier error messages

- Don't use contractions
- Remove unecessary words

===

M   source/blender/modifiers/intern/MOD_nodes.cc

===

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index f96fffb6ce3..c1660cb80f4 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -814,17 +814,16 @@ static void check_property_socket_sync(const Object *ob, 
ModifierData *md)
 IDProperty *property = IDP_GetPropertyFromGroup(nmd->settings.properties, 
socket->identifier);
 if (property == nullptr) {
   if (socket->type == SOCK_STRING) {
-BKE_modifier_set_error(ob, md, "String sockets cannot be exposed in 
the modifier");
+BKE_modifier_set_error(ob, md, "String socket can not be exposed in 
the modifier");
   }
   else if (socket->type == SOCK_OBJECT) {
-BKE_modifier_set_error(ob, md, "Object sockets cannot be exposed in 
the modifier");
+BKE_modifier_set_error(ob, md, "Object socket can not be exposed in 
the modifier");
   }
   else if (socket->type == SOCK_GEOMETRY) {
-BKE_modifier_set_error(ob, md, "The node group can only have one 
geometry input");
+BKE_modifier_set_error(ob, md, "Node group can only have one geometry 
input");
   }
   else {
-BKE_modifier_set_error(
-ob, md, "Missing modifier property for input socket \"%s\"", 
socket->name);
+BKE_modifier_set_error(ob, md, "Missing property for input socket 
\"%s\"", socket->name);
   }
   continue;
 }
@@ -832,7 +831,7 @@ static void check_property_socket_sync(const Object *ob, 
ModifierData *md)
 const SocketPropertyType *property_type = 
get_socket_property_type(*socket);
 if (!property_type->is_correct_type(*property)) {
   BKE_modifier_set_error(
-  ob, md, "Property type does not match for input socket \"(%s)\"", 
socket->name);
+  ob, md, "Property type does not match input socket \"(%s)\"", 
socket->name);
   continue;
 }
   }
@@ -845,7 +844,7 @@ static void check_property_socket_sync(const Object *ob, 
ModifierData *md)
   }
 
   if (!has_geometry_output) {
-BKE_modifier_set_error(ob, md, "The node group must have a geometry 
output");
+BKE_modifier_set_error(ob, md, "Node group must have a geometry output");
   }
 }

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


[Bf-blender-cvs] [db03a2e296d] asset-browser: Fix compile error on Windows

2020-11-25 Thread Julian Eisel
Commit: db03a2e296d94807674c8b47d96f618f2baca955
Author: Julian Eisel
Date:   Wed Nov 25 19:27:15 2020 +0100
Branches: asset-browser
https://developer.blender.org/rBdb03a2e296d94807674c8b47d96f618f2baca955

Fix compile error on Windows

`alloca.h` doesn't seem to be available there.

===

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

===

diff --git a/source/blender/editors/space_file/file_draw.c 
b/source/blender/editors/space_file/file_draw.c
index b9b6b9bb5e4..775de578944 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -21,11 +21,11 @@
  * \ingroup spfile
  */
 
-#include 
 #include 
 #include 
 #include 
 
+#include "BLI_alloca.h"
 #include "BLI_blenlib.h"
 #include "BLI_fileops_types.h"
 #include "BLI_math.h"

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


[Bf-blender-cvs] [52e3eb481bd] asset-browser: Merge branch 'master' into asset-browser

2020-11-25 Thread Julian Eisel
Commit: 52e3eb481bd13c0222fa95f07843517dd7892acc
Author: Julian Eisel
Date:   Wed Nov 25 17:58:19 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB52e3eb481bd13c0222fa95f07843517dd7892acc

Merge branch 'master' into asset-browser

===



===



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


[Bf-blender-cvs] [4b1c32008c7] asset-browser: Fix broken custom preview-icons & failing script_load_addons test

2020-11-25 Thread Julian Eisel
Commit: 4b1c32008c73c8376460174a05bd32b87d07a51e
Author: Julian Eisel
Date:   Wed Nov 25 19:03:56 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB4b1c32008c73c8376460174a05bd32b87d07a51e

Fix broken custom preview-icons & failing script_load_addons test

===

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

===

diff --git a/source/blender/blenkernel/intern/icons.c 
b/source/blender/blenkernel/intern/icons.c
index d6877b06462..6fcfa025511 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -481,7 +481,7 @@ PreviewImage *BKE_previewimg_cached_thumbnail_read(const 
char *name,
   }
 
   if (!prv) {
-previewimg_defered_create(path, source);
+prv = previewimg_defered_create(path, source);
 force_update = true;
   }

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


[Bf-blender-cvs] [8330e19cb2e] master: RNA Armature: Improve the description of AxisRollFromMatrix

2020-11-25 Thread Germano Cavalcante
Commit: 8330e19cb2e7faca9884e34a8f46564250c8c29a
Author: Germano Cavalcante
Date:   Wed Nov 25 11:43:16 2020 -0300
Branches: master
https://developer.blender.org/rB8330e19cb2e7faca9884e34a8f46564250c8c29a

RNA Armature: Improve the description of AxisRollFromMatrix

The roll value may not be as expected when a matrix is not orthogonal
or has a negative determinant.

This can lead to confusion as seen in T82930.

Therefore, make it clear that this is a limitation and that a value for
the roll is somewhat indeterminable in these cases.

This fixes T82930

===

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

===

diff --git a/source/blender/makesrna/intern/rna_armature_api.c 
b/source/blender/makesrna/intern/rna_armature_api.c
index a9d39b7eda8..36aa0401c7d 100644
--- a/source/blender/makesrna/intern/rna_armature_api.c
+++ b/source/blender/makesrna/intern/rna_armature_api.c
@@ -196,7 +196,9 @@ void RNA_api_bone(StructRNA *srna)
 
   func = RNA_def_function(srna, "AxisRollFromMatrix", 
"rna_Bone_AxisRollFromMatrix");
   RNA_def_function_ui_description(func,
-  "Convert a rotational matrix to the axis + 
roll representation");
+  "Convert a rotational matrix to the axis + 
roll representation. "
+  "Note that the resulting value of the roll 
may not be as "
+  "expected if the matrix has shear or 
negative determinant.");
   RNA_def_function_flag(func, FUNC_NO_SELF);
   parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
   RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_3x3);

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


[Bf-blender-cvs] [b4f3c3cca00] geometry-nodes: Geometry Nodes: Use context for active modifier operators

2020-11-25 Thread Hans Goudey
Commit: b4f3c3cca00d889abb585e3bc7d9806e003c3a11
Author: Hans Goudey
Date:   Wed Nov 25 11:46:02 2020 -0500
Branches: geometry-nodes
https://developer.blender.org/rBb4f3c3cca00d889abb585e3bc7d9806e003c3a11

Geometry Nodes: Use context for active modifier operators

This adds "modifier" as a new context variable in the property editor.
It is used instead of getting the active modifier directly. This way it
displays in the breadcrumbs panel, and the variable can be set only
in the modifier tab, meaning it won't work from the shortcut even
when the modifiers aren't visible.

===

M   source/blender/editors/object/object_modifier.c
M   source/blender/editors/space_buttons/buttons_context.c

===

diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 864b3357ea2..7d12fa1805b 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1101,7 +1101,7 @@ static void edit_modifier_report_property(wmOperatorType 
*ot)
  * Using modifier names and data context.
  * \{ */
 
-static bool edit_modifier_properties_base(bContext *C, wmOperator *op)
+bool edit_modifier_invoke_properties(bContext *C, wmOperator *op)
 {
   if (RNA_struct_property_is_set(op->ptr, "modifier")) {
 return true;
@@ -1117,73 +1117,6 @@ static bool edit_modifier_properties_base(bContext *C, 
wmOperator *op)
   return false;
 }
 
-static bool edit_modifier_properties_active(bContext *C, wmOperator *op)
-{
-  Object *ob = ED_object_active_context(C);
-  if (ob != NULL) {
-ModifierData *md = BKE_object_active_modifier(ob);
-if (md != NULL) {
-  RNA_string_set(op->ptr, "modifier", md->name);
-  return true;
-}
-  }
-
-  return false;
-}
-
-bool edit_modifier_invoke_properties(bContext *C, wmOperator *op)
-{
-  if (edit_modifier_properties_base(C, op)) {
-return true;
-  }
-  if (edit_modifier_properties_active(C, op)) {
-return true;
-  }
-
-  return false;
-}
-
-/**
- * Run the regular invoke properties, then also check the custom data
- * of panels under the mouse for a modifier.
- *
- * \param event: If this isn't NULL, the operator will also look for panels 
underneath
- * the cursor with customdata set to a modifier.
- * \param r_retval: This should be used if #event is used in order to to return
- * #OPERATOR_PASS_THROUGH to check other operators with the same key set.
- */
-bool edit_modifier_invoke_properties_with_hover_no_active(bContext *C,
-  wmOperator *op,
-  const wmEvent *event,
-  int *r_retval)
-{
-
-  if (edit_modifier_properties_base(C, op)) {
-return true;
-  }
-
-  PointerRNA *panel_ptr = UI_region_panel_custom_data_under_cursor(C, event);
-
-  if (!(panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
-if (RNA_struct_is_a(panel_ptr->type, _Modifier)) {
-  ModifierData *md = panel_ptr->data;
-  RNA_string_set(op->ptr, "modifier", md->name);
-  return true;
-}
-BLI_assert(r_retval != NULL); /* We need the return value in this case. */
-if (r_retval != NULL) {
-  *r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
-}
-return false;
-  }
-
-  if (r_retval != NULL) {
-*r_retval = OPERATOR_CANCELLED;
-  }
-
-  return false;
-}
-
 ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
 {
   char modifier_name[MAX_NAME];
@@ -1248,7 +1181,9 @@ static int modifier_remove_invoke(bContext *C, wmOperator 
*op, const wmEvent *UN
   if (edit_modifier_invoke_properties(C, op)) {
 return modifier_remove_exec(C, op);
   }
-  return OPERATOR_CANCELLED;
+
+  /* Work around multiple operators using the same shortcut. */
+  return (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
 }
 
 void OBJECT_OT_modifier_remove(wmOperatorType *ot)
@@ -1293,7 +1228,8 @@ static int modifier_move_up_invoke(bContext *C, 
wmOperator *op, const wmEvent *U
   if (edit_modifier_invoke_properties(C, op)) {
 return modifier_move_up_exec(C, op);
   }
-  return OPERATOR_CANCELLED;
+  /* Work around multiple operators using the same shortcut. */
+  return (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
 }
 
 void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
@@ -1337,7 +1273,8 @@ static int modifier_move_down_invoke(bContext *C, 
wmOperator *op, const wmEvent
   if (edit_modifier_invoke_properties(C, op)) {
 return modifier_move_down_exec(C, op);
   }
-  return OPERATOR_CANCELLED;
+  /* Work around multiple operators using the same shortcut. */
+  return (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
 }
 
 void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
@@ -1483,7 +1420,8 @@ static int modifier_apply_invoke(bContext *C, wmOperator 

[Bf-blender-cvs] [272e0770a03] asset-browser: Proper implementation of "Make Asset" for button context menus

2020-11-25 Thread Julian Eisel
Commit: 272e0770a032805b5675dd317882fd7f81cd76e7
Author: Julian Eisel
Date:   Wed Nov 25 16:58:20 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB272e0770a032805b5675dd317882fd7f81cd76e7

Proper implementation of "Make Asset" for button context menus

Buttons or other UI elements can now set a "focused_id" context pointer. The
asset operators (and in future, general data-block operators) can use this
then. Further the UI code automatically sets it when a button represents a
data-block pointer. That way, data-block search menus or data-block selectors
also show "Make Asset" in the context menu.

This also works for material slots now, the material slot you right click will
properly set the "focused_id" context pointer, and "Make Asset" makes that
material an asset.

Had to add support for using custom context pointers to context menus and
UILists.

Addresses T82664.

===

M   release/scripts/startup/bl_ui/properties_material.py
M   source/blender/blenkernel/BKE_context.h
M   source/blender/blenkernel/intern/context.c
M   source/blender/editors/asset/CMakeLists.txt
M   source/blender/editors/asset/asset_edit.c
M   source/blender/editors/asset/asset_ops.c
M   source/blender/editors/include/ED_asset.h
M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface.c
M   source/blender/editors/interface/interface_context_menu.c
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/interface/interface_templates.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index 6aaec9940e8..cd6bebfea94 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -42,6 +42,9 @@ class MATERIAL_UL_matslots(UIList):
 # ob = data
 slot = item
 ma = slot.material
+
+layout.context_pointer_set("focused_id", ma)
+
 if self.layout_type in {'DEFAULT', 'COMPACT'}:
 if ma:
 layout.prop(ma, "name", text="", emboss=False, icon_value=icon)
diff --git a/source/blender/blenkernel/BKE_context.h 
b/source/blender/blenkernel/BKE_context.h
index af9a95e1753..94392dd78da 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -143,8 +143,9 @@ bContext *CTX_copy(const bContext *C);
 
 /* Stored Context */
 
-bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA 
*ptr);
+bContextStore *CTX_store_add(ListBase *contexts, const char *name, const 
PointerRNA *ptr);
 bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context);
+bContextStore *CTX_store_get(bContext *C);
 void CTX_store_set(bContext *C, bContextStore *store);
 bContextStore *CTX_store_copy(bContextStore *store);
 void CTX_store_free(bContextStore *store);
diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index 2e4d3d62925..65accc66084 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -123,7 +123,7 @@ void CTX_free(bContext *C)
 
 /* store */
 
-bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA 
*ptr)
+bContextStore *CTX_store_add(ListBase *contexts, const char *name, const 
PointerRNA *ptr)
 {
   /* ensure we have a context to put the entry in, if it was already used
* we have to copy the context to ensure */
@@ -178,6 +178,11 @@ bContextStore *CTX_store_add_all(ListBase *contexts, 
bContextStore *context)
   return ctx;
 }
 
+bContextStore *CTX_store_get(bContext *C)
+{
+  return C->wm.store;
+}
+
 void CTX_store_set(bContext *C, bContextStore *store)
 {
   C->wm.store = store;
diff --git a/source/blender/editors/asset/CMakeLists.txt 
b/source/blender/editors/asset/CMakeLists.txt
index 8ba15208afc..63a1761b264 100644
--- a/source/blender/editors/asset/CMakeLists.txt
+++ b/source/blender/editors/asset/CMakeLists.txt
@@ -22,6 +22,7 @@ set(INC
 ../../makesdna
 ../../makesrna
 ../../windowmanager
+../../../../intern/guardedalloc
 )
 
 set(INC_SYS
diff --git a/source/blender/editors/asset/asset_edit.c 
b/source/blender/editors/asset/asset_edit.c
index 583fc66ef40..c52e8bc7062 100644
--- a/source/blender/editors/asset/asset_edit.c
+++ b/source/blender/editors/asset/asset_edit.c
@@ -27,6 +27,8 @@
 
 #include "UI_interface_icons.h"
 
+#include "RNA_access.h"
+
 #include "ED_asset.h"
 
 bool ED_asset_make_for_id(const bContext *C, ID *id)
@@ -49,3 +51,9 @@ bool ED_asset_make_for_id(const bContext *C, ID *id)
 
   return true;
 }
+
+bool ED_asset_can_make_single_from_context(const bContext *C)
+{
+  /* Context needs a "focused_id" pointer to be set for #ASSET_OT_make() to 
use. */
+  return 

[Bf-blender-cvs] [e3f8ffc4825] geometry-nodes: Cleanup: avoid very generic using-namespace statements

2020-11-25 Thread Jacques Lucke
Commit: e3f8ffc48252d3af14faeac7b6bb6f6e08abe7f6
Author: Jacques Lucke
Date:   Wed Nov 25 16:47:09 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rBe3f8ffc48252d3af14faeac7b6bb6f6e08abe7f6

Cleanup: avoid very generic using-namespace statements

===

M   source/blender/functions/FN_multi_function.hh
M   source/blender/modifiers/intern/MOD_nodes.cc
M   source/blender/nodes/NOD_derived_node_tree.hh

===

diff --git a/source/blender/functions/FN_multi_function.hh 
b/source/blender/functions/FN_multi_function.hh
index bf431984946..d8924b3cf23 100644
--- a/source/blender/functions/FN_multi_function.hh
+++ b/source/blender/functions/FN_multi_function.hh
@@ -122,4 +122,17 @@ inline MFParamsBuilder::MFParamsBuilder(const class 
MultiFunction , int64_t m
 
 extern const MultiFunction _multi_function;
 
+namespace multi_function_types {
+using fn::CPPType;
+using fn::GMutableSpan;
+using fn::GSpan;
+using fn::MFContext;
+using fn::MFContextBuilder;
+using fn::MFDataType;
+using fn::MFParams;
+using fn::MFParamsBuilder;
+using fn::MFParamType;
+using fn::MultiFunction;
+}  // namespace multi_function_types
+
 }  // namespace blender::fn
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index 38cae4f525a..f96fffb6ce3 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -74,12 +74,17 @@
 #include "NOD_type_callbacks.hh"
 
 using blender::float3;
-
-/* To be replaced soon. */
-using namespace blender;
-using namespace blender::nodes;
-using namespace blender::fn;
-using namespace blender::bke;
+using blender::IndexRange;
+using blender::Map;
+using blender::Set;
+using blender::Span;
+using blender::StringRef;
+using blender::Vector;
+using blender::fn::GMutablePointer;
+using blender::fn::GValueMap;
+using blender::nodes::GeoNodeExecParams;
+using namespace blender::nodes::derived_node_tree_types;
+using namespace blender::fn::multi_function_types;
 
 static void initData(ModifierData *md)
 {
@@ -177,23 +182,23 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
 
 class GeometryNodesEvaluator {
  private:
-  LinearAllocator<> allocator_;
+  blender::LinearAllocator<> allocator_;
   Map value_by_input_;
   Vector group_outputs_;
-  MultiFunctionByNode _by_node_;
-  const DataTypeConversions _;
-  const PersistentDataHandleMap _map_;
+  blender::nodes::MultiFunctionByNode _by_node_;
+  const blender::nodes::DataTypeConversions _;
+  const blender::bke::PersistentDataHandleMap _map_;
   const Object *self_object_;
 
  public:
   GeometryNodesEvaluator(const Map 
_input_data,
  Vector group_outputs,
- MultiFunctionByNode _by_node,
- const PersistentDataHandleMap _map,
+ blender::nodes::MultiFunctionByNode _by_node,
+ const blender::bke::PersistentDataHandleMap 
_map,
  const Object *self_object)
   : group_outputs_(std::move(group_outputs)),
 mf_by_node_(mf_by_node),
-conversions_(get_implicit_type_conversions()),
+conversions_(blender::nodes::get_implicit_type_conversions()),
 handle_map_(handle_map),
 self_object_(self_object)
   {
@@ -251,7 +256,7 @@ class GeometryNodesEvaluator {
 
 if (!socket_to_compute.is_available()) {
   /* If the output is not available, use a default value. */
-  const CPPType  = 
*socket_cpp_type_get(*socket_to_compute.typeinfo());
+  const CPPType  = 
*blender::nodes::socket_cpp_type_get(*socket_to_compute.typeinfo());
   void *buffer = allocator_.allocate(type.size(), type.alignment());
   type.copy_to_uninitialized(type.default_value(), buffer);
   this->forward_to_inputs(socket_to_compute, {type, buffer});
@@ -304,7 +309,7 @@ class GeometryNodesEvaluator {
 Vector output_data;
 for (const DOutputSocket *dsocket : node.outputs()) {
   if (dsocket->is_available()) {
-const CPPType  = *socket_cpp_type_get(*dsocket->typeinfo());
+const CPPType  = 
*blender::nodes::socket_cpp_type_get(*dsocket->typeinfo());
 void *buffer = allocator_.allocate(type.size(), type.alignment());
 fn_params.add_uninitialized_single_output(GMutableSpan(type, buffer, 
1));
 output_data.append(GMutablePointer(type, buffer));
@@ -333,7 +338,7 @@ class GeometryNodesEvaluator {
 
 Vector to_sockets_same_type;
 for (const DInputSocket *to_socket : to_sockets_all) {
-  const CPPType _type = *socket_cpp_type_get(*to_socket->typeinfo());
+  const CPPType _type = 
*blender::nodes::socket_cpp_type_get(*to_socket->typeinfo());
   if (from_type == to_type) {
 to_sockets_same_type.append(to_socket);
   }
@@ -382,16 +387,16 @@ class GeometryNodesEvaluator {
   

[Bf-blender-cvs] [559999b2f54] geometry-nodes: Cleanup: minor changes

2020-11-25 Thread Jacques Lucke
Commit: 55b2f54764a1fdf8411f3681f207fefa4271
Author: Jacques Lucke
Date:   Wed Nov 25 16:17:58 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB55b2f54764a1fdf8411f3681f207fefa4271

Cleanup: minor changes

===

M   source/blender/blenlib/BLI_user_counter.hh
M   source/blender/blenloader/intern/readfile.c

===

diff --git a/source/blender/blenlib/BLI_user_counter.hh 
b/source/blender/blenlib/BLI_user_counter.hh
index 66c8e3ad215..ef276814981 100644
--- a/source/blender/blenlib/BLI_user_counter.hh
+++ b/source/blender/blenlib/BLI_user_counter.hh
@@ -25,8 +25,8 @@
 namespace blender {
 
 /**
- * A simple automatic reference counter. This should probably be moved to 
another file eventually.
- * It is similar to std::shared_ptr, but expects that the reference count is 
inside the object.
+ * A simple automatic reference counter. It is similar to std::shared_ptr, but 
expects that the
+ * reference count is inside the object.
  */
 template class UserCounter {
  private:
diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index fca6079ceb6..2c10dd446f1 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -89,7 +89,6 @@
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
-
 #include "BKE_workspace.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] [f67f895770c] master: GPencil: Disable vertex color when use holdout

2020-11-25 Thread Antonio Vazquez
Commit: f67f895770c546243d6976228fbf4a500c19185f
Author: Antonio Vazquez
Date:   Wed Nov 25 16:00:44 2020 +0100
Branches: master
https://developer.blender.org/rBf67f895770c546243d6976228fbf4a500c19185f

GPencil: Disable vertex color when use holdout

If the material has the holdout enabled, the value of the vertex color must not 
be used.

===

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

===

diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
index 94b066c12e5..45b2b92a09b 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
@@ -526,6 +526,11 @@ void stroke_vertex()
   vec4 stroke_col = MATERIAL(m).stroke_color;
   float mix_tex = MATERIAL(m).stroke_texture_mix;
 
+  /* Special case: We don't use vertex color if material Holdout. */
+  if (GP_FLAG_TEST(GP_FLAG(m), GP_STROKE_HOLDOUT)) {
+vert_col = vec4(0.0);
+  }
+
   color_output(stroke_col, vert_col, vert_strength * small_line_opacity, 
mix_tex);
 
   matFlag = GP_FLAG(m) & ~GP_FILL_FLAGS;
@@ -576,6 +581,11 @@ void fill_vertex()
   float fill_opacity = fcol1.a - (fcol_decode.a * 10);
   fcol_decode.a /= 1.0;
 
+  /* Special case: We don't use vertex color if material Holdout. */
+  if (GP_FLAG_TEST(GP_FLAG(m), GP_FILL_HOLDOUT)) {
+fcol_decode = vec4(0.0);
+  }
+
   /* Apply opacity. */
   fill_col.a *= fill_opacity;
   /* If factor is > 1 force opacity. */

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


[Bf-blender-cvs] [257725f8299] geometry-nodes: Geometry Nodes: hide domain enum from random attribute node

2020-11-25 Thread Jacques Lucke
Commit: 257725f8299172a2a533fd28986278d8fdded684
Author: Jacques Lucke
Date:   Wed Nov 25 15:57:41 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB257725f8299172a2a533fd28986278d8fdded684

Geometry Nodes: hide domain enum from random attribute node

While we can support different domains already in this node, there is not
really anything you could do with that data yet. It can be added back when
there is a use case for it.

===

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

===

diff --git a/source/blender/editors/space_node/drawnode.c 
b/source/blender/editors/space_node/drawnode.c
index cf1ce5015e3..fdcd8f340dc 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3171,7 +3171,6 @@ static void node_geometry_buts_random_attribute(uiLayout 
*layout,
 PointerRNA *ptr)
 {
   uiItemR(layout, ptr, "data_type", DEFAULT_FLAGS, "", ICON_NONE);
-  uiItemR(layout, ptr, "domain", DEFAULT_FLAGS, "", ICON_NONE);
 }
 
 static void node_geometry_buts_attribute_math(uiLayout *layout,

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


[Bf-blender-cvs] [b356288a757] geometry-nodes: Geometry Nodes: change builtin attribute names based on T82693

2020-11-25 Thread Jacques Lucke
Commit: b356288a7574eda370263ecdc1df26d30b83d9e2
Author: Jacques Lucke
Date:   Wed Nov 25 15:55:29 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rBb356288a7574eda370263ecdc1df26d30b83d9e2

Geometry Nodes: change builtin attribute names based on T82693

===

M   source/blender/blenkernel/intern/attribute_access.cc
M   source/blender/blenkernel/intern/hair.c
M   source/blender/blenkernel/intern/pointcloud.cc
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/nodes/geometry/nodes/node_geo_point_instance.cc

===

diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index c3df7374fb0..ce56118e9ba 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -610,7 +610,7 @@ int PointCloudComponent::attribute_domain_size(const 
AttributeDomain domain) con
 
 bool PointCloudComponent::attribute_is_builtin(const StringRef attribute_name) 
const
 {
-  return attribute_name == "Position";
+  return attribute_name == "position";
 }
 
 ReadAttributePtr PointCloudComponent::attribute_try_get_for_read(
@@ -742,7 +742,7 @@ int MeshComponent::attribute_domain_size(const 
AttributeDomain domain) const
 
 bool MeshComponent::attribute_is_builtin(const StringRef attribute_name) const
 {
-  return attribute_name == "Position";
+  return attribute_name == "position";
 }
 
 ReadAttributePtr MeshComponent::attribute_try_get_for_read(const StringRef 
attribute_name) const
@@ -751,7 +751,7 @@ ReadAttributePtr 
MeshComponent::attribute_try_get_for_read(const StringRef attri
 return {};
   }
 
-  if (attribute_name == "Position") {
+  if (attribute_name == "position") {
 auto get_vertex_position = [](const MVert ) { return float3(vert.co); 
};
 return std::make_unique<
 blender::bke::DerivedArrayReadAttribute>(
@@ -802,7 +802,7 @@ WriteAttributePtr 
MeshComponent::attribute_try_get_for_write(const StringRef att
 BKE_mesh_update_customdata_pointers(mesh, false);
   };
 
-  if (attribute_name == "Position") {
+  if (attribute_name == "position") {
 CustomData_duplicate_referenced_layer(>vdata, CD_MVERT, 
mesh->totvert);
 update_mesh_pointers();
 
@@ -945,7 +945,7 @@ Set MeshComponent::attribute_names() const
   }
 
   Set names;
-  names.add("Position");
+  names.add("position");
   for (StringRef name : vertex_group_names_.keys()) {
 names.add(name);
   }
diff --git a/source/blender/blenkernel/intern/hair.c 
b/source/blender/blenkernel/intern/hair.c
index 554919ad1a0..a44b054e366 100644
--- a/source/blender/blenkernel/intern/hair.c
+++ b/source/blender/blenkernel/intern/hair.c
@@ -49,8 +49,8 @@
 
 #include "BLO_read_write.h"
 
-static const char *HAIR_ATTR_POSITION = "Position";
-static const char *HAIR_ATTR_RADIUS = "Radius";
+static const char *HAIR_ATTR_POSITION = "position";
+static const char *HAIR_ATTR_RADIUS = "radius";
 
 /* Hair datablock */
 
diff --git a/source/blender/blenkernel/intern/pointcloud.cc 
b/source/blender/blenkernel/intern/pointcloud.cc
index 108ce390271..dbb0a1bd569 100644
--- a/source/blender/blenkernel/intern/pointcloud.cc
+++ b/source/blender/blenkernel/intern/pointcloud.cc
@@ -54,8 +54,8 @@
 
 static void pointcloud_random(PointCloud *pointcloud);
 
-const char *POINTCLOUD_ATTR_POSITION = "Position";
-const char *POINTCLOUD_ATTR_RADIUS = "Radius";
+const char *POINTCLOUD_ATTR_POSITION = "position";
+const char *POINTCLOUD_ATTR_RADIUS = "radius";
 
 static void pointcloud_init_data(ID *id)
 {
diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index b591f57a7f1..68d22b36e5c 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -511,6 +511,20 @@ static void do_versions_point_attributes(CustomData *pdata)
   }
 }
 
+static void do_versions_point_attribute_names(CustomData *pdata)
+{
+  /* Change from capital initial letter to lower case (T82693). */
+  for (int i = 0; i < pdata->totlayer; i++) {
+CustomDataLayer *layer = >layers[i];
+if (layer->type == CD_PROP_FLOAT3 && STREQ(layer->name, "Position")) {
+  STRNCPY(layer->name, "position");
+}
+else if (layer->type == CD_PROP_FLOAT && STREQ(layer->name, "Radius")) {
+  STRNCPY(layer->name, "radius");
+}
+  }
+}
+
 /* Move FCurve handles towards the control point in such a way that the curve 
itself doesn't
  * change. Since 2.91 FCurves are computed slightly differently, which 
requires this update to keep
  * the same animation result. Previous versions scaled down overlapping 
handles during evaluation.
@@ -1181,5 +1195,13 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 }
+
+/* Hair and 

[Bf-blender-cvs] [c65b2fb91ae] tmp-ocio-v2: OCIOv2: Fix compilations issues in Cycles.

2020-11-25 Thread Jeroen Bakker
Commit: c65b2fb91aedc69a145e543635a894a0b3e071c3
Author: Jeroen Bakker
Date:   Wed Nov 25 15:46:57 2020 +0100
Branches: tmp-ocio-v2
https://developer.blender.org/rBc65b2fb91aedc69a145e543635a894a0b3e071c3

OCIOv2: Fix compilations issues in Cycles.

This is a rough version. The result should be slower than we have. We
should find a solution where we could cache the device_processor or find
a better way how to increase the performance by evaluating an area or
using GPU processors. OCIO also has a function called
`getOptimizedCPUProcessor`.

===

M   intern/cycles/render/colorspace.cpp
M   intern/cycles/render/shader.cpp

===

diff --git a/intern/cycles/render/colorspace.cpp 
b/intern/cycles/render/colorspace.cpp
index 57979d5f225..cf7cbaa9137 100644
--- a/intern/cycles/render/colorspace.cpp
+++ b/intern/cycles/render/colorspace.cpp
@@ -192,6 +192,7 @@ void ColorSpaceManager::is_builtin_colorspace(ustring 
colorspace,
 return;
   }
 
+  OCIO::ConstCPUProcessorRcPtr device_processor = 
processor->getDefaultCPUProcessor();
   is_scene_linear = true;
   is_srgb = true;
   for (int i = 0; i < 256; i++) {
@@ -201,10 +202,10 @@ void ColorSpaceManager::is_builtin_colorspace(ustring 
colorspace,
 float cG[3] = {0, v, 0};
 float cB[3] = {0, 0, v};
 float cW[3] = {v, v, v};
-processor->applyRGB(cR);
-processor->applyRGB(cG);
-processor->applyRGB(cB);
-processor->applyRGB(cW);
+device_processor->applyRGB(cR);
+device_processor->applyRGB(cG);
+device_processor->applyRGB(cB);
+device_processor->applyRGB(cW);
 
 /* Make sure that there is no channel crosstalk. */
 if (fabsf(cR[1]) > 1e-5f || fabsf(cR[2]) > 1e-5f || fabsf(cG[0]) > 1e-5f ||
@@ -267,6 +268,7 @@ inline void processor_apply_pixels(const OCIO::Processor 
*processor, T *pixels,
   /* TODO: implement faster version for when we know the conversion
* is a simple matrix transform between linear spaces. In that case
* un-premultiply is not needed. */
+  OCIO::ConstCPUProcessorRcPtr device_processor = 
processor->getDefaultCPUProcessor();
 
   /* Process large images in chunks to keep temporary memory requirement down. 
*/
   const size_t chunk_size = std::min((size_t)(16 * 1024 * 1024), num_pixels);
@@ -289,7 +291,7 @@ inline void processor_apply_pixels(const OCIO::Processor 
*processor, T *pixels,
 }
 
 OCIO::PackedImageDesc desc((float *)float_pixels.data(), width, 1, 4);
-processor->apply(desc);
+device_processor->apply(desc);
 
 for (size_t i = 0; i < width; i++) {
   float4 value = float_pixels[i];
@@ -345,13 +347,14 @@ void 
ColorSpaceManager::to_scene_linear(ColorSpaceProcessor *processor_,
   const OCIO::Processor *processor = (const OCIO::Processor *)processor_;
 
   if (processor) {
+OCIO::ConstCPUProcessorRcPtr device_processor = 
processor->getDefaultCPUProcessor();
 if (channels == 3) {
-  processor->applyRGB(pixel);
+  device_processor->applyRGB(pixel);
 }
 else if (channels == 4) {
   if (pixel[3] == 1.0f || pixel[3] == 0.0f) {
 /* Fast path for RGBA. */
-processor->applyRGB(pixel);
+device_processor->applyRGB(pixel);
   }
   else {
 /* Un-associate and associate alpha since color management should not
@@ -363,7 +366,7 @@ void ColorSpaceManager::to_scene_linear(ColorSpaceProcessor 
*processor_,
 pixel[1] *= inv_alpha;
 pixel[2] *= inv_alpha;
 
-processor->applyRGB(pixel);
+device_processor->applyRGB(pixel);
 
 pixel[0] *= alpha;
 pixel[1] *= alpha;
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index cf49dedc426..4ac3222a556 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -394,20 +394,24 @@ ShaderManager::ShaderManager()
   OCIO::ConstProcessorRcPtr to_rgb_processor = config->getProcessor("XYZ", 
"scene_linear");
   OCIO::ConstProcessorRcPtr to_xyz_processor = 
config->getProcessor("scene_linear", "XYZ");
   if (to_rgb_processor && to_xyz_processor) {
+OCIO::ConstCPUProcessorRcPtr to_xyz_device_processor =
+to_xyz_processor->getDefaultCPUProcessor();
+OCIO::ConstCPUProcessorRcPtr to_rgb_device_processor =
+to_rgb_processor->getDefaultCPUProcessor();
 float r[] = {1.0f, 0.0f, 0.0f};
 float g[] = {0.0f, 1.0f, 0.0f};
 float b[] = {0.0f, 0.0f, 1.0f};
-to_xyz_processor->applyRGB(r);
-to_xyz_processor->applyRGB(g);
-to_xyz_processor->applyRGB(b);
+to_xyz_device_processor->applyRGB(r);
+to_xyz_device_processor->applyRGB(g);
+to_xyz_device_processor->applyRGB(b);
 rgb_to_y = make_float3(r[1], g[1], b[1]);
 
 float x[] = {1.0f, 0.0f, 0.0f};
 float y[] = {0.0f, 1.0f, 0.0f};
 float z[] = {0.0f, 0.0f, 1.0f};

[Bf-blender-cvs] [1274822d089] tmp-ocio-v2: OCIOv2: Update install_deps

2020-11-25 Thread Jeroen Bakker
Commit: 1274822d0894506d30db139c869927cdf52b9af3
Author: Jeroen Bakker
Date:   Wed Nov 25 15:46:38 2020 +0100
Branches: tmp-ocio-v2
https://developer.blender.org/rB1274822d0894506d30db139c869927cdf52b9af3

OCIOv2: Update install_deps

===

M   build_files/build_environment/install_deps.sh

===

diff --git a/build_files/build_environment/install_deps.sh 
b/build_files/build_environment/install_deps.sh
index c065b48f6ea..db2a0a4a2ba 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -419,10 +419,10 @@ TBB_FORCE_BUILD=false
 TBB_FORCE_REBUILD=false
 TBB_SKIP=false
 
-OCIO_VERSION="1.1.1"
-OCIO_VERSION_SHORT="1.1"
-OCIO_VERSION_MIN="1.0"
-OCIO_VERSION_MAX="1.2"
+OCIO_VERSION="2.0.0-beta1"
+OCIO_VERSION_SHORT="2.0"
+OCIO_VERSION_MIN="2.0"
+OCIO_VERSION_MAX="2.0"
 OCIO_FORCE_BUILD=false
 OCIO_FORCE_REBUILD=false
 OCIO_SKIP=false
@@ -1808,8 +1808,8 @@ compile_OCIO() {
 cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
 cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
 cmake_d="$cmake_d -D OCIO_BUILD_APPS=OFF"
-cmake_d="$cmake_d -D OCIO_BUILD_PYGLUE=OFF"
-cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
+cmake_d="$cmake_d -D OCIO_BUILD_PYTHON=OFF"
+cmake_d="$cmake_d -D OCIO_BUILD_GPU_TESTS=OFF"
 
 if file /bin/cp | grep -q '32-bit'; then
   cflags="-fPIC -m32 -march=i686"

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


[Bf-blender-cvs] [d344d25b7bd] geometry-nodes: Geometry Nodes: simplify Attribute Math node by using a new abstraction

2020-11-25 Thread Jacques Lucke
Commit: d344d25b7bdbf85de7b7c64805604a412089ae17
Author: Jacques Lucke
Date:   Wed Nov 25 15:40:33 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rBd344d25b7bdbf85de7b7c64805604a412089ae17

Geometry Nodes: simplify Attribute Math node by using a new abstraction

===

M   source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc 
b/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc
index 810bc6734f6..d8c2b75a0a9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc
@@ -26,6 +26,8 @@
 #include "DNA_mesh_types.h"
 #include "DNA_pointcloud_types.h"
 
+#include "NOD_math_functions.hh"
+
 static bNodeSocketTemplate geo_node_attribute_math_in[] = {
 {SOCK_GEOMETRY, N_("Geometry")},
 {SOCK_STRING, N_("Attribute A")},
@@ -64,221 +66,70 @@ static void geo_node_random_attribute_update(bNodeTree 
*UNUSED(ntree), bNode *no
 
 namespace blender::nodes {
 
-/**
- * Do implicit conversion from other attribute types to float.
- */
-static Array attribute_ensure_float_type(ReadAttributePtr attribute)
-{
-  Array array(attribute->size());
-  if (attribute->cpp_type().is()) {
-FloatReadAttribute float_attribute = std::move(attribute);
-for (const int i : IndexRange(float_attribute.size())) {
-  array[i] = float_attribute[i];
-}
-  }
-  else if (attribute->cpp_type().is()) {
-Float3ReadAttribute float3_attribute = std::move(attribute);
-for (const int i : IndexRange(float3_attribute.size())) {
-  array[i] = float3_attribute[i].length();
-}
-  }
-#if 0 /* More CPP types to support in the future. */
-  else if (attribute->cpp_type().is()) {
-  }
-  else if (attribute->cpp_type().is()) {
-  }
-  else if (attribute->cpp_type().is()) {
-  }
-#endif
-
-  return array;
-}
-
-static void math_operation_attribute_float(Array input_a,
-   float input_b,
-   FloatWriteAttribute float_attribute,
-   const int operation)
+static void do_math_operation(const FloatReadAttribute _a,
+  const FloatReadAttribute _b,
+  FloatWriteAttribute result,
+  const int operation)
 {
-  switch (operation) {
-case NODE_MATH_ADD:
-  for (const int i : IndexRange(input_a.size())) {
-float_attribute.set(i, input_a[i] + input_b);
-  }
-  break;
-case NODE_MATH_SUBTRACT:
-  for (const int i : IndexRange(input_a.size())) {
-float_attribute.set(i, input_a[i] - input_b);
-  }
-  break;
-case NODE_MATH_MULTIPLY:
-  for (const int i : IndexRange(input_a.size())) {
-float_attribute.set(i, input_a[i] * input_b);
-  }
-  break;
-case NODE_MATH_DIVIDE:
-  /* Protect against division by zero. */
-  if (input_b == 0.0f) {
-for (const int i : IndexRange(input_a.size())) {
-  float_attribute.set(i, 0.0f);
-}
-  }
-  else {
-for (const int i : IndexRange(input_a.size())) {
-  float_attribute.set(i, input_a[i] / input_b);
+  const int size = input_a.size();
+
+  bool success = try_dispatch_float_math_fl_fl_to_fl(
+  operation, [&](auto math_function, const FloatMathOperationInfo 
(info)) {
+for (const int i : IndexRange(size)) {
+  const float in1 = input_a[i];
+  const float in2 = input_b[i];
+  const float out = math_function(in1, in2);
+  result.set(i, out);
 }
-  }
-  break;
-  }
-}
+  });
 
-static void math_operation_float_attribute(float input_a,
-   Array input_b,
-   FloatWriteAttribute float_attribute,
-   const int operation)
-{
-  switch (operation) {
-case NODE_MATH_ADD:
-  for (const int i : IndexRange(float_attribute.size())) {
-float_attribute.set(i, input_a + input_b[i]);
-  }
-  break;
-case NODE_MATH_SUBTRACT:
-  for (const int i : IndexRange(float_attribute.size())) {
-float_attribute.set(i, input_a - input_b[i]);
-  }
-  break;
-case NODE_MATH_MULTIPLY:
-  for (const int i : IndexRange(float_attribute.size())) {
-float_attribute.set(i, input_a * input_b[i]);
-  }
-  break;
-case NODE_MATH_DIVIDE:
-  for (const int i : IndexRange(float_attribute.size())) {
-/* Protect against division by zero. */
-float_attribute.set(i, safe_divide(input_a, input_b[i]));
-  }
-  break;
-  }
-}
-
-static void math_operation_attribute_attribute(Array input_a,
- 

[Bf-blender-cvs] [044def82b9c] geometry-nodes: Geometry Nodes: add utility method to create a dummy attribute reader

2020-11-25 Thread Jacques Lucke
Commit: 044def82b9cd7fb6dc4ce5a923a68a985e257dc6
Author: Jacques Lucke
Date:   Wed Nov 25 15:31:56 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB044def82b9cd7fb6dc4ce5a923a68a985e257dc6

Geometry Nodes: add utility method to create a dummy attribute reader

This can be used when instead of an actual attribute, a constant value
should be used.

===

M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/intern/attribute_access.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
index 1e5a4d3c543..284c9ae4c9f 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -152,6 +152,21 @@ class GeometryComponent {
 return this->attribute_get_for_read(attribute_name, domain, type, 
_value);
   }
 
+  /* Get a read-only dummy attribute that always returns the same value. */
+  blender::bke::ReadAttributePtr attribute_get_constant_for_read(const 
AttributeDomain domain,
+ const 
CustomDataType data_type,
+ const void 
*value) const;
+
+  /* Get a read-only dummy attribute that always returns the same value. */
+  template
+  blender::bke::TypedReadAttribute attribute_get_constant_for_read(const 
AttributeDomain domain,
+  const T 
) const
+  {
+const blender::fn::CPPType _type = blender::fn::CPPType::get();
+const CustomDataType type = 
blender::bke::cpp_type_to_custom_data_type(cpp_type);
+return this->attribute_get_constant_for_read(domain, type, );
+  }
+
   /**
* Returns the attribute with the given parameters if it exists.
* If an exact match does not exist, other attributes with the same name are 
deleted and a new
diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index ad5f7e1a781..c3df7374fb0 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -533,15 +533,21 @@ ReadAttributePtr 
GeometryComponent::attribute_get_for_read(const StringRef attri
   if (attribute) {
 return attribute;
   }
+  return this->attribute_get_constant_for_read(domain, data_type, 
default_value);
+}
 
+blender::bke::ReadAttributePtr 
GeometryComponent::attribute_get_constant_for_read(
+const AttributeDomain domain, const CustomDataType data_type, const void 
*value) const
+{
+  BLI_assert(this->attribute_domain_supported(domain));
   const blender::fn::CPPType *cpp_type = 
blender::bke::custom_data_type_to_cpp_type(data_type);
   BLI_assert(cpp_type != nullptr);
-  if (default_value == nullptr) {
-default_value = cpp_type->default_value();
+  if (value == nullptr) {
+value = cpp_type->default_value();
   }
   const int domain_size = this->attribute_domain_size(domain);
   return std::make_unique(
-  domain, domain_size, *cpp_type, default_value);
+  domain, domain_size, *cpp_type, value);
 }
 
 WriteAttributePtr GeometryComponent::attribute_try_ensure_for_write(const 
StringRef attribute_name,

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


[Bf-blender-cvs] [8742bbd607a] geometry-nodes: Nodes: simplify Math code by using new abstraction layer

2020-11-25 Thread Jacques Lucke
Commit: 8742bbd607a8c8c1f2d99a23d56993fee99cfd26
Author: Jacques Lucke
Date:   Wed Nov 25 15:39:42 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB8742bbd607a8c8c1f2d99a23d56993fee99cfd26

Nodes: simplify Math code by using new abstraction layer

===

M   source/blender/nodes/shader/nodes/node_shader_math.cc

===

diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc 
b/source/blender/nodes/shader/nodes/node_shader_math.cc
index e7bbadfbcb0..f54914ceba9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -23,6 +23,8 @@
 
 #include "node_shader_util.h"
 
+#include "NOD_math_functions.hh"
+
 /*  SCALAR MATH  */
 static bNodeSocketTemplate sh_node_math_in[] = {
 {SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -1.0f, 1.0f, 
PROP_NONE},
@@ -34,93 +36,15 @@ static bNodeSocketTemplate sh_node_math_out[] = 
{{SOCK_FLOAT, N_("Value")}, {-1,
 
 static const char *gpu_shader_get_name(int mode)
 {
-  switch (mode) {
-case NODE_MATH_ADD:
-  return "math_add";
-case NODE_MATH_SUBTRACT:
-  return "math_subtract";
-case NODE_MATH_MULTIPLY:
-  return "math_multiply";
-case NODE_MATH_DIVIDE:
-  return "math_divide";
-case NODE_MATH_MULTIPLY_ADD:
-  return "math_multiply_add";
-
-case NODE_MATH_POWER:
-  return "math_power";
-case NODE_MATH_LOGARITHM:
-  return "math_logarithm";
-case NODE_MATH_EXPONENT:
-  return "math_exponent";
-case NODE_MATH_SQRT:
-  return "math_sqrt";
-case NODE_MATH_INV_SQRT:
-  return "math_inversesqrt";
-case NODE_MATH_ABSOLUTE:
-  return "math_absolute";
-case NODE_MATH_RADIANS:
-  return "math_radians";
-case NODE_MATH_DEGREES:
-  return "math_degrees";
-
-case NODE_MATH_MINIMUM:
-  return "math_minimum";
-case NODE_MATH_MAXIMUM:
-  return "math_maximum";
-case NODE_MATH_LESS_THAN:
-  return "math_less_than";
-case NODE_MATH_GREATER_THAN:
-  return "math_greater_than";
-case NODE_MATH_SIGN:
-  return "math_sign";
-case NODE_MATH_COMPARE:
-  return "math_compare";
-case NODE_MATH_SMOOTH_MIN:
-  return "math_smoothmin";
-case NODE_MATH_SMOOTH_MAX:
-  return "math_smoothmax";
-
-case NODE_MATH_ROUND:
-  return "math_round";
-case NODE_MATH_FLOOR:
-  return "math_floor";
-case NODE_MATH_CEIL:
-  return "math_ceil";
-case NODE_MATH_FRACTION:
-  return "math_fraction";
-case NODE_MATH_MODULO:
-  return "math_modulo";
-case NODE_MATH_TRUNC:
-  return "math_trunc";
-case NODE_MATH_SNAP:
-  return "math_snap";
-case NODE_MATH_WRAP:
-  return "math_wrap";
-case NODE_MATH_PINGPONG:
-  return "math_pingpong";
-
-case NODE_MATH_SINE:
-  return "math_sine";
-case NODE_MATH_COSINE:
-  return "math_cosine";
-case NODE_MATH_TANGENT:
-  return "math_tangent";
-case NODE_MATH_SINH:
-  return "math_sinh";
-case NODE_MATH_COSH:
-  return "math_cosh";
-case NODE_MATH_TANH:
-  return "math_tanh";
-case NODE_MATH_ARCSINE:
-  return "math_arcsine";
-case NODE_MATH_ARCCOSINE:
-  return "math_arccosine";
-case NODE_MATH_ARCTANGENT:
-  return "math_arctangent";
-case NODE_MATH_ARCTAN2:
-  return "math_arctan2";
+  const blender::nodes::FloatMathOperationInfo *info =
+  blender::nodes::get_float_math_operation_info(mode);
+  if (!info) {
+return nullptr;
+  }
+  if (info->shader_name.is_empty()) {
+return nullptr;
   }
-  return nullptr;
+  return info->shader_name.c_str();
 }
 
 static int gpu_shader_math(GPUMaterial *mat,
@@ -149,201 +73,39 @@ static const blender::fn::MultiFunction 
_base_multi_function(
 blender::nodes::NodeMFNetworkBuilder )
 {
   const int mode = builder.bnode().custom1;
-  switch (mode) {
-case NODE_MATH_ADD: {
-  static blender::fn::CustomMF_SI_SI_SO fn{
-  "Add", [](float a, float b) { return a + b; }};
-  return fn;
-}
-case NODE_MATH_SUBTRACT: {
-  static blender::fn::CustomMF_SI_SI_SO fn{
-  "Subtract", [](float a, float b) { return a - b; }};
-  return fn;
-}
-case NODE_MATH_MULTIPLY: {
-  static blender::fn::CustomMF_SI_SI_SO fn{
-  "Multiply", [](float a, float b) { return a * b; }};
-  return fn;
-}
-case NODE_MATH_DIVIDE: {
-  static blender::fn::CustomMF_SI_SI_SO fn{"Divide", 
safe_divide};
-  return fn;
-}
-case NODE_MATH_MULTIPLY_ADD: {
-  static blender::fn::CustomMF_SI_SI_SI_SO fn{
-  "Multiply Add", [](float a, float b, float c) { return a * b + c; }};
-  return fn;
-}
 
-case NODE_MATH_POWER: {
-  static blender::fn::CustomMF_SI_SI_SO fn{"Power", 

[Bf-blender-cvs] [3576e669cbc] geometry-nodes: Nodes: initial abstraction to simplify math node implementations

2020-11-25 Thread Jacques Lucke
Commit: 3576e669cbca2957ed29eb877d9161310374da63
Author: Jacques Lucke
Date:   Wed Nov 25 15:38:08 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB3576e669cbca2957ed29eb877d9161310374da63

Nodes: initial abstraction to simplify math node implementations

Currently, implementing a node that supports math operations requires
you to write a long switch statement. The goal of this abstraction
is to reduce the number of these switch statements.

Note, this commit adds new such long switch cases. However, in the upcoming
commits existing math nodes are updated to use this abstraction, resulting in
less code overall.

===

M   source/blender/nodes/CMakeLists.txt
A   source/blender/nodes/NOD_math_functions.hh
A   source/blender/nodes/intern/math_functions.cc

===

diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index 7115c20cf97..a367f40dca7 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -274,6 +274,7 @@ set(SRC
   texture/node_texture_util.c
 
   intern/derived_node_tree.cc
+  intern/math_functions.cc
   intern/node_common.c
   intern/node_exec.c
   intern/node_geometry_exec.cc
@@ -299,6 +300,7 @@ set(SRC
   NOD_node_tree_ref.hh
   NOD_shader.h
   NOD_geometry.h
+  NOD_math_functions.hh
   NOD_socket.h
   NOD_static_types.h
   NOD_texture.h
diff --git a/source/blender/nodes/NOD_math_functions.hh 
b/source/blender/nodes/NOD_math_functions.hh
new file mode 100644
index 000..70e4174a844
--- /dev/null
+++ b/source/blender/nodes/NOD_math_functions.hh
@@ -0,0 +1,200 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "DNA_node_types.h"
+
+#include "BLI_math_base_safe.h"
+#include "BLI_math_rotation.h"
+#include "BLI_string_ref.hh"
+
+namespace blender::nodes {
+
+struct FloatMathOperationInfo {
+  StringRefNull title_case_name;
+  StringRefNull shader_name;
+
+  FloatMathOperationInfo() = delete;
+  FloatMathOperationInfo(StringRefNull title_case_name, StringRefNull 
shader_name)
+  : title_case_name(title_case_name), shader_name(shader_name)
+  {
+  }
+};
+
+const FloatMathOperationInfo *get_float_math_operation_info(const int 
operation);
+
+/**
+ * This calls the `callback` with two arguments:
+ *  1. The math function that takes a float as input and outputs a new float.
+ *  2. A #FloatMathOperationInfo struct reference.
+ * Returns true when the callback has been called, otherwise false.
+ *
+ * The math function that is passed to the callback is actually a lambda 
function that is different
+ * for every operation. Therefore, if the callback is templated on the math 
function, it will get
+ * instantiated for every operation separately. This has two benefits:
+ *  - The compiler can optimize the callback for every operation separately.
+ *  - A static variable declared in the callback will be generated for every 
operation separately.
+ *
+ * If separate instantiations are not desired, the callback can also take a 
function pointer with
+ * the following signature as input instead: float (*math_function)(float a).
+ */
+template
+inline bool try_dispatch_float_math_fl_to_fl(const int operation, Callback 
&)
+{
+  const FloatMathOperationInfo *info = 
get_float_math_operation_info(operation);
+  if (info == nullptr) {
+return false;
+  }
+
+  /* This is just an utility function to keep the individual cases smaller. */
+  auto dispatch = [&](auto math_function) -> bool {
+callback(math_function, *info);
+return true;
+  };
+
+  switch (operation) {
+case NODE_MATH_EXPONENT:
+  return dispatch([](float a) { return expf(a); });
+case NODE_MATH_SQRT:
+  return dispatch([](float a) { return safe_sqrtf(a); });
+case NODE_MATH_INV_SQRT:
+  return dispatch([](float a) { return safe_inverse_sqrtf(a); });
+case NODE_MATH_ABSOLUTE:
+  return dispatch([](float a) { return fabs(a); });
+case NODE_MATH_RADIANS:
+  return dispatch([](float a) { return (float)DEG2RAD(a); });
+case NODE_MATH_DEGREES:
+  return dispatch([](float a) { return (float)RAD2DEG(a); });
+case NODE_MATH_SIGN:
+  return 

[Bf-blender-cvs] [436fd5663e6] master: Fix T82988: Div by zero with curve deform modifier

2020-11-25 Thread Robert Guetzkow
Commit: 436fd5663e64979d59cacc12323053f860ce39b0
Author: Robert Guetzkow
Date:   Wed Nov 25 14:26:53 2020 +0100
Branches: master
https://developer.blender.org/rB436fd5663e64979d59cacc12323053f860ce39b0

Fix T82988: Div by zero with curve deform modifier

In `calc_curve_deform` a factor is calculated without checking if
the divisior is zero or close to zero. This patch adds the missing
checks and sets the factor to zero if the division shouldn't be
computed.

Reviewed By: mont29

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

===

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

===

diff --git a/source/blender/blenkernel/intern/curve_deform.c 
b/source/blender/blenkernel/intern/curve_deform.c
index 049bd46c434..4725be6d302 100644
--- a/source/blender/blenkernel/intern/curve_deform.c
+++ b/source/blender/blenkernel/intern/curve_deform.c
@@ -163,16 +163,33 @@ static bool calc_curve_deform(
   if (is_neg_axis) {
 index = axis - 3;
 if (cu->flag & CU_STRETCH) {
-  fac = -(co[index] - cd->dmax[index]) / (cd->dmax[index] - 
cd->dmin[index]);
+  const float divisor = cd->dmax[index] - cd->dmin[index];
+  if (LIKELY(divisor > FLT_EPSILON)) {
+fac = -(co[index] - cd->dmax[index]) / divisor;
+  }
+  else {
+fac = 0.0f;
+  }
 }
 else {
-  fac = -(co[index] - cd->dmax[index]) / 
(ob_curve->runtime.curve_cache->path->totdist);
+  if (LIKELY(ob_curve->runtime.curve_cache->path->totdist > FLT_EPSILON)) {
+fac = -(co[index] - cd->dmax[index]) / 
(ob_curve->runtime.curve_cache->path->totdist);
+  }
+  else {
+fac = 0.0f;
+  }
 }
   }
   else {
 index = axis;
 if (cu->flag & CU_STRETCH) {
-  fac = (co[index] - cd->dmin[index]) / (cd->dmax[index] - 
cd->dmin[index]);
+  const float divisor = cd->dmax[index] - cd->dmin[index];
+  if (LIKELY(divisor > FLT_EPSILON)) {
+fac = (co[index] - cd->dmin[index]) / divisor;
+  }
+  else {
+fac = 0.0f;
+  }
 }
 else {
   if (LIKELY(ob_curve->runtime.curve_cache->path->totdist > FLT_EPSILON)) {

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


[Bf-blender-cvs] [f4b1c9e0c05] geometry-nodes-deduplicate-float-math: simplify math node

2020-11-25 Thread Jacques Lucke
Commit: f4b1c9e0c0534acc00279c8b31ebae5fea6b22ce
Author: Jacques Lucke
Date:   Wed Nov 25 13:45:58 2020 +0100
Branches: geometry-nodes-deduplicate-float-math
https://developer.blender.org/rBf4b1c9e0c0534acc00279c8b31ebae5fea6b22ce

simplify math node

===

M   source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc 
b/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc
index 810bc6734f6..d8c2b75a0a9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc
@@ -26,6 +26,8 @@
 #include "DNA_mesh_types.h"
 #include "DNA_pointcloud_types.h"
 
+#include "NOD_math_functions.hh"
+
 static bNodeSocketTemplate geo_node_attribute_math_in[] = {
 {SOCK_GEOMETRY, N_("Geometry")},
 {SOCK_STRING, N_("Attribute A")},
@@ -64,221 +66,70 @@ static void geo_node_random_attribute_update(bNodeTree 
*UNUSED(ntree), bNode *no
 
 namespace blender::nodes {
 
-/**
- * Do implicit conversion from other attribute types to float.
- */
-static Array attribute_ensure_float_type(ReadAttributePtr attribute)
-{
-  Array array(attribute->size());
-  if (attribute->cpp_type().is()) {
-FloatReadAttribute float_attribute = std::move(attribute);
-for (const int i : IndexRange(float_attribute.size())) {
-  array[i] = float_attribute[i];
-}
-  }
-  else if (attribute->cpp_type().is()) {
-Float3ReadAttribute float3_attribute = std::move(attribute);
-for (const int i : IndexRange(float3_attribute.size())) {
-  array[i] = float3_attribute[i].length();
-}
-  }
-#if 0 /* More CPP types to support in the future. */
-  else if (attribute->cpp_type().is()) {
-  }
-  else if (attribute->cpp_type().is()) {
-  }
-  else if (attribute->cpp_type().is()) {
-  }
-#endif
-
-  return array;
-}
-
-static void math_operation_attribute_float(Array input_a,
-   float input_b,
-   FloatWriteAttribute float_attribute,
-   const int operation)
+static void do_math_operation(const FloatReadAttribute _a,
+  const FloatReadAttribute _b,
+  FloatWriteAttribute result,
+  const int operation)
 {
-  switch (operation) {
-case NODE_MATH_ADD:
-  for (const int i : IndexRange(input_a.size())) {
-float_attribute.set(i, input_a[i] + input_b);
-  }
-  break;
-case NODE_MATH_SUBTRACT:
-  for (const int i : IndexRange(input_a.size())) {
-float_attribute.set(i, input_a[i] - input_b);
-  }
-  break;
-case NODE_MATH_MULTIPLY:
-  for (const int i : IndexRange(input_a.size())) {
-float_attribute.set(i, input_a[i] * input_b);
-  }
-  break;
-case NODE_MATH_DIVIDE:
-  /* Protect against division by zero. */
-  if (input_b == 0.0f) {
-for (const int i : IndexRange(input_a.size())) {
-  float_attribute.set(i, 0.0f);
-}
-  }
-  else {
-for (const int i : IndexRange(input_a.size())) {
-  float_attribute.set(i, input_a[i] / input_b);
+  const int size = input_a.size();
+
+  bool success = try_dispatch_float_math_fl_fl_to_fl(
+  operation, [&](auto math_function, const FloatMathOperationInfo 
(info)) {
+for (const int i : IndexRange(size)) {
+  const float in1 = input_a[i];
+  const float in2 = input_b[i];
+  const float out = math_function(in1, in2);
+  result.set(i, out);
 }
-  }
-  break;
-  }
-}
+  });
 
-static void math_operation_float_attribute(float input_a,
-   Array input_b,
-   FloatWriteAttribute float_attribute,
-   const int operation)
-{
-  switch (operation) {
-case NODE_MATH_ADD:
-  for (const int i : IndexRange(float_attribute.size())) {
-float_attribute.set(i, input_a + input_b[i]);
-  }
-  break;
-case NODE_MATH_SUBTRACT:
-  for (const int i : IndexRange(float_attribute.size())) {
-float_attribute.set(i, input_a - input_b[i]);
-  }
-  break;
-case NODE_MATH_MULTIPLY:
-  for (const int i : IndexRange(float_attribute.size())) {
-float_attribute.set(i, input_a * input_b[i]);
-  }
-  break;
-case NODE_MATH_DIVIDE:
-  for (const int i : IndexRange(float_attribute.size())) {
-/* Protect against division by zero. */
-float_attribute.set(i, safe_divide(input_a, input_b[i]));
-  }
-  break;
-  }
-}
-
-static void math_operation_attribute_attribute(Array input_a,
-   Array 

[Bf-blender-cvs] [c8b0fcb1775] geometry-nodes-deduplicate-float-math: support creating constant dummy attributes

2020-11-25 Thread Jacques Lucke
Commit: c8b0fcb1775eb83f998feed4fafc49aa928588b7
Author: Jacques Lucke
Date:   Wed Nov 25 13:07:55 2020 +0100
Branches: geometry-nodes-deduplicate-float-math
https://developer.blender.org/rBc8b0fcb1775eb83f998feed4fafc49aa928588b7

support creating constant dummy attributes

===

M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/intern/attribute_access.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
index 1e5a4d3c543..f7b3a83dc0c 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -152,6 +152,19 @@ class GeometryComponent {
 return this->attribute_get_for_read(attribute_name, domain, type, 
_value);
   }
 
+  blender::bke::ReadAttributePtr attribute_get_constant_for_read(const 
AttributeDomain domain,
+ const 
CustomDataType data_type,
+ const void 
*value) const;
+
+  template
+  blender::bke::TypedReadAttribute attribute_get_constant_for_read(const 
AttributeDomain domain,
+  const T 
) const
+  {
+const blender::fn::CPPType _type = blender::fn::CPPType::get();
+const CustomDataType type = 
blender::bke::cpp_type_to_custom_data_type(cpp_type);
+return this->attribute_get_constant_for_read(domain, type, );
+  }
+
   /**
* Returns the attribute with the given parameters if it exists.
* If an exact match does not exist, other attributes with the same name are 
deleted and a new
diff --git a/source/blender/blenkernel/intern/attribute_access.cc 
b/source/blender/blenkernel/intern/attribute_access.cc
index ad5f7e1a781..c3df7374fb0 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -533,15 +533,21 @@ ReadAttributePtr 
GeometryComponent::attribute_get_for_read(const StringRef attri
   if (attribute) {
 return attribute;
   }
+  return this->attribute_get_constant_for_read(domain, data_type, 
default_value);
+}
 
+blender::bke::ReadAttributePtr 
GeometryComponent::attribute_get_constant_for_read(
+const AttributeDomain domain, const CustomDataType data_type, const void 
*value) const
+{
+  BLI_assert(this->attribute_domain_supported(domain));
   const blender::fn::CPPType *cpp_type = 
blender::bke::custom_data_type_to_cpp_type(data_type);
   BLI_assert(cpp_type != nullptr);
-  if (default_value == nullptr) {
-default_value = cpp_type->default_value();
+  if (value == nullptr) {
+value = cpp_type->default_value();
   }
   const int domain_size = this->attribute_domain_size(domain);
   return std::make_unique(
-  domain, domain_size, *cpp_type, default_value);
+  domain, domain_size, *cpp_type, value);
 }
 
 WriteAttributePtr GeometryComponent::attribute_try_ensure_for_write(const 
StringRef attribute_name,

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


[Bf-blender-cvs] [790cfe022d0] geometry-nodes-deduplicate-float-math: Merge branch 'geometry-nodes' into geometry-nodes-deduplicate-float-math

2020-11-25 Thread Jacques Lucke
Commit: 790cfe022d011cd89b4ede0211bfaa42e58aaeb3
Author: Jacques Lucke
Date:   Wed Nov 25 11:51:24 2020 +0100
Branches: geometry-nodes-deduplicate-float-math
https://developer.blender.org/rB790cfe022d011cd89b4ede0211bfaa42e58aaeb3

Merge branch 'geometry-nodes' into geometry-nodes-deduplicate-float-math

===



===



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


[Bf-blender-cvs] [54d9138a87b] geometry-nodes-deduplicate-float-math: support remaining math functions

2020-11-25 Thread Jacques Lucke
Commit: 54d9138a87b5a14f5332e99c1219c537768d6371
Author: Jacques Lucke
Date:   Wed Nov 25 12:29:10 2020 +0100
Branches: geometry-nodes-deduplicate-float-math
https://developer.blender.org/rB54d9138a87b5a14f5332e99c1219c537768d6371

support remaining math functions

===

M   source/blender/nodes/NOD_math_functions.hh

===

diff --git a/source/blender/nodes/NOD_math_functions.hh 
b/source/blender/nodes/NOD_math_functions.hh
index 70319c032ed..c212fb0bf51 100644
--- a/source/blender/nodes/NOD_math_functions.hh
+++ b/source/blender/nodes/NOD_math_functions.hh
@@ -137,6 +137,8 @@ inline bool try_dispatch_float_math_fl_fl_to_fl(const int 
operation, OpType &
   return dispatch([](float a, float b) { return floorf(safe_divide(a, b)) 
* b; });
 case NODE_MATH_ARCTAN2:
   return dispatch([](float a, float b) { return atan2f(a, b); });
+case NODE_MATH_PINGPONG:
+  return dispatch([](float a, float b) { return pingpongf(a, b); });
   }
   return false;
 }
@@ -161,6 +163,12 @@ inline bool try_dispatch_float_math_fl_fl_fl_to_fl(const 
int operation, OpType &
   return dispatch([](float a, float b, float c) -> float {
 return ((a == b) || (fabsf(a - b) <= fmaxf(c, FLT_EPSILON))) ? 1.0f : 
0.0f;
   });
+case NODE_MATH_SMOOTH_MIN:
+  return dispatch([](float a, float b, float c) { return smoothminf(a, b, 
c); });
+case NODE_MATH_SMOOTH_MAX:
+  return dispatch([](float a, float b, float c) { return -smoothminf(-a, 
-b, -c); });
+case NODE_MATH_WRAP:
+  return dispatch([](float a, float b, float c) { return wrapf(a, b, c); 
});
   }
   return false;
 }

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


[Bf-blender-cvs] [ac229a8f925] geometry-nodes-deduplicate-float-math: Merge branch 'geometry-nodes' into geometry-nodes-deduplicate-float-math

2020-11-25 Thread Jacques Lucke
Commit: ac229a8f9259e00b6ad7861965bc30e53394cf13
Author: Jacques Lucke
Date:   Wed Nov 25 12:28:04 2020 +0100
Branches: geometry-nodes-deduplicate-float-math
https://developer.blender.org/rBac229a8f9259e00b6ad7861965bc30e53394cf13

Merge branch 'geometry-nodes' into geometry-nodes-deduplicate-float-math

===



===



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


[Bf-blender-cvs] [43238861233] master: Atomics: Cleanup, move defines closer to usage

2020-11-25 Thread Sergey Sharybin
Commit: 432388612336bd7b40d4c65ea06f676c0bbb78dc
Author: Sergey Sharybin
Date:   Wed Nov 25 12:37:20 2020 +0100
Branches: master
https://developer.blender.org/rB432388612336bd7b40d4c65ea06f676c0bbb78dc

Atomics: Cleanup, move defines closer to usage

There is a special defines block needed for ARM on Linux. Move it from
public header to an implementation file.

No functional changes.

This is a non-functional part of original fix done by Brecht in D9577.

===

M   intern/atomic/atomic_ops.h
M   intern/atomic/intern/atomic_ops_unix.h

===

diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index 5e89315ebdc..91c6ab9fec5 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -54,16 +54,6 @@
 #ifndef __ATOMIC_OPS_H__
 #define __ATOMIC_OPS_H__
 
-#if defined(__arm__)
-/* Attempt to fix compilation error on Debian armel kernel.
- * arm7 architecture does have both 32 and 64bit atomics, however
- * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
- */
-#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
-#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
-#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
-#endif
-
 #include "intern/atomic_ops_utils.h"
 
 
/**/
diff --git a/intern/atomic/intern/atomic_ops_unix.h 
b/intern/atomic/intern/atomic_ops_unix.h
index e1126cab0c2..3b1b5c072e8 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -49,6 +49,16 @@
 
 #include "atomic_ops_utils.h"
 
+#if defined(__arm__)
+/* Attempt to fix compilation error on Debian armel kernel.
+ * arm7 architecture does have both 32 and 64bit atomics, however
+ * its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
+ */
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_4
+#  define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
+#endif
+
 
/**/
 /* 64-bit operations. */
 #if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8)

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


[Bf-blender-cvs] [4a179e8e3e0] master: Atomics: Fix missing 64bit implementation for 32bit platforms

2020-11-25 Thread Sergey Sharybin
Commit: 4a179e8e3e0fe39b76baa3cba753491a8083de51
Author: Sergey Sharybin
Date:   Wed Nov 25 12:37:32 2020 +0100
Branches: master
https://developer.blender.org/rB4a179e8e3e0fe39b76baa3cba753491a8083de51

Atomics: Fix missing 64bit implementation for 32bit platforms

Blender uses 64bit atomics to manipulate SessionUUID, and these atomics
were not defined on any of 32bit platforms.

While official support is limited to 64bit platforms only, the code
should not make assumptions about bitness or endianess, in terms that
there should be codepaths and fallback (or provision of them) for 32bit
platforms.

This change makes 64bit atomic functions defined for all platforms.
The atomic_test was compiled and successfully tested on i686 and armv7l
platforms. The rest of compilation process of Blender will be very
tedious, so that was not done.

This change is essential, but not necessarily enough to make Blender
compilable on i686 (ability to compile Blender on 32bit platforms was
lost during the 2.91 development).

This is a functional part of original fix done by Brecht in D9577.

===

M   intern/atomic/atomic_ops.h
M   intern/atomic/intern/atomic_ops_msvc.h
M   intern/atomic/intern/atomic_ops_unix.h
M   intern/atomic/tests/atomic_test.cc

===

diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h
index 91c6ab9fec5..e6ca7a105ba 100644
--- a/intern/atomic/atomic_ops.h
+++ b/intern/atomic/atomic_ops.h
@@ -59,7 +59,6 @@
 
/**/
 /* Function prototypes. */
 
-#if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8)
 ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x);
 ATOMIC_INLINE uint64_t atomic_sub_and_fetch_uint64(uint64_t *p, uint64_t x);
 ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x);
@@ -71,7 +70,6 @@ ATOMIC_INLINE int64_t atomic_sub_and_fetch_int64(int64_t *p, 
int64_t x);
 ATOMIC_INLINE int64_t atomic_fetch_and_add_int64(int64_t *p, int64_t x);
 ATOMIC_INLINE int64_t atomic_fetch_and_sub_int64(int64_t *p, int64_t x);
 ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t old, int64_t _new);
-#endif
 
 ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x);
 ATOMIC_INLINE uint32_t atomic_sub_and_fetch_uint32(uint32_t *p, uint32_t x);
diff --git a/intern/atomic/intern/atomic_ops_msvc.h 
b/intern/atomic/intern/atomic_ops_msvc.h
index 9c68d74995d..356140541ba 100644
--- a/intern/atomic/intern/atomic_ops_msvc.h
+++ b/intern/atomic/intern/atomic_ops_msvc.h
@@ -46,7 +46,6 @@
 #endif
 
 /* 64-bit operations. */
-#if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8)
 /* Unsigned */
 ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x)
 {
@@ -98,7 +97,6 @@ ATOMIC_INLINE int64_t atomic_fetch_and_sub_int64(int64_t *p, 
int64_t x)
 {
   return InterlockedExchangeAdd64(p, -x);
 }
-#endif
 
 
/**/
 /* 32-bit operations. */
diff --git a/intern/atomic/intern/atomic_ops_unix.h 
b/intern/atomic/intern/atomic_ops_unix.h
index 3b1b5c072e8..0de9daaaf5f 100644
--- a/intern/atomic/intern/atomic_ops_unix.h
+++ b/intern/atomic/intern/atomic_ops_unix.h
@@ -61,8 +61,7 @@
 
 
/**/
 /* 64-bit operations. */
-#if (LG_SIZEOF_PTR == 8 || LG_SIZEOF_INT == 8)
-#  if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || 
defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
 /* Unsigned */
 ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x)
 {
@@ -115,7 +114,7 @@ ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t 
old, int64_t _new)
   return __sync_val_compare_and_swap(v, old, _new);
 }
 
-#  elif (defined(__amd64__) || defined(__x86_64__))
+#elif (defined(__amd64__) || defined(__x86_64__))
 /* Unsigned */
 ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x)
 {
@@ -189,9 +188,8 @@ ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t 
old, int64_t _new)
   asm volatile("lock; cmpxchgq %2,%1" : "=a"(ret), "+m"(*v) : "r"(_new), 
"0"(old) : "memory");
   return ret;
 }
-#  else
-#error "Missing implementation for 64-bit atomic operations"
-#  endif
+#else
+#  error "Missing implementation for 64-bit atomic operations"
 #endif
 
 
/**/
diff --git a/intern/atomic/tests/atomic_test.cc 
b/intern/atomic/tests/atomic_test.cc
index f52422d0d30..6178b5074a7 100644
--- a/intern/atomic/tests/atomic_test.cc
+++ b/intern/atomic/tests/atomic_test.cc
@@ -14,11 +14,6 @@
 #  endif
 #endif
 
-/* NOTE: it is suboptimal to duplicate same check as in API, but this check is
- * planned 

[Bf-blender-cvs] [92d12741a56] geometry-nodes: Merge branch 'master' into geometry-nodes

2020-11-25 Thread Jacques Lucke
Commit: 92d12741a561a7cd491b837da2b8fda84e6a0a09
Author: Jacques Lucke
Date:   Wed Nov 25 12:27:44 2020 +0100
Branches: geometry-nodes
https://developer.blender.org/rB92d12741a561a7cd491b837da2b8fda84e6a0a09

Merge branch 'master' into geometry-nodes

===



===



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


[Bf-blender-cvs] [1c86d32fa7d] master: Nodes: deduplicate ping pong math operation

2020-11-25 Thread Jacques Lucke
Commit: 1c86d32fa7d4c367370d06b7983410f4c33d58a2
Author: Jacques Lucke
Date:   Wed Nov 25 12:24:32 2020 +0100
Branches: master
https://developer.blender.org/rB1c86d32fa7d4c367370d06b7983410f4c33d58a2

Nodes: deduplicate ping pong math operation

The formula did not change. The only side effect of this change should be
that the compositor node now does not divide by zero in some cases.

===

M   source/blender/blenlib/intern/math_base_inline.c
M   source/blender/compositor/operations/COM_MathBaseOperation.cpp
M   source/blender/nodes/texture/nodes/node_texture_math.c

===

diff --git a/source/blender/blenlib/intern/math_base_inline.c 
b/source/blender/blenlib/intern/math_base_inline.c
index 8cc5c31a4c7..1dc7c21f1d4 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -387,6 +387,14 @@ MINLINE float wrapf(float value, float max, float min)
   return (range != 0.0f) ? value - (range * floorf((value - min) / range)) : 
min;
 }
 
+MINLINE float pingpongf(float value, float scale)
+{
+  if (scale == 0.0f) {
+return 0.0f;
+  }
+  return fabsf(fractf((value - scale) / (scale * 2.0f)) * scale * 2.0f - 
scale);
+}
+
 // Square.
 
 MINLINE int square_s(short a)
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp 
b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index edd5bb6d139..dbec6dd1874 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -671,9 +671,7 @@ void MathPingpongOperation::executePixelSampled(float 
output[4],
   this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
   this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
 
-  output[0] = fabsf(fractf((inputValue1[0] - inputValue2[0]) / (inputValue2[0] 
* 2.0f)) *
-inputValue2[0] * 2.0f -
-inputValue2[0]);
+  output[0] = pingpongf(inputValue1[0], inputValue2[0]);
 
   clampIfNeeded(output);
 }
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c 
b/source/blender/nodes/texture/nodes/node_texture_math.c
index 134a0ebb093..53022c9e120 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -282,12 +282,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, 
bNodeStack **in, shor
 }
 
 case NODE_MATH_PINGPONG: {
-  if (in1 == 0.0f) {
-*out = 0.0f;
-  }
-  else {
-*out = fabsf(fractf((in0 - in1) / (in1 * 2.0f)) * in1 * 2.0f - in1);
-  }
+  *out = pingpongf(in0, in1);
   break;
 }

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


[Bf-blender-cvs] [b50598bc78c] blender-v2.91-release: Docs: 2.91 release description for Linux appdata

2020-11-25 Thread Dalai Felinto
Commit: b50598bc78c74634113b4dc08a024828f5aadc97
Author: Dalai Felinto
Date:   Wed Nov 25 12:06:48 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rBb50598bc78c74634113b4dc08a024828f5aadc97

Docs: 2.91 release description for Linux appdata

===

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

===

diff --git a/release/freedesktop/org.blender.Blender.appdata.xml 
b/release/freedesktop/org.blender.Blender.appdata.xml
index edadf9d7438..33a40a07bf1 100644
--- a/release/freedesktop/org.blender.Blender.appdata.xml
+++ b/release/freedesktop/org.blender.Blender.appdata.xml
@@ -40,6 +40,30 @@
 
 
 
+
+
+New features:
+
+Volume modifiers
+Precise boolean
+Cloth brush collision
+Custom curve bevels
+Grease Pencil image tracer
+Property search and fuzzy search
+
+Enhancements:
+
+Boundary and pose cloth brushes
+Material holdout for Grease Pencil
+Sculpting gestures
+Overrides resync and transform support
+Animation proxy conversion
+Compound shape collision
+Outliner collection colors
+Snappier F-Curves and seamless keyframe insertion
+
+
+
 
 
 New features:

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


[Bf-blender-cvs] [9e77fc533c1] master: Cleanup: remove useless cast.

2020-11-25 Thread Bastien Montagne
Commit: 9e77fc533c1387776900fcc91ed9591f33dd8bf2
Author: Bastien Montagne
Date:   Wed Nov 25 11:19:14 2020 +0100
Branches: master
https://developer.blender.org/rB9e77fc533c1387776900fcc91ed9591f33dd8bf2

Cleanup: remove useless cast.

===

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

===

diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 126063288d8..ccb077d6b82 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -609,7 +609,7 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, 
const char *name)
 return BLI_ghash_lookup(pose->chanhash, (const void *)name);
   }
 
-  return BLI_findstring(&((const bPose *)pose)->chanbase, name, 
offsetof(bPoseChannel, name));
+  return BLI_findstring(>chanbase, name, offsetof(bPoseChannel, name));
 }
 
 /**

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


[Bf-blender-cvs] [0f45cab862b] blender-v2.91-release: Versionbump: Blender 2.91 release

2020-11-25 Thread Jeroen Bakker
Commit: 0f45cab862b88c0ab0ec6878bd782820c277d7df
Author: Jeroen Bakker
Date:   Wed Nov 25 09:34:47 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB0f45cab862b88c0ab0ec6878bd782820c277d7df

Versionbump: Blender 2.91 release

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index cc7270c8ee0..95bc8f39b4f 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -35,7 +35,7 @@ extern "C" {
 /* Blender patch version for bugfix releases. */
 #define BLENDER_VERSION_PATCH 0
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE beta
+#define BLENDER_VERSION_CYCLE release
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION

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


[Bf-blender-cvs] [787af651a7e] blender-v2.91-release: File version bump

2020-11-25 Thread Jeroen Bakker
Commit: 787af651a7ee82a5ba48fbccd1a3e3b66ac74edb
Author: Jeroen Bakker
Date:   Wed Nov 25 09:27:16 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB787af651a7ee82a5ba48fbccd1a3e3b66ac74edb

File version bump

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenloader/intern/versioning_userdef.c

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 741abb50453..cc7270c8ee0 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 9
+#define BLENDER_FILE_SUBVERSION 10
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the 
file
diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index f76fac23e96..bdcab6ecbb3 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -246,6 +246,12 @@ static void do_versions_theme(const UserDef *userdef, 
bTheme *btheme)
 FROM_DEFAULT_V4_UCHAR(space_graph.vertex_active);
   }
 
+  if (!USER_VERSION_ATLEAST(291, 10)) {
+for (int i = 0; i < COLLECTION_COLOR_TOT; ++i) {
+  FROM_DEFAULT_V4_UCHAR(collection_color[i].color);
+}
+  }
+
   /**
* Versioning code until next subversion bump goes here.
*
@@ -257,9 +263,6 @@ static void do_versions_theme(const UserDef *userdef, 
bTheme *btheme)
*/
   {
 /* Keep this block, even when empty. */
-for (int i = 0; i < COLLECTION_COLOR_TOT; ++i) {
-  FROM_DEFAULT_V4_UCHAR(collection_color[i].color);
-}
   }
 
 #undef FROM_DEFAULT_V4_UCHAR

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


[Bf-blender-cvs] [b1533f8fa4b] master: Tracking: Cleanup, de-duplicate implementation of marker lookup

2020-11-25 Thread Sergey Sharybin
Commit: b1533f8fa4b157a1f6d4e383c4e60d384cb6dd97
Author: Sergey Sharybin
Date:   Tue Nov 24 16:29:41 2020 +0100
Branches: master
https://developer.blender.org/rBb1533f8fa4b157a1f6d4e383c4e60d384cb6dd97

Tracking: Cleanup, de-duplicate implementation of marker lookup

The logic was duplicated.

Should be no functional changes. The modified function is expected
to give same exact results for all inputs.

On the "caching last-used track" topic. The code was using last_marker
to allow faster lookup of marker closest to the frame. With this
change it is still the case since the BKE_tracking_marker_get() does
cache last used marker.

===

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

===

diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c 
b/source/blender/blenkernel/intern/tracking_stabilize.c
index d968ac4c03e..6f58416924f 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -270,21 +270,8 @@ static bool is_effectively_disabled(StabContext *ctx,
 
 static int search_closest_marker_index(MovieTrackingTrack *track, int 
ref_frame)
 {
-  MovieTrackingMarker *markers = track->markers;
-  int end = track->markersnr;
-  int i = track->last_marker;
-
-  i = MAX2(0, i);
-  i = MIN2(i, end - 1);
-  for (; i < end - 1 && markers[i].framenr <= ref_frame; i++) {
-/* pass */
-  }
-  for (; 0 < i && markers[i].framenr > ref_frame; i--) {
-/* pass */
-  }
-
-  track->last_marker = i;
-  return i;
+  const MovieTrackingMarker *marker = BKE_tracking_marker_get(track, 
ref_frame);
+  return marker - track->markers;
 }
 
 static void retrieve_next_higher_usable_frame(

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