[Bf-blender-cvs] [f8577db05df] master: Docs: document the use_axis_view argumeht to view_roll_angle

2022-03-01 Thread Campbell Barton
Commit: f8577db05dfc5140049d9a8b21a774cefea0bf79
Author: Campbell Barton
Date:   Wed Mar 2 18:28:15 2022 +1100
Branches: master
https://developer.blender.org/rBf8577db05dfc5140049d9a8b21a774cefea0bf79

Docs: document the use_axis_view argumeht to view_roll_angle

Also remove event print left in by accident.

===

M   source/blender/editors/space_view3d/view3d_navigate_roll.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/space_view3d/view3d_navigate_roll.c 
b/source/blender/editors/space_view3d/view3d_navigate_roll.c
index 8d01f6b591b..9c070fb0341 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_roll.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_roll.c
@@ -24,6 +24,11 @@
 /** \name View Roll Operator
  * \{ */
 
+/**
+ * \param use_axis_view: When true, keep axis-aligned orthographic views
+ * (when rotating in 90 degree increments). While this may seem obscure some 
NDOF
+ * devices have key shortcuts to do this (see #NDOF_BUTTON_ROLL_CW & 
#NDOF_BUTTON_ROLL_CCW).
+ */
 static void view_roll_angle(ARegion *region,
 float quat[4],
 const float orig_quat[4],
diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 017af86e401..08d842e198a 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3185,8 +3185,6 @@ static int wm_handlers_do(bContext *C, wmEvent *event, 
ListBase *handlers)
 
 CLOG_INFO(WM_LOG_HANDLERS, 1, "handling PRESS_DRAG");
 
-WM_event_print(event);
-
 action |= wm_handlers_do_intern(C, win, event, handlers);
 
 event->direction = 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] [46a5a15d30f] master: Cleanup: rename direction enum as it's part of the key-map item

2022-03-01 Thread Campbell Barton
Commit: 46a5a15d30f951b150b66856442566d5b657ab1e
Author: Campbell Barton
Date:   Wed Mar 2 17:54:06 2022 +1100
Branches: master
https://developer.blender.org/rB46a5a15d30f951b150b66856442566d5b657ab1e

Cleanup: rename direction enum as it's part of the key-map item

Also improve doc-strings for key-map item constants.

===

M   source/blender/blenloader/intern/versioning_userdef.c
M   source/blender/makesrna/intern/rna_wm.c
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/intern/wm_event_query.c
M   source/blender/windowmanager/wm_event_types.h

===

diff --git a/source/blender/blenloader/intern/versioning_userdef.c 
b/source/blender/blenloader/intern/versioning_userdef.c
index 862e8a09166..e933964221b 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -411,7 +411,7 @@ static bool keymap_item_update_tweak_event(wmKeyMapItem 
*kmi, void *UNUSED(user_
   return false;
   }
 
-  if (kmi->val >= EVT_GESTURE_N && kmi->val <= EVT_GESTURE_NW) {
+  if (kmi->val >= KM_DIRECTION_N && kmi->val <= KM_DIRECTION_NW) {
 kmi->direction = kmi->val;
   }
   else {
diff --git a/source/blender/makesrna/intern/rna_wm.c 
b/source/blender/makesrna/intern/rna_wm.c
index d88f150c1dd..8835591f303 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -365,14 +365,14 @@ const EnumPropertyItem rna_enum_event_value_items[] = {
 
 const EnumPropertyItem rna_enum_event_direction_items[] = {
 {KM_ANY, "ANY", 0, "Any", ""},
-{EVT_GESTURE_N, "NORTH", 0, "North", ""},
-{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
-{EVT_GESTURE_E, "EAST", 0, "East", ""},
-{EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
-{EVT_GESTURE_S, "SOUTH", 0, "South", ""},
-{EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
-{EVT_GESTURE_W, "WEST", 0, "West", ""},
-{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
+{KM_DIRECTION_N, "NORTH", 0, "North", ""},
+{KM_DIRECTION_NE, "NORTH_EAST", 0, "North-East", ""},
+{KM_DIRECTION_E, "EAST", 0, "East", ""},
+{KM_DIRECTION_SE, "SOUTH_EAST", 0, "South-East", ""},
+{KM_DIRECTION_S, "SOUTH", 0, "South", ""},
+{KM_DIRECTION_SW, "SOUTH_WEST", 0, "South-West", ""},
+{KM_DIRECTION_W, "WEST", 0, "West", ""},
+{KM_DIRECTION_NW, "NORTH_WEST", 0, "North-West", ""},
 {0, NULL, 0, NULL, NULL},
 };
 
diff --git a/source/blender/windowmanager/WM_types.h 
b/source/blender/windowmanager/WM_types.h
index b2e214782f0..c4858a8a1fa 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -225,35 +225,68 @@ typedef enum eOperatorPropTags {
 } eOperatorPropTags;
 #define OP_PROP_TAG_ADVANCED ((eOperatorPropTags)OP_PROP_TAG_ADVANCED)
 
-/* ** wmKeyMap  */
-
-/* modifier */
-#define KM_SHIFT 1
-#define KM_CTRL 2
-#define KM_ALT 4
-#define KM_OSKEY 8
-
-/* Used for key-map item creation function arguments (never stored in DNA). */
-#define KM_SHIFT_ANY 16
-#define KM_CTRL_ANY 32
-#define KM_ALT_ANY 64
-#define KM_OSKEY_ANY 128
-
-/* KM_MOD_ flags for `wmKeyMapItem` and `wmEvent.alt/shift/oskey/ctrl`. */
-/* note that KM_ANY and KM_NOTHING are used with these defines too */
+/*  */
+/** \name #wmKeyMapItem
+ * \{ */
+
+/**
+ * Modifier keys, not actually used for #wmKeyMapItem (never stored in DNA), 
used for:
+ * - #wmEvent.modifier without the `KM_*_ANY` flags.
+ * - #WM_keymap_add_item & #WM_modalkeymap_add_item
+ */
+enum {
+  KM_SHIFT = (1 << 0),
+  KM_CTRL = (1 << 1),
+  KM_ALT = (1 << 2),
+  KM_OSKEY = (1 << 3),
+
+  /* Used for key-map item creation function arguments. */
+  KM_SHIFT_ANY = (1 << 4),
+  KM_CTRL_ANY = (1 << 5),
+  KM_ALT_ANY = (1 << 6),
+  KM_OSKEY_ANY = (1 << 7),
+};
+
+/* `KM_MOD_*` flags for #wmKeyMapItem and `wmEvent.alt/shift/oskey/ctrl`. */
+/* Note that #KM_ANY and #KM_NOTHING are used with these defines too. */
 #define KM_MOD_HELD 1
 
-/* type: defined in wm_event_types.c */
-#define KM_TEXTINPUT -2
-
-/* val */
-#define KM_ANY -1
-#define KM_NOTHING 0
-#define KM_PRESS 1
-#define KM_RELEASE 2
-#define KM_CLICK 3
-#define KM_DBL_CLICK 4
-#define KM_CLICK_DRAG 5
+/**
+ * #wmKeyMapItem.type
+ * NOTE: most types are defined in `wm_event_types.h`.
+ */
+enum {
+  KM_TEXTINPUT = -2,
+};
+
+/** #wmKeyMapItem.val */
+enum {
+  KM_ANY = -1,
+  KM_NOTHING = 0,
+  KM_PRESS = 1,
+  KM_RELEASE = 2,
+  KM_CLICK = 3,
+  KM_DBL_CLICK = 4,
+  KM_CLICK_DRAG = 5,
+};
+
+/**
+ * #wmKeyMapItem.direction
+ *
+ * Value of tweaks and line gestures. #KM_ANY (-1) works for this case too.
+ */
+enum {
+  KM_DIRECTION_N = 1,
+  KM_DIRECTION_NE = 2,
+  KM_DIRECTION_E = 3,
+  KM_DIRECTION_SE = 4,
+  

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

2022-03-01 Thread Bastien Montagne
Commit: d3632df2f6f4e878a6ab6301ff295fad9dd6153d
Author: Bastien Montagne
Date:   Tue Mar 1 18:02:56 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rBd3632df2f6f4e878a6ab6301ff295fad9dd6153d

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 8fcf967bce8..a3892ef65f7 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] [c13f95daab9] liboverride-systemoverrides: LibOverride: Add initial handling of system overrides in creation/duplication/resync code, and some basic do_version.

2022-03-01 Thread Bastien Montagne
Commit: c13f95daab9c49be756df9997cec29261bbf8c88
Author: Bastien Montagne
Date:   Wed Feb 23 14:56:42 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rBc13f95daab9c49be756df9997cec29261bbf8c88

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 1ca34f40218..880332f168e 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] [50f12310cb2] liboverride-systemoverrides: LibOverride: make some override properties 'overridable'.

2022-03-01 Thread Bastien Montagne
Commit: 50f12310cb2f0670fddbf5a63f5353e3aa5a5e9d
Author: Bastien Montagne
Date:   Wed Feb 23 10:39:48 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB50f12310cb2f0670fddbf5a63f5353e3aa5a5e9d

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 e3e9a234ac9..2ed798f0089 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -1823,6 +1823,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",
@@ -1832,6 +1833,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",
@@ -1987,6 +1989,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] [69e34df379b] liboverride-systemoverrides: LibOverride: Add initial System Override flag.

2022-03-01 Thread Bastien Montagne
Commit: 69e34df379b6a052a0d59e383919fa71962142d4
Author: Bastien Montagne
Date:   Tue Feb 22 17:20:18 2022 +0100
Branches: liboverride-systemoverrides
https://developer.blender.org/rB69e34df379b6a052a0d59e383919fa71962142d4

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 922c1beda38..1ca34f40218 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 daecb3d7a31..3c79e69350c 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1991,7 +1991,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 94ffa330064..e3e9a234ac9 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -1824,6 +1824,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] [7e4c0313283] master: Cleanup: remove all tweak events from key-map presets

2022-03-01 Thread Campbell Barton
Commit: 7e4c0313283304bd8f020eaedb94b35e75b50068
Author: Campbell Barton
Date:   Wed Mar 2 17:29:27 2022 +1100
Branches: master
https://developer.blender.org/rB7e4c0313283304bd8f020eaedb94b35e75b50068

Cleanup: remove all tweak events from key-map presets

===

M   release/scripts/modules/bl_keymap_utils/io.py
M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M   tests/python/bl_keymap_validate.py

===

diff --git a/release/scripts/modules/bl_keymap_utils/io.py 
b/release/scripts/modules/bl_keymap_utils/io.py
index 456a1fa5a83..6631461eaba 100644
--- a/release/scripts/modules/bl_keymap_utils/io.py
+++ b/release/scripts/modules/bl_keymap_utils/io.py
@@ -249,20 +249,6 @@ def _init_properties_from_data(base_props, base_value):
 def keymap_init_from_data(km, km_items, is_modal=False):
 new_fn = getattr(km.keymap_items, "new_modal" if is_modal else "new")
 for (kmi_idname, kmi_args, kmi_data) in km_items:
-
-# TODO(@campbellbarton): Temporary workaround keep until our
-# key-maps have been updated to remove tweak events.
-if ty_new := {
-'EVT_TWEAK_L': 'LEFTMOUSE',
-'EVT_TWEAK_M': 'MIDDLEMOUSE',
-'EVT_TWEAK_R': 'RIGHTMOUSE',
-}.get(kmi_args["type"]):
-kmi_args["type"] = ty_new
-if (value := kmi_args["value"]) != 'ANY':
-kmi_args["direction"] = value
-kmi_args["value"] = 'CLICK_DRAG'
-# End workaround.
-
 kmi = new_fn(kmi_idname, **kmi_args)
 if kmi_data is not None:
 if not kmi_data.get("active", True):
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index bf71b8aece8..6f4f862a3b8 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -20,12 +20,8 @@ class Params:
 "legacy",
 "select_mouse",
 "select_mouse_value",
-"select_tweak",
 "action_mouse",
-"action_tweak",
 "tool_mouse",
-"tool_tweak",
-"tool_maybe_tweak",
 "tool_maybe_tweak_value",
 "context_menu_event",
 "cursor_set_event",
@@ -72,13 +68,13 @@ class Params:
 "use_fallback_tool_select_mouse",
 # Shorthand for: `('CLICK' if self.use_fallback_tool_rmb else 
self.select_mouse_value)`.
 "select_mouse_value_fallback",
-# Shorthand for: `{"type": params.select_tweak, "value": 'ANY'}`.
+# Shorthand for: `{"type": params.select_mouse, "value": 
'CLICK_DRAG'}`.
 "select_tweak_event",
 # Shorthand for: `('CLICK_DRAG' if params.use_pie_click_drag else 
'PRESS')`
 "pie_value",
-# Shorthand for: `{"type": params.tool_tweak, "value": 'ANY'}`.
+# Shorthand for: `{"type": params.tool_mouse, "value": 'CLICK_DRAG'}`.
 "tool_tweak_event",
-# Shorthand for: `{"type": params.tool_maybe_tweak, "value": 
params.tool_maybe_tweak_value}`.
+# Shorthand for: `{"type": params.tool_mouse, "value": 
params.tool_maybe_tweak_value}`.
 #
 # NOTE: This is typically used for active tool key-map items however 
it should never
 # be used for selection tools (the default box-select tool for 
example).
@@ -122,24 +118,19 @@ class Params:
 # Right mouse select.
 self.select_mouse = 'RIGHTMOUSE'
 self.select_mouse_value = 'PRESS'
-self.select_tweak = 'EVT_TWEAK_R'
 self.action_mouse = 'LEFTMOUSE'
-self.action_tweak = 'EVT_TWEAK_L'
 self.tool_mouse = 'LEFTMOUSE'
-self.tool_tweak = 'EVT_TWEAK_L'
 if use_alt_tool_or_cursor:
-self.tool_maybe_tweak = 'LEFTMOUSE'
 self.tool_maybe_tweak_value = 'PRESS'
 else:
-self.tool_maybe_tweak = 'EVT_TWEAK_L'
-self.tool_maybe_tweak_value = 'ANY'
+self.tool_maybe_tweak_value = 'CLICK_DRAG'
 
 self.context_menu_event = {"type": 'W', "value": 'PRESS'}
 
 # Use the "cursor" functionality for RMB select.
 if use_alt_tool_or_cursor:
 self.cursor_set_event = {"type": 'LEFTMOUSE', "value": 
'PRESS', "alt": True}
-self.cursor_tweak_event = {"type": 'EVT_TWEAK_L', "value": 
'ANY', "alt": True}
+self.cursor_tweak_event = {"type": 'LEFTMOUSE', "value": 
'CLICK_DRAG', "alt": True}
 else:
 self.cursor_set_event = {"type": 'LEFTMOUSE', "value": 'CLICK'}
 self.cursor_tweak_event = None
@@ -151,13 +142,9 @@ class Params:
 

[Bf-blender-cvs] [4986f718482] master: Event System: remove tweak events in favor of click-drag

2022-03-01 Thread Campbell Barton
Commit: 4986f718482b061082936f1f6aa13929741093a2
Author: Campbell Barton
Date:   Wed Mar 2 15:07:00 2022 +1100
Branches: master
https://developer.blender.org/rB4986f718482b061082936f1f6aa13929741093a2

Event System: remove tweak events in favor of click-drag

Supporting two kinds of dragging is redundant, remove tweak events as
they only supported 3 mouse buttons and added complexity from using the
'value' to store directions.

Support only click-drag events (KM_CLICK_DRAG) which can be used with
any keyboard or mouse button.

Details:

- A "direction" member has been added to keymap items and events which
  can be used when the event value is set to KM_CLICK_DRAG.

- Keymap items are version patched.

- Loading older key-maps are also updated.

- Currently the key-maps stored in ./release/scripts/presets/keyconfig/
  still reference tweak events & need updating. For now they are updated
  on load.

Note that in general this wont impact add-ons as modal operators don't
receive tweak events.

Reviewed By: brecht

Ref D14214

===

M   release/scripts/modules/bl_keymap_utils/io.py
M   release/scripts/modules/bl_keymap_utils/versioning.py
M   release/scripts/modules/rna_keymap_ui.py
M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenloader/intern/versioning_userdef.c
M   source/blender/editors/interface/interface_context_menu.c
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/interface_icons.c
M   source/blender/editors/space_view3d/view3d_navigate_dolly.c
M   source/blender/editors/space_view3d/view3d_navigate_move.c
M   source/blender/editors/transform/transform.c
M   source/blender/makesdna/DNA_windowmanager_types.h
M   source/blender/makesrna/RNA_enum_items.h
M   source/blender/makesrna/intern/rna_wm.c
M   source/blender/makesrna/intern/rna_wm_api.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/WM_keymap.h
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/intern/wm.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_gesture_ops.c
M   source/blender/windowmanager/intern/wm_keymap.c
M   source/blender/windowmanager/intern/wm_keymap_utils.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/wm.h
M   source/blender/windowmanager/wm_event_types.h

===

diff --git a/release/scripts/modules/bl_keymap_utils/io.py 
b/release/scripts/modules/bl_keymap_utils/io.py
index f34002741c6..456a1fa5a83 100644
--- a/release/scripts/modules/bl_keymap_utils/io.py
+++ b/release/scripts/modules/bl_keymap_utils/io.py
@@ -52,6 +52,8 @@ def kmi_args_as_data(kmi):
 s.append(f"\"{attr:s}\": " + ("-1" if mod == -1 else "True"))
 if (mod := kmi.key_modifier) and (mod != 'NONE'):
 s.append(f"\"key_modifier\": '{mod:s}'")
+if (direction := kmi.direction) and (direction != 'ANY'):
+s.append(f"\"direction\": '{direction:s}'")
 
 if kmi.repeat:
 if (
@@ -247,6 +249,20 @@ def _init_properties_from_data(base_props, base_value):
 def keymap_init_from_data(km, km_items, is_modal=False):
 new_fn = getattr(km.keymap_items, "new_modal" if is_modal else "new")
 for (kmi_idname, kmi_args, kmi_data) in km_items:
+
+# TODO(@campbellbarton): Temporary workaround keep until our
+# key-maps have been updated to remove tweak events.
+if ty_new := {
+'EVT_TWEAK_L': 'LEFTMOUSE',
+'EVT_TWEAK_M': 'MIDDLEMOUSE',
+'EVT_TWEAK_R': 'RIGHTMOUSE',
+}.get(kmi_args["type"]):
+kmi_args["type"] = ty_new
+if (value := kmi_args["value"]) != 'ANY':
+kmi_args["direction"] = value
+kmi_args["value"] = 'CLICK_DRAG'
+# End workaround.
+
 kmi = new_fn(kmi_idname, **kmi_args)
 if kmi_data is not None:
 if not kmi_data.get("active", True):
diff --git a/release/scripts/modules/bl_keymap_utils/versioning.py 
b/release/scripts/modules/bl_keymap_utils/versioning.py
index ee7cc5daceb..402c21f8ef1 100644
--- a/release/scripts/modules/bl_keymap_utils/versioning.py
+++ b/release/scripts/modules/bl_keymap_utils/versioning.py
@@ -30,4 +30,22 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
 # Setting repeat true on other kinds of events is harmless.
 item_event["repeat"] = True
 
+if keyconfig_version <= (3, 2, 5):
+  

[Bf-blender-cvs] [426ff481a78] master: Event System: match click-drag & tweak event handling for transform

2022-03-01 Thread Campbell Barton
Commit: 426ff481a789017bd5810a2064ec06a298a6f2dc
Author: Campbell Barton
Date:   Wed Mar 2 14:53:15 2022 +1100
Branches: master
https://developer.blender.org/rB426ff481a789017bd5810a2064ec06a298a6f2dc

Event System: match click-drag & tweak event handling for transform

===

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

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index d7a71350934..36ffcc8cd68 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1697,7 +1697,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
 
   /* Needed to translate tweak events to mouse buttons. */
   t->launch_event = event ? 
WM_userdef_event_type_from_keymap_type(event->type) : -1;
-  t->is_launch_event_tweak = event ? ISTWEAK(event->type) : false;
+  t->is_launch_event_drag = event ? (ISTWEAK(event->type) || event->val == 
KM_CLICK_DRAG) : false;
 
   /* XXX Remove this when wm_operator_call_internal doesn't use 
window->eventstate
* (which can have type = 0) */
diff --git a/source/blender/editors/transform/transform.h 
b/source/blender/editors/transform/transform.h
index 757c11f1179..3ee5868d5be 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -592,9 +592,11 @@ typedef struct TransInfo {
   /*** NEW STUFF */
   /** event type used to launch transform. */
   short launch_event;
-  /** Is the actual launch event a tweak event? (launch_event above is set to 
the corresponding
-   * mouse button then.) */
-  bool is_launch_event_tweak;
+  /**
+   * Is the actual launch event a drag event?
+   * (`launch_event` is set to the corresponding mouse button then.)
+   */
+  bool is_launch_event_drag;
 
   bool is_orient_default_overwrite;
 
diff --git a/source/blender/editors/transform/transform_convert_graph.c 
b/source/blender/editors/transform/transform_convert_graph.c
index 608fd59c8b7..54222fbb117 100644
--- a/source/blender/editors/transform/transform_convert_graph.c
+++ b/source/blender/editors/transform/transform_convert_graph.c
@@ -161,7 +161,7 @@ static void graph_bezt_get_transform_selection(const 
TransInfo *t,
   bool left = use_handle ? ((bezt->f1 & SELECT) != 0) : key;
   bool right = use_handle ? ((bezt->f3 & SELECT) != 0) : key;
 
-  if (use_handle && t->is_launch_event_tweak) {
+  if (use_handle && t->is_launch_event_drag) {
 if (sipo->runtime.flag & SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT) {
   key = right = false;
 }

___
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] [78372d8b9ca] master: Event System: support "Release Confirms" for click-drag events

2022-03-01 Thread Campbell Barton
Commit: 78372d8b9ca2e923945a009166b9bc04f74ddadf
Author: Campbell Barton
Date:   Wed Mar 2 14:44:34 2022 +1100
Branches: master
https://developer.blender.org/rB78372d8b9ca2e923945a009166b9bc04f74ddadf

Event System: support "Release Confirms" for click-drag events

===

M   source/blender/editors/animation/anim_markers.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_event_query.c

===

diff --git a/source/blender/editors/animation/anim_markers.c 
b/source/blender/editors/animation/anim_markers.c
index ab51702d628..95125516fe8 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -700,7 +700,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
 typedef struct MarkerMove {
   SpaceLink *slink;
   ListBase *markers;
-  int event_type; /* store invoke-event, to verify */
+  short event_type, event_val; /* store invoke-event, to verify */
   int *oldframe, evtx, firstx;
   NumInput num;
 } MarkerMove;
@@ -844,6 +844,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator 
*op, const wmEvent *eve
 mm->evtx = event->xy[0];
 mm->firstx = event->xy[0];
 mm->event_type = event->type;
+mm->event_val = event->val;
 
 /* add temp handler */
 WM_event_add_modal_handler(C, op);
@@ -941,7 +942,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator 
*op, const wmEvent *even
   case EVT_PADENTER:
   case LEFTMOUSE:
   case MIDDLEMOUSE:
-if (WM_event_is_modal_tweak_exit(event, mm->event_type)) {
+if (WM_event_is_modal_drag_exit(event, mm->event_type, mm->event_val)) 
{
   ed_marker_move_exit(C, op);
   WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
   WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 2c2143f350a..07eaa2ab976 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -1424,9 +1424,11 @@ bool WM_window_modal_keymap_status_draw(struct bContext 
*C,
 void WM_event_print(const struct wmEvent *event);
 
 /**
- * For modal callbacks, check configuration for how to interpret exit with 
tweaks.
+ * For modal callbacks, check configuration for how to interpret exit when 
dragging.
  */
-bool WM_event_is_modal_tweak_exit(const struct wmEvent *event, int 
tweak_event);
+bool WM_event_is_modal_drag_exit(const struct wmEvent *event,
+ short init_event_type,
+ short init_event_val);
 bool WM_event_is_last_mousemove(const struct wmEvent *event);
 bool WM_event_is_mouse_drag(const struct wmEvent *event);
 bool WM_event_is_mouse_drag_or_press(const wmEvent *event);
diff --git a/source/blender/windowmanager/intern/wm_event_query.c 
b/source/blender/windowmanager/intern/wm_event_query.c
index 5e8b9b945c9..ddca10a8382 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -183,34 +183,37 @@ bool WM_event_type_mask_test(const int event_type, const 
enum eEventType_Mask ma
 /** \name Event Motion Queries
  * \{ */
 
-bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event)
+bool WM_event_is_modal_drag_exit(const wmEvent *event,
+ const short init_event_type,
+ const short init_event_val)
 {
-  /* if the release-confirm userpref setting is enabled,
-   * tweak events can be canceled when mouse is released
-   */
+  /* If the release-confirm preference setting is enabled,
+   * drag events can be canceled when mouse is released. */
   if (U.flag & USER_RELEASECONFIRM) {
 /* option on, so can exit with km-release */
 if (event->val == KM_RELEASE) {
-  switch (tweak_event) {
+  switch (init_event_type) {
 case EVT_TWEAK_L:
 case EVT_TWEAK_M:
 case EVT_TWEAK_R:
   return 1;
   }
+  if ((init_event_val == KM_CLICK_DRAG) && (event->type == 
init_event_type)) {
+return 1;
+  }
 }
 else {
-  /* if the initial event wasn't a tweak event then
-   * ignore USER_RELEASECONFIRM setting: see T26756. */
-  if (ELEM(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
+  /* If the initial event wasn't a drag event then
+   * ignore #USER_RELEASECONFIRM setting: see T26756. */
+  if ((ELEM(init_event_type, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) ||
+   init_event_val == KM_CLICK_DRAG) == 0) {
 return 1;
   }
 }
   }
   else {
-/* this is fine as long as not doing km-release, otherwise
- * some items (i.e. markers) being tweaked may end up getting
- * dropped all over
- */
+/* This is fine as long as not doing 

[Bf-blender-cvs] [aa71414dfca] master: Fix click-drag events for dragging markers

2022-03-01 Thread Campbell Barton
Commit: aa71414dfca7f301e101cce3e72551e7529290ea
Author: Campbell Barton
Date:   Wed Mar 2 14:28:06 2022 +1100
Branches: master
https://developer.blender.org/rBaa71414dfca7f301e101cce3e72551e7529290ea

Fix click-drag events for dragging markers

Clicking and dragging markers accumulates flags from multiple operators
in a way that can't be interpreted when combine.

Follow tweak behavior for cancelling click-drag events.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 20940c59679..b3b99b0b7fc 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3157,44 +3157,40 @@ static int wm_handlers_do(bContext *C, wmEvent *event, 
ListBase *handlers)
   if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
 /* Test for #WM_CLICK_DRAG events. */
 
-/* NOTE(@campbellbarton): Needed so drag can be used for editors that 
support both click
+/* NOTE(@campbellbarton): Ignore `action` so drag can be used for editors 
that use both click
  * selection and passing through the drag action to box select. See 
#WM_generic_select_modal.
- * Unlike click, accept `action` when break isn't set.
- * Operators can return `OPERATOR_FINISHED | OPERATOR_PASS_THROUGH` which 
results
- * in `action` setting #WM_HANDLER_HANDLED, but not #WM_HANDLER_BREAK. */
-if ((action & WM_HANDLER_BREAK) == 0 || wm_action_not_handled(action)) {
-  if (win->event_queue_check_drag) {
-if (WM_event_drag_test(event, event->prev_click_xy)) {
-  win->event_queue_check_drag_handled = true;
-
-  const int prev_xy[2] = {UNPACK2(event->xy)};
-  const short prev_val = event->val;
-  const short prev_type = event->type;
-  const uint8_t prev_modifier = event->modifier;
-  const short prev_keymodifier = event->keymodifier;
-
-  copy_v2_v2_int(event->xy, event->prev_click_xy);
-  event->val = KM_CLICK_DRAG;
-  event->type = event->prev_type;
-  event->modifier = event->prev_click_modifier;
-  event->keymodifier = event->prev_click_keymodifier;
-
-  CLOG_INFO(WM_LOG_HANDLERS, 1, "handling PRESS_DRAG");
+ * In the case of marker select-drag the combinations of (pass-through / 
finished / modal)
+ * can accumulate to have flags set that they can't be properly 
interpreted here.
+ * Instead `win->event_queue_check_drag` is cleared in 
`wm_event_do_handlers`. */
+if (win->event_queue_check_drag) {
+  if (WM_event_drag_test(event, event->prev_click_xy)) {
+win->event_queue_check_drag_handled = true;
+
+const int prev_xy[2] = {UNPACK2(event->xy)};
+const short prev_val = event->val;
+const short prev_type = event->type;
+const uint8_t prev_modifier = event->modifier;
+const short prev_keymodifier = event->keymodifier;
+
+copy_v2_v2_int(event->xy, event->prev_click_xy);
+event->val = KM_CLICK_DRAG;
+event->type = event->prev_type;
+event->modifier = event->prev_click_modifier;
+event->keymodifier = event->prev_click_keymodifier;
+
+CLOG_INFO(WM_LOG_HANDLERS, 1, "handling PRESS_DRAG");
 
-  action |= wm_handlers_do_intern(C, win, event, handlers);
+WM_event_print(event);
 
-  event->keymodifier = prev_keymodifier;
-  event->modifier = prev_modifier;
-  event->val = prev_val;
-  event->type = prev_type;
-  copy_v2_v2_int(event->xy, prev_xy);
+action |= wm_handlers_do_intern(C, win, event, handlers);
 
-  win->event_queue_check_click = false;
-  if (!((action & WM_HANDLER_BREAK) == 0 || 
wm_action_not_handled(action))) {
-/* Only disable when handled as other handlers may use this drag 
event. */
-win->event_queue_check_drag = false;
-  }
-}
+event->keymodifier = prev_keymodifier;
+event->modifier = prev_modifier;
+event->val = prev_val;
+event->type = prev_type;
+copy_v2_v2_int(event->xy, prev_xy);
+
+win->event_queue_check_click = false;
   }
 }
 else {
@@ -3270,7 +3266,6 @@ static int wm_handlers_do(bContext *C, wmEvent *event, 
ListBase *handlers)
 }
 else {
   win->event_queue_check_click = false;
-  win->event_queue_check_drag = false;
 }
   }
   else if (ISMOUSE_WHEEL(event->type) || ISMOUSE_GESTURE(event->type)) {
@@ -3720,6 +3715,10 @@ void wm_event_do_handlers(bContext *C)
   /* Builtin tweak, if action is break it removes tweak. */
   wm_tweakevent_test(C, event, action);
 
+  if (action & WM_HANDLER_BREAK) {
+win->event_queue_check_drag = 

[Bf-blender-cvs] [aa500c4fcab] master: Cleanup: use back-slash for doxygen commands, color after parameters

2022-03-01 Thread Campbell Barton
Commit: aa500c4fcabe7dad834b91572c75bee760041ede
Author: Campbell Barton
Date:   Wed Mar 2 12:07:18 2022 +1100
Branches: master
https://developer.blender.org/rBaa500c4fcabe7dad834b91572c75bee760041ede

Cleanup: use back-slash for doxygen commands, color after parameters

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_ISystem.h
M   intern/ghost/intern/GHOST_System.h
M   intern/ghost/intern/GHOST_SystemCocoa.h
M   source/blender/blenkernel/BKE_lib_remap.h
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/space_outliner/tree/tree_element.hh
M   source/blender/functions/FN_multi_function_procedure_optimization.hh
M   source/blender/gpu/intern/gpu_shader_create_info.hh
M   source/blender/imbuf/IMB_imbuf.h
M   source/blender/io/wavefront_obj/exporter/obj_export_io.hh
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 18439350238..4e48a908c00 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -253,7 +253,7 @@ extern int GHOST_GetFullScreen(GHOST_SystemHandle 
systemhandle);
  * Get the Window under the cursor.
  * \param x: The x-coordinate of the cursor.
  * \param y: The y-coordinate of the cursor.
- * @return The window under the cursor or nullptr in none.
+ * \return The window under the cursor or nullptr in none.
  */
 extern GHOST_WindowHandle GHOST_GetWindowUnderCursor(GHOST_SystemHandle 
systemhandle,
  int32_t x,
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index a33879522f4..ed193ee7e5d 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -313,7 +313,7 @@ class GHOST_ISystem {
* Get the Window under the cursor.
* \param x: The x-coordinate of the cursor.
* \param y: The y-coordinate of the cursor.
-   * @return The window under the cursor or nullptr if none.
+   * \return The window under the cursor or nullptr if none.
*/
   virtual GHOST_IWindow *getWindowUnderCursor(int32_t x, int32_t y) = 0;
 
diff --git a/intern/ghost/intern/GHOST_System.h 
b/intern/ghost/intern/GHOST_System.h
index 0911b35f617..0e1e3f734ae 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -161,7 +161,7 @@ class GHOST_System : public GHOST_ISystem {
* Get the Window under the cursor.
* \param x: The x-coordinate of the cursor.
* \param y: The y-coordinate of the cursor.
-   * @return The window under the cursor or nullptr if none.
+   * \return The window under the cursor or nullptr if none.
*/
   GHOST_IWindow *getWindowUnderCursor(int32_t x, int32_t y);
 
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h 
b/intern/ghost/intern/GHOST_SystemCocoa.h
index 926d50b7942..8b6dfb4efed 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -113,7 +113,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* Get the Window under the cursor.
* \param x: The x-coordinate of the cursor.
* \param y: The y-coordinate of the cursor.
-   * @return The window under the cursor or nullptr if none.
+   * \return The window under the cursor or nullptr if none.
*/
   GHOST_IWindow *getWindowUnderCursor(int32_t x, int32_t y);
 
diff --git a/source/blender/blenkernel/BKE_lib_remap.h 
b/source/blender/blenkernel/BKE_lib_remap.h
index 94b94303ec9..fd7d39fc250 100644
--- a/source/blender/blenkernel/BKE_lib_remap.h
+++ b/source/blender/blenkernel/BKE_lib_remap.h
@@ -220,7 +220,7 @@ IDRemapperApplyResult BKE_id_remapper_apply(const struct 
IDRemapper *id_remapper
  * Use this function when `ID_REMAP_APPLY_UNMAP_WHEN_REMAPPING_TO_SELF`. In 
this case
  * the #id_self parameter is required. Otherwise the #BKE_id_remapper_apply 
can be used.
  *
- * \param id_self required for ID_REMAP_APPLY_UNMAP_WHEN_REMAPPING_TO_SELF.
+ * \param id_self: required for ID_REMAP_APPLY_UNMAP_WHEN_REMAPPING_TO_SELF.
  * When remapping to id_self it will then be remapped to NULL.
  */
 IDRemapperApplyResult BKE_id_remapper_apply_ex(const struct IDRemapper 
*id_remapper,
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h 
b/source/blender/editors/sculpt_paint/sculpt_intern.h
index a6b412b2b7e..6f9df4d8252 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1105,10 +1105,10 @@ bool SCULPT_search_sphere_cb(PBVHNode *node, void 
*data_v);
 bool SCULPT_search_circle_cb(PBVHNode *node, void *data_v);
 
 /**
- * Initialize a point-in-brush test with a given falloff shape
+ * Initialize a point-in-brush test with a given falloff shape.
  *
- * \param falloff_shape PAINT_FALLOFF_SHAPE_SPHERE or PAINT_FALLOFF_SHAPE_TUBE
- * 

[Bf-blender-cvs] [cf428b2ebdd] master: Fix ignored click-drag events when operators pass-through & finished

2022-03-01 Thread Campbell Barton
Commit: cf428b2ebddabd5786f65ae8901f25a4cbf456da
Author: Campbell Barton
Date:   Wed Mar 2 12:15:01 2022 +1100
Branches: master
https://developer.blender.org/rBcf428b2ebddabd5786f65ae8901f25a4cbf456da

Fix ignored click-drag events when operators pass-through & finished

Replacing tweak key-map items with click-drag caused selection
in the graph/sequencer/node editors to ignore drag events
(all uses of WM_generic_select_modal).

Operators that return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED
result in the event loop considering the event as being handled.

This stopped WM_CLICK_DRAG events from being generated which is not the
case for tweak events.

As click-drag is intended to be compatible with tweak events,
accept drag events when WM_HANDLER_BREAK isn't set or when
wm_action_not_handled returns true.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index fb5af920ff8..20940c59679 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -3155,8 +3155,14 @@ static int wm_handlers_do(bContext *C, wmEvent *event, 
ListBase *handlers)
   }
 
   if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
-/* Test for CLICK_DRAG events. */
-if (wm_action_not_handled(action)) {
+/* Test for #WM_CLICK_DRAG events. */
+
+/* NOTE(@campbellbarton): Needed so drag can be used for editors that 
support both click
+ * selection and passing through the drag action to box select. See 
#WM_generic_select_modal.
+ * Unlike click, accept `action` when break isn't set.
+ * Operators can return `OPERATOR_FINISHED | OPERATOR_PASS_THROUGH` which 
results
+ * in `action` setting #WM_HANDLER_HANDLED, but not #WM_HANDLER_BREAK. */
+if ((action & WM_HANDLER_BREAK) == 0 || wm_action_not_handled(action)) {
   if (win->event_queue_check_drag) {
 if (WM_event_drag_test(event, event->prev_click_xy)) {
   win->event_queue_check_drag_handled = true;
@@ -3184,7 +3190,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, 
ListBase *handlers)
   copy_v2_v2_int(event->xy, prev_xy);
 
   win->event_queue_check_click = false;
-  if (!wm_action_not_handled(action)) {
+  if (!((action & WM_HANDLER_BREAK) == 0 || 
wm_action_not_handled(action))) {
 /* Only disable when handled as other handlers may use this drag 
event. */
 win->event_queue_check_drag = false;
   }

___
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] [e03b9f555c1] master: Cmake: Re-enable Amaranth add-on

2022-03-01 Thread Aaron Carlisle
Commit: e03b9f555c177161ac3ed66e2f6071d479a563f7
Author: Aaron Carlisle
Date:   Tue Mar 1 17:45:13 2022 -0500
Branches: master
https://developer.blender.org/rBe03b9f555c177161ac3ed66e2f6071d479a563f7

Cmake: Re-enable Amaranth add-on

This add-on now conforms to the distribution requirements, see: T95442.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 01f3e6f52c6..d17afad0918 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -379,9 +379,6 @@ if(WITH_PYTHON)
 PATTERN "__pycache__" EXCLUDE
 PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
 PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
-
- # Disable add-ons that don't conform to distribution requirements, 
see: T95442.
- PATTERN "addons/amaranth" EXCLUDE
   )
 
   unset(ADDON_EXCLUDE_CONDITIONAL)

___
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] [a75e9863fef] blender-v3.1-release: Cmake: Re-enable Amaranth add-on

2022-03-01 Thread Aaron Carlisle
Commit: a75e9863fef9a3f1f9495d66a21c85a7cc73367c
Author: Aaron Carlisle
Date:   Tue Mar 1 17:45:13 2022 -0500
Branches: blender-v3.1-release
https://developer.blender.org/rBa75e9863fef9a3f1f9495d66a21c85a7cc73367c

Cmake: Re-enable Amaranth add-on

This add-on now conforms to the distribution requirements, see: T95442.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 2e626428826..bc4d912405c 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -389,9 +389,6 @@ if(WITH_PYTHON)
 PATTERN "__pycache__" EXCLUDE
 PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
 PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
-
- # Disable add-ons that don't conform to distribution requirements, 
see: T95442.
- PATTERN "addons/amaranth" EXCLUDE
   )
 
   unset(ADDON_EXCLUDE_CONDITIONAL)

___
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] [10405b15ecc] master: Cleanup: Refactor seeking code

2022-03-01 Thread Richard Antalik
Commit: 10405b15ecc3f79e9279ac2eb1f711f4bb1c1cc5
Author: Richard Antalik
Date:   Tue Mar 1 23:41:00 2022 +0100
Branches: master
https://developer.blender.org/rB10405b15ecc3f79e9279ac2eb1f711f4bb1c1cc5

Cleanup: Refactor seeking code

Improve readability and reduce indentation levels. No functional changes.

Reviewed By: zeddb

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

===

M   source/blender/imbuf/intern/anim_movie.c

===

diff --git a/source/blender/imbuf/intern/anim_movie.c 
b/source/blender/imbuf/intern/anim_movie.c
index 469141cb996..f97a50ecf47 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -867,6 +867,17 @@ static void ffmpeg_decode_store_frame_pts(struct anim 
*anim)
  (int64_t)anim->cur_pts);
 }
 
+static int ffmpeg_read_video_frame(struct anim *anim, AVPacket *packet)
+{
+  int ret = 0;
+  while (ret = av_read_frame(anim->pFormatCtx, packet) >= 0) {
+if (packet->stream_index == anim->videoStream) {
+  break;
+}
+  }
+  return ret;
+}
+
 /* decode one video frame also considering the packet read into cur_packet */
 static int ffmpeg_decode_video_frame(struct anim *anim)
 {
@@ -887,7 +898,7 @@ static int ffmpeg_decode_video_frame(struct anim *anim)
 anim->cur_packet->stream_index = -1;
   }
 
-  while ((rval = av_read_frame(anim->pFormatCtx, anim->cur_packet)) >= 0) {
+  while ((rval = ffmpeg_read_video_frame(anim, anim->cur_packet)) >= 0) {
 av_log(anim->pFormatCtx,
AV_LOG_DEBUG,
"%sREAD: strID=%d (VID: %d) dts=%" PRId64 " pts=%" PRId64 " %s\n",
@@ -897,14 +908,13 @@ static int ffmpeg_decode_video_frame(struct anim *anim)
(anim->cur_packet->dts == AV_NOPTS_VALUE) ? -1 : 
(int64_t)anim->cur_packet->dts,
(anim->cur_packet->pts == AV_NOPTS_VALUE) ? -1 : 
(int64_t)anim->cur_packet->pts,
(anim->cur_packet->flags & AV_PKT_FLAG_KEY) ? " KEY" : "");
-if (anim->cur_packet->stream_index == anim->videoStream) {
-  avcodec_send_packet(anim->pCodecCtx, anim->cur_packet);
-  anim->pFrameComplete = avcodec_receive_frame(anim->pCodecCtx, 
anim->pFrame) == 0;
 
-  if (anim->pFrameComplete) {
-ffmpeg_decode_store_frame_pts(anim);
-break;
-  }
+avcodec_send_packet(anim->pCodecCtx, anim->cur_packet);
+anim->pFrameComplete = avcodec_receive_frame(anim->pCodecCtx, 
anim->pFrame) == 0;
+
+if (anim->pFrameComplete) {
+  ffmpeg_decode_store_frame_pts(anim);
+  break;
 }
 av_packet_unref(anim->cur_packet);
 anim->cur_packet->stream_index = -1;
@@ -1159,13 +1169,59 @@ static int ffmpeg_generic_seek_workaround(struct anim 
*anim,
   return av_seek_frame(anim->pFormatCtx, anim->videoStream, current_pts, 
AVSEEK_FLAG_BACKWARD);
 }
 
+/* Read packet until timestamp matches `anim->cur_packet`, thus recovering 
internal `anim` stream
+ * position state. */
+static void ffmpeg_seek_recover_stream_position(struct anim *anim)
+{
+  AVPacket *temp_packet = av_packet_alloc();
+  while (ffmpeg_read_video_frame(anim, temp_packet)) {
+int64_t current_pts = timestamp_from_pts_or_dts(anim->cur_packet->pts, 
anim->cur_packet->dts);
+int64_t temp_pts = timestamp_from_pts_or_dts(temp_packet->pts, 
temp_packet->dts);
+av_packet_unref(temp_packet);
+
+if (current_pts == temp_pts) {
+  break;
+}
+  }
+  av_packet_free(_packet);
+}
+
+/* Check if seeking and mainly flushing codec buffers is needed. */
+static bool ffmpeg_seek_buffers_need_flushing(struct anim *anim, int position, 
int64_t seek_pos)
+{
+  /* Get timestamp of packet read after seeking. */
+  AVPacket *temp_packet = av_packet_alloc();
+  ffmpeg_read_video_frame(anim, temp_packet);
+  int64_t gop_pts = timestamp_from_pts_or_dts(temp_packet->pts, 
temp_packet->dts);
+  av_packet_unref(temp_packet);
+  av_packet_free(_packet);
+
+  /* Seeking gives packet, that is currently read. No seeking was necessary, 
so buffers don't have
+   * to be flushed. */
+  if (gop_pts == timestamp_from_pts_or_dts(anim->cur_packet->pts, 
anim->cur_packet->dts)) {
+return false;
+  }
+
+  /* Packet after seeking is same key frame as current, and further in time. 
No seeking was
+   * necessary, so buffers don't have to be flushed. But stream position has 
to be recovered. */
+  if (gop_pts == anim->cur_key_frame_pts && position > anim->cur_position) {
+ffmpeg_seek_recover_stream_position(anim);
+return false;
+  }
+
+  /* Seeking was necessary, but we have read packets. Therefore we must seek 
again. */
+  av_seek_frame(anim->pFormatCtx, anim->videoStream, seek_pos, 
AVSEEK_FLAG_BACKWARD);
+  anim->cur_key_frame_pts = gop_pts;
+  return true;
+}
+
 /* Seek to last necessary key frame. */
 static int ffmpeg_seek_to_key_frame(struct anim *anim,
 int position,
  

[Bf-blender-cvs] [4491c622605] master: Fix potential crash during proxy building

2022-03-01 Thread Richard Antalik
Commit: 4491c6226051799f4415ba50abbc4861e09af862
Author: Richard Antalik
Date:   Tue Mar 1 23:35:21 2022 +0100
Branches: master
https://developer.blender.org/rB4491c6226051799f4415ba50abbc4861e09af862

Fix potential crash during proxy building

Last step of proxy building caused crash due to thread race contition
when acessing ed->seqbase.

Looking at code, it seems that calling IMB_close_anim_proxies on
original strips is unnecessary so this code was removed to resolve this
issue.

Locking seqbase data may be possible, but it's not very practical as
many functions access this data on demand which can easily cause
program to freeze.

Reviewed By: sergey

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

===

M   source/blender/sequencer/intern/proxy.c

===

diff --git a/source/blender/sequencer/intern/proxy.c 
b/source/blender/sequencer/intern/proxy.c
index d87da1557e0..91b69bfe01f 100644
--- a/source/blender/sequencer/intern/proxy.c
+++ b/source/blender/sequencer/intern/proxy.c
@@ -549,18 +549,6 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context,
   }
 }
 
-static bool seq_orig_free_anims(Sequence *seq_iter, void *data)
-{
-  SessionUUID orig_seq_uuid = ((SeqIndexBuildContext *)data)->orig_seq_uuid;
-
-  if (BLI_session_uuid_is_equal(_iter->runtime.session_uuid, 
_seq_uuid)) {
-for (StripAnim *sanim = seq_iter->anims.first; sanim; sanim = sanim->next) 
{
-  IMB_close_anim_proxies(sanim->anim);
-}
-  }
-  return true;
-}
-
 void SEQ_proxy_rebuild_finish(SeqIndexBuildContext *context, bool stop)
 {
   if (context->index_context) {
@@ -570,9 +558,6 @@ void SEQ_proxy_rebuild_finish(SeqIndexBuildContext 
*context, bool stop)
   IMB_close_anim_proxies(sanim->anim);
 }
 
-/* `context->seq_orig` may have been removed during building. */
-SEQ_for_each_callback(>scene->ed->seqbase, seq_orig_free_anims, 
context);
-
 IMB_anim_index_rebuild_finish(context->index_context, stop);
   }

___
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] [bfe37b7255e] master: Merge branch 'blender-v3.1-release'

2022-03-01 Thread Germano Cavalcante
Commit: bfe37b7255e76b7c66e3f9cfd47bd0636ac142cf
Author: Germano Cavalcante
Date:   Tue Mar 1 18:25:59 2022 -0300
Branches: master
https://developer.blender.org/rBbfe37b7255e76b7c66e3f9cfd47bd0636ac142cf

Merge branch 'blender-v3.1-release'

===



===

diff --cc source/blender/editors/screen/area.c
index a64948b5864,c6834c84794..af84f6f99a9
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@@ -3438,38 -3454,6 +3438,37 @@@ bool ED_area_is_global(const ScrArea *a
return area->global != NULL;
  }
  
 +ScrArea *ED_area_find_under_cursor(const bContext *C, int spacetype, const 
int xy[2])
 +{
 +  bScreen *screen = CTX_wm_screen(C);
 +  wmWindow *win = CTX_wm_window(C);
-   wmWindowManager *wm = CTX_wm_manager(C);
 +
 +  ScrArea *area = NULL;
 +
 +  if (win->parent) {
 +/* If active window is a child, check itself first. */
 +area = BKE_screen_find_area_xy(screen, spacetype, xy);
 +  }
 +
 +  if (!area) {
 +/* Check all windows except the active one. */
 +int scr_pos[2];
- wmWindow *r_win = WM_window_find_under_cursor(wm, win, win, xy, scr_pos);
- if (r_win) {
++wmWindow *r_win = WM_window_find_under_cursor(win, xy, scr_pos);
++if (r_win && r_win != win) {
 +  win = r_win;
 +  screen = WM_window_get_active_screen(win);
 +  area = BKE_screen_find_area_xy(screen, spacetype, scr_pos);
 +}
 +  }
 +
 +  if (!area && !win->parent) {
 +/* If active window is a parent window, check itself last. */
 +area = BKE_screen_find_area_xy(screen, spacetype, xy);
 +  }
 +
 +  return area;
 +}
 +
  ScrArea *ED_screen_areas_iter_first(const wmWindow *win, const bScreen 
*screen)
  {
ScrArea *global_area = win->global_areas.areabase.first;

___
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] [9bd586a01e6] blender-v3.1-release: Fix T95608: Mac issues with drag drop on multi-monitor

2022-03-01 Thread Germano Cavalcante
Commit: 9bd586a01e6813a615eab05871803730603e2152
Author: Germano Cavalcante
Date:   Tue Mar 1 18:09:28 2022 -0300
Branches: blender-v3.1-release
https://developer.blender.org/rB9bd586a01e6813a615eab05871803730603e2152

Fix T95608: Mac issues with drag drop on multi-monitor

Mousemove events are sent to windows.

In Windows OS, almost all mousemove events are sent to the window whose
mouse cursor is over.

On MacOS, the window with mousemove events is always the active window.
It doesn't matter if the mouse cursor is inside or outside the window.

So, in order for non-active windows to also have events,
`WM_window_find_under_cursor` is called to find those windows and send
the same events.

The problem is that to find the window, `WM_window_find_under_cursor`
only has the mouse coordinates available, it doesn't differentiate
which monitor these coordinates came from.

So the mouse on one monitor may incorrectly send events to a window on
another monitor.

The solution used is to use a native API on Mac to detect the window
under the cursor.

For Windows and Linux nothing has changed.

Reviewed By: brecht

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

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_ISystem.h
M   intern/ghost/intern/GHOST_C-api.cpp
M   intern/ghost/intern/GHOST_System.cpp
M   intern/ghost/intern/GHOST_System.h
M   intern/ghost/intern/GHOST_SystemCocoa.h
M   intern/ghost/intern/GHOST_SystemCocoa.mm
M   intern/ghost/intern/GHOST_SystemNULL.h
M   source/blender/editors/interface/interface_eyedropper.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 98094cc0669..a2eef91c704 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -265,6 +265,16 @@ extern GHOST_TSuccess 
GHOST_EndFullScreen(GHOST_SystemHandle systemhandle);
  */
 extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle);
 
+/**
+ * Get the Window under the cursor.
+ * \param x: The x-coordinate of the cursor.
+ * \param y: The y-coordinate of the cursor.
+ * @return The window under the cursor or nullptr in none.
+ */
+extern GHOST_WindowHandle GHOST_GetWindowUnderCursor(GHOST_SystemHandle 
systemhandle,
+ int32_t x,
+ int32_t y);
+
 
/***
  * Event management functionality
  
***/
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 05c6c9d907f..4c568a0cc02 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -325,6 +325,14 @@ class GHOST_ISystem {
*/
   virtual void useWindowFocus(const bool use_focus) = 0;
 
+  /**
+   * Get the Window under the cursor.
+   * \param x: The x-coordinate of the cursor.
+   * \param y: The y-coordinate of the cursor.
+   * @return The window under the cursor or nullptr if none.
+   */
+  virtual GHOST_IWindow *getWindowUnderCursor(int32_t x, int32_t y) = 0;
+
   
/***
* Event management functionality

***/
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index a21c3a90c06..3d8411a8268 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -249,6 +249,16 @@ int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
   return (int)system->getFullScreen();
 }
 
+GHOST_WindowHandle GHOST_GetWindowUnderCursor(GHOST_SystemHandle systemhandle,
+  int32_t x,
+  int32_t y)
+{
+  GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
+  GHOST_IWindow *window = system->getWindowUnderCursor(x, y);
+
+  return (GHOST_WindowHandle)window;
+}
+
 bool GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, bool waitForEvent)
 {
   GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
diff --git a/intern/ghost/intern/GHOST_System.cpp 
b/intern/ghost/intern/GHOST_System.cpp
index d09c167cb95..17f74003805 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -205,6 +205,25 @@ bool GHOST_System::getFullScreen(void)
   return fullScreen;
 }
 
+GHOST_IWindow *GHOST_System::getWindowUnderCursor(int32_t x, int32_t y)
+{
+  /* TODO: This solution should follow the order of the activated windows 
(Z-order).
+   * It is 

[Bf-blender-cvs] [0b5bd7a1be4] tmp_lib_update_32: windows: fix typo in platform/platform_win32.cmake

2022-03-01 Thread Ray Molenkamp
Commit: 0b5bd7a1be45e42dc6412dfb880f9a9dcab0603a
Author: Ray Molenkamp
Date:   Tue Mar 1 12:39:20 2022 -0700
Branches: tmp_lib_update_32
https://developer.blender.org/rB0b5bd7a1be45e42dc6412dfb880f9a9dcab0603a

windows: fix typo in platform/platform_win32.cmake

missing endif()

===

M   build_files/cmake/platform/platform_win32.cmake

===

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 6347ef468b1..7a2fa1e8857 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -417,7 +417,7 @@ if(WITH_IMAGE_OPENEXR)
   optimized ${IMATH_LIBPATH}/Imath-3_1.lib
   debug ${IMATH_LIBPATH}/Imath-3_1_d.lib
 )
-
+  endif()
   set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
   set(OPENEXR_VERSION "3.14")
   windows_find_package(OPENEXR REQUIRED)

___
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] [e1ec2d02514] master: Merge branch 'blender-v3.1-release'

2022-03-01 Thread Germano Cavalcante
Commit: e1ec2d025142a35ce5a5302da0b9a71a279c61f2
Author: Germano Cavalcante
Date:   Tue Mar 1 16:31:18 2022 -0300
Branches: master
https://developer.blender.org/rBe1ec2d025142a35ce5a5302da0b9a71a279c61f2

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] [8e88af99348] blender-v3.1-release: Fix wrong object mode checking in snap code

2022-03-01 Thread Germano Cavalcante
Commit: 8e88af99348590e9879dcbfe97bbbc180fc5ec67
Author: Germano Cavalcante
Date:   Tue Mar 1 16:11:38 2022 -0300
Branches: blender-v3.1-release
https://developer.blender.org/rB8e88af99348590e9879dcbfe97bbbc180fc5ec67

Fix wrong object mode checking in snap code

The value of `OB_MODE_OBJECT` is 0, this makes it unsuitable as a bitflag.

Issue pointed out at https://pvs-studio.com/en/blog/posts/cpp/0922/

Thanks to Andrey Karpov

===

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

===

diff --git a/source/blender/editors/transform/transform_snap_object.c 
b/source/blender/editors/transform/transform_snap_object.c
index dc9315b6d5a..515a4360bb5 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -491,7 +491,7 @@ static void iter_snap_objects(SnapObjectContext *sctx,
   }
 }
 else if (snap_select == SNAP_NOT_SELECTED) {
-  if (is_object_active && !(base->object->mode & OB_MODE_OBJECT)) {
+  if (is_object_active && base->object->mode != OB_MODE_OBJECT) {
 /* Pass. Consider the selection of elements being edited. */
   }
   else if ((base->flag & BASE_SELECTED) || (base->flag_legacy & 
BA_WAS_SEL)) {

___
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] [8322a4f6b76] blender-v3.1-release: Fix T92980: missing Cycles video texture update with persistent data

2022-03-01 Thread Brecht Van Lommel
Commit: 8322a4f6b76960cb4983f8aaf5a74e694aed1384
Author: Brecht Van Lommel
Date:   Tue Mar 1 19:45:36 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB8322a4f6b76960cb4983f8aaf5a74e694aed1384

Fix T92980: missing Cycles video texture update with persistent data

===

M   intern/cycles/blender/shader.cpp
M   intern/cycles/blender/sync.cpp
M   intern/cycles/blender/sync.h

===

diff --git a/intern/cycles/blender/shader.cpp b/intern/cycles/blender/shader.cpp
index 418393c2be7..65866525894 100644
--- a/intern/cycles/blender/shader.cpp
+++ b/intern/cycles/blender/shader.cpp
@@ -1587,18 +1587,13 @@ void BlenderSync::sync_lights(BL::Depsgraph 
_depsgraph, bool update_all)
   }
 }
 
-void BlenderSync::sync_shaders(BL::Depsgraph _depsgraph, BL::SpaceView3D 
_v3d)
+void BlenderSync::sync_shaders(BL::Depsgraph _depsgraph, BL::SpaceView3D 
_v3d, bool update_all)
 {
-  /* for auto refresh images */
-  ImageManager *image_manager = scene->image_manager;
-  const int frame = b_scene.frame_current();
-  const bool auto_refresh_update = 
image_manager->set_animation_frame_update(frame);
-
   shader_map.pre_sync();
 
-  sync_world(b_depsgraph, b_v3d, auto_refresh_update);
-  sync_lights(b_depsgraph, auto_refresh_update);
-  sync_materials(b_depsgraph, auto_refresh_update);
+  sync_world(b_depsgraph, b_v3d, update_all);
+  sync_lights(b_depsgraph, update_all);
+  sync_materials(b_depsgraph, update_all);
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 7e6f1535d66..851e4751501 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -259,7 +259,12 @@ void BlenderSync::sync_data(BL::RenderSettings _render,
 int height,
 void **python_thread_state)
 {
-  if (!has_updates_) {
+  /* For auto refresh images. */
+  ImageManager *image_manager = scene->image_manager;
+  const int frame = b_scene.frame_current();
+  const bool auto_refresh_update = 
image_manager->set_animation_frame_update(frame);
+
+  if (!has_updates_ && !auto_refresh_update) {
 return;
   }
 
@@ -274,7 +279,7 @@ void BlenderSync::sync_data(BL::RenderSettings _render,
   sync_view_layer(b_view_layer);
   sync_integrator(b_view_layer, background);
   sync_film(b_view_layer, b_v3d);
-  sync_shaders(b_depsgraph, b_v3d);
+  sync_shaders(b_depsgraph, b_v3d, auto_refresh_update);
   sync_images();
 
   geometry_synced.clear(); /* use for objects and motion sync */
diff --git a/intern/cycles/blender/sync.h b/intern/cycles/blender/sync.h
index 3722b938863..01bb92331f6 100644
--- a/intern/cycles/blender/sync.h
+++ b/intern/cycles/blender/sync.h
@@ -127,7 +127,7 @@ class BlenderSync {
   /* Shader */
   array find_used_shaders(BL::Object _ob);
   void sync_world(BL::Depsgraph _depsgraph, BL::SpaceView3D _v3d, bool 
update_all);
-  void sync_shaders(BL::Depsgraph _depsgraph, BL::SpaceView3D _v3d);
+  void sync_shaders(BL::Depsgraph _depsgraph, BL::SpaceView3D _v3d, bool 
update_all);
   void sync_nodes(Shader *shader, BL::ShaderNodeTree _ntree);
 
   /* Object */

___
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] [6498688e274] master: GPencil: Improve subdivision modifier

2022-03-01 Thread Henrik Dick
Commit: 6498688e274836a66d9075edfe79fd3572334427
Author: Henrik Dick
Date:   Tue Mar 1 19:32:02 2022 +0100
Branches: master
https://developer.blender.org/rB6498688e274836a66d9075edfe79fd3572334427

GPencil: Improve subdivision modifier

The subdivision modifier for Grease Pencil handles closed strokes
correctly now and does converge to the same shape as the mesh
subdivision surface.

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

===

M   source/blender/blenkernel/intern/gpencil_geom.cc
M   source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c

===

diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc 
b/source/blender/blenkernel/intern/gpencil_geom.cc
index 1823d84d48d..865bcebee25 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -2098,27 +2098,30 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, 
bGPDstroke *gps, int level, int
   MDeformVert *dvert_final = nullptr;
   MDeformVert *dvert_next = nullptr;
   int totnewpoints, oldtotpoints;
-  int i2;
+
+  bool cyclic = (gps->flag & GP_STROKE_CYCLIC) != 0;
 
   for (int s = 0; s < level; s++) {
-totnewpoints = gps->totpoints - 1;
+totnewpoints = gps->totpoints;
+if (!cyclic) {
+  totnewpoints--;
+}
 /* duplicate points in a temp area */
-temp_points = (bGPDspoint *)MEM_dupallocN(gps->points);
+temp_points = gps->points;
 oldtotpoints = gps->totpoints;
 
 /* resize the points arrays */
 gps->totpoints += totnewpoints;
-gps->points = (bGPDspoint *)MEM_recallocN(gps->points, 
sizeof(*gps->points) * gps->totpoints);
+gps->points = (bGPDspoint *)MEM_malloc_arrayN(gps->totpoints, 
sizeof(*gps->points), __func__);
 if (gps->dvert != nullptr) {
-  temp_dverts = (MDeformVert *)MEM_dupallocN(gps->dvert);
-  gps->dvert = (MDeformVert *)MEM_recallocN(gps->dvert, 
sizeof(*gps->dvert) * gps->totpoints);
+  temp_dverts = gps->dvert;
+  gps->dvert = (MDeformVert *)MEM_malloc_arrayN(gps->totpoints, 
sizeof(*gps->dvert), __func__);
 }
 
 /* move points from last to first to new place */
-i2 = gps->totpoints - 1;
-for (int i = oldtotpoints - 1; i > 0; i--) {
+for (int i = 0; i < oldtotpoints; i++) {
   bGPDspoint *pt = _points[i];
-  bGPDspoint *pt_final = >points[i2];
+  bGPDspoint *pt_final = >points[i * 2];
 
   copy_v3_v3(_final->x, >x);
   pt_final->pressure = pt->pressure;
@@ -2131,18 +2134,16 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, 
bGPDstroke *gps, int level, int
 
   if (gps->dvert != nullptr) {
 dvert = _dverts[i];
-dvert_final = >dvert[i2];
+dvert_final = >dvert[i * 2];
 dvert_final->totweight = dvert->totweight;
 dvert_final->dw = dvert->dw;
   }
-  i2 -= 2;
 }
 /* interpolate mid points */
-i2 = 1;
-for (int i = 0; i < oldtotpoints - 1; i++) {
-  bGPDspoint *pt = _points[i];
-  bGPDspoint *next = _points[i + 1];
-  bGPDspoint *pt_final = >points[i2];
+for (int i = cyclic ? 0 : 1, j = cyclic ? oldtotpoints - 1 : 0; i < 
oldtotpoints; j = i, i++) {
+  bGPDspoint *pt = _points[j];
+  bGPDspoint *next = _points[i];
+  bGPDspoint *pt_final = >points[j * 2 + 1];
 
   /* add a half way point */
   interp_v3_v3v3(_final->x, >x, >x, 0.5f);
@@ -2155,9 +2156,9 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, 
bGPDstroke *gps, int level, int
   interp_v4_v4v4(pt_final->vert_color, pt->vert_color, next->vert_color, 
0.5f);
 
   if (gps->dvert != nullptr) {
-dvert = _dverts[i];
-dvert_next = _dverts[i + 1];
-dvert_final = >dvert[i2];
+dvert = _dverts[j];
+dvert_next = _dverts[i];
+dvert_final = >dvert[j * 2 + 1];
 
 dvert_final->totweight = dvert->totweight;
 dvert_final->dw = (MDeformWeight *)MEM_dupallocN(dvert->dw);
@@ -2172,8 +2173,6 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, 
bGPDstroke *gps, int level, int
   }
 }
   }
-
-  i2 += 2;
 }
 
 MEM_SAFE_FREE(temp_points);
@@ -2181,20 +2180,18 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, 
bGPDstroke *gps, int level, int
 
 /* Move points to smooth stroke (not simple type). */
 if (type != GP_SUBDIV_SIMPLE) {
-  /* duplicate points in a temp area with the new subdivide data */
-  temp_points = (bGPDspoint *)MEM_dupallocN(gps->points);
-
+  float mid[3];
   /* extreme points are not changed */
-  for (int i = 0; i < gps->totpoints - 2; i++) {
-bGPDspoint *pt = _points[i];
-bGPDspoint *next = _points[i + 1];
-bGPDspoint *pt_final = >points[i + 1];
+  for (int i = cyclic ? 0 : 2, j = cyclic ? gps->totpoints - 2 : 0; i < 
gps->totpoints - 2;
+   j = i, i += 2) {
+bGPDspoint *prev = 

[Bf-blender-cvs] [444d57d4404] master: Geometry Nodes: Port most curve primitives to new data-block

2022-03-01 Thread Hans Goudey
Commit: 444d57d440459304a248ba75e1936b69be4d09dd
Author: Hans Goudey
Date:   Tue Mar 1 12:06:11 2022 -0500
Branches: master
https://developer.blender.org/rB444d57d440459304a248ba75e1936b69be4d09dd

Geometry Nodes: Port most curve primitives to new data-block

Create `Curves` directly, instead of using the conversion from
`CurveEval`. This means that the `tilt` and `radius` attributes
don't need to be allocated. The old behavior is kept by using the
right defaults in the conversion to `CurveEval` later on.

The Bezier segment primitive isn't ported yet, because functions
to provide easy access to built-in attributes used for Bezier curves
haven't been added yet.

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

===

M   source/blender/blenkernel/BKE_curves.hh
M   source/blender/blenkernel/intern/curves.cc
M   source/blender/editors/include/ED_curves.h
M   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc

===

diff --git a/source/blender/blenkernel/BKE_curves.hh 
b/source/blender/blenkernel/BKE_curves.hh
index 6fa7de49eb0..f3d9090d16b 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -158,4 +158,9 @@ class CurvesGeometry : public ::CurvesGeometry {
 
 Curves *curves_new_nomain(int point_size, int curves_size);
 
+/**
+ * Create a new curves data-block containing a single curve with the given 
length and type.
+ */
+Curves *curves_new_nomain_single(int point_size, CurveType type);
+
 }  // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/curves.cc 
b/source/blender/blenkernel/intern/curves.cc
index c7aaf4718fe..838f7f28e93 100644
--- a/source/blender/blenkernel/intern/curves.cc
+++ b/source/blender/blenkernel/intern/curves.cc
@@ -374,4 +374,13 @@ Curves *curves_new_nomain(const int point_size, const int 
curves_size)
   return curves;
 }
 
+Curves *curves_new_nomain_single(const int point_size, const CurveType type)
+{
+  Curves *curves = curves_new_nomain(point_size, 1);
+  CurvesGeometry  = CurvesGeometry::wrap(curves->geometry);
+  geometry.offsets().last() = point_size;
+  geometry.curve_types().first() = type;
+  return curves;
+}
+
 }  // namespace blender::bke
diff --git a/source/blender/editors/include/ED_curves.h 
b/source/blender/editors/include/ED_curves.h
index 706563061d4..9233b65b2ce 100644
--- a/source/blender/editors/include/ED_curves.h
+++ b/source/blender/editors/include/ED_curves.h
@@ -25,4 +25,4 @@ namespace blender::ed::curves {
 bke::CurvesGeometry primitive_random_sphere(int curves_size, int 
points_per_curve);
 
 }
-#endif
\ No newline at end of file
+#endif
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
index 339e65321b1..6c7d7ed375b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_arc.cc
@@ -1,11 +1,15 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
-#include "BKE_spline.hh"
+#include 
+
 #include "BLI_math_base_safe.h"
+
+#include "BKE_curves.hh"
+
 #include "UI_interface.h"
 #include "UI_resources.h"
+
 #include "node_geometry_util.hh"
-#include 
 
 namespace blender::nodes::node_geo_curve_primitive_arc_cc {
 
@@ -139,32 +143,24 @@ static bool colinear_f3_f3_f3(const float3 p1, const 
float3 p2, const float3 p3)
   return (ELEM(a, b, b * -1.0f));
 }
 
-static std::unique_ptr create_arc_curve_from_points(const int 
resolution,
-   const float3 a,
-   const float3 b,
-   const float3 c,
-   float 
angle_offset,
-   const bool 
connect_center,
-   const bool 
invert_arc,
-   float3 
_center,
-   float3 
_normal,
-   float _radius)
+static Curves *create_arc_curve_from_points(const int resolution,
+ 

[Bf-blender-cvs] [f085c2bab5b] blender-v3.1-release: Cmake: Re-enable tiny cad add-on

2022-03-01 Thread Aaron Carlisle
Commit: f085c2bab5b62a7ec188d7e5be93dfdd4b5418aa
Author: Aaron Carlisle
Date:   Tue Mar 1 11:58:19 2022 -0500
Branches: blender-v3.1-release
https://developer.blender.org/rBf085c2bab5b62a7ec188d7e5be93dfdd4b5418aa

Cmake: Re-enable tiny cad add-on

This add-on now conforms to the distribution requirements, see: T95442.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 22903cfae64..2e626428826 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -392,7 +392,6 @@ if(WITH_PYTHON)
 
  # Disable add-ons that don't conform to distribution requirements, 
see: T95442.
  PATTERN "addons/amaranth" EXCLUDE
- PATTERN "addons/mesh_tiny_cad" EXCLUDE
   )
 
   unset(ADDON_EXCLUDE_CONDITIONAL)

___
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] [89bf5d8ba98] master: Cmake: Re-enable tiny cad add-on

2022-03-01 Thread Aaron Carlisle
Commit: 89bf5d8ba98f4236f9d14d3a6029f0471e42
Author: Aaron Carlisle
Date:   Tue Mar 1 11:56:42 2022 -0500
Branches: master
https://developer.blender.org/rB89bf5d8ba98f4236f9d14d3a6029f0471e42

Cmake: Re-enable tiny cad add-on

This add-on now conforms to the distribution requirements, see: T95442.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 042e49c402b..01f3e6f52c6 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -382,7 +382,6 @@ if(WITH_PYTHON)
 
  # Disable add-ons that don't conform to distribution requirements, 
see: T95442.
  PATTERN "addons/amaranth" EXCLUDE
- PATTERN "addons/mesh_tiny_cad" EXCLUDE
   )
 
   unset(ADDON_EXCLUDE_CONDITIONAL)

___
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] [f98d74c80de] master: Curves: Move curves primitive to object add code

2022-03-01 Thread Hans Goudey
Commit: f98d74c80de7b1cae1e5a963f33c51c49f478ba1
Author: Hans Goudey
Date:   Tue Mar 1 11:40:25 2022 -0500
Branches: master
https://developer.blender.org/rBf98d74c80de7b1cae1e5a963f33c51c49f478ba1

Curves: Move curves primitive to object add code

Currently, any time a Curves data-block is created, the `curves_random`
function runs, filling it with 500 random curves, also adding a radius
attribute. This is just left over from the prototype in the initial
commit that added the type.

This commit moves the code that creates the random data to the curve
editors module, like the other primitives are organized.

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

===

M   source/blender/blenkernel/intern/curves.cc
M   source/blender/editors/curves/CMakeLists.txt
A   source/blender/editors/curves/intern/curves_add.cc
M   source/blender/editors/include/ED_curves.h
M   source/blender/editors/object/CMakeLists.txt
M   source/blender/editors/object/object_add.cc

===

diff --git a/source/blender/blenkernel/intern/curves.cc 
b/source/blender/blenkernel/intern/curves.cc
index d7783c76f65..c7aaf4718fe 100644
--- a/source/blender/blenkernel/intern/curves.cc
+++ b/source/blender/blenkernel/intern/curves.cc
@@ -50,7 +50,6 @@ using blender::Span;
 
 static const char *ATTR_POSITION = "position";
 
-static void curves_random(Curves *curves);
 static void update_custom_data_pointers(Curves );
 
 static void curves_init_data(ID *id)
@@ -61,8 +60,6 @@ static void curves_init_data(ID *id)
   MEMCPY_STRUCT_AFTER(curves, DNA_struct_default_get(Curves), id);
 
   new (>geometry) blender::bke::CurvesGeometry();
-
-  curves_random(curves);
 }
 
 static void curves_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID 
*id_src, const int flag)
@@ -234,49 +231,6 @@ static void update_custom_data_pointers(Curves )
   
blender::bke::CurvesGeometry::wrap(curves.geometry).update_customdata_pointers();
 }
 
-static void curves_random(Curves *curves)
-{
-  const int numpoints = 8;
-
-  blender::bke::CurvesGeometry  = 
blender::bke::CurvesGeometry::wrap(curves->geometry);
-  geometry = blender::bke::CurvesGeometry(500 * numpoints, 500);
-
-  MutableSpan offsets = geometry.offsets();
-  MutableSpan positions = geometry.positions();
-
-  float *radius_data = (float *)CustomData_add_layer_named(
-  _data, CD_PROP_FLOAT, CD_DEFAULT, nullptr, 
geometry.point_size, "radius");
-  MutableSpan radii{radius_data, geometry.points_size()};
-
-  for (const int i : offsets.index_range()) {
-offsets[i] = numpoints * i;
-  }
-
-  RandomNumberGenerator rng;
-
-  for (int i = 0; i < geometry.curve_size; i++) {
-const IndexRange curve_range = geometry.range_for_curve(i);
-MutableSpan curve_positions = positions.slice(curve_range);
-MutableSpan curve_radii = radii.slice(curve_range);
-
-const float theta = 2.0f * M_PI * rng.get_float();
-const float phi = saacosf(2.0f * rng.get_float() - 1.0f);
-
-float3 no = {std::sin(theta) * std::sin(phi), std::cos(theta) * 
std::sin(phi), std::cos(phi)};
-no = blender::math::normalize(no);
-
-float3 co = no;
-for (int key = 0; key < numpoints; key++) {
-  float t = key / (float)(numpoints - 1);
-  curve_positions[key] = co;
-  curve_radii[key] = 0.02f * (1.0f - t);
-
-  float3 offset = float3(rng.get_float(), rng.get_float(), 
rng.get_float()) * 2.0f - 1.0f;
-  co += (offset + no) / numpoints;
-}
-  }
-}
-
 void *BKE_curves_add(Main *bmain, const char *name)
 {
   Curves *curves = static_cast(BKE_id_new(bmain, ID_CV, name));
diff --git a/source/blender/editors/curves/CMakeLists.txt 
b/source/blender/editors/curves/CMakeLists.txt
index 93b21a46916..1731d224b3e 100644
--- a/source/blender/editors/curves/CMakeLists.txt
+++ b/source/blender/editors/curves/CMakeLists.txt
@@ -14,6 +14,7 @@ set(INC
 )
 
 set(SRC
+  intern/curves_add.cc
   intern/curves_ops.cc
 )
 
diff --git a/source/blender/editors/curves/intern/curves_add.cc 
b/source/blender/editors/curves/intern/curves_add.cc
new file mode 100644
index 000..9cde23451dc
--- /dev/null
+++ b/source/blender/editors/curves/intern/curves_add.cc
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/** \file
+ * \ingroup edcurves
+ */
+
+#include "BLI_rand.hh"
+
+#include "BKE_curves.hh"
+
+#include "ED_curves.h"
+
+namespace blender::ed::curves {
+
+bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int 
points_per_curve)
+{
+  bke::CurvesGeometry curves(points_per_curve * curves_size, curves_size);
+
+  MutableSpan offsets = curves.offsets();
+  MutableSpan positions = curves.positions();
+
+  float *radius_data = (float *)CustomData_add_layer_named(
+  _data, CD_PROP_FLOAT, CD_DEFAULT, nullptr, 
curves.point_size, "radius");
+  MutableSpan radii{radius_data, curves.points_size()};
+
+  for (const int i : 

[Bf-blender-cvs] [952a613d384] blender-v3.1-release: Cycles: Hide MetalRT checkbox for AMD GPUs

2022-03-01 Thread Michael Jones
Commit: 952a613d3843a7ab47bd8063da71c277ee0a013f
Author: Michael Jones
Date:   Tue Feb 22 17:09:28 2022 +
Branches: blender-v3.1-release
https://developer.blender.org/rB952a613d3843a7ab47bd8063da71c277ee0a013f

Cycles: Hide MetalRT checkbox for AMD GPUs

This patch hides the MetalRT checkbox for AMD GPUs, pending fixes for MetalRT 
argument encoding on AMD.

Reviewed By: brecht

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

===

M   intern/cycles/blender/addon/properties.py
M   intern/cycles/device/metal/device_impl.mm

===

diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index ef686fc0c70..84d0e95acd8 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1527,9 +1527,12 @@ class CyclesPreferences(bpy.types.AddonPreferences):
 row.prop(self, "peer_memory")
 
 if compute_device_type == 'METAL':
-row = layout.row()
-row.use_property_split = True
-row.prop(self, "use_metalrt")
+import platform
+# MetalRT only works on Apple Silicon at present, pending argument 
encoding fixes on AMD
+if platform.machine() == 'arm64':
+row = layout.row()
+row.use_property_split = True
+row.prop(self, "use_metalrt")
 
 
 def draw(self, context):
diff --git a/intern/cycles/device/metal/device_impl.mm 
b/intern/cycles/device/metal/device_impl.mm
index 8ced0210e30..7291dd880ca 100644
--- a/intern/cycles/device/metal/device_impl.mm
+++ b/intern/cycles/device/metal/device_impl.mm
@@ -90,11 +90,11 @@ MetalDevice::MetalDevice(const DeviceInfo , Stats 
, Profiler 
 }
 case METAL_GPU_APPLE: {
   max_threads_per_threadgroup = 512;
+  use_metalrt = info.use_metalrt;
   break;
 }
   }
 
-  use_metalrt = info.use_metalrt;
   if (auto metalrt = getenv("CYCLES_METALRT")) {
 use_metalrt = (atoi(metalrt) != 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] [b5176e90bf5] temp-image-buffer-rasterizer: Improved rasterizing quality.

2022-03-01 Thread Jeroen Bakker
Commit: b5176e90bf5cd06065f48591699043d4f3850ed6
Author: Jeroen Bakker
Date:   Tue Mar 1 15:54:54 2022 +0100
Branches: temp-image-buffer-rasterizer
https://developer.blender.org/rBb5176e90bf5cd06065f48591699043d4f3850ed6

Improved rasterizing quality.

===

M   source/blender/imbuf/IMB_rasterizer.hh
M   source/blender/imbuf/intern/rasterizer_test.cc

===

diff --git a/source/blender/imbuf/IMB_rasterizer.hh 
b/source/blender/imbuf/IMB_rasterizer.hh
index aa51dab68df..6a07a0a20d7 100644
--- a/source/blender/imbuf/IMB_rasterizer.hh
+++ b/source/blender/imbuf/IMB_rasterizer.hh
@@ -75,7 +75,7 @@
 
 #include 
 
-//#define DEBUG_PRINT
+#define DEBUG_PRINT
 
 namespace blender::imbuf::rasterizer {
 
@@ -206,6 +206,8 @@ template class 
Rasterlines {
   {
   }
 
+  virtual ~Rasterlines() = default;
+
   void append(const Rasterline )
   {
 buffer.append(value);
@@ -275,10 +277,7 @@ class Rasterizer {
   {
   }
 
-  virtual ~Rasterizer()
-  {
-flush();
-  }
+  virtual ~Rasterizer() = default;
 
   VertexShader _shader()
   {
@@ -350,13 +349,7 @@ class Rasterizer {
 std::array sorted_vertices = 
order_triangle_vertices(vertex_out);
 
 const int min_rasterline_y = 
clamping_method.scanline_for(sorted_vertices[0]->coord[1]);
-const int mid_rasterline_y_correction = 
clamping_method.distance_to_scanline_anchor(
-sorted_vertices[1]->coord[1]) 
== 0.0 ?
-0 :
-1;
-const int mid_rasterline_y = max_ii(
-clamping_method.scanline_for(sorted_vertices[1]->coord[1]) - 
mid_rasterline_y_correction,
-min_rasterline_y);
+const int mid_rasterline_y = 
clamping_method.scanline_for(sorted_vertices[1]->coord[1]);
 const int max_rasterline_y = 
clamping_method.scanline_for(sorted_vertices[2]->coord[1]) - 1;
 
 /* left and right branch. */
@@ -642,6 +635,7 @@ class Rasterizer {
   void render_rasterline(const RasterlineType )
   {
 FragmentInputType data = rasterline.start_data;
+printf("%u, %u\n", rasterline.start_x, rasterline.end_x);
 for (uint32_t x = rasterline.start_x; x < rasterline.end_x; x++) {
   uint32_t pixel_index = (rasterline.y * image_buffer_->x + x);
   float *pixel_ptr = _buffer_->rect_float[pixel_index * 4];
diff --git a/source/blender/imbuf/intern/rasterizer_test.cc 
b/source/blender/imbuf/intern/rasterizer_test.cc
index e4b8a5c043a..e3ee6ffadce 100644
--- a/source/blender/imbuf/intern/rasterizer_test.cc
+++ b/source/blender/imbuf/intern/rasterizer_test.cc
@@ -28,7 +28,7 @@ class VertexShader : public AbstractVertexShader {
   {
 float2 coord = float2(vp_mat * float3(input.uv[0], input.uv[1], 0.0));
 r_output->coord = coord * image_size;
-r_output->data = float4(coord[0], coord[1], input.value, 1.0);
+r_output->data = float4(input.value, input.value, input.value, 1.0);
   }
 };
 
@@ -76,14 +76,13 @@ TEST(imbuf_rasterizer, draw_triangle_edge_alignment_quality)
  VertexInput(float2(1.0, -1.0), 1.0));
 rasterizer.flush();
 
+/* Check if each pixel has been drawn exactly once. */
 if (rasterizer.stats.drawn_fragments != IMBUF_SIZE * IMBUF_SIZE) {
   printf("%s\n", file_name);
 }
-
-/* Check if each pixel has been drawn exactly once. */
 EXPECT_EQ(rasterizer.stats.drawn_fragments, IMBUF_SIZE * IMBUF_SIZE);
 
-#if 1
+#if 0
 IMB_saveiff(_buffer, file_name, IB_rectfloat);
 #endif
 
@@ -92,6 +91,94 @@ TEST(imbuf_rasterizer, draw_triangle_edge_alignment_quality)
 
   imb_freerectImbuf_all(_buffer);
 }
+/**
+ * This test case renders 3 images that should have the same coverage. But 
using a different edge.
+ *
+ * The results should be identical.
+ */
+TEST(imbuf_rasterizer, edge_pixel_clamping)
+{
+  using RasterizerType =
+  Rasterizer;
+  float clear_color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+
+  ImBuf image_buffer_a;
+  ImBuf image_buffer_b;
+  ImBuf image_buffer_c;
+  int fragments_drawn_a;
+  int fragments_drawn_b;
+  int fragments_drawn_c;
+
+  {
+printf("a\n");
+IMB_initImBuf(_buffer_a, IMBUF_SIZE, IMBUF_SIZE, 32, IB_rectfloat);
+
+RasterizerType rasterizer_a(_buffer_a);
+VertexShader _shader = rasterizer_a.vertex_shader();
+vertex_shader.image_size = float2(image_buffer_a.x, image_buffer_a.y);
+vertex_shader.vp_mat = float4x4::identity();
+IMB_rectfill(_buffer_a, clear_color);
+rasterizer_a.draw_triangle(VertexInput(float2(0.2, -0.2), 1.0),
+   VertexInput(float2(1.2, 1.2), 1.0),
+   VertexInput(float2(1.5, -0.3), 1.0));
+rasterizer_a.flush();
+fragments_drawn_a = rasterizer_a.stats.drawn_fragments;
+  }
+  {
+printf("b\n");
+IMB_initImBuf(_buffer_b, IMBUF_SIZE, IMBUF_SIZE, 32, IB_rectfloat);
+
+

[Bf-blender-cvs] [1383c53e188] temp-library-overrides-outliner: Display modifiers and other collections with overrides in the tree

2022-03-01 Thread Julian Eisel
Commit: 1383c53e188ae4bd083634c3cd03247c3ff2448f
Author: Julian Eisel
Date:   Tue Mar 1 15:27:56 2022 +0100
Branches: temp-library-overrides-outliner
https://developer.blender.org/rB1383c53e188ae4bd083634c3cd03247c3ff2448f

Display modifiers and other collections with overrides in the tree

Rather than only displaying individual overriden modifier in the tree,
all are shown now, since the other modifiers add important context (e.g.
the order). This is especially important when a modifier was added
through an override. Same for constraints and in fact all other
collection properties now. The items are grouped together under a parent
item (e.g. "Modifiers").

Also:
- Path segments that define nested structs (RNA pointer properties where
  the pointer property itself isn't the override) will also be displayed
  as a parent item now, as explained in T95802, since this comes
  naturally from the code added for grouping collection items. If we end
  up not liking this, and rather display a single item with a sub-path,
  this can easily be done still.

===

M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_outliner/outliner_tree.cc
M   source/blender/editors/space_outliner/tree/tree_element.cc
M   source/blender/editors/space_outliner/tree/tree_element.hh
M   source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M   source/blender/editors/space_outliner/tree/tree_element_overrides.hh
M   source/blender/makesdna/DNA_outliner_types.h

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index c6816bc9bd2..16c6c4809e1 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -2405,6 +2405,12 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem 
*tselem, TreeElement *te)
   case TSE_LIBRARY_OVERRIDE:
 data.icon = ICON_LIBRARY_DATA_OVERRIDE;
 break;
+  case TSE_LIBRARY_OVERRIDE_RNA_COLLECTION_ITEM: {
+const auto _col_item = 
tree_element_cast(
+te);
+data.icon = override_col_item->getIcon();
+break;
+  }
   case TSE_LINKED_OB:
 data.icon = ICON_OBJECT_DATA;
 break;
@@ -3337,7 +3343,11 @@ static void outliner_draw_tree_element(bContext *C,
 offsx += UI_UNIT_X;
 
 /* Data-type icon. */
-if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, 
TSE_ID_BASE))) {
+if (!(ELEM(tselem->type,
+   TSE_RNA_PROPERTY,
+   TSE_RNA_ARRAY_ELEM,
+   TSE_ID_BASE,
+   TSE_LIBRARY_OVERRIDE_RNA_CONTAINER))) {
   tselem_draw_icon(block,
xmax,
(float)startx + offsx,
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc 
b/source/blender/editors/space_outliner/outliner_tree.cc
index 06a5918f25c..673fe8ae1c6 100644
--- a/source/blender/editors/space_outliner/outliner_tree.cc
+++ b/source/blender/editors/space_outliner/outliner_tree.cc
@@ -871,7 +871,11 @@ TreeElement *outliner_add_element(SpaceOutliner 
*space_outliner,
   BLI_assert_msg(0, "Expected this ID type to be ported to new Outliner 
tree-element design");
 }
   }
-  else if (ELEM(type, TSE_LIBRARY_OVERRIDE_BASE, TSE_LIBRARY_OVERRIDE)) {
+  else if (ELEM(type,
+TSE_LIBRARY_OVERRIDE_BASE,
+TSE_LIBRARY_OVERRIDE,
+TSE_LIBRARY_OVERRIDE_RNA_CONTAINER,
+TSE_LIBRARY_OVERRIDE_RNA_COLLECTION_ITEM)) {
 if (!te->abstract_element) {
   BLI_assert_msg(0,
  "Expected override types to be ported to new Outliner 
tree-element design");
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc 
b/source/blender/editors/space_outliner/tree/tree_element.cc
index 3c2023d7905..7b0db0d46ba 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element.cc
@@ -74,6 +74,12 @@ std::unique_ptr 
AbstractTreeElement::createFromType(const i
 case TSE_LIBRARY_OVERRIDE:
   return std::make_unique(
   legacy_te, *static_cast(idv));
+case TSE_LIBRARY_OVERRIDE_RNA_CONTAINER:
+  return std::make_unique(
+  legacy_te, *static_cast(idv));
+case TSE_LIBRARY_OVERRIDE_RNA_COLLECTION_ITEM:
+  return std::make_unique(
+  legacy_te, *static_cast(idv));
 case TSE_RNA_STRUCT:
   return std::make_unique(legacy_te,
 
*reinterpret_cast(idv));
@@ -98,6 +104,11 @@ std::unique_ptr 
AbstractTreeElement::createFromType(const i
   return nullptr;
 }
 
+TreeElement ::getLegacyElement() const
+{
+  return legacy_te_;
+}
+
 void tree_element_expand(const AbstractTreeElement 

[Bf-blender-cvs] [4faed6f315c] tmp-transform-navigate: Allow navigating while transforming (second solution)

2022-03-01 Thread Germano Cavalcante
Commit: 4faed6f315c12910a698984c4de7250154af1eb4
Author: Germano Cavalcante
Date:   Tue Mar 1 10:00:56 2022 -0300
Branches: tmp-transform-navigate
https://developer.blender.org/rB4faed6f315c12910a698984c4de7250154af1eb4

Allow navigating while transforming (second solution)

Navigating while transforming is not a new idea:
- https://rightclickselect.com/p/ui/Tqbbbc/allow-navigating-while-transforming 
(See comments);
- {D1583}
- {T37427}

This feature allows us to be more freedom in transforming an object in closed 
spaces.

And with {D9415} navigating while transform becomes a necessity because: how 
could we move from a point at the bottom of one object to the top of another 
without being able to rotate the view?

The patch implements this feature as being experimental (See image):
{F11826349, layout=left, width=600}
Because transform's modal keymaps conflict, two (temporary) operators were 
created to update the keymap and avoid conflicts.

The main solution in the patch was to create the `bool 
ED_view3d_navigation_do(...);` utility that can be used for any operator.

- Currently only 3 navigation operators are supported (more may be added over 
time):
 - VIEW3D_OT_zoom,
 - VIEW3D_OT_rotate,
 - VIEW3D_OT_move
- This patch only affects the modal transform operators in 3D View. They are:
 - Translation,
 - Rotation,
 - Resize,
 - Skin Resize,
 - To Sphere,
 - Shear,
 - Bend,
 - Shrink/Fatten,
 - Tilt,
 - Trackball,
 - Push/Pull,
 - Crease,
 - Bone Size,
 - Bone Envelope,
 - Bone Envelope Distance,
 - Curve Shrink/Fatten,
 - Grease Pencil Shrink/Fatten,
 - Bone Roll,
 - Bevel Weight,
 - Align,
 - Edge Slide,
 - Sequence Slide,
 - Grease Pencil Opacity
- Navigation is not available when transforming with Release Confirm
- Default modal keymaps need to be edited to avoid conflict (in the patch a 
temporary operator was implemented to automatically update keymaps)

|Modal Map (Blender):| Conflict: | Current: | New:
|---|---|---|---
| Increase Proportional Influence | VIEW3D_OT_zoom | Wheel Down | Alt Wheel Down
| Decrease Proportional Influence | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Adjust Proportional Influence | VIEW3D_OT_rotate | Mouse/Trackpad Pan | Alt 
Mouse/Trackpad Pan
| Increase Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Down | Alt Wheel 
Down
| Decrease Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Automatic Constraint | VIEW3D_OT_rotate | Middle Mouse | Alt Middle Mouse
| Automatic Constraint Plane | VIEW3D_OT_move | Shift Middle Mouse | Shift Alt 
Middle Mouse

|Modal Map (Industry Compatible):| Conflict: | Current: | New:
|---|---|---|---
| Increase Proportional Influence | VIEW3D_OT_zoom | Wheel Down | Shift Wheel 
Down
| Decrease Proportional Influence | VIEW3D_OT_zoom | Wheel Up | Shift Wheel Up
| Adjust Proportional Influence | VIEW3D_OT_rotate | Mouse/Trackpad Pan | Alt 
Mouse/Trackpad Pan
| Select Next Edge Slide Edge | VIEW3D_OT_zoom | Alt Wheel Down | Shift Alt 
Wheel Down
| Select Previous Edge Slide Edge | VIEW3D_OT_zoom | Alt Wheel Up | Shift Alt 
Wheel Up
| Increase Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Down | Shift Wheel 
Down
| Decrease Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Up | Shift Wheel Up

|Modal Map (Blender 27x):| Conflict: | Current: | New:
|---|---|---|---
| Increase Proportional Influence | VIEW3D_OT_zoom | Wheel Down | Alt Wheel Down
| Decrease Proportional Influence | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Increase Proportional Influence | VIEW3D_OT_view_pan | Shift Wheel Down | 
Shift Alt Wheel Down
| Decrease Proportional Influence | VIEW3D_OT_view_pan | Shift Wheel Up | Shift 
Alt Wheel Up
| Adjust Proportional Influence | VIEW3D_OT_rotate | Mouse/Trackpad Pan | Alt 
Mouse/Trackpad Pan
| Increase Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Down | Alt Wheel 
Down
| Decrease Max AutoIK Chain Length | VIEW3D_OT_zoom | Wheel Up | Alt Wheel Up
| Increase Max AutoIK Chain Length | VIEW3D_OT_view_pan | Shift Wheel Down | 
Shift Alt Wheel Down
| Decrease Max AutoIK Chain Length | VIEW3D_OT_view_pan | Shift Wheel Up | 
Shift Alt Wheel Up
| Automatic Constraint | VIEW3D_OT_rotate | Middle Mouse | Alt Middle Mouse
| Automatic Constraint Plane | VIEW3D_OT_move | Shift Middle Mouse | Shift Alt 
Middle Mouse

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

===

M   release/scripts/startup/bl_ui/space_userpref.py
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_navigate.c
M   source/blender/editors/space_view3d/view3d_navigate.h
M   source/blender/editors/space_view3d/view3d_navigate_move.c
M   source/blender/editors/space_view3d/view3d_navigate_rotate.c
M   source/blender/editors/space_view3d/view3d_navigate_zoom.c
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   

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

2022-03-01 Thread Campbell Barton
Commit: 143bc9f8d4baf2a7312f3e836a464f74148c4a3b
Author: Campbell Barton
Date:   Tue Mar 1 23:11:46 2022 +1100
Branches: master
https://developer.blender.org/rB143bc9f8d4baf2a7312f3e836a464f74148c4a3b

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] [d681d82d41c] blender-v3.1-release: Fix T96035: Some tool settings do not work

2022-03-01 Thread Campbell Barton
Commit: d681d82d41c176951eb294a2d1dd413eb2fe8af2
Author: Campbell Barton
Date:   Tue Mar 1 23:06:01 2022 +1100
Branches: blender-v3.1-release
https://developer.blender.org/rBd681d82d41c176951eb294a2d1dd413eb2fe8af2

Fix T96035: Some tool settings do not work

Oversight in 74611e3555684a22e9a07bd0992a444b571b8083 missed updating
property access to use the tool identifier to lookup the property group.

===

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

===

diff --git a/source/blender/windowmanager/WM_toolsystem.h 
b/source/blender/windowmanager/WM_toolsystem.h
index 32b9cf1d7ba..5cbe1e2da14 100644
--- a/source/blender/windowmanager/WM_toolsystem.h
+++ b/source/blender/windowmanager/WM_toolsystem.h
@@ -117,6 +117,7 @@ void WM_toolsystem_do_msg_notify_tag_refresh(struct 
bContext *C,
  struct wmMsgSubscribeKey *msg_key,
  struct wmMsgSubscribeValue 
*msg_val);
 
+struct IDProperty *WM_toolsystem_ref_properties_get_idprops(struct bToolRef 
*tref);
 struct IDProperty *WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef 
*tref);
 void WM_toolsystem_ref_properties_ensure_ex(struct bToolRef *tref,
 const char *idname,
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c 
b/source/blender/windowmanager/intern/wm_toolsystem.c
index fce11853030..df6f0a9e1ff 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -830,6 +830,15 @@ static IDProperty *idprops_ensure_named_group(IDProperty 
*group, const char *idn
   return prop;
 }
 
+IDProperty *WM_toolsystem_ref_properties_get_idprops(bToolRef *tref)
+{
+  IDProperty *group = tref->properties;
+  if (group == NULL) {
+return NULL;
+  }
+  return IDP_GetPropertyFromGroup(group, tref->idname);
+}
+
 IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref)
 {
   if (tref->properties == NULL) {
@@ -844,7 +853,7 @@ bool WM_toolsystem_ref_properties_get_ex(bToolRef *tref,
  StructRNA *type,
  PointerRNA *r_ptr)
 {
-  IDProperty *group = tref->properties;
+  IDProperty *group = WM_toolsystem_ref_properties_get_idprops(tref);
   IDProperty *prop = group ? IDP_GetPropertyFromGroup(group, idname) : NULL;
   RNA_pointer_create(NULL, type, prop, r_ptr);
   return (prop != NULL);
@@ -873,8 +882,9 @@ void WM_toolsystem_ref_properties_init_for_keymap(bToolRef 
*tref,
 IDPropertyTemplate val = {0};
 dst_ptr->data = IDP_New(IDP_GROUP, , "wmOpItemProp");
   }
-  if (tref->properties != NULL) {
-IDProperty *prop = IDP_GetPropertyFromGroup(tref->properties, ot->idname);
+  IDProperty *group = WM_toolsystem_ref_properties_get_idprops(tref);
+  if (group != NULL) {
+IDProperty *prop = IDP_GetPropertyFromGroup(group, ot->idname);
 if (prop) {
   /* Important key-map items properties don't get overwritten by the tools.
* - When a key-map item doesn't set a property, the tool-systems is 
used.

___
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] [f493e2f23a0] master: Merge branch 'blender-v3.1-release'

2022-03-01 Thread Sergey Sharybin
Commit: f493e2f23a04da77b423dfe0699cae8368bc2062
Author: Sergey Sharybin
Date:   Tue Mar 1 11:46:53 2022 +0100
Branches: master
https://developer.blender.org/rBf493e2f23a04da77b423dfe0699cae8368bc2062

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] [629f22f161a] blender-v3.1-release: Fix T95997: Crash when entering edit mode

2022-03-01 Thread Sergey Sharybin
Commit: 629f22f161abfbe492d71e08cc89651da683aded
Author: Sergey Sharybin
Date:   Thu Feb 24 14:15:38 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB629f22f161abfbe492d71e08cc89651da683aded

Fix T95997: Crash when entering edit mode

The issue was uncovered by the 0f89bcdbebf5, but the root cause goes
into a much earlier design violation happened in the code: the modifier
evaluation function is modifying input mesh, which is not something
what is ever expected.

Bring code closer to the older state where such modification is only
done for the object in edit mode.

---

From own tests works seems to work fine, but extra eyes and testing
is needed.

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

===

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

===

diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc 
b/source/blender/blenkernel/intern/DerivedMesh.cc
index 1fcf1bf1839..00a6fa6d178 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -1667,7 +1667,9 @@ static void editbmesh_calc_modifiers(struct Depsgraph 
*depsgraph,
   }
   else {
 Mesh *me_orig = mesh_input;
-if (me_orig->id.tag & LIB_TAG_COPIED_ON_WRITE) {
+/* Modifying the input mesh is weak, however as there can only be one 
object in edit mode
+ * even if multiple are sharing the same mesh this should be thread 
safe. */
+if ((me_orig->id.tag & LIB_TAG_COPIED_ON_WRITE) && (ob->mode & 
OB_MODE_EDIT)) {
   if (!BKE_mesh_runtime_ensure_edit_data(me_orig)) {
 BKE_mesh_runtime_reset_edit_data(me_orig);
   }

___
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] [90ec634135a] master: Fix incorrect drag-event threshold when releasing modifiers early

2022-03-01 Thread Campbell Barton
Commit: 90ec634135a0a79534fc34146c4860805279a3a9
Author: Campbell Barton
Date:   Tue Mar 1 21:33:16 2022 +1100
Branches: master
https://developer.blender.org/rB90ec634135a0a79534fc34146c4860805279a3a9

Fix incorrect drag-event threshold when releasing modifiers early

db4313610cab18933c1b1b1348720ea241b9d91e added support for modifier
keys to be released while dragging.

The key release events set wmEvent.prev_type which is used select the
drag threshold, causing the wrong threshold to be used.

Add wmEvent.prev_click_type which is only set when the drag begins.

===

M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/intern/wm_event_query.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/windowmanager/WM_types.h 
b/source/blender/windowmanager/WM_types.h
index cdbaa2739ba..26462402e3d 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -636,6 +636,15 @@ typedef struct wmEvent {
   short prev_type;
   /** The previous value of `val`. */
   short prev_val;
+  /**
+   * The previous value of #wmEvent.xy,
+   * Unlike other previous state variables, this is set on any mouse motion.
+   * Use `prev_click` for the value at time of pressing.
+   */
+  int prev_xy[2];
+
+  /** The `type` at the point of the click action. */
+  short prev_click_type;
   /** The time when the key is pressed, see #PIL_check_seconds_timer. */
   double prev_click_time;
   /** The location when the key is pressed (used to enforce drag thresholds). 
*/
@@ -645,13 +654,6 @@ typedef struct wmEvent {
   /** The `keymodifier` at the point of the click action. */
   short prev_click_keymodifier;
 
-  /**
-   * The previous value of #wmEvent.xy,
-   * Unlike other previous state variables, this is set on any mouse motion.
-   * Use `prev_click` for the value at time of pressing.
-   */
-  int prev_xy[2];
-
   /**
* Modifier states.
* #KM_SHIFT, #KM_CTRL, #KM_ALT & #KM_OSKEY is apple or windows-key.
diff --git a/source/blender/windowmanager/intern/wm_event_query.c 
b/source/blender/windowmanager/intern/wm_event_query.c
index 0d42d0a44c7..5e8b9b945c9 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -260,8 +260,8 @@ bool WM_cursor_test_motion_and_update(const int mval[2])
 int WM_event_drag_threshold(const struct wmEvent *event)
 {
   int drag_threshold;
-  if (ISMOUSE(event->prev_type)) {
-BLI_assert(event->prev_type != MOUSEMOVE);
+  if (ISMOUSE(event->prev_click_type)) {
+BLI_assert(event->prev_click_type != MOUSEMOVE);
 /* Using the previous type is important is we want to check the last 
pressed/released button,
  * The `event->type` would include #MOUSEMOVE which is always the case 
when dragging
  * and does not help us know which threshold to use. */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 4e9a430b380..ee07e90f4de 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4705,10 +4705,11 @@ static void wm_event_prev_values_set(wmEvent *event, 
wmEvent *event_state)
 static void wm_event_prev_click_set(wmEvent *event, wmEvent *event_state)
 {
   event->prev_click_time = event_state->prev_click_time = 
PIL_check_seconds_timer();
-  event->prev_click_xy[0] = event_state->prev_click_xy[0] = event_state->xy[0];
-  event->prev_click_xy[1] = event_state->prev_click_xy[1] = event_state->xy[1];
+  event->prev_click_type = event_state->prev_click_type = event_state->type;
   event->prev_click_modifier = event_state->prev_click_modifier = 
event_state->modifier;
   event->prev_click_keymodifier = event_state->prev_click_keymodifier = 
event_state->keymodifier;
+  event->prev_click_xy[0] = event_state->prev_click_xy[0] = event_state->xy[0];
+  event->prev_click_xy[1] = event_state->prev_click_xy[1] = event_state->xy[1];
 }
 
 static wmEvent *wm_event_add_mousemove(wmWindow *win, const wmEvent *event)

___
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] [cde5e12c0bc] blender-v3.1-release: Fix T96097: Image editor tile drawing not working.

2022-03-01 Thread Jeroen Bakker
Commit: cde5e12c0bcc55b7c19b625ebf7a6f29dbd833d7
Author: Jeroen Bakker
Date:   Tue Mar 1 11:35:11 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBcde5e12c0bcc55b7c19b625ebf7a6f29dbd833d7

Fix T96097: Image editor tile drawing not working.

The image engine is depth aware when using tile drawing the depth is
only updated for the central image what lead to showing the background
on top of other areas.

Also makes sure that switching the tile drawing would lead to an update
of the texture slots.

===

M   source/blender/draw/engines/image/image_drawing_mode.hh
M   source/blender/draw/engines/image/image_instance_data.hh
M   source/blender/draw/engines/image/image_usage.hh

===

diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh 
b/source/blender/draw/engines/image/image_drawing_mode.hh
index 267b0477a29..12d8607a8bd 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -507,7 +507,9 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 
 /* Step: Add the GPU textures to the shgroup. */
 instance_data->update_batches();
-add_depth_shgroups(*instance_data, image, iuser);
+if (!instance_data->flags.do_tile_drawing) {
+  add_depth_shgroups(*instance_data, image, iuser);
+}
 add_shgroups(instance_data);
   }
 
@@ -523,8 +525,10 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 
 DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
 GPU_framebuffer_bind(dfbl->default_fb);
+
 static float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-GPU_framebuffer_clear_color_depth(dfbl->default_fb, clear_col, 1.0);
+float clear_depth = instance_data->flags.do_tile_drawing ? 0.75 : 1.0f;
+GPU_framebuffer_clear_color_depth(dfbl->default_fb, clear_col, 
clear_depth);
 
 DRW_view_set_active(instance_data->view);
 DRW_draw_pass(instance_data->passes.depth_pass);
diff --git a/source/blender/draw/engines/image/image_instance_data.hh 
b/source/blender/draw/engines/image/image_instance_data.hh
index f8f20fbe178..7aeb423071e 100644
--- a/source/blender/draw/engines/image/image_instance_data.hh
+++ b/source/blender/draw/engines/image/image_instance_data.hh
@@ -121,7 +121,7 @@ struct IMAGE_InstanceData {
 
   void update_image_usage(const ImageUser *image_user)
   {
-ImageUsage usage(image, image_user);
+ImageUsage usage(image, image_user, flags.do_tile_drawing);
 if (last_usage != usage) {
   last_usage = usage;
   reset_dirty_flag(true);
diff --git a/source/blender/draw/engines/image/image_usage.hh 
b/source/blender/draw/engines/image/image_usage.hh
index bbd56e3db7a..a581731036e 100644
--- a/source/blender/draw/engines/image/image_usage.hh
+++ b/source/blender/draw/engines/image/image_usage.hh
@@ -24,7 +24,7 @@
 
 /**
  * ImageUsage contains data of the image and image user to identify changes 
that require a rebuild
- * of the texture slots.
+ * the texture slots.
  */
 struct ImageUsage {
   /** Render pass of the image that is used. */
@@ -37,11 +37,12 @@ struct ImageUsage {
   ColorManagedColorspaceSettings colorspace_settings;
   /** IMA_ALPHA_* */
   char alpha_mode;
+  bool last_tile_drawing;
 
   const void *last_image = nullptr;
 
   ImageUsage() = default;
-  ImageUsage(const struct Image *image, const struct ImageUser *image_user)
+  ImageUsage(const struct Image *image, const struct ImageUser *image_user, 
bool do_tile_drawing)
   {
 pass = image_user ? image_user->pass : 0;
 layer = image_user ? image_user->layer : 0;
@@ -49,6 +50,7 @@ struct ImageUsage {
 colorspace_settings = image->colorspace_settings;
 alpha_mode = image->alpha_mode;
 last_image = static_cast(image);
+last_tile_drawing = do_tile_drawing;
   }
 
   bool operator==(const ImageUsage ) const

___
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] [4b9c77a19aa] master: Merge branch 'blender-v3.1-release'

2022-03-01 Thread Jacques Lucke
Commit: 4b9c77a19aa359b5ab4b86e05cff1c8627d05a1e
Author: Jacques Lucke
Date:   Tue Mar 1 11:36:46 2022 +0100
Branches: master
https://developer.blender.org/rB4b9c77a19aa359b5ab4b86e05cff1c8627d05a1e

Merge branch 'blender-v3.1-release'

===



===

diff --cc source/blender/draw/engines/image/image_drawing_mode.hh
index b9de0838fef,267b0477a29..c727fbcd98f
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@@ -373,19 -419,15 +403,15 @@@ template class 
 *
 * Returns true when a float buffer was created. Somehow the VSE cache 
increases the ref
 * counter, but might use a different mechanism for destructing the image, 
that doesn't free the
 -   * rect_float as the refcounter isn't 0. To work around this we destruct 
any created local
 +   * rect_float as the reference-counter isn't 0. To work around this we 
destruct any created local
 * buffers ourself.
 */
-   bool ensure_float_buffer(ImBuf _buffer) const
+   ImBuf *ensure_float_buffer(IMAGE_InstanceData _data, ImBuf 
*image_buffer) const
{
- if (image_buffer.rect_float == nullptr) {
-   IMB_float_from_rect(_buffer);
-   return true;
- }
- return false;
+ return instance_data.float_buffers.ensure_float_buffer(image_buffer);
}
  
-   void do_full_update_texture_slot(const IMAGE_InstanceData _data,
+   void do_full_update_texture_slot(IMAGE_InstanceData _data,
 const TextureInfo _info,
 ImBuf _buffer,
 ImBuf _buffer,

___
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] [9216cf9cb58] blender-v3.1-release: Fix: dangling internal links after removing sockets

2022-03-01 Thread Jacques Lucke
Commit: 9216cf9cb589f4d8ec0e79f0f0a160ce2c1dfb07
Author: Jacques Lucke
Date:   Tue Mar 1 11:34:22 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB9216cf9cb589f4d8ec0e79f0f0a160ce2c1dfb07

Fix: dangling internal links after removing sockets

This is a follow up for rBd5e73fa13dd275fb9c76b1e41142ab086dd2e6be.
The issue was found with the file in T95997.

===

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

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 40d0c24c9af..fbf5677e867 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -1973,6 +1973,8 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node)
 }
   }
 
+  BLI_freelistN(>internal_links);
+
   LISTBASE_FOREACH_MUTABLE (bNodeSocket *, sock, >inputs) {
 node_socket_free(sock, true);
 MEM_freeN(sock);

___
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] [476fe7d1642] blender-v3.1-release: Fix T95979: Bake doesn't update Image editor.

2022-03-01 Thread Jeroen Bakker
Commit: 476fe7d164225add7d91b2d619e2764c2c5a1a04
Author: Jeroen Bakker
Date:   Tue Mar 1 11:20:54 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB476fe7d164225add7d91b2d619e2764c2c5a1a04

Fix T95979: Bake doesn't update Image editor.

===

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

===

diff --git a/source/blender/editors/object/object_bake_api.c 
b/source/blender/editors/object/object_bake_api.c
index cef99017b9c..0acaa8924cb 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -317,6 +317,7 @@ static void bake_targets_refresh(BakeTargets *targets)
 Image *ima = targets->images[i].image;
 
 if (ima) {
+  BKE_image_partial_update_mark_full_update(ima);
   LISTBASE_FOREACH (ImageTile *, tile, >tiles) {
 BKE_image_free_gputextures(ima);
 DEG_id_tag_update(>id, 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] [a5214212cff] blender-v3.1-release: Fix T96030: ImageEditor not updated for generated images.

2022-03-01 Thread Jeroen Bakker
Commit: a5214212cffba14aa99c3eac49809709c94125f1
Author: Jeroen Bakker
Date:   Tue Mar 1 10:51:07 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBa5214212cffba14aa99c3eac49809709c94125f1

Fix T96030: ImageEditor not updated for generated images.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_image.c 
b/source/blender/makesrna/intern/rna_image.c
index a533ea88436..c586ae319ee 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -117,6 +117,7 @@ static void rna_Image_generated_update(Main *bmain, Scene 
*UNUSED(scene), Pointe
 {
   Image *ima = (Image *)ptr->owner_id;
   BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
+  BKE_image_partial_update_mark_full_update(ima);
 }
 
 static void rna_Image_colormanage_update(Main *bmain, Scene *UNUSED(scene), 
PointerRNA *ptr)
@@ -155,6 +156,7 @@ static void rna_Image_views_format_update(Main *bmain, 
Scene *scene, PointerRNA
   }
 
   BKE_image_release_ibuf(ima, ibuf, lock);
+  BKE_image_partial_update_mark_full_update(ima);
 }
 
 static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)

___
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] [eec1c162000] blender-v3.1-release: Fix T96030: Update Image editor after reload.

2022-03-01 Thread Jeroen Bakker
Commit: eec1c162000546d64232ad63e89cb0b54ac04881
Author: Jeroen Bakker
Date:   Tue Mar 1 11:04:09 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBeec1c162000546d64232ad63e89cb0b54ac04881

Fix T96030: Update Image editor after reload.

===

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

===

diff --git a/source/blender/blenkernel/intern/image.c 
b/source/blender/blenkernel/intern/image.c
index bf6ede77a79..487a018b9b7 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -3585,6 +3585,7 @@ static void image_tag_reload(Image *ima, ID *iuser_id, 
ImageUser *iuser, void *c
   /* Must copy image user changes to CoW data-block. */
   DEG_id_tag_update(iuser_id, ID_RECALC_COPY_ON_WRITE);
 }
+BKE_image_partial_update_mark_full_update(ima);
   }
 }

___
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] [d743ef91df7] blender-v3.1-release: Fix 3d texture painting artifacts.

2022-03-01 Thread Jeroen Bakker
Commit: d743ef91df743941a859a98fb6a94e3982c234b5
Author: Jeroen Bakker
Date:   Tue Mar 1 10:45:19 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBd743ef91df743941a859a98fb6a94e3982c234b5

Fix 3d texture painting artifacts.

When dimension of images aren't a multifold of 256 parts of the gpu
textures are not updated. This patch will calculate the correct part of
the image that needs to be reuploaded.

===

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

===

diff --git a/source/blender/blenkernel/intern/image_gpu.cc 
b/source/blender/blenkernel/intern/image_gpu.cc
index 42dcfcd7aa9..d854c043a3e 100644
--- a/source/blender/blenkernel/intern/image_gpu.cc
+++ b/source/blender/blenkernel/intern/image_gpu.cc
@@ -338,19 +338,25 @@ static void 
image_gpu_texture_partial_update_changes_available(
 Image *image, PartialUpdateChecker::CollectResult )
 {
   while (changes.get_next_change() == 
ePartialUpdateIterResult::ChangeAvailable) {
-const int tile_offset_x = changes.changed_region.region.xmin;
-const int tile_offset_y = changes.changed_region.region.ymin;
-const int tile_width = min_ii(changes.tile_data.tile_buffer->x,
-  
BLI_rcti_size_x(_region.region));
-const int tile_height = min_ii(changes.tile_data.tile_buffer->y,
-   
BLI_rcti_size_y(_region.region));
+/* Calculate the clipping region with the tile buffer.
+ * TODO(jbakker): should become part of ImageTileData to deduplicate with 
image engine. */
+rcti buffer_rect;
+BLI_rcti_init(
+_rect, 0, changes.tile_data.tile_buffer->x, 0, 
changes.tile_data.tile_buffer->y);
+rcti clipped_update_region;
+const bool has_overlap = BLI_rcti_isect(
+_rect, _region.region, _update_region);
+if (!has_overlap) {
+  continue;
+}
+
 image_update_gputexture_ex(image,
changes.tile_data.tile,
changes.tile_data.tile_buffer,
-   tile_offset_x,
-   tile_offset_y,
-   tile_width,
-   tile_height);
+   clipped_update_region.xmin,
+   clipped_update_region.ymin,
+   BLI_rcti_size_x(_update_region),
+   BLI_rcti_size_y(_update_region));
   }
 }

___
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] [4a4701b43c5] blender-v3.1-release: Fix painting on none 256 aligned images.

2022-03-01 Thread Jeroen Bakker
Commit: 4a4701b43c53d1a4946e224821ba398548b22043
Author: Jeroen Bakker
Date:   Tue Mar 1 09:32:58 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB4a4701b43c53d1a4946e224821ba398548b22043

Fix painting on none 256 aligned images.

Internally the update tiles are 256x256. Due to some miscalculations
tiles were not generated correctly if the dimension of the image wasn't
a multifold of 256.

===

M   source/blender/blenkernel/intern/image_partial_update.cc
M   source/blender/draw/engines/image/image_drawing_mode.hh

===

diff --git a/source/blender/blenkernel/intern/image_partial_update.cc 
b/source/blender/blenkernel/intern/image_partial_update.cc
index 7e187c2014e..bec3c193af5 100644
--- a/source/blender/blenkernel/intern/image_partial_update.cc
+++ b/source/blender/blenkernel/intern/image_partial_update.cc
@@ -213,8 +213,8 @@ struct TileChangeset {
 tile_width = image_buffer->x;
 tile_height = image_buffer->y;
 
-int chunk_x_len = tile_width / CHUNK_SIZE;
-int chunk_y_len = tile_height / CHUNK_SIZE;
+int chunk_x_len = (tile_width + CHUNK_SIZE - 1) / CHUNK_SIZE;
+int chunk_y_len = (tile_height + CHUNK_SIZE - 1) / CHUNK_SIZE;
 init_chunks(chunk_x_len, chunk_y_len);
 return true;
   }
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh 
b/source/blender/draw/engines/image/image_drawing_mode.hh
index 4564ef87025..267b0477a29 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -229,7 +229,21 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 BLI_assert(float_buffer->rect == nullptr);
 BLI_assert(src->rect_float == nullptr);
 BLI_assert(src->rect != nullptr);
-IMB_float_from_rect_ex(float_buffer, src, _region.region);
+
+/* Calculate the overlap between the updated region and the buffer size. 
Partial Update Checker
+ * always returns a tile (256x256). Which could lay partially outside the 
buffer when using
+ * different resolutions.
+ */
+rcti buffer_rect;
+BLI_rcti_init(_rect, 0, float_buffer->x, 0, float_buffer->y);
+rcti clipped_update_region;
+const bool has_overlap = BLI_rcti_isect(
+_rect, _region.region, _update_region);
+if (!has_overlap) {
+  return;
+}
+
+IMB_float_from_rect_ex(float_buffer, src, _update_region);
   }
 
   void do_partial_update(PartialUpdateChecker::CollectResult 
,

___
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