[Bf-blender-cvs] [1f9d85f56aa] master: Fix cursor drag failing to use click-start

2022-03-08 Thread Campbell Barton
Commit: 1f9d85f56aace91e7958566c446e079b7f1c21c6
Author: Campbell Barton
Date:   Wed Mar 9 17:18:31 2022 +1100
Branches: master
https://developer.blender.org/rB1f9d85f56aace91e7958566c446e079b7f1c21c6

Fix cursor drag failing to use click-start

Error in b8960267dd51f9108b3b49e9b762e6b4d35ae1dc,
the flag was cleared before use.

===

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

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 9810f1cb6ad..bb80109d8c9 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1706,12 +1706,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
 t->launch_event = LEFTMOUSE;
   }
 
-  if (options & CTX_CURSOR) {
-/* Cursor should always use the drag start as the combination of 
click-drag to place & move
- * doesn't work well if the click location isn't used when transforming. */
-t->flag |= T_EVENT_DRAG_START;
-  }
-
   unit_m3(t->spacemtx);
 
   initTransInfo(C, t, op, event);
diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index 776229d66a0..3b9e2a982dc 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -206,6 +206,12 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
 t->obedit_type = -1;
   }
 
+  if (t->options & CTX_CURSOR) {
+/* Cursor should always use the drag start as the combination of 
click-drag to place & move
+ * doesn't work well if the click location isn't used when transforming. */
+t->flag |= T_EVENT_DRAG_START;
+  }
+
   /* Many kinds of transform only use a single handle. */
   if (t->data_container == NULL) {
 t->data_container = MEM_callocN(sizeof(*t->data_container), __func__);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9416004092c] master: Cleanup: use doxygen comments & sections for animation files

2022-03-08 Thread Campbell Barton
Commit: 9416004092c5db4b16e8c3f241f3ae789c8789bc
Author: Campbell Barton
Date:   Wed Mar 9 16:29:22 2022 +1100
Branches: master
https://developer.blender.org/rB9416004092c5db4b16e8c3f241f3ae789c8789bc

Cleanup: use doxygen comments & sections for animation files

===

M   source/blender/editors/animation/anim_intern.h
M   source/blender/editors/animation/keyframing.c
M   source/blender/editors/include/ED_anim_api.h

===

diff --git a/source/blender/editors/animation/anim_intern.h 
b/source/blender/editors/animation/anim_intern.h
index e7277c51cd3..8d8d624c69b 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -14,49 +14,80 @@ extern ListBase builtin_keyingsets;
 
 /* Operator Define Prototypes --- */
 
-/* Main Keyframe Management operators:
- * These handle keyframes management from various spaces. They only make use of
- * Keying Sets.
- */
+/*  */
+/** \name Main Keyframe Management operators
+ *
+ * These handle keyframes management from various spaces.
+ * They only make use of Keying Sets.
+ * \{ */
+
 void ANIM_OT_keyframe_insert(struct wmOperatorType *ot);
 void ANIM_OT_keyframe_delete(struct wmOperatorType *ot);
 void ANIM_OT_keyframe_insert_by_name(struct wmOperatorType *ot);
 void ANIM_OT_keyframe_delete_by_name(struct wmOperatorType *ot);
 
-/* Main Keyframe Management operators:
- * These handle keyframes management from various spaces. They will handle the 
menus
- * required for each space.
- */
+/** \} */
+
+/*  */
+/** \name Main Keyframe Management operators
+ *
+ * These handle keyframes management from various spaces.
+ * They will handle the menus required for each space.
+ * \{ */
+
 void ANIM_OT_keyframe_insert_menu(struct wmOperatorType *ot);
 
 void ANIM_OT_keyframe_delete_v3d(struct wmOperatorType *ot);
 void ANIM_OT_keyframe_clear_v3d(struct wmOperatorType *ot);
 
-/* Keyframe management operators for UI buttons (RMB menu). */
+/** \} */
+
+/*  */
+/** \name Keyframe management operators for UI buttons (RMB menu)
+ * \{ */
+
 void ANIM_OT_keyframe_insert_button(struct wmOperatorType *ot);
 void ANIM_OT_keyframe_delete_button(struct wmOperatorType *ot);
 void ANIM_OT_keyframe_clear_button(struct wmOperatorType *ot);
 
-/* .. */
+/** \} */
+
+/*  */
+/** \name KeyingSet management operators for UI buttons (RMB menu)
+ * \{ */
 
-/* KeyingSet management operators for UI buttons (RMB menu) */
 void ANIM_OT_keyingset_button_add(struct wmOperatorType *ot);
 void ANIM_OT_keyingset_button_remove(struct wmOperatorType *ot);
 
-/* KeyingSet management operators for RNA collections/UI buttons */
+/** \} */
+
+/*  */
+/** \name KeyingSet management operators for RNA collections/UI buttons
+ * \{ */
+
 void ANIM_OT_keying_set_add(struct wmOperatorType *ot);
 void ANIM_OT_keying_set_remove(struct wmOperatorType *ot);
 void ANIM_OT_keying_set_path_add(struct wmOperatorType *ot);
 void ANIM_OT_keying_set_path_remove(struct wmOperatorType *ot);
 
-/* KeyingSet general operators */
+/** \} */
+
+/*  */
+/** \name KeyingSet general operators
+ * \{ */
+
 void ANIM_OT_keying_set_active_set(struct wmOperatorType *ot);
 
-/* .. */
+/** \} */
+
+/*  */
+/** \name Driver management operators for UI buttons (RMB menu)
+ * \{ */
 
-/* Driver management operators for UI buttons (RMB menu) */
 void ANIM_OT_driver_button_add(struct wmOperatorType *ot);
 void ANIM_OT_driver_button_remove(struct wmOperatorType *ot);
 void ANIM_OT_driver_button_edit(struct wmOperatorType *ot);
 void ANIM_OT_copy_driver_button(struct wmOperatorType *ot);
 void ANIM_OT_paste_driver_button(struct wmOperatorType *ot);
+
+/** \} */
diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index feb78ce293e..90c127b620b 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -244,7 +244,7 @@ FCurve *ED_action_fcurve_ensure(struct Main *bmain,
   return fcu;
 }
 
-/* Helper for update_autoflags_fcurve() */
+/** Helper for #update_autoflags_fcurve(). */
 static void update_autoflags_fcurve_direct(FCurve *fcu, PropertyRNA *prop)
 {
   /* set additional flags for the F-Curve (i.e. only integer values) */
@@ -304,7 +304,8 @@ void update_autoflags_fcurve(FCurve *fcu, bContext *C, 
ReportList *reports, Poin
 /* 

[Bf-blender-cvs] [136f0910ff6] master: Fix T96250: Invalid default for uv_relax_method

2022-03-08 Thread Campbell Barton
Commit: 136f0910ff662a74b02c30ae9b79275bc74c8406
Author: Campbell Barton
Date:   Wed Mar 9 16:10:19 2022 +1100
Branches: master
https://developer.blender.org/rB136f0910ff662a74b02c30ae9b79275bc74c8406

Fix T96250: Invalid default for uv_relax_method

Correct the default & version existing files.

===

M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/makesdna/DNA_scene_defaults.h

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 2a840ea585a..32dcb977110 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2578,5 +2578,12 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
*/
   {
 /* Keep this block, even when empty. */
+
+LISTBASE_FOREACH (Scene *, scene, >scenes) {
+  ToolSettings *ts = scene->toolsettings;
+  if (ts->uv_relax_method == 0) {
+ts->uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN;
+  }
+}
   }
 }
diff --git a/source/blender/makesdna/DNA_scene_defaults.h 
b/source/blender/makesdna/DNA_scene_defaults.h
index 82f788e0623..74db1d14bbc 100644
--- a/source/blender/makesdna/DNA_scene_defaults.h
+++ b/source/blender/makesdna/DNA_scene_defaults.h
@@ -360,6 +360,10 @@
 /* GP Stroke Placement */ \
 .gpencil_v3d_align = GP_PROJECT_VIEWSPACE, \
 .gpencil_v2d_align = GP_PROJECT_VIEWSPACE, \
+ \
+/* UV painting */ \
+.uv_sculpt_settings = 0, \
+.uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN, \
   }
 
 /* clang-format off */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [20f53f69849] master: Correct assert in 399ac1ff113e20688f277157ccb3c671648c9b1c

2022-03-08 Thread Campbell Barton
Commit: 20f53f6984997f94def980b71a4e71119dbb147d
Author: Campbell Barton
Date:   Wed Mar 9 13:43:39 2022 +1100
Branches: master
https://developer.blender.org/rB20f53f6984997f94def980b71a4e71119dbb147d

Correct assert in 399ac1ff113e20688f277157ccb3c671648c9b1c

Pass NULL instead of an empty string.

===

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

===

diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index 25b1ccecf2e..feb78ce293e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1958,7 +1958,7 @@ void ANIM_OT_keyframe_insert_by_name(wmOperatorType *ot)
 
   /* keyingset to use (idname) */
   prop = RNA_def_string(
-  ot->srna, "type", "", MAX_ID_NAME - 2, "Keying Set", "The Keying Set to 
use");
+  ot->srna, "type", NULL, MAX_ID_NAME - 2, "Keying Set", "The Keying Set 
to use");
   RNA_def_property_flag(prop, PROP_HIDDEN);
   ot->prop = prop;
 }
@@ -2119,7 +2119,7 @@ void ANIM_OT_keyframe_delete_by_name(wmOperatorType *ot)
 
   /* keyingset to use (idname) */
   prop = RNA_def_string(
-  ot->srna, "type", "", MAX_ID_NAME - 2, "Keying Set", "The Keying Set to 
use");
+  ot->srna, "type", NULL, MAX_ID_NAME - 2, "Keying Set", "The Keying Set 
to use");
   RNA_def_property_flag(prop, PROP_HIDDEN);
   ot->prop = prop;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [399ac1ff113] master: Fix subtype & default for keying set operator properties

2022-03-08 Thread Campbell Barton
Commit: 399ac1ff113e20688f277157ccb3c671648c9b1c
Author: Campbell Barton
Date:   Wed Mar 9 13:19:33 2022 +1100
Branches: master
https://developer.blender.org/rB399ac1ff113e20688f277157ccb3c671648c9b1c

Fix subtype & default for keying set operator properties

Error in 1a12c9edab4ac89c8a87c20ad3a2195d0e681bc8,
also correct descriptions.

===

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

===

diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index a4845de7d7d..25b1ccecf2e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1957,7 +1957,8 @@ void ANIM_OT_keyframe_insert_by_name(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* keyingset to use (idname) */
-  prop = RNA_def_string_file_path(ot->srna, "type", "Type", MAX_ID_NAME - 2, 
"", "");
+  prop = RNA_def_string(
+  ot->srna, "type", "", MAX_ID_NAME - 2, "Keying Set", "The Keying Set to 
use");
   RNA_def_property_flag(prop, PROP_HIDDEN);
   ot->prop = prop;
 }
@@ -2117,7 +2118,8 @@ void ANIM_OT_keyframe_delete_by_name(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* keyingset to use (idname) */
-  prop = RNA_def_string_file_path(ot->srna, "type", "Type", MAX_ID_NAME - 2, 
"", "");
+  prop = RNA_def_string(
+  ot->srna, "type", "", MAX_ID_NAME - 2, "Keying Set", "The Keying Set to 
use");
   RNA_def_property_flag(prop, PROP_HIDDEN);
   ot->prop = prop;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e55f4657f7b] master: Fix T89560: Keymap editor no longer shows keying set dropdown

2022-03-08 Thread Campbell Barton
Commit: e55f4657f7b7ae8ac915eefd633d08ae56bb3574
Author: Campbell Barton
Date:   Wed Mar 9 13:01:05 2022 +1100
Branches: master
https://developer.blender.org/rBe55f4657f7b7ae8ac915eefd633d08ae56bb3574

Fix T89560: Keymap editor no longer shows keying set dropdown

Include built-in keying sets when ANIM_keying_sets_enum_itemf is called
without a context to allow binding keys to built-in keying sets.

===

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

===

diff --git a/source/blender/editors/animation/keyingsets.c 
b/source/blender/editors/animation/keyingsets.c
index 6fcdd21bad8..dcf8835c911 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -715,55 +715,54 @@ const EnumPropertyItem 
*ANIM_keying_sets_enum_itemf(bContext *C,
 PropertyRNA *UNUSED(prop),
 bool *r_free)
 {
-  Scene *scene = CTX_data_scene(C);
   KeyingSet *ks;
   EnumPropertyItem *item = NULL, item_tmp = {0};
   int totitem = 0;
   int i = 0;
 
-  if (C == NULL) {
-return DummyRNA_DEFAULT_items;
-  }
+  if (C != NULL) {
+Scene *scene = CTX_data_scene(C);
+/* active Keying Set
+ * - only include entry if it exists
+ */
+if (scene->active_keyingset) {
+  /* active Keying Set */
+  item_tmp.identifier = "__ACTIVE__";
+  item_tmp.name = "Active Keying Set";
+  item_tmp.value = i;
+  RNA_enum_item_add(, , _tmp);
 
-  /* active Keying Set
-   * - only include entry if it exists
-   */
-  if (scene->active_keyingset) {
-/* active Keying Set */
-item_tmp.identifier = "__ACTIVE__";
-item_tmp.name = "Active Keying Set";
-item_tmp.value = i;
-RNA_enum_item_add(, , _tmp);
-
-/* separator */
-RNA_enum_item_add_separator(, );
-  }
+  /* separator */
+  RNA_enum_item_add_separator(, );
+}
 
-  i++;
+i++;
 
-  /* user-defined Keying Sets
-   * - these are listed in the order in which they were defined for the active 
scene
-   */
-  if (scene->keyingsets.first) {
-for (ks = scene->keyingsets.first; ks; ks = ks->next, i++) {
-  if (ANIM_keyingset_context_ok_poll(C, ks)) {
-item_tmp.identifier = ks->idname;
-item_tmp.name = ks->name;
-item_tmp.description = ks->description;
-item_tmp.value = i;
-RNA_enum_item_add(, , _tmp);
+/* user-defined Keying Sets
+ * - these are listed in the order in which they were defined for the 
active scene
+ */
+if (scene->keyingsets.first) {
+  for (ks = scene->keyingsets.first; ks; ks = ks->next, i++) {
+if (ANIM_keyingset_context_ok_poll(C, ks)) {
+  item_tmp.identifier = ks->idname;
+  item_tmp.name = ks->name;
+  item_tmp.description = ks->description;
+  item_tmp.value = i;
+  RNA_enum_item_add(, , _tmp);
+}
   }
-}
 
-/* separator */
-RNA_enum_item_add_separator(, );
+  /* separator */
+  RNA_enum_item_add_separator(, );
+}
   }
 
   /* builtin Keying Sets */
   i = -1;
   for (ks = builtin_keyingsets.first; ks; ks = ks->next, i--) {
-/* only show KeyingSet if context is suitable */
-if (ANIM_keyingset_context_ok_poll(C, ks)) {
+/* Only show #KeyingSet if context is suitable or if there is no context 
which is needed
+ * to support key-bindings to be assigned since key bindings are not 
context aware. */
+if ((C == NULL) || ANIM_keyingset_context_ok_poll(C, ks)) {
   item_tmp.identifier = ks->idname;
   item_tmp.name = ks->name;
   item_tmp.description = ks->description;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [21462565632] master: Cleanup: use ELEM macro

2022-03-08 Thread Campbell Barton
Commit: 21462565632b876ac4eadf2bd30573f2fda70c76
Author: Campbell Barton
Date:   Wed Mar 9 09:35:37 2022 +1100
Branches: master
https://developer.blender.org/rB21462565632b876ac4eadf2bd30573f2fda70c76

Cleanup: use ELEM macro

===

M   source/blender/blenkernel/intern/fluid.c
M   source/blender/blenkernel/intern/gpencil_modifier.c
M   source/blender/blenkernel/intern/idprop.c
M   source/blender/blenkernel/intern/image_gpu.cc
M   source/blender/blenkernel/intern/mask.c
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/spline_bezier.cc
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/blenkernel/intern/writeffmpeg.c
M   source/blender/blenlib/intern/path_util.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/space_file/filelist.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_text/text_draw.c
M   source/blender/editors/transform/transform_convert_mesh.c
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_select.c
M   source/blender/gpu/intern/gpu_vertex_format.cc
M   source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
M   source/blender/makesrna/intern/makesrna.c
M   source/blender/makesrna/intern/rna_camera.c
M   source/blender/makesrna/intern/rna_define.c
M   source/blender/makesrna/intern/rna_dynamicpaint.c
M   source/blender/makesrna/intern/rna_particle.c
M   source/blender/makesrna/intern/rna_rna.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/makesrna/intern/rna_ui.c
M   source/blender/makesrna/intern/rna_xr.c
M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/xr/intern/wm_xr_operators.c
M   source/creator/creator_args.c

===

diff --git a/source/blender/blenkernel/intern/fluid.c 
b/source/blender/blenkernel/intern/fluid.c
index 6f2760e91a6..f85361e94ff 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -1845,8 +1845,8 @@ static void sample_mesh(FluidFlowSettings *ffs,
   const float surface_distance = 1.732;
   nearest.dist_sq = surface_distance * surface_distance; /* find_nearest uses 
squared distance. */
 
-  bool is_gas_flow = (ffs->type == FLUID_FLOW_TYPE_SMOKE || ffs->type == 
FLUID_FLOW_TYPE_FIRE ||
-  ffs->type == FLUID_FLOW_TYPE_SMOKEFIRE);
+  bool is_gas_flow = ELEM(
+  ffs->type, FLUID_FLOW_TYPE_SMOKE, FLUID_FLOW_TYPE_FIRE, 
FLUID_FLOW_TYPE_SMOKEFIRE);
 
   /* Emission strength for gases will be computed below.
* For liquids it's not needed. Just set to non zero value
@@ -2035,8 +2035,7 @@ static void emit_from_mesh_task_cb(void *__restrict 
userdata,
 
   /* Compute emission only for flow objects that produce fluid (i.e. skip 
outflow objects).
* Result in bb->influence. Also computes initial velocities. Result in 
bb->velocity. */
-  if ((data->ffs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY) ||
-  (data->ffs->behavior == FLUID_FLOW_BEHAVIOR_INFLOW)) {
+  if (ELEM(data->ffs->behavior, FLUID_FLOW_BEHAVIOR_GEOMETRY, 
FLUID_FLOW_BEHAVIOR_INFLOW)) {
 sample_mesh(data->ffs,
 data->mvert,
 data->vert_normals,
@@ -2697,8 +2696,8 @@ static bool escape_flowsobject(Object *flowobj,
   bool is_static = is_static_object(flowobj);
 
   bool liquid_flow = ffs->type == FLUID_FLOW_TYPE_LIQUID;
-  bool gas_flow = (ffs->type == FLUID_FLOW_TYPE_SMOKE || ffs->type == 
FLUID_FLOW_TYPE_FIRE ||
-   ffs->type == FLUID_FLOW_TYPE_SMOKEFIRE);
+  bool gas_flow = ELEM(
+  ffs->type, FLUID_FLOW_TYPE_SMOKE, FLUID_FLOW_TYPE_FIRE, 
FLUID_FLOW_TYPE_SMOKEFIRE);
   bool is_geometry = (ffs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY);
 
   bool liquid_domain = fds->type == FLUID_DOMAIN_TYPE_LIQUID;
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c 
b/source/blender/blenkernel/intern/gpencil_modifier.c
index ffc1f2d8774..9c546cc118a 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -196,9 +196,11 @@ bool BKE_gpencil_has_transform_modifiers(Object *ob)
   LISTBASE_FOREACH (GpencilModifierData *, md, >greasepencil_modifiers) {
 /* Only if enabled in edit mode. */
 if (!GPENCIL_MODIFIER_EDIT(md, true) && GPENCIL_MODIFIER_ACTIVE(md, 
false)) {
-  if ((md->type == eGpencilModifierType_Armature) || (md->type == 
eGpencilModifierType_Hook) ||
-  (md->type == eGpencilModifierType_Lattice) ||
-  (md->type == eGpencilModifierType_Offset)) {
+  if (ELEM(md->type,
+   eGpencilModifierType_Armature,
+ 

[Bf-blender-cvs] [626c844105a] master: Cleanup: rename wmEvent.prev_click_* to prev_press_*

2022-03-08 Thread Campbell Barton
Commit: 626c844105afc3b2455f5a1b87ac8a7839a7e0bf
Author: Campbell Barton
Date:   Wed Mar 9 09:01:28 2022 +1100
Branches: master
https://developer.blender.org/rB626c844105afc3b2455f5a1b87ac8a7839a7e0bf

Cleanup: rename wmEvent.prev_click_* to prev_press_*

At the time of naming these members only some event types generated
click events so it made some sense to differentiate a click.

Now all buttons support click & drag it's more logical to use the
prefix "prev_press_" as any press event will set these values.

Also update doc-strings.

===

M   source/blender/editors/sculpt_paint/sculpt_cloth.c
M   source/blender/editors/sculpt_paint/sculpt_filter_color.c
M   source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M   source/blender/makesrna/intern/rna_wm.c
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/intern/wm_event_query.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c 
b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 80ba7601cb1..a4cfb611138 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -1502,7 +1502,7 @@ static int sculpt_cloth_filter_modal(bContext *C, 
wmOperator *op, const wmEvent
 return OPERATOR_RUNNING_MODAL;
   }
 
-  const float len = event->prev_click_xy[0] - event->xy[0];
+  const float len = event->prev_press_xy[0] - event->xy[0];
   filter_strength = filter_strength * -len * 0.001f * UI_DPI_FAC;
 
   SCULPT_vertex_random_access_ensure(ss);
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c 
b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
index 93e2d721962..377f1e0ed32 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
@@ -215,7 +215,7 @@ static int sculpt_color_filter_modal(bContext *C, 
wmOperator *op, const wmEvent
 return OPERATOR_RUNNING_MODAL;
   }
 
-  const float len = event->prev_click_xy[0] - event->xy[0];
+  const float len = event->prev_press_xy[0] - event->xy[0];
   filter_strength = filter_strength * -len * 0.001f;
 
   float fill_color[3];
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c 
b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index ac2c83d3a9c..b73e182fcab 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -606,7 +606,7 @@ static int sculpt_mesh_filter_modal(bContext *C, wmOperator 
*op, const wmEvent *
 return OPERATOR_RUNNING_MODAL;
   }
 
-  const float len = event->prev_click_xy[0] - event->xy[0];
+  const float len = event->prev_press_xy[0] - event->xy[0];
   filter_strength = filter_strength * -len * 0.001f * UI_DPI_FAC;
 
   SCULPT_vertex_random_access_ensure(ss);
diff --git a/source/blender/makesrna/intern/rna_wm.c 
b/source/blender/makesrna/intern/rna_wm.c
index bc879d8254a..a850f8862bc 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -2103,14 +2103,14 @@ static void rna_def_event(BlenderRNA *brna)
   prop, "Mouse Previous Y Position", "The window relative vertical 
location of the mouse");
 
   prop = RNA_def_property(srna, "mouse_prev_press_x", PROP_INT, PROP_NONE);
-  RNA_def_property_int_sdna(prop, NULL, "prev_click_xy[0]");
+  RNA_def_property_int_sdna(prop, NULL, "prev_press_xy[0]");
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_ui_text(prop,
"Mouse Previous X Press Position",
"The window relative horizontal location of the 
last press event");
 
   prop = RNA_def_property(srna, "mouse_prev_press_y", PROP_INT, PROP_NONE);
-  RNA_def_property_int_sdna(prop, NULL, "prev_click_xy[1]");
+  RNA_def_property_int_sdna(prop, NULL, "prev_press_xy[1]");
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_ui_text(prop,
"Mouse Previous Y Press Position",
diff --git a/source/blender/windowmanager/WM_types.h 
b/source/blender/windowmanager/WM_types.h
index 3d8577933cf..8934f714c21 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -238,6 +238,7 @@ enum {
   KM_SHIFT = (1 << 0),
   KM_CTRL = (1 << 1),
   KM_ALT = (1 << 2),
+  /** Use for Windows-Key on MS-Windows, Command-key on macOS and Super on 
Linux. */
   KM_OSKEY = (1 << 3),
 
   /* Used for key-map item creation function arguments. */
@@ -268,7 +269,7 @@ enum {
   KM_CLICK = 3,
   KM_DBL_CLICK = 4,
   /**
-   * \note The cursor location at the point dragging starts is set to 
#wmEvent.prev_click_xy
+   * \note The 

[Bf-blender-cvs] [353376c7833] master: Fix T92331: Duplicated Window Should Not Be Modal

2022-03-08 Thread Harley Acheson
Commit: 353376c783390a158c0a3cedf9887a4df06c7cf1
Author: Harley Acheson
Date:   Tue Mar 8 13:54:19 2022 -0800
Branches: master
https://developer.blender.org/rB353376c783390a158c0a3cedf9887a4df06c7cf1

Fix T92331: Duplicated Window Should Not Be Modal

Operator area_dupli_invoke should not create modal windows.

See D14253 for details.

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

Reviewed by Brecht Van Lommel

===

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

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index ee3bc3cba76..9343f4a3b34 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1421,7 +1421,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
 area->winy,
 SPACE_EMPTY,
 false,
-true,
+false,
 false,
 WIN_ALIGN_ABSOLUTE);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [eb326c7b402] master: Attributes: Implement CustomData interpolation for boolean data type

2022-03-08 Thread Aleksi Juvani
Commit: eb326c7b402e4914e9a619b899a388be7668255b
Author: Aleksi Juvani
Date:   Tue Mar 8 15:51:53 2022 -0600
Branches: master
https://developer.blender.org/rBeb326c7b402e4914e9a619b899a388be7668255b

Attributes: Implement CustomData interpolation for boolean data type

This commit fixes an issue, where for instance, when merging vertices
with the "Merge by Distance" geometry node, the resulting vertices had
their boolean attributes set unpredictably.

Boolean attributes are implemented as custom data, and when welding
vertices, the custom data for the resulting vertices comes from
interpolating the custom data of the source vertices.

This commit implements the missing interpolation function for the
boolean custom data type. This interpolation function is implemented in
terms of the logical or operation, that is to say, if any of the source
vertices (with a weight greater than zero) have the boolean set, the
boolean will also be set on the resulting vertex.

This logic matches 95981c9876483256b28.

In geometry nodes, attribute interpolation generally does not use the
CustomData API for performance reasons, but other areas of Blender
still do.

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

===

M   source/blender/blenkernel/intern/customdata.cc

===

diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 4492f8bbc64..b348e18a6a8 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -1450,6 +1450,21 @@ static bool layerValidate_propfloat2(void *data, const 
uint totitems, const bool
   return has_errors;
 }
 
+static void layerInterp_propbool(const void **sources,
+ const float *weights,
+ const float *UNUSED(sub_weights),
+ int count,
+ void *dest)
+{
+  bool result = false;
+  for (int i = 0; i < count; i++) {
+const float interp_weight = weights[i];
+const bool src = *(const bool *)sources[i];
+result |= src && (interp_weight > 0.0f);
+  }
+  *(bool *)dest = result;
+}
+
 static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 /* 0: CD_MVERT */
 {sizeof(MVert), "MVert", 1, nullptr, nullptr, nullptr, nullptr, nullptr, 
nullptr},
@@ -1838,7 +1853,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
  N_("Boolean"),
  nullptr,
  nullptr,
- nullptr,
+ layerInterp_propbool,
  nullptr,
  nullptr,
  nullptr,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [395e4307db6] tmp_lib_update_32: Merge remote-tracking branch 'origin/master' into tmp_lib_update_32

2022-03-08 Thread Ray Molenkamp
Commit: 395e4307db6c113c62e001991ca3d7cc3ff7736b
Author: Ray Molenkamp
Date:   Tue Mar 8 14:50:21 2022 -0700
Branches: tmp_lib_update_32
https://developer.blender.org/rB395e4307db6c113c62e001991ca3d7cc3ff7736b

Merge remote-tracking branch 'origin/master' into tmp_lib_update_32

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [521d4190a09] master: Fix T96146: Subdivide curve node uninitialized dangling handles

2022-03-08 Thread Hans Goudey
Commit: 521d4190a09b1117f4f729991a0c636be4c2b8f3
Author: Hans Goudey
Date:   Tue Mar 8 15:45:17 2022 -0600
Branches: master
https://developer.blender.org/rB521d4190a09b1117f4f729991a0c636be4c2b8f3

Fix T96146: Subdivide curve node uninitialized dangling handles

Handles of non-cyclic bezier curves were not initialized.
Now properly copy the dangling handle positions and types
from the source curve.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc
index 6456af5f295..371556c04f1 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc
@@ -206,6 +206,10 @@ static void subdivide_bezier_spline(const BezierSpline 
,
   }
   else {
 dst_positions.last() = src_positions.last();
+dst_type_left.first() = src.handle_types_left().first();
+dst_type_right.last() = src.handle_types_right().last();
+dst_handles_left.first() = src_handles_left.first();
+dst_handles_right.last() = src_handles_right.last();
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b8960267dd5] master: Event System: drag events no longer default to the drag start location

2022-03-08 Thread Campbell Barton
Commit: b8960267dd51f9108b3b49e9b762e6b4d35ae1dc
Author: Campbell Barton
Date:   Wed Mar 9 08:36:36 2022 +1100
Branches: master
https://developer.blender.org/rBb8960267dd51f9108b3b49e9b762e6b4d35ae1dc

Event System: drag events no longer default to the drag start location

This avoids transform jumping which is a problem when tweaking values a
small amount. A fix for T40549 was made box-select used the location
when the key was pressed.

While it's important for box-select or any operator where it's expected
the drag-start location is used, this is only needed in some cases.
Since the event stores the click location and the current location,
no longer overwrite the events real location. Operators that depend on
using the drag-start can use this location if they need.

In some cases the region relative cursor location (Event.mval) now needs
to be calculated based on the click location.

- Added `WM_event_drag_start_mval` for convenient access to the region
  relative drag-start location (for drag events).
- Added `WM_event_drag_start_xy` for window relative coordinates.
- Added Python property Event.mouse_prev_click_x/y

Resolves T93599.

Reviewed By: Severin

Ref D14213

===

M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/space_action/action_select.c
M   source/blender/editors/space_graph/graph_select.c
M   source/blender/editors/space_node/node_edit.cc
M   source/blender/editors/space_node/node_relationships.cc
M   source/blender/editors/space_node/node_select.cc
M   source/blender/editors/space_outliner/outliner_dragdrop.cc
M   source/blender/editors/space_outliner/outliner_edit.cc
M   source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M   source/blender/editors/space_view3d/view3d_placement.c
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_generics.c
M   source/blender/makesrna/intern/rna_wm.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
M   source/blender/windowmanager/intern/wm_event_query.c
M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/intern/wm_gesture.c
M   source/blender/windowmanager/intern/wm_operators.c

===

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 8262be163b7..f5fa710067b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -9394,7 +9394,9 @@ static int ui_list_activate_hovered_row(bContext *C,
 }
   }
 
-  const int *mouse_xy = (event->val == KM_CLICK_DRAG) ? event->prev_click_xy : 
event->xy;
+  int mouse_xy[2];
+  WM_event_drag_start_xy(event, mouse_xy);
+
   uiBut *listrow = ui_list_row_find_mouse_over(region, mouse_xy);
   if (listrow) {
 wmOperatorType *custom_activate_optype = 
ui_list->dyn_data->custom_activate_optype;
@@ -9421,7 +9423,9 @@ static bool ui_list_is_hovering_draggable_but(bContext *C,
   const wmEvent *event)
 {
   /* On a tweak event, uses the coordinates from where tweaking was started. */
-  const int *mouse_xy = (event->val == KM_CLICK_DRAG) ? event->prev_click_xy : 
event->xy;
+  int mouse_xy[2];
+  WM_event_drag_start_xy(event, mouse_xy);
+
   const uiBut *hovered_but = ui_but_find_mouse_over_ex(region, mouse_xy, 
false, NULL, NULL);
 
   if (list->dyn_data->custom_drag_optype) {
diff --git a/source/blender/editors/space_action/action_select.c 
b/source/blender/editors/space_action/action_select.c
index 65815983767..b972ccbaf89 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -511,8 +511,12 @@ static int actkeys_box_select_invoke(bContext *C, 
wmOperator *op, const wmEvent
   }
 
   bool tweak = RNA_boolean_get(op->ptr, "tweak");
-  if (tweak && actkeys_is_key_at_position(, event->mval[0], 
event->mval[1])) {
-return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  if (tweak) {
+int mval[2];
+WM_event_drag_start_mval(event, ac.region, mval);
+if (actkeys_is_key_at_position(, mval[0], mval[1])) {
+  return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+}
   }
 
   return WM_gesture_box_invoke(C, op, event);
diff --git a/source/blender/editors/space_graph/graph_select.c 
b/source/blender/editors/space_graph/graph_select.c
index 2ed684c6e97..39b980ac4c3 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -799,7 +799,9 @@ static int graphkeys_box_select_invoke(bContext *C, 
wmOperator *op, const 

[Bf-blender-cvs] [156e07232e7] master: Geometry Nodes: Tiny optimization to UV Sphere primitive

2022-03-08 Thread Hallam Roberts
Commit: 156e07232e79d53fa3f43d4bcfc4b0c4061331e5
Author: Hallam Roberts
Date:   Tue Mar 8 14:39:58 2022 -0600
Branches: master
https://developer.blender.org/rB156e07232e79d53fa3f43d4bcfc4b0c4061331e5

Geometry Nodes: Tiny optimization to UV Sphere primitive

Prevents a few unneeded calls to `std::sin`, with an observed
performance improvement of about 1 percent.

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

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
index 4a09fd8d1d2..4e0e5c7c912 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
@@ -76,10 +76,10 @@ static void calculate_sphere_vertex_data(MutableSpan 
verts,
   int vert_index = 1;
   for (const int ring : IndexRange(1, rings - 1)) {
 const float theta = ring * delta_theta;
+const float sin_theta = std::sin(theta);
 const float z = std::cos(theta);
 for (const int segment : IndexRange(1, segments)) {
   const float phi = segment * delta_phi;
-  const float sin_theta = std::sin(theta);
   const float x = sin_theta * std::cos(phi);
   const float y = sin_theta * std::sin(phi);
   copy_v3_v3(verts[vert_index].co, float3(x, y, z) * radius);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d09695b4dd0] master: Cleanup: Clang tidy

2022-03-08 Thread Hans Goudey
Commit: d09695b4dd0eca917004177d30df9e09d9f8732d
Author: Hans Goudey
Date:   Tue Mar 8 13:28:22 2022 -0600
Branches: master
https://developer.blender.org/rBd09695b4dd0eca917004177d30df9e09d9f8732d

Cleanup: Clang tidy

===

M   source/blender/depsgraph/intern/depsgraph_tag.cc
M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M   source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_select.c

===

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc 
b/source/blender/depsgraph/intern/depsgraph_tag.cc
index b8c85430f06..9551a00cf95 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -483,7 +483,7 @@ void deg_graph_node_tag_zero(Main *bmain,
 if (comp_node->type == NodeType::ANIMATION) {
   continue;
 }
-else if (comp_node->type == NodeType::COPY_ON_WRITE) {
+if (comp_node->type == NodeType::COPY_ON_WRITE) {
   id_node->is_cow_explicitly_tagged = true;
 }
 
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc 
b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index b1635ce6e09..19022d534b2 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -739,7 +739,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
 case ID_GD: {
   bGPdata *gpd_cow = (bGPdata *)id_cow;
   bGPDlayer *gpl = (bGPDlayer *)(gpd_cow->layers.first);
-  if (gpl != NULL && gpl->runtime.gpl_orig == NULL) {
+  if (gpl != nullptr && gpl->runtime.gpl_orig == nullptr) {
 BKE_gpencil_data_update_orig_pointers((bGPdata *)id_orig, gpd_cow);
   }
   break;
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index 4bf81b72c3c..4dee7641623 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -518,7 +518,7 @@ class AddOperation : public CurvesSculptStrokeOperation {
   };
 
  public:
-  ~AddOperation()
+  ~AddOperation() override
   {
 if (old_kdtree_ != nullptr) {
   BLI_kdtree_3d_free(old_kdtree_);
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index 53de7d582b6..04d4da5e62f 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -2348,10 +2348,8 @@ static BIFIconID tree_element_get_icon_from_id(const ID 
*id)
   if (text->filepath == nullptr || (text->flags & TXT_ISMEM)) {
 return ICON_FILE_TEXT;
   }
-  else {
-/* Helps distinguish text-based formats like the file-browser does. */
-return (BIFIconID)ED_file_extension_icon(text->filepath);
-  }
+  /* Helps distinguish text-based formats like the file-browser does. */
+  return (BIFIconID)ED_file_extension_icon(text->filepath);
 }
 case ID_GR:
   return ICON_OUTLINER_COLLECTION;
diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender/editors/uvedit/uvedit_ops.c
index bbf84ee74d7..fe6f9f0d513 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1518,11 +1518,11 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
   BM_face_select_set(em->bm, efa, false);
   break;
 }
-else if (UV_VERT_SEL_TEST(luv, !swap) && (ts->uv_selectmode == 
UV_SELECT_VERTEX)) {
+if (UV_VERT_SEL_TEST(luv, !swap) && (ts->uv_selectmode == 
UV_SELECT_VERTEX)) {
   BM_face_select_set(em->bm, efa, false);
   break;
 }
-else if (ts->uv_selectmode == UV_SELECT_ISLAND) {
+if (ts->uv_selectmode == UV_SELECT_ISLAND) {
   BM_face_select_set(em->bm, efa, false);
   break;
 }
@@ -1533,18 +1533,21 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
   BM_ITER_ELEM (l, , efa, BM_LOOPS_OF_FACE) {
 luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
 if (UV_EDGE_SEL_TEST(luv, !swap) && (ts->uv_selectmode == 
UV_SELECT_EDGE)) {
-  if (em->selectmode == SCE_SELECT_EDGE)
+  if (em->selectmode == SCE_SELECT_EDGE) {
 BM_edge_select_set(em->bm, l->e, false);
+  }
   else {
 BM_vert_select_set(em->bm, l->v, false);
 BM_vert_select_set(em->bm, l->next->v, false);
   }
 }
 else if 

[Bf-blender-cvs] [90c3147e05b] master: Cleanup: Correct comment

2022-03-08 Thread Hans Goudey
Commit: 90c3147e05b31000ad6ca2f9db1d1b0907c7acd6
Author: Hans Goudey
Date:   Tue Mar 8 12:31:21 2022 -0600
Branches: master
https://developer.blender.org/rB90c3147e05b31000ad6ca2f9db1d1b0907c7acd6

Cleanup: Correct comment

Normals aren't stored in custom data anymore, nor are they stored in
MVert for comparisons.

===

M   source/blender/blenkernel/intern/mesh.cc

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 37564f9334f..824c1ab1b90 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -142,11 +142,11 @@ static void mesh_copy_data(Main *bmain, ID *id_dst, const 
ID *id_src, const int
 
   mesh_dst->mselect = (MSelect *)MEM_dupallocN(mesh_dst->mselect);
 
-  /* Set normal layers dirty, since they aren't included in CD_MASK_MESH and 
are therefore not
-   * copied to the destination mesh. Alternatively normal layers could be 
copied if they aren't
-   * dirty, avoiding recomputation in some cases. However, a copied mesh is 
often changed anyway,
-   * so that idea is not clearly better. With proper reference counting, all 
custom data layers
-   * could be copied as the cost would be much lower. */
+  /* Set normal layers dirty. They should be dirty by default on new meshes 
anyway, but being
+   * explicit about it is safer. Alternatively normal layers could be copied 
if they aren't dirty,
+   * avoiding recomputation in some cases. However, a copied mesh is often 
changed anyway, so that
+   * idea is not clearly better. With proper reference counting, all custom 
data layers could be
+   * copied as the cost would be much lower. */
   BKE_mesh_normals_tag_dirty(mesh_dst);
 
   /* TODO: Do we want to add flag to prevent this? */
@@ -510,7 +510,6 @@ static int customdata_compare(
 return MESHCMP_VERTCOMISMATCH;
   }
 }
-/* I don't care about normals, let's just do coordinates. */
   }
   break;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c7ff99b1008] master: Merge branch 'blender-v3.1-release'

2022-03-08 Thread Hans Goudey
Commit: c7ff99b1008f8f88deedb9029e1759e500a8068f
Author: Hans Goudey
Date:   Tue Mar 8 12:19:50 2022 -0600
Branches: master
https://developer.blender.org/rBc7ff99b1008f8f88deedb9029e1759e500a8068f

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c77597cd0e1] blender-v3.1-release: Fix T95843: Invalid mesh runtime data after sculpt undo

2022-03-08 Thread Hans Goudey
Commit: c77597cd0e15f9d7b6f963593b545cc94950eb8d
Author: Hans Goudey
Date:   Tue Mar 8 12:16:20 2022 -0600
Branches: blender-v3.1-release
https://developer.blender.org/rBc77597cd0e15f9d7b6f963593b545cc94950eb8d

Fix T95843: Invalid mesh runtime data after sculpt undo

When the geometry of the sculpt mesh was replaced when restoring from
a full undo step, the runtime data was not cleared (including any
normals, triangulation data, or any other cached derived data).
In the report, only the invalid normals were observed.

The fix is to simply clear these caches. Later they will be reallocated
and recalculated if necessary. Since the whole mesh replaced here
anyway, this should be a safe fix.

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c 
b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 8819496c168..f740f38fdc6 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -47,6 +47,7 @@
 #include "BKE_key.h"
 #include "BKE_main.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_runtime.h"
 #include "BKE_multires.h"
 #include "BKE_object.h"
 #include "BKE_paint.h"
@@ -547,6 +548,8 @@ static void 
sculpt_undo_geometry_restore_data(SculptUndoNodeGeometry *geometry,
   >pdata, >pdata, CD_MASK_MESH.pmask, CD_DUPLICATE, 
geometry->totpoly);
 
   BKE_mesh_update_customdata_pointers(mesh, false);
+
+  BKE_mesh_runtime_clear_cache(mesh);
 }
 
 static void sculpt_undo_geometry_free_data(SculptUndoNodeGeometry *geometry)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ffea47530d8] master: Merge branch 'blender-v3.1-release'

2022-03-08 Thread Thomas Dinges
Commit: ffea47530d868ba5c56ed688417f2260af439712
Author: Thomas Dinges
Date:   Tue Mar 8 18:46:23 2022 +0100
Branches: master
https://developer.blender.org/rBffea47530d868ba5c56ed688417f2260af439712

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7add8163e4b] blender-v3.1-release: Blender 3.1 - version bump -> release

2022-03-08 Thread Thomas Dinges
Commit: 7add8163e4b628767c546dae687333225c78c8c0
Author: Thomas Dinges
Date:   Tue Mar 8 18:36:00 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB7add8163e4b628767c546dae687333225c78c8c0

Blender 3.1 - version bump -> 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 3f290e64447..f97825c6626 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 rc
+#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
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b154b8c6f80] master: Merge branch 'blender-v3.1-release'

2022-03-08 Thread Thomas Dinges
Commit: b154b8c6f801c1bc8d4ea0c141abd5933395d1b0
Author: Thomas Dinges
Date:   Tue Mar 8 18:34:09 2022 +0100
Branches: master
https://developer.blender.org/rBb154b8c6f801c1bc8d4ea0c141abd5933395d1b0

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b217eb73f58] blender-v3.1-release: Licenses: Attribution document for Blender 3.1

2022-03-08 Thread Dalai Felinto
Commit: b217eb73f58dc2a159bd464140fb4900e0c363a9
Author: Dalai Felinto
Date:   Tue Mar 8 18:26:50 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBb217eb73f58dc2a159bd464140fb4900e0c363a9

Licenses: Attribution document for Blender 3.1

===

M   release/license/THIRD-PARTY-LICENSES.txt

===

diff --git a/release/license/THIRD-PARTY-LICENSES.txt 
b/release/license/THIRD-PARTY-LICENSES.txt
index 2bd4ac23d6d..933f03b5564 100644
--- a/release/license/THIRD-PARTY-LICENSES.txt
+++ b/release/license/THIRD-PARTY-LICENSES.txt
@@ -318,7 +318,7 @@ Copyright (c) 2006, Google Inc.
 All rights reserved.
 ** ISPC; version 1.16.0 -- https://github.com/ispc/ispc
 Copyright Intel Corporation
-** NumPy; version 1.21.2 -- https://numpy.org/
+** NumPy; version 1.22.0 -- https://numpy.org/
 Copyright (c) 2005-2021, NumPy Developers.
 ** Open Shading Language; version 1.11.14.1 --
 https://github.com/imageworks/OpenShadingLanguage
@@ -822,7 +822,7 @@ Yoyodyne, Inc., hereby disclaims all copyright interest in 
the program
 ** FFTW; version 3.3.8 -- http://www.fftw.org/
 Copyright (c) 2003, 2007-14 Matteo Frigo
 Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
-** GMP; version 6.2.0 -- https://gmplib.org/
+** GMP; version 6.2.1 -- https://gmplib.org/
 Copyright 1996-2020 Free Software Foundation, Inc.
 ** OpenAL; version 1.20.1 -- http://openal-soft.org
 Copyright (c) 2015, Archontis Politis
@@ -1162,7 +1162,7 @@ Copyright (C) 2003-2021 x264 project
 ** miniLZO; version 2.08 -- http://www.oberhumer.com/opensource/lzo/
 LZO and miniLZO are Copyright (C) 1996-2014 Markus Franz Xaver Oberhumer
 All Rights Reserved.
-** The FreeType Project; version 2.10.2 --
+** The FreeType Project; version 2.11.1 --
 https://sourceforge.net/projects/freetype
 Copyright (C) 1996-2020 by David Turner, Robert Wilhelm, and Werner Lemberg.
 ** X Drag and Drop; version 2000-08-08 --
@@ -1174,7 +1174,7 @@ Project initiators:
 Christoph Lampert 
 Michael Militzer 
 Peter Ross 
-** Zstandard; version 1.5.0 -- https://github.com/facebook/zstd
+** Zstandard; version 1.6.0 -- https://github.com/facebook/zstd
 Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
 
 GNU GENERAL PUBLIC LICENSE
@@ -2956,6 +2956,8 @@ December 9, 2010
 
 --
 
+** Brotli; version 1.0.9 -- https://github.com/google/brotli
+Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
 ** Expat; version 2.2.10 -- https://github.com/libexpat/libexpat/
 Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
 Copyright (c) 2001-2019 Expat maintainers
@@ -3627,7 +3629,7 @@ disclaims all warranties with regard to this software.
 
 --
 
-** Python; version 3.9.7 -- https://www.python.org
+** Python; version 3.10.2 -- https://www.python.org
 Copyright (c) 2001-2021 Python Software Foundation. All rights reserved.
 
 A. HISTORY OF THE SOFTWARE

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c305b88aacb] blender-v3.1-release: Docs: 3.1 release description for Linux appdata

2022-03-08 Thread Thomas Dinges
Commit: c305b88aacb1248cdd82df486954046824da34f6
Author: Thomas Dinges
Date:   Tue Mar 8 16:55:19 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBc305b88aacb1248cdd82df486954046824da34f6

Docs: 3.1 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 4b413f6b38d..12291860050 100644
--- a/release/freedesktop/org.blender.Blender.appdata.xml
+++ b/release/freedesktop/org.blender.Blender.appdata.xml
@@ -40,6 +40,27 @@
 
 
 
+
+
+New features:
+
+GPU acceleration for the Subdivision modifier
+Cycles Metal GPU backend, contributed by Apple
+Point Cloud rendering
+More Geometry Nodes, including extrude mesh
+
+Enhancements:
+
+Faster and less memory usage in geometry nodes
+Grease Pencil Dilate/Contract fill
+Vertex Creasing support
+Faster .obj and .fbx export
+Image editor is able to handle large images
+Python 3.10
+User Interface updates
+
+
+
 
 
 New features:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [50bd8bb175f] master: Cleanup: Remove extra . at the end of RNA string

2022-03-08 Thread Antonio Vazquez
Commit: 50bd8bb175f022df5d3d016d8ac09de5352f3bfa
Author: Antonio Vazquez
Date:   Tue Mar 8 16:55:29 2022 +0100
Branches: master
https://developer.blender.org/rB50bd8bb175f022df5d3d016d8ac09de5352f3bfa

Cleanup: Remove extra . at the end of RNA string

The strings must not end with point.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c 
b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 45f98a2a88b..33c0b29f6d0 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2074,7 +2074,7 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA 
*brna)
"ADDITIVE",
ICON_PARTICLE_PATH,
"Additive",
-   "Builds only new strokes (assuming 'additive' drawing)."},
+   "Builds only new strokes (assuming 'additive' drawing)"},
   {0, NULL, 0, NULL, NULL},
   };

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [62885637fb5] master: Cleanup: Make format

2022-03-08 Thread Antonio Vazquez
Commit: 62885637fb5ffbe81efe0e03a2832c5f65d0f5fe
Author: Antonio Vazquez
Date:   Tue Mar 8 16:41:30 2022 +0100
Branches: master
https://developer.blender.org/rB62885637fb5ffbe81efe0e03a2832c5f65d0f5fe

Cleanup: Make format

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index e0da483310d..6d9d9035c84 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -181,11 +181,8 @@ typedef struct tStrokeBuildDetails {
 } tStrokeBuildDetails;
 
 /* Sequential and additive - Show strokes one after the other. */
-static void build_sequential(BuildGpencilModifierData *mmd,
- bGPdata *gpd,
- bGPDframe *gpf,
- float fac,
- bool additive)
+static void build_sequential(
+BuildGpencilModifierData *mmd, bGPdata *gpd, bGPDframe *gpf, float fac, 
bool additive)
 {
   size_t tot_strokes = BLI_listbase_count(>strokes);
   size_t start_stroke;
@@ -197,15 +194,18 @@ static void build_sequential(BuildGpencilModifierData 
*mmd,
   if (additive) {
 if (gpf->prev) {
   start_stroke = BLI_listbase_count(>prev->strokes);
-} else {
+}
+else {
   start_stroke = 0;
 }
 if (start_stroke <= tot_strokes) {
   tot_strokes = tot_strokes - start_stroke;
-} else {
+}
+else {
   start_stroke = 0;
 }
-  } else {
+  }
+  else {
 start_stroke = 0;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [944122d49f5] master: Cleanup: Use ELEM macro

2022-03-08 Thread Antonio Vazquez
Commit: 944122d49f5c7766bfd353874bdcaf3328079cd4
Author: Antonio Vazquez
Date:   Tue Mar 8 16:44:03 2022 +0100
Branches: master
https://developer.blender.org/rB944122d49f5c7766bfd353874bdcaf3328079cd4

Cleanup: Use ELEM macro

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index 6d9d9035c84..1a69a6a8a38 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -571,7 +571,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
 
   uiItemS(layout);
 
-  if (mode == GP_BUILD_MODE_SEQUENTIAL || mode == GP_BUILD_MODE_CONCURRENT) {
+  if (ELEM(mode, GP_BUILD_MODE_SEQUENTIAL, GP_BUILD_MODE_CONCURRENT)) {
 uiItemR(layout, ptr, "transition", 0, NULL, ICON_NONE);
   }
   row = uiLayoutRow(layout, true);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [57918356780] master: Geometry Nodes: fix spline length node after recent refactor

2022-03-08 Thread Jacques Lucke
Commit: 5791835678067b5656469647990d769249065ee1
Author: Jacques Lucke
Date:   Tue Mar 8 16:09:44 2022 +0100
Branches: master
https://developer.blender.org/rB5791835678067b5656469647990d769249065ee1

Geometry Nodes: fix spline length node after recent refactor

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

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc 
b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
index f952e15fbbe..c3d87055745 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
@@ -25,13 +25,16 @@ static VArray construct_spline_length_gvarray(const 
CurveComponent 
   const std::unique_ptr curve = 
curves_to_curve_eval(*component.get_for_read());
 
   Span splines = curve->splines();
-  auto length_fn = [splines](int i) { return splines[i]->length(); };
+  Array spline_lenghts(splines.size());
+  for (const int i : splines.index_range()) {
+spline_lenghts[i] = splines[i]->length();
+  }
 
   if (domain == ATTR_DOMAIN_CURVE) {
-return VArray::ForFunc(splines.size(), length_fn);
+return VArray::ForContainer(std::move(spline_lenghts));
   }
   if (domain == ATTR_DOMAIN_POINT) {
-VArray length = VArray::ForFunc(splines.size(), length_fn);
+VArray length = 
VArray::ForContainer(std::move(spline_lenghts));
 return component.attribute_try_adapt_domain(
 std::move(length), ATTR_DOMAIN_CURVE, ATTR_DOMAIN_POINT);
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bf73f073568] temp-3d-texturing-brush-b: changes logging.

2022-03-08 Thread Jeroen Bakker
Commit: bf73f07356840471177f5193c69e76ce91e07b18
Author: Jeroen Bakker
Date:   Tue Mar 8 15:58:36 2022 +0100
Branches: temp-3d-texturing-brush-b
https://developer.blender.org/rBbf73f07356840471177f5193c69e76ce91e07b18

changes logging.

===

M   source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc 
b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
index 56dff8a01ae..f83a5de0f43 100644
--- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
@@ -469,6 +469,8 @@ static void init_using_intersection(Object *ob, int 
totnode, PBVHNode **nodes)
   int pixels_added = 0;
   Bucket bucket;
   for (int y_bucket = 0; y_bucket < image_buffer->y; y_bucket += Bucket::Size) 
{
+printf("%d: %d pixels added.\n", y_bucket, 
+pixels_added);
 for (int x_bucket = 0; x_bucket < image_buffer->x; x_bucket += 
Bucket::Size) {
   bucket.entries.clear();
   BLI_rctf_init(,
@@ -476,8 +478,7 @@ static void init_using_intersection(Object *ob, int 
totnode, PBVHNode **nodes)
 float(x_bucket + Bucket::Size) / image_buffer->x,
 float(y_bucket) / image_buffer->y,
 float(y_bucket + Bucket::Size) / image_buffer->y);
-  print_rctf_id();
-  printf("%d pixels already added.\n", pixels_added);
+  // print_rctf_id();
 
   for (int n = 0; n < nodes_to_initialize.size(); n++) {
 PBVHNode *node = nodes_to_initialize[n];
@@ -523,7 +524,7 @@ static void init_using_intersection(Object *ob, int 
totnode, PBVHNode **nodes)
 }
 BKE_pbvh_vertex_iter_end;
   }
-  printf("Loaded %ld entries in bucket\n", bucket.entries.size());
+  // printf("Loaded %ld entries in bucket\n", bucket.entries.size());
   if (bucket.entries.size() == 0) {
 continue;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [85007b186ff] liboverride-systemoverrides: LibOverride: Implement default 'user override' behavior.

2022-03-08 Thread Bastien Montagne
Commit: 85007b186ffdb584c4129d2cace4ef2bf68900ec
Author: Bastien Montagne
Date:   Tue Mar 1 18:02:56 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB85007b186ffdb584c4129d2cace4ef2bf68900ec

LibOverride: Implement default 'user override' behavior.

Implement default behavior to decide which overrides remain 'system'
ones, and which become 'user editable' ones, when creating hierarchy
override from 3DView or the Outliner.

3DView:
If from an Empty-instanced collection, only Armature objects in
that collection are user overrides.
If from a set of selected objects, all overrides created from selected
objects are user overrides.

Outliner:
All override IDs created from selected elements in the Outliner are user
overrides.

===

M   source/blender/editors/object/object_relations.c
M   source/blender/editors/space_outliner/outliner_tools.cc

===

diff --git a/source/blender/editors/object/object_relations.c 
b/source/blender/editors/object/object_relations.c
index 3ecf86d14ed..b2914e0c01f 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -2273,6 +2273,10 @@ static int make_override_library_exec(bContext *C, 
wmOperator *op)
   ID *id_root = NULL;
   bool is_override_instancing_object = false;
 
+  GSet *user_overrides_objects_uuids = BLI_gset_new(
+  BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
+  bool user_overrides_from_selected_objects = false;
+
   if (!ID_IS_LINKED(obact) && obact->instance_collection != NULL &&
   ID_IS_LINKED(obact->instance_collection)) {
 if (!ID_IS_OVERRIDABLE_LIBRARY(obact->instance_collection)) {
@@ -2285,6 +2289,7 @@ static int make_override_library_exec(bContext *C, 
wmOperator *op)
 
 id_root = >instance_collection->id;
 is_override_instancing_object = true;
+user_overrides_from_selected_objects = false;
   }
   else if (!make_override_library_object_overridable_check(bmain, obact)) {
 const int i = RNA_property_enum_get(op->ptr, op->type->prop);
@@ -2309,16 +2314,53 @@ static int make_override_library_exec(bContext *C, 
wmOperator *op)
   return OPERATOR_CANCELLED;
 }
 id_root = >id;
+user_overrides_from_selected_objects = true;
   }
   /* Else, poll func ensures us that ID_IS_LINKED(obact) is true. */
   else {
 id_root = >id;
+user_overrides_from_selected_objects = true;
+  }
+
+  if (user_overrides_from_selected_objects) {
+/* Only selected objects can be 'user overrides'. */
+FOREACH_SELECTED_OBJECT_BEGIN (view_layer, CTX_wm_view3d(C), ob_iter) {
+  BLI_gset_add(user_overrides_objects_uuids, 
POINTER_FROM_UINT(ob_iter->id.session_uuid));
+}
+FOREACH_SELECTED_OBJECT_END;
+  }
+  else {
+/* Only armatures inside the root collection (and their children) can be 
'user overrides'. */
+FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN ((Collection *)id_root, ob_iter) 
{
+  if (ob_iter->type == OB_ARMATURE) {
+BLI_gset_add(user_overrides_objects_uuids, 
POINTER_FROM_UINT(ob_iter->id.session_uuid));
+  }
+}
+FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
   }
 
   BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
 
+  ID *id_root_override;
   const bool success = BKE_lib_override_library_create(
-  bmain, scene, view_layer, NULL, id_root, id_root, >id, NULL);
+  bmain, scene, view_layer, NULL, id_root, id_root, >id, 
_root_override);
+
+  /* Define liboverrides from selected/validated objects as user defined. */
+  ID *id_hierarchy_root_override = 
id_root_override->override_library->hierarchy_root;
+  ID *id_iter;
+  FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
+if (ID_IS_LINKED(id_iter) || !ID_IS_OVERRIDE_LIBRARY_REAL(id_iter) ||
+id_iter->override_library->hierarchy_root != 
id_hierarchy_root_override) {
+  continue;
+}
+if (BLI_gset_haskey(user_overrides_objects_uuids,
+
POINTER_FROM_UINT(id_iter->override_library->reference->session_uuid))) {
+  id_iter->override_library->flag &= 
~IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED;
+}
+  }
+  FOREACH_MAIN_ID_END;
+
+  BLI_gset_free(user_overrides_objects_uuids, NULL);
 
   /* Remove the instance empty from this scene, the items now have an 
overridden collection
* instead. */
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc 
b/source/blender/editors/space_outliner/outliner_tools.cc
index fdefcc6133e..4a12eeccb66 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -31,6 +31,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_ghash.h"
+#include "BLI_set.hh"
 #include "BLI_utildefines.h"
 
 #include "BKE_anim_data.h"
@@ -87,6 +88,8 @@ static CLG_LogRef LOG = {"ed.outliner.tools"};
 
 using namespace blender::ed::outliner;
 
+using blender::Set;
+
 

[Bf-blender-cvs] [9ca9af2ae43] liboverride-systemoverrides: LibOverride: Add hierarchy creation from IDTemplate UI widget.

2022-03-08 Thread Bastien Montagne
Commit: 9ca9af2ae43b127431e40c77e489ff911c5e7914
Author: Bastien Montagne
Date:   Tue Mar 8 15:51:08 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB9ca9af2ae43b127431e40c77e489ff911c5e7914

LibOverride: Add hierarchy creation from IDTemplate UI widget.

This is fairly tricky to perform, since there is often very limited
contextual information available about the 'active' hierarchy to
override.

This commit is a first step, it is expected to handle decently well
cases like obdata (recreating necessary object and collection
hierarchy), at least in most common cases.

===

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

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 43968e2c986..215198656a8 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -13,6 +13,7 @@
 
 #include "DNA_brush_types.h"
 #include "DNA_cachefile_types.h"
+#include "DNA_collection_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_curveprofile_types.h"
 #include "DNA_gpencil_modifier_types.h"
@@ -587,6 +588,252 @@ void UI_context_active_but_prop_get_templateID(bContext 
*C,
   }
 }
 
+static void template_id_liboverride_hierarchy_collection_root_find_recursive(
+Collection *collection,
+const int parent_level,
+Collection **r_collection_parent_best,
+int *r_parent_level_best)
+{
+  if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY_REAL(collection)) {
+return;
+  }
+  if (ID_IS_OVERRIDABLE_LIBRARY(collection) || 
ID_IS_OVERRIDE_LIBRARY_REAL(collection)) {
+if (parent_level > *r_parent_level_best) {
+  *r_parent_level_best = parent_level;
+  *r_collection_parent_best = collection;
+}
+  }
+  for (CollectionParent *iter = collection->parents.first; iter != NULL; iter 
= iter->next) {
+if (iter->collection->id.lib != collection->id.lib && 
ID_IS_LINKED(iter->collection)) {
+  continue;
+}
+template_id_liboverride_hierarchy_collection_root_find_recursive(
+iter->collection, parent_level + 1, r_collection_parent_best, 
r_parent_level_best);
+  }
+}
+
+static void template_id_liboverride_hierarchy_collections_tag_recursive(
+Collection *root_collection, ID *target_id, const bool do_parents)
+{
+  root_collection->id.tag |= LIB_TAG_DOIT;
+
+  /* Tag all local parents of the root collection, so that usages of the root 
collection and other
+   * linked ones can be replaced by the local overrides in those parents too. 
*/
+  if (do_parents) {
+for (CollectionParent *iter = root_collection->parents.first; iter != NULL;
+ iter = iter->next) {
+  if (ID_IS_LINKED(iter->collection)) {
+continue;
+  }
+  iter->collection->id.tag |= LIB_TAG_DOIT;
+}
+  }
+
+  for (CollectionChild *iter = root_collection->children.first; iter != NULL; 
iter = iter->next) {
+if (iter->collection->id.lib != root_collection->id.lib && 
ID_IS_LINKED(root_collection)) {
+  continue;
+}
+if (ID_IS_LINKED(iter->collection) && iter->collection->id.lib != 
target_id->lib) {
+  continue;
+}
+if (GS(target_id->name) == ID_OB &&
+!BKE_collection_has_object_recursive(iter->collection, (Object 
*)target_id)) {
+  continue;
+}
+if (GS(target_id->name) == ID_GR &&
+!BKE_collection_has_collection(iter->collection, (Collection 
*)target_id)) {
+  continue;
+}
+template_id_liboverride_hierarchy_collections_tag_recursive(
+iter->collection, target_id, false);
+  }
+}
+
+static void template_id_liboverride_hierarchy_create(bContext *C,
+ Main *bmain,
+ TemplateID *template_ui,
+ PointerRNA *idptr,
+ const char 
**r_undo_push_label)
+{
+  ID *id = idptr->data;
+  ID *owner_id = template_ui->ptr.owner_id;
+
+  /* If the ID is directly linked, do not try to perform a hierarchy override, 
just override this
+   * single ID, remap this single usage to it, and in case current user is 
already a hierechy
+   * override, add the new override to this hierarchy. */
+  if (ID_IS_OVERRIDABLE_LIBRARY(id) && !ID_IS_LINKED(owner_id)) {
+/* Only remap that specific ID usage to overriding local data-block. */
+ID *override_id = BKE_lib_override_library_create_from_id(bmain, id, 
false);
+if (override_id != NULL) {
+  BKE_main_id_newptr_and_tag_clear(bmain);
+
+  if (GS(override_id->name) == ID_OB) {
+Scene *scene = CTX_data_scene(C);
+if (!BKE_collection_has_object_recursive(scene->master_collection,
+ 

[Bf-blender-cvs] [4fa2e9f121a] liboverride-systemoverrides: LibOverride: Add initial handling of system overrides in creation/duplication/resync code, and some basic do_version.

2022-03-08 Thread Bastien Montagne
Commit: 4fa2e9f121ad8b00c3c277d80d484bc34286cd12
Author: Bastien Montagne
Date:   Wed Feb 23 14:56:42 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB4fa2e9f121ad8b00c3c277d80d484bc34286cd12

LibOverride: Add initial handling of system overrides in 
creation/duplication/resync code, and some basic do_version.

When creating with hierarchies, core code only generates system
overrides, responsibility to define 'user overrides' is then for the
higher-level calling code (Editor/Operator-level).

do_version code uses fairly basic euristics, should be good enough here
though in most cases. and can always be refined later if needed.

===

M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/blenkernel/intern/lib_override_proxy_conversion.c
M   source/blender/blenloader/intern/versioning_300.c

===

diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 5fd3480a7fe..bd1f6272b31 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -121,6 +121,9 @@ IDOverrideLibrary *BKE_lib_override_library_init(ID 
*local_id, ID *reference_id)
   local_id->override_library->reference = reference_id;
   id_us_plus(local_id->override_library->reference);
   local_id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_REFOK;
+  /* By default initialized libioverrides are 'system overrides', higher-level 
code is responsible
+   * to unset this flag for specific IDs. */
+  local_id->override_library->flag |= IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED;
   /* TODO: do we want to add tag or flag to referee to mark it as such? */
   return local_id->override_library;
 }
@@ -299,6 +302,7 @@ ID *BKE_lib_override_library_create_from_id(Main *bmain,
* mess in case there are a lot of hidden, non-instantiated, non-properly 
organized dependencies.
* Ref T94650. */
   local_id->override_library->flag |= IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY;
+  local_id->override_library->flag &= ~IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED;
   local_id->override_library->hierarchy_root = local_id;
 
   if (do_tagged_remap) {
@@ -1621,6 +1625,8 @@ static bool lib_override_library_resync(Main *bmain,
   if (ID_IS_OVERRIDE_LIBRARY_REAL(id_override_new)) {
 BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_override_old));
 
+id_override_new->override_library->flag = 
id_override_old->override_library->flag;
+
 /* Copy over overrides rules from old override ID to new one. */
 BLI_duplicatelist(_override_new->override_library->properties,
   _override_old->override_library->properties);
diff --git a/source/blender/blenkernel/intern/lib_override_proxy_conversion.c 
b/source/blender/blenkernel/intern/lib_override_proxy_conversion.c
index dc164313788..5e9d8e8c4d0 100644
--- a/source/blender/blenkernel/intern/lib_override_proxy_conversion.c
+++ b/source/blender/blenkernel/intern/lib_override_proxy_conversion.c
@@ -62,6 +62,7 @@ bool BKE_lib_override_library_proxy_convert(Main *bmain,
   ob_proxy->proxy->id.tag |= LIB_TAG_DOIT;
   ob_proxy->proxy->id.newid = _proxy->id;
   BKE_lib_override_library_init(_proxy->id, _proxy->proxy->id);
+  ob_proxy->id.override_library->flag &= 
~IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED;
 
   ob_proxy->proxy->proxy_from = NULL;
   ob_proxy->proxy = ob_proxy->proxy_group = NULL;
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 2a840ea585a..684f843441b 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2567,6 +2567,29 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 
+  /* TODO Add actual version check and file version bump before commit. */
+  {
+/* NOTE: This is a fairly rough process, based on very basic euristics. 
Should be enough for a
+ * do_version code though, this is a new optional feature, not a critical 
conversion. */
+ID *id;
+FOREACH_MAIN_ID_BEGIN (bmain, id) {
+  if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) || ID_IS_LINKED(id)) {
+/* Ignore non-real liboverrides, and linked ones. */
+continue;
+  }
+  if (GS(id->name) == ID_OB) {
+/* Never 'lock' an object into a system override for now. */
+continue;
+  }
+  if (BKE_lib_override_library_is_user_edited(id)) {
+/* Do not 'lock' an ID already edited by the user. */
+continue;
+  }
+  id->override_library->flag |= IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED;
+}
+FOREACH_MAIN_ID_END;
+  }
+
   /**
* Versioning code until next subversion bump goes here.
*

___
Bf-blender-cvs mailing list

[Bf-blender-cvs] [57934c34206] liboverride-systemoverrides: LibOverride: Add initial System Override flag.

2022-03-08 Thread Bastien Montagne
Commit: 57934c34206cd717d2f961194fc64b811d75cd69
Author: Bastien Montagne
Date:   Tue Feb 22 17:20:18 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB57934c34206cd717d2f961194fc64b811d75cd69

LibOverride: Add initial System Override flag.

This merely adds the flag, exposes it in RMA, and uses it in some of the
most common 'is editable' checks (RNA, `BASE_EDITABLE` macro...).

Next step: do_version and defining systemoverrides at creation.

===

M   source/blender/blenkernel/BKE_lib_override.h
M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/makesdna/DNA_ID.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_ID.c
M   source/blender/makesrna/intern/rna_access.c

===

diff --git a/source/blender/blenkernel/BKE_lib_override.h 
b/source/blender/blenkernel/BKE_lib_override.h
index 98301ca7a70..daa94031489 100644
--- a/source/blender/blenkernel/BKE_lib_override.h
+++ b/source/blender/blenkernel/BKE_lib_override.h
@@ -64,6 +64,11 @@ void BKE_lib_override_library_free(struct IDOverrideLibrary 
**override, bool do_
  */
 bool BKE_lib_override_library_is_user_edited(struct ID *id);
 
+/**
+ * Check if given ID is a system override.
+ */
+bool BKE_lib_override_library_is_system_defined(struct Main *bmain, struct ID 
*id);
+
 /**
  * Create an overridden local copy of linked reference.
  *
diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 9b7f9d4f36d..5fd3480a7fe 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -275,6 +275,18 @@ bool BKE_lib_override_library_is_user_edited(struct ID *id)
   return false;
 }
 
+bool BKE_lib_override_library_is_system_defined(Main *bmain, ID *id)
+{
+
+  if (ID_IS_OVERRIDE_LIBRARY(id)) {
+ID *override_owner_id;
+lib_override_get(bmain, id, _owner_id);
+return (override_owner_id->override_library->flag & 
IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED) !=
+   0;
+  }
+  return false;
+}
+
 ID *BKE_lib_override_library_create_from_id(Main *bmain,
 ID *reference_id,
 const bool do_tagged_remap)
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 011f3618e15..f00594da80e 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -319,6 +319,11 @@ enum {
* because it was created as an single override, outside of any hierarchy 
consideration).
*/
   IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY = 1 << 0,
+  /**
+   * The override ID is required for the system to work (because of ID 
dependencies), but is not
+   * seen as editable by the user.
+   */
+  IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED = 1 << 1,
 };
 
 /* watch it: Sequence has identical beginning. */
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 512be41ce2c..1ac369a5012 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1994,7 +1994,10 @@ extern const char *RE_engine_id_CYCLES;
((v3d == NULL) || (((1 << (base)->object->type) & 
(v3d)->object_type_exclude_select) == 0)) && \
(((base)->flag & BASE_SELECTABLE) != 0))
 #define BASE_SELECTED(v3d, base) (BASE_VISIBLE(v3d, base) && (((base)->flag & 
BASE_SELECTED) != 0))
-#define BASE_EDITABLE(v3d, base) (BASE_VISIBLE(v3d, base) && 
!ID_IS_LINKED((base)->object))
+#define BASE_EDITABLE(v3d, base) \
+  (BASE_VISIBLE(v3d, base) && !ID_IS_LINKED((base)->object) && \
+   (!ID_IS_OVERRIDE_LIBRARY_REAL((base)->object) || \
+((base)->object->id.override_library->flag & 
IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED) == 0))
 #define BASE_SELECTED_EDITABLE(v3d, base) \
   (BASE_EDITABLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
 
diff --git a/source/blender/makesrna/intern/rna_ID.c 
b/source/blender/makesrna/intern/rna_ID.c
index a9725da7841..f52991c551b 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -1829,6 +1829,15 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
   RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 
IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY);
 
+  prop = RNA_def_boolean(srna,
+ "is_system_override",
+ false,
+ "Is System Override",
+ "Whether this library override exists only for the 
override hierarchy, "
+ "or if it is actually editable by the user");
+  RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
+  

[Bf-blender-cvs] [25c1ff7fc57] liboverride-systemoverrides: LibOverride: make some override properties 'overridable'.

2022-03-08 Thread Bastien Montagne
Commit: 25c1ff7fc57b4b913213221a28bb12b9df657771
Author: Bastien Montagne
Date:   Wed Feb 23 10:39:48 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB25c1ff7fc57b4b913213221a28bb12b9df657771

LibOverride: make some override properties 'overridable'.

The whole liboverride data is still ignored by override diffing etc.,
but some of their flags should be editable (from script and/or advanced
technical/debug UI). So using a weird combination of flags to achieve
this.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_ID.c 
b/source/blender/makesrna/intern/rna_ID.c
index f52991c551b..2bda69bc117 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -1828,6 +1828,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
  "hierarchy, or as a single, isolated and autonomous 
override");
   RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
   RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 
IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY);
+  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
 
   prop = RNA_def_boolean(srna,
  "is_system_override",
@@ -1837,6 +1838,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
  "or if it is actually editable by the user");
   RNA_def_property_update(prop, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", 
IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED);
+  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
 
   prop = RNA_def_collection(srna,
 "properties",
@@ -1992,6 +1994,8 @@ static void rna_def_ID(BlenderRNA *brna)
   prop = RNA_def_pointer(
   srna, "override_library", "IDOverrideLibrary", "Library Override", 
"Library override data");
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_override_flag(prop,
+ PROPOVERRIDE_NO_COMPARISON | 
PROPOVERRIDE_OVERRIDABLE_LIBRARY);
 
   prop = RNA_def_pointer(srna,
  "preview",

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [893a6987593] temp-3d-texturing-brush-b: Improved performance. Still takes minutes to build accelleration structures.

2022-03-08 Thread Jeroen Bakker
Commit: 893a6987593fe9226277da406be21026863d9ded
Author: Jeroen Bakker
Date:   Tue Mar 8 15:51:33 2022 +0100
Branches: temp-3d-texturing-brush-b
https://developer.blender.org/rB893a6987593fe9226277da406be21026863d9ded

Improved performance. Still takes minutes to build accelleration structures.

===

M   source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc 
b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
index de450b061f4..56dff8a01ae 100644
--- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
@@ -53,6 +53,7 @@ struct NodeData {
 
   Vector pixels;
   rcti dirty_region;
+  rctf uv_region;
 
   NodeData()
   {
@@ -449,6 +450,7 @@ static void init_using_intersection(Object *ob, int 
totnode, PBVHNode **nodes)
 }
 node_data = MEM_new(__func__);
 BKE_pbvh_node_texture_paint_data_set(node, node_data, NodeData::free_func);
+BLI_rctf_init_minmax(_data->uv_region);
 nodes_to_initialize.append(node);
   }
   if (nodes_to_initialize.size() == 0) {
@@ -480,6 +482,13 @@ static void init_using_intersection(Object *ob, int 
totnode, PBVHNode **nodes)
   for (int n = 0; n < nodes_to_initialize.size(); n++) {
 PBVHNode *node = nodes_to_initialize[n];
 PBVHVertexIter vd;
+NodeData *node_data = static_cast(BKE_pbvh_node_texture_paint_data_get(node));
+if (BLI_rctf_is_valid(_data->uv_region)) {
+  if (!BLI_rctf_isect(, _data->uv_region, nullptr)) 
{
+continue;
+  }
+}
+
 BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
   MeshElemMap *vert_map = >pmap[vd.index];
   for (int j = 0; j < ss->pmap[vd.index].count; j++) {
@@ -500,6 +509,9 @@ static void init_using_intersection(Object *ob, int 
totnode, PBVHNode **nodes)
   BLI_rctf_do_minmax_v(_bound, v1_uv);
   BLI_rctf_do_minmax_v(_bound, v2_uv);
   BLI_rctf_do_minmax_v(_bound, v3_uv);
+  BLI_rctf_do_minmax_v(_data->uv_region, v1_uv);
+  BLI_rctf_do_minmax_v(_data->uv_region, v2_uv);
+  BLI_rctf_do_minmax_v(_data->uv_region, v3_uv);
 }
 if (BLI_rctf_isect(, _bound, nullptr)) {
   BucketEntry entry;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0cd71774209] temp-3d-texturing-brush-b: Use different rasterization.

2022-03-08 Thread Jeroen Bakker
Commit: 0cd7177420959f6caf6eab08145e32fe085c685f
Author: Jeroen Bakker
Date:   Tue Mar 8 15:17:33 2022 +0100
Branches: temp-3d-texturing-brush-b
https://developer.blender.org/rB0cd7177420959f6caf6eab08145e32fe085c685f

Use different rasterization.

===

M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc

===

diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index f6b334f2175..f19c3c66c9a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3171,6 +3171,10 @@ static void do_brush_action(Sculpt *sd, Object *ob, 
Brush *brush, UnifiedPaintSe
 return;
   }
 
+  if (brush->sculpt_tool == SCULPT_TOOL_TEXTURE_PAINT && type != PBVH_FACES) {
+return;
+  }
+
   /* Build a list of all nodes that are potentially within the brush's area of 
influence */
 
   if (SCULPT_tool_needs_all_pbvh_nodes(brush)) {
@@ -3216,6 +3220,11 @@ static void do_brush_action(Sculpt *sd, Object *ob, 
Brush *brush, UnifiedPaintSe
 }
   }
 
+  if (brush->sculpt_tool == SCULPT_TOOL_TEXTURE_PAINT) {
+/* TODO should perhaps move to higher level doing this per step is not 
needed. */
+SCULPT_init_texture_paint(ob);
+  }
+
   /* For anchored brushes with spherical falloff, we start off with zero 
radius, thus we have no
* PBVH nodes on the first brush step. */
   if (totnode ||
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h 
b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 39aaf4d1276..93bb8fb4fe3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1614,6 +1614,7 @@ void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object 
*ob, PBVHNode **nodes, in
 /* Paint Brush. */
 void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode);
 void SCULPT_do_texture_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, 
int totnode);
+void SCULPT_init_texture_paint(Object *ob);
 void SCULPT_flush_texture_paint(Object *ob);
 
 /* Smear Brush. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc 
b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
index 05708cc47bb..de450b061f4 100644
--- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc
@@ -60,20 +60,18 @@ struct NodeData {
 BLI_rcti_init_minmax(_region);
   }
 
-  void init_pixels(Object *ob, PBVHNode *node, ImBuf *image_buffer);
+  void init_pixels_rasterization(Object *ob, PBVHNode *node, ImBuf 
*image_buffer);
+
   void flush(ImBuf _buffer)
   {
 flags.dirty = false;
-int pixels_flushed = 0;
 for (PixelData  : pixels) {
   if (pixel.flags.dirty) {
 const int pixel_offset = (pixel.pixel_pos[1] * image_buffer.x + 
pixel.pixel_pos[0]) * 4;
 copy_v4_v4(_buffer.rect_float[pixel_offset], pixel.content);
 pixel.flags.dirty = false;
-pixels_flushed += 1;
   }
 }
-printf("%s: %d pixels flushed\n", __func__, pixels_flushed);
   }
 
   void mark_region(Image , ImBuf _buffer)
@@ -198,9 +196,8 @@ using RasterizerType = Rasterizer(ob->data);
   MLoopUV *ldata_uv = static_cast(CustomData_get_layer(>ldata, CD_MLOOPUV));
   if (ldata_uv == nullptr) {
@@ -228,7 +225,6 @@ void NodeData::init_pixels(Object *ob, PBVHNode *node, 
ImBuf *image_buffer)
   }
 
   const MLoop *loopstart = >mloop[p->loopstart];
-
   for (int triangle = 0; triangle < p->totloop - 2; triangle++) {
 const int v1_index = loopstart[0].v;
 const int v2_index = loopstart[triangle + 1].v;
@@ -264,6 +260,7 @@ static void do_task_cb_ex(void *__restrict userdata,
   const Brush *brush = data->brush;
   PBVHNode *node = data->nodes[n];
   NodeData *node_data = static_cast(BKE_pbvh_node_texture_paint_data_get(node));
+  BLI_assert(node_data != nullptr);
 
   SculptBrushTest test;
   SculptBrushTestFn sculpt_brush_test_sq_fn = 
SCULPT_brush_test_init_with_falloff_shape(
@@ -275,10 +272,274 @@ static void do_task_cb_ex(void *__restrict userdata,
 }
 const float falloff_strength = BKE_brush_curve_strength(brush, 
sqrtf(test.dist), test.radius);
 interp_v3_v3v3(pixel.content, pixel.content, brush->rgb, falloff_strength);
+pixel.content[3] = 1.0f;
 pixel.flags.dirty = true;
 BLI_rcti_do_minmax_v(_data->dirty_region, pixel.pixel_pos);
+node_data->flags.dirty = true;
   }
-  node_data->flags.dirty = true;
+}
+
+static void init_rasterization_task_cb_ex(void *__restrict userdata,
+  const int n,
+  const TaskParallelTLS *__restrict 

[Bf-blender-cvs] [7bd3762b7cf] master: UI: Minor tweaks to IDTemplate operations.

2022-03-08 Thread Bastien Montagne
Commit: 7bd3762b7cfc13336b08ac5915e21f1842b7ba24
Author: Bastien Montagne
Date:   Tue Mar 8 14:57:09 2022 +0100
Branches: master
https://developer.blender.org/rB7bd3762b7cfc13336b08ac5915e21f1842b7ba24

UI: Minor tweaks to IDTemplate operations.

===

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

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 32b3bb5e926..43968e2c986 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -686,7 +686,7 @@ static void template_id_cb(bContext *C, void *arg_litem, 
void *arg_event)
 idptr = RNA_property_pointer_get(_ui->ptr, template_ui->prop);
 RNA_property_pointer_set(_ui->ptr, template_ui->prop, idptr, 
NULL);
 RNA_property_update(C, _ui->ptr, template_ui->prop);
-undo_push_label = "Override Data-Block";
+undo_push_label = "Make Local";
   }
   break;
 case UI_ID_ALONE:
@@ -1004,7 +1004,7 @@ static void template_ID(const bContext *C,
   UI_but_flag_enable(but, UI_BUT_REDALERT);
 }
 
-if (id->lib) {
+if (ID_IS_LINKED(id)) {
   if (id->tag & LIB_TAG_INDIRECT) {
 but = uiDefIconBut(block,
UI_BTYPE_BUT,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [bea7d2e22da] master: LibOverride: Do not assert when root ID is not object/collection.

2022-03-08 Thread Bastien Montagne
Commit: bea7d2e22dae905f7b57d3aeb1436e5a959fa976
Author: Bastien Montagne
Date:   Tue Mar 8 14:56:30 2022 +0100
Branches: master
https://developer.blender.org/rBbea7d2e22dae905f7b57d3aeb1436e5a959fa976

LibOverride: Do not assert when root ID is not object/collection.

While uncommon, this is still a valid case...

===

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

===

diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 392af2c9f5b..9b7f9d4f36d 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -1063,7 +1063,7 @@ static void lib_override_library_create_post_process(Main 
*bmain,
 break;
   }
   default:
-BLI_assert(0);
+break;
 }
   }
   if (default_instantiating_collection == NULL) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [178f4fa71eb] master: Cleanup: fix compiler warning

2022-03-08 Thread Brecht Van Lommel
Commit: 178f4fa71ebec87993094184ddfb98b7e6f74a86
Author: Brecht Van Lommel
Date:   Tue Mar 8 12:29:57 2022 +0100
Branches: master
https://developer.blender.org/rB178f4fa71ebec87993094184ddfb98b7e6f74a86

Cleanup: fix compiler warning

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
index 874e29dda86..2fb9f724130 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
@@ -176,7 +176,7 @@ static void node_geo_exec(GeoNodeExecParams params)
   const GeometryNodeCurvePrimitiveCircleMode mode = 
(GeometryNodeCurvePrimitiveCircleMode)
 storage.mode;
 
-  Curves *curves;
+  Curves *curves = nullptr;
   if (mode == GEO_NODE_CURVE_PRIMITIVE_CIRCLE_TYPE_POINTS) {
 float3 center_point;
 curves = create_point_circle_curve(params.extract_input("Point 1"),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3cb3167278a] master: Simplify sound property handling

2022-03-08 Thread Richard Antalik
Commit: 3cb3167278a7f9d488b66a7fc591aea8288408e9
Author: Richard Antalik
Date:   Tue Mar 8 13:15:41 2022 +0100
Branches: master
https://developer.blender.org/rB3cb3167278a7f9d488b66a7fc591aea8288408e9

Simplify sound property handling

Sound properties like volume, pitch and muting are handled in
`BKE_sound_add_scene_sound()`. This is unnecessary, because in
properties are then set to real values in `SEQ_edit_update_muting()` and
`seq_update_seq_cb()`.

Alternatively, it may be better to remove all other updates leave them
in `BKE_sound_add_scene_sound()`. But I want to add muting per channel,
whhich is easier and probably cleaner to do with function
`SEQ_edit_update_muting()`.

Reviewed By: sergey

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

===

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

===

diff --git a/source/blender/blenkernel/intern/sound.c 
b/source/blender/blenkernel/intern/sound.c
index fd9735ff07f..8b72fd05057 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -727,16 +727,11 @@ void *BKE_sound_add_scene_sound(
   }
   sound_verify_evaluated_id(>sound->id);
   const double fps = FPS;
-  void *handle = AUD_Sequence_add(scene->sound_scene,
-  sequence->sound->playback_handle,
-  startframe / fps,
-  endframe / fps,
-  frameskip / fps + 
sequence->sound->offset_time);
-  AUD_SequenceEntry_setMuted(handle, (sequence->flag & SEQ_MUTE) != 0);
-  AUD_SequenceEntry_setAnimationData(handle, AUD_AP_VOLUME, CFRA, 
>volume, 0);
-  AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PITCH, CFRA, 
>pitch, 0);
-  AUD_SequenceEntry_setAnimationData(handle, AUD_AP_PANNING, CFRA, 
>pan, 0);
-  return handle;
+  return AUD_Sequence_add(scene->sound_scene,
+  sequence->sound->playback_handle,
+  startframe / fps,
+  endframe / fps,
+  frameskip / fps + sequence->sound->offset_time);
 }
 
 void *BKE_sound_add_scene_sound_defaults(Scene *scene, Sequence *sequence)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [73dc8c24e44] master: PyAPI: optimize depsgraph use in PyDrivers

2022-03-08 Thread Campbell Barton
Commit: 73dc8c24e44ba8b462f88c1c629a84c98979ef41
Author: Campbell Barton
Date:   Tue Mar 8 22:07:59 2022 +1100
Branches: master
https://developer.blender.org/rB73dc8c24e44ba8b462f88c1c629a84c98979ef41

PyAPI: optimize depsgraph use in PyDrivers

Avoid re-creating & freeing the depsgraph for every driver evaluation.

Now the depsgraph is kept in the name-space (matching self),
only re-created when the value changes.

In a contrived test-case with many drivers this gave ~15% overall
speedup for animation playback.

===

M   source/blender/python/intern/bpy_driver.c
M   source/blender/python/intern/bpy_intern_string.c
M   source/blender/python/intern/bpy_intern_string.h

===

diff --git a/source/blender/python/intern/bpy_driver.c 
b/source/blender/python/intern/bpy_driver.c
index e2b6b2bec29..68018d22753 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -162,9 +162,11 @@ static struct {
   /* borrowed reference to the 'self' in 'bpy_pydriver_Dict'
* keep for as long as the same self is used. */
   PyObject *self;
+  BPy_StructRNA *depsgraph;
 } g_pydriver_state_prev = {
 .evaltime = FLT_MAX,
 .self = NULL,
+.depsgraph = NULL,
 };
 
 static void bpy_pydriver_namespace_update_frame(const float evaltime)
@@ -199,6 +201,38 @@ static void bpy_pydriver_namespace_clear_self(void)
   }
 }
 
+static PyObject *bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph 
*depsgraph)
+{
+  struct PointerRNA depsgraph_ptr;
+  RNA_pointer_create(NULL, _Depsgraph, depsgraph, _ptr);
+  return pyrna_struct_CreatePyObject(_ptr);
+}
+
+/**
+ * Adds a variable 'depsgraph' to the name-space. This can then be used to 
obtain evaluated
+ * data-blocks, and the current view layer and scene. See T75553.
+ */
+static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph 
*depsgraph)
+{
+  /* This should never happen, but it's probably better to have None in Python
+   * than a NULL-wrapping Depsgraph Python struct. */
+  BLI_assert(depsgraph != NULL);
+  if (UNLIKELY(depsgraph == NULL)) {
+PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_depsgraph, Py_None);
+g_pydriver_state_prev.depsgraph = NULL;
+return;
+  }
+
+  if ((g_pydriver_state_prev.depsgraph == NULL) ||
+  ((depsgraph != g_pydriver_state_prev.depsgraph->ptr.data))) {
+PyObject *item = bpy_pydriver_depsgraph_as_pyobject(depsgraph);
+PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_depsgraph, item);
+Py_DECREF(item);
+
+g_pydriver_state_prev.depsgraph = (BPy_StructRNA *)item;
+  }
+}
+
 void BPY_driver_reset(void)
 {
   PyGILState_STATE gilstate;
@@ -226,6 +260,7 @@ void BPY_driver_reset(void)
 
   /* freed when clearing driver dict */
   g_pydriver_state_prev.self = NULL;
+  g_pydriver_state_prev.depsgraph = NULL;
 
   if (use_gil) {
 PyGILState_Release(gilstate);
@@ -369,41 +404,6 @@ static bool bpy_driver_secure_bytecode_validate(PyObject 
*expr_code, PyObject *d
 }
 
 #endif /* USE_BYTECODE_WHITELIST */
-
-static PyObject *bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph 
*depsgraph)
-{
-  /* This should never happen, but it's probably better to have None in Python
-   * than a NULL-wrapping Depsgraph py struct. */
-  BLI_assert(depsgraph != NULL);
-  if (depsgraph == NULL) {
-Py_RETURN_NONE;
-  }
-
-  struct PointerRNA depsgraph_ptr;
-  RNA_pointer_create(NULL, _Depsgraph, depsgraph, _ptr);
-  return pyrna_struct_CreatePyObject(_ptr);
-}
-
-/**
- * Adds a variable 'depsgraph' to the driver variables. This can then be used 
to obtain evaluated
- * data-blocks, and the current view layer and scene. See T75553.
- */
-static void bpy_pydriver_namespace_add_depsgraph(PyObject *driver_vars,
- struct Depsgraph *depsgraph)
-{
-  PyObject *py_depsgraph = bpy_pydriver_depsgraph_as_pyobject(depsgraph);
-  const char *depsgraph_variable_name = "depsgraph";
-
-  if (PyDict_SetItemString(driver_vars, depsgraph_variable_name, py_depsgraph) 
== -1) {
-fprintf(stderr,
-"\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n",
-depsgraph_variable_name);
-PyErr_Print();
-PyErr_Clear();
-  }
-  Py_DECREF(py_depsgraph);
-}
-
 float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
   ChannelDriver *driver,
   ChannelDriver *driver_orig,
@@ -489,6 +489,8 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
 bpy_pydriver_namespace_clear_self();
   }
 
+  bpy_pydriver_namespace_update_depsgraph(anim_eval_context->depsgraph);
+
   if (driver_orig->expr_comp == NULL) {
 driver_orig->flag |= DRIVER_FLAG_RECOMPILE;
   }
@@ -613,8 +615,6 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
   }
 #endif /* USE_BYTECODE_WHITELIST */
 
-  bpy_pydriver_namespace_add_depsgraph(driver_vars, 

[Bf-blender-cvs] [f76f48be23e] master: Fix (unreported) liboverride rules from linked data disapearing.

2022-03-08 Thread Bastien Montagne
Commit: f76f48be23e04dbbbe313e428636cfcbcf2be59c
Author: Bastien Montagne
Date:   Tue Mar 8 12:08:21 2022 +0100
Branches: master
https://developer.blender.org/rBf76f48be23e04dbbbe313e428636cfcbcf2be59c

Fix (unreported) liboverride rules from linked data disapearing.

Code cleaning up no-more-needed override data during diffing process
would systematically remove override data from linked IDs.

While this is not a critical issue in theory, it has bad consequences at
the very least on user UI/UX, and potentially can cause bugs in some
corner-cases scenarii.

===

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

===

diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 6a0f3bb5611..392af2c9f5b 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -2979,6 +2979,12 @@ bool 
BKE_lib_override_library_main_operations_create(Main *bmain, const bool for
 id->override_library, IDOVERRIDE_LIBRARY_TAG_UNUSED, false);
   }
 }
+else {
+  /* Clear 'unused' tag for un-processed IDs, otherwise e.g. linked 
overrides will loose their
+   * list of overridden properties. */
+  BKE_lib_override_library_properties_tag(
+  id->override_library, IDOVERRIDE_LIBRARY_TAG_UNUSED, false);
+}
 id->tag &= ~LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH;
   }
   FOREACH_MAIN_ID_END;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0df8c22c8a3] master: LibOverrides: Tweak to ensure no overrides can be created on linked data.

2022-03-08 Thread Bastien Montagne
Commit: 0df8c22c8a369e8dd2d7ad6653556e622f98471b
Author: Bastien Montagne
Date:   Tue Mar 8 11:01:34 2022 +0100
Branches: master
https://developer.blender.org/rB0df8c22c8a369e8dd2d7ad6653556e622f98471b

LibOverrides: Tweak to ensure no overrides can be created on linked data.

Was already mostly the case, but from RNA API there was no proper check.

===

M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/makesrna/intern/rna_ID.c

===

diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 922c1beda38..6a0f3bb5611 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -2854,6 +2854,7 @@ bool BKE_lib_override_library_status_check_reference(Main 
*bmain, ID *local)
 
 bool BKE_lib_override_library_operations_create(Main *bmain, ID *local)
 {
+  BLI_assert(!ID_IS_LINKED(local));
   BLI_assert(local->override_library != NULL);
   const bool is_template = (local->override_library->reference == NULL);
   bool created = false;
diff --git a/source/blender/makesrna/intern/rna_ID.c 
b/source/blender/makesrna/intern/rna_ID.c
index 94ffa330064..a9725da7841 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -744,6 +744,11 @@ static void rna_ID_override_library_operations_update(ID 
*id,
 return;
   }
 
+  if (ID_IS_LINKED(id)) {
+BKE_reportf(reports, RPT_ERROR, "ID '%s' is linked, cannot edit its 
overrides", id->name);
+return;
+  }
+
   BKE_lib_override_library_operations_create(bmain, id);
 
   WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1c1efe3ac60] master: Fix memory leak evaluating PyDrivers

2022-03-08 Thread Campbell Barton
Commit: 1c1efe3ac605b187254377058c93fd34c94aaf9a
Author: Campbell Barton
Date:   Tue Mar 8 20:42:24 2022 +1100
Branches: master
https://developer.blender.org/rB1c1efe3ac605b187254377058c93fd34c94aaf9a

Fix memory leak evaluating PyDrivers

Missed decref in 686ab4c9401a90b22fb17e46c992eb513fe4f693 caused every
driver evaluation to create the BPy_StructRNA depsgraph without freeing
the previously allocated depsgraph.

===

M   source/blender/python/intern/bpy_driver.c

===

diff --git a/source/blender/python/intern/bpy_driver.c 
b/source/blender/python/intern/bpy_driver.c
index 61bb183068d..e2b6b2bec29 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -401,6 +401,7 @@ static void bpy_pydriver_namespace_add_depsgraph(PyObject 
*driver_vars,
 PyErr_Print();
 PyErr_Clear();
   }
+  Py_DECREF(py_depsgraph);
 }
 
 float BPY_driver_exec(struct PathResolvedRNA *anim_rna,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [10c11bb8973] master: Curves: add initial comb, grow and shrink brush

2022-03-08 Thread Jacques Lucke
Commit: 10c11bb89736d19f06131378dc539fb225b9b562
Author: Jacques Lucke
Date:   Tue Mar 8 10:41:52 2022 +0100
Branches: master
https://developer.blender.org/rB10c11bb89736d19f06131378dc539fb225b9b562

Curves: add initial comb, grow and shrink brush

The exact behavior of the brushes is still being iterated on, but it
helps having a base implementation that we can work upon.
All of that is still hidden behind an experimental feature flag anyway.

The brushes will get a name in the ui soon.

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

===

M   source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
M   source/blender/makesdna/DNA_brush_enums.h
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index 12c03804981..4bf81b72c3c 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -11,6 +11,7 @@
 #include "BKE_mesh.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_paint.h"
+#include "BKE_spline.hh"
 
 #include "WM_api.h"
 #include "WM_toolsystem.h"
@@ -150,15 +151,22 @@ class DeleteOperation : public 
CurvesSculptStrokeOperation {
   }
 };
 
-class MoveOperation : public CurvesSculptStrokeOperation {
+/**
+ * Moves individual points under the brush and does a length preservation step 
afterwards.
+ */
+class CombOperation : public CurvesSculptStrokeOperation {
  private:
-  Vector points_to_move_indices_;
-  IndexMask points_to_move_;
   float2 last_mouse_position_;
 
  public:
   void on_stroke_extended(bContext *C, const StrokeExtension 
_extension) override
   {
+BLI_SCOPED_DEFER([&]() { last_mouse_position_ = 
stroke_extension.mouse_position; });
+
+if (stroke_extension.is_first) {
+  return;
+}
+
 Scene  = *CTX_data_scene(C);
 Object  = *CTX_data_active_object(C);
 ARegion *region = CTX_wm_region(C);
@@ -168,6 +176,10 @@ class MoveOperation : public CurvesSculptStrokeOperation {
 CurvesSculpt _sculpt = *scene.toolsettings->curves_sculpt;
 Brush  = *BKE_paint_brush(_sculpt.paint);
 const float brush_radius = BKE_brush_size_get(, );
+const float brush_strength = BKE_brush_alpha_get(, );
+
+const float4x4 ob_mat = object.obmat;
+const float4x4 ob_imat = ob_mat.inverted();
 
 float4x4 projection;
 ED_view3d_ob_project_mat_get(rv3d, , projection.values);
@@ -176,39 +188,312 @@ class MoveOperation : public CurvesSculptStrokeOperation 
{
 CurvesGeometry  = CurvesGeometry::wrap(curves_id.geometry);
 MutableSpan positions = curves.positions();
 
-if (stroke_extension.is_first) {
-  /* Find point indices to move. */
-  points_to_move_ = index_mask_ops::find_indices_based_on_predicate(
-  curves.points_range(), 512, points_to_move_indices_, [&](const 
int64_t point_i) {
-const float3 position = positions[point_i];
-float2 screen_position;
-ED_view3d_project_float_v2_m4(region, position, screen_position, 
projection.values);
-const float distance = len_v2v2(screen_position, 
stroke_extension.mouse_position);
-return distance <= brush_radius;
-  });
-}
-else {
-  /* Move points based on mouse movement. */
-  const float2 mouse_diff = stroke_extension.mouse_position - 
last_mouse_position_;
-  threading::parallel_for(points_to_move_.index_range(), 512, [&](const 
IndexRange range) {
-for (const int point_i : points_to_move_.slice(range)) {
+const float2 mouse_prev = last_mouse_position_;
+const float2 mouse_cur = stroke_extension.mouse_position;
+const float2 mouse_diff = mouse_cur - mouse_prev;
+const float mouse_diff_len = math::length(mouse_diff);
+
+threading::parallel_for(curves.curves_range(), 256, [&](const IndexRange 
curves_range) {
+  for (const int curve_i : curves_range) {
+const IndexRange curve_points = curves.range_for_curve(curve_i);
+/* Compute lengths of the segments. Those are used to make sure that 
the lengths don't
+ * change. */
+Vector segment_lengths(curve_points.size() - 1);
+for (const int segment_i : IndexRange(curve_points.size() - 1)) {
+  const float3  = positions[curve_points[segment_i]];
+  const float3  = positions[curve_points[segment_i] + 1];
+  const float length = math::distance(p1, p2);
+  segment_lengths[segment_i] = length;
+}
+bool curve_changed = false;
+for (const int point_i : curve_points.drop_front(1)) {
   const float3 old_position = positions[point_i];
+
+  /* Find the position of the point in screen space. */
   float2 old_position_screen;
   ED_view3d_project_float_v2_m4(
  

[Bf-blender-cvs] [94d2470c416] master: Curves: increase default viewport resolution for curves object

2022-03-08 Thread Jacques Lucke
Commit: 94d2470c416f70f7b0a357b1c3f3fc80d3e7360b
Author: Jacques Lucke
Date:   Tue Mar 8 10:36:46 2022 +0100
Branches: master
https://developer.blender.org/rB94d2470c416f70f7b0a357b1c3f3fc80d3e7360b

Curves: increase default viewport resolution for curves object

This part has to be refactored soon anyway, because more types
curves have to be drawn for the new Curves object.

For now, 3 is a better default than 2, because that matches the
actual resolution of the curve currently.

===

M   source/blender/draw/intern/draw_cache_impl_curves.cc

===

diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc 
b/source/blender/draw/intern/draw_cache_impl_curves.cc
index df1ac12605a..aea71d965d1 100644
--- a/source/blender/draw/intern/draw_cache_impl_curves.cc
+++ b/source/blender/draw/intern/draw_cache_impl_curves.cc
@@ -340,7 +340,7 @@ bool hair_ensure_procedural_data(Object *object,
   HairBatchCache *cache = curves_batch_cache_get(curves);
   *r_hair_cache = >hair;
 
-  const int steps = 2; /* TODO: don't hard-code? */
+  const int steps = 3; /* TODO: don't hard-code? */
   (*r_hair_cache)->final[subdiv].strands_res = 1 << (steps + subdiv);
 
   /* Refreshed on combing and simulation. */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4b598739c5c] master: Curves: disable stroke spacing for curve sculpt brushes

2022-03-08 Thread Jacques Lucke
Commit: 4b598739c5c18c83048646e27e91f1f0bf53acc6
Author: Jacques Lucke
Date:   Tue Mar 8 10:33:51 2022 +0100
Branches: master
https://developer.blender.org/rB4b598739c5c18c83048646e27e91f1f0bf53acc6

Curves: disable stroke spacing for curve sculpt brushes

This makes the brushes more smooth, because the brush has an
effect after every mouse move, instead of only every x pixels.

For this to work well, the brushes have to look at the stroke
segments instead of at the mouse positions separately.

A more fine grained check might be added in the future.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c 
b/source/blender/editors/sculpt_paint/paint_stroke.c
index ae7570d21a1..1705e36363e 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -1000,6 +1000,10 @@ bool paint_space_stroke_enabled(Brush *br, ePaintMode 
mode)
 return true;
   }
 
+  if (mode == PAINT_MODE_SCULPT_CURVES) {
+return false;
+  }
+
   return paint_supports_dynamic_size(br, mode);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b588c09eee4] master: Fix: add missing case in switch statement for curves

2022-03-08 Thread Jacques Lucke
Commit: b588c09eee40db46ed10ed5f723c89aef7ea816b
Author: Jacques Lucke
Date:   Tue Mar 8 10:23:38 2022 +0100
Branches: master
https://developer.blender.org/rBb588c09eee40db46ed10ed5f723c89aef7ea816b

Fix: add missing case in switch statement for curves

===

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

===

diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index d42c8ea37d5..238cf1ad74e 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -551,6 +551,8 @@ ePaintMode BKE_paintmode_get_active_from_context(const 
bContext *C)
   return PAINT_MODE_TEXTURE_3D;
 case OB_MODE_EDIT:
   return PAINT_MODE_SCULPT_UV;
+case OB_MODE_SCULPT_CURVES:
+  return PAINT_MODE_SCULPT_CURVES;
 default:
   return PAINT_MODE_TEXTURE_2D;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1d902a6367d] blender-v3.1-release: Fix T96213: Crash when texture painting across multiple materials.

2022-03-08 Thread Jeroen Bakker
Commit: 1d902a6367d1d18670ed75e3508cd0db00021350
Author: Jeroen Bakker
Date:   Tue Mar 8 10:38:13 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB1d902a6367d1d18670ed75e3508cd0db00021350

Fix T96213: Crash when texture painting across multiple materials.

Issue only happens in release builds on windows. That said it was an
actual error in the code. This class is compiled inline in release
builds. When updating multiple textures it would reuse the same memory
to collect the changes. When the previous loaded tilenumber was exactly the
same but from a different image the tile buffer wasn't loaded.

Reviewed By: sergey

Maniphest Tasks: T96213

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

===

M   source/blender/blenkernel/BKE_image_partial_update.hh

===

diff --git a/source/blender/blenkernel/BKE_image_partial_update.hh 
b/source/blender/blenkernel/BKE_image_partial_update.hh
index ca7c4f40593..b00ec98353c 100644
--- a/source/blender/blenkernel/BKE_image_partial_update.hh
+++ b/source/blender/blenkernel/BKE_image_partial_update.hh
@@ -227,7 +227,7 @@ template struct 
PartialUpdateChecker {
 ePartialUpdateCollectResult result_code;
 
private:
-TileNumber last_tile_number;
+TileNumber last_tile_number = 0;
 
public:
 CollectResult(PartialUpdateChecker *checker, 
ePartialUpdateCollectResult result_code)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3d71a05a1de] master: Merge branch 'blender-v3.1-release'

2022-03-08 Thread Sergey Sharybin
Commit: 3d71a05a1de5ed48cc2931dba3917494efce7bd5
Author: Sergey Sharybin
Date:   Tue Mar 8 09:52:47 2022 +0100
Branches: master
https://developer.blender.org/rB3d71a05a1de5ed48cc2931dba3917494efce7bd5

Merge branch 'blender-v3.1-release'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2ddb53de540] blender-v3.1-release: Fix T96228: TypeError on use of Copy from Active Track operation

2022-03-08 Thread Pratik Borhade
Commit: 2ddb53de5403fb02e4de053084b2d00b2372a122
Author: Pratik Borhade
Date:   Tue Mar 8 09:50:32 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB2ddb53de5403fb02e4de053084b2d00b2372a122

Fix T96228: TypeError on use of Copy from Active Track operation

Issue was introduced after the python 3.10 switch
Explicit conversion to int will fix the issue.
Same issue is likely to happen with `MovieTrackingSettings.default_search_size`
So I did the same change over there.

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

===

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

===

diff --git a/release/scripts/startup/bl_operators/clip.py 
b/release/scripts/startup/bl_operators/clip.py
index f0e099244f4..734fb071d42 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -123,8 +123,8 @@ def CLIP_default_settings_from_track(clip, track, framenr):
 search[1] = search[1] * height
 
 settings.default_correlation_min = track.correlation_min
-settings.default_pattern_size = max(pattern[0], pattern[1])
-settings.default_search_size = max(search[0], search[1])
+settings.default_pattern_size = int(max(pattern[0], pattern[1]))
+settings.default_search_size = int(max(search[0], search[1]))
 settings.default_frames_limit = track.frames_limit
 settings.default_pattern_match = track.pattern_match
 settings.default_margin = track.margin

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs