[Bf-blender-cvs] [3836b6ff8cb] master: Cancel Equalize Handles & Snap Keys when no control points are selected

2022-11-08 Thread Colin Basnett
Commit: 3836b6ff8cba135d185e147dbffca7847870e6cd
Author: Colin Basnett
Date:   Tue Nov 8 19:19:59 2022 -0800
Branches: master
https://developer.blender.org/rB3836b6ff8cba135d185e147dbffca7847870e6cd

Cancel Equalize Handles & Snap Keys when no control points are selected

The Equalize Handles and Snap Keys operators would allow the user to
invoke them successfully even when they would have no effect due to
there not being any selected control points.

This patch makes it so that an error is displayed when these operators
are invoked with no control points are selected.

The reason this is in the `invoke` function is because it would be too
expensive to run this check in the `poll` function since it requires a
linear search through all the keys of all the visible F-Curves.

Reviewed By: sybren

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

===

M   source/blender/blenkernel/BKE_fcurve.h
M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/editors/space_graph/graph_edit.c

===

diff --git a/source/blender/blenkernel/BKE_fcurve.h 
b/source/blender/blenkernel/BKE_fcurve.h
index c11e6353bc0..cbdf37e14bd 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -430,6 +430,11 @@ bool BKE_fcurve_are_keyframes_usable(struct FCurve *fcu);
 bool BKE_fcurve_is_keyframable(struct FCurve *fcu);
 bool BKE_fcurve_is_protected(struct FCurve *fcu);
 
+/**
+ * Are any of the keyframe control points selected on the F-Curve?
+ */
+bool BKE_fcurve_has_selected_control_points(const struct FCurve *fcu);
+
 /**
  * Checks if the F-Curve has a Cycles modifier with simple settings
  * that warrant transition smoothing.
diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index beea3217126..d248faaab00 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -965,6 +965,18 @@ bool BKE_fcurve_is_protected(FCurve *fcu)
   return ((fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & 
AGRP_PROTECTED)));
 }
 
+bool BKE_fcurve_has_selected_control_points(const FCurve *fcu)
+{
+  int i;
+  BezTriple *bezt;
+  for (bezt = fcu->bezt, i = 0; i < fcu->totvert; ++i, ++bezt) {
+if ((bezt->f2 & SELECT) != 0) {
+  return true;
+}
+  }
+  return false;
+}
+
 bool BKE_fcurve_is_keyframable(FCurve *fcu)
 {
   /* F-Curve's keyframes must be "usable" (i.e. visible + have an effect on 
final result) */
diff --git a/source/blender/editors/space_graph/graph_edit.c 
b/source/blender/editors/space_graph/graph_edit.c
index a23b33dde95..c605ba6776f 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2333,6 +2333,48 @@ static int graphkeys_snap_exec(bContext *C, wmOperator 
*op)
   return OPERATOR_FINISHED;
 }
 
+bool graph_has_selected_control_points(struct bContext *C)
+{
+  bAnimContext ac;
+  ListBase anim_data = {NULL, NULL};
+
+  /* Get editor data. */
+  if (ANIM_animdata_get_context(C, ) == 0) {
+return OPERATOR_CANCELLED;
+  }
+
+  /* Filter data. */
+  const int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | 
ANIMFILTER_FCURVESONLY |
+  ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
+  ANIM_animdata_filter(, _data, filter, ac.data, ac.datatype);
+
+  /* Check if any of the visible and editable f-curves have at least one 
selected control point. */
+  bool has_selected_control_points = false;
+  LISTBASE_FOREACH (bAnimListElem *, ale, _data) {
+const FCurve *fcu = ale->key_data;
+if (BKE_fcurve_has_selected_control_points(fcu)) {
+  has_selected_control_points = true;
+  break;
+}
+  }
+
+  ANIM_animdata_freelist(_data);
+
+  return has_selected_control_points;
+}
+
+int graphkeys_selected_control_points_invoke(struct bContext *C,
+ struct wmOperator *op,
+ const struct wmEvent *event)
+{
+  if (!graph_has_selected_control_points(C)) {
+BKE_report(op->reports, RPT_ERROR, "No control points are selected");
+return OPERATOR_CANCELLED;
+  }
+
+  return WM_menu_invoke(C, op, event);
+}
+
 void GRAPH_OT_snap(wmOperatorType *ot)
 {
   /* Identifiers */
@@ -2341,7 +2383,7 @@ void GRAPH_OT_snap(wmOperatorType *ot)
   ot->description = "Snap selected keyframes to the chosen times/values";
 
   /* API callbacks */
-  ot->invoke = WM_menu_invoke;
+  ot->invoke = graphkeys_selected_control_points_invoke;
   ot->exec = graphkeys_snap_exec;
   ot->poll = graphop_editable_keyframes_poll;
 
@@ -2418,7 +2460,7 @@ void GRAPH_OT_equalize_handles(wmOperatorType *ot)
   "Ensure selected keyframes' handles have equal length, optionally making 
them horizontal. "
   "Automatic, Automatic Clamped, or Vector handle types will 

[Bf-blender-cvs] [800b025518e] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Campbell Barton
Commit: 800b025518e497d5298e6d44c769613481034bca
Author: Campbell Barton
Date:   Wed Nov 9 14:34:08 2022 +1100
Branches: master
https://developer.blender.org/rB800b025518e497d5298e6d44c769613481034bca

Merge branch 'blender-v3.4-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] [fb52a09840e] blender-v3.4-release: Fix T102287: Unhandled Numpad Separator on QWERTZ under Wayland

2022-11-08 Thread Campbell Barton
Commit: fb52a09840efa4dbaa21176f6ecec4f4fef63f64
Author: Campbell Barton
Date:   Wed Nov 9 14:22:28 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rBfb52a09840efa4dbaa21176f6ecec4f4fef63f64

Fix T102287: Unhandled Numpad Separator on QWERTZ under Wayland

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 3a0ba5cd21a..f068ef79c57 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1264,6 +1264,12 @@ static GHOST_TKey xkb_map_gkey(const xkb_keysym_t sym)
   GXMAP(gkey, XKB_KEY_XF86AudioStop, GHOST_kKeyMediaStop);
   GXMAP(gkey, XKB_KEY_XF86AudioPrev, GHOST_kKeyMediaFirst);
   GXMAP(gkey, XKB_KEY_XF86AudioNext, GHOST_kKeyMediaLast);
+
+  /* Additional keys for non US layouts. */
+
+  /* Uses the same physical key as #XKB_KEY_KP_Decimal for QWERTZ layout, 
see: T102287. */
+  GXMAP(gkey, XKB_KEY_KP_Separator, GHOST_kKeyNumpadPeriod);
+
   default:
 /* Rely on #xkb_map_gkey_or_scan_code to report when no key can be 
found. */
 gkey = GHOST_kKeyUnknown;

___
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] [baee7ce4a5b] master: Fix T102306: buildtime shader compilation option fails under Wayland

2022-11-08 Thread Campbell Barton
Commit: baee7ce4a5be105a2e98dc8e4fcdc4f8b5f5e673
Author: Campbell Barton
Date:   Wed Nov 9 13:32:53 2022 +1100
Branches: master
https://developer.blender.org/rBbaee7ce4a5be105a2e98dc8e4fcdc4f8b5f5e673

Fix T102306: buildtime shader compilation option fails under Wayland

libdecor (for window decorations) was crashing on exit with the shader
builder, avoid the crash by calling the "background" system creation
function which doesn't initialize window management under Wayland.

===

M   source/blender/gpu/intern/gpu_shader_builder.cc

===

diff --git a/source/blender/gpu/intern/gpu_shader_builder.cc 
b/source/blender/gpu/intern/gpu_shader_builder.cc
index abb45ca074a..96e3eacd6f5 100644
--- a/source/blender/gpu/intern/gpu_shader_builder.cc
+++ b/source/blender/gpu/intern/gpu_shader_builder.cc
@@ -59,7 +59,7 @@ void ShaderBuilder::init()
   break;
   }
 
-  ghost_system_ = GHOST_CreateSystem();
+  ghost_system_ = GHOST_CreateSystemBackground();
   ghost_context_ = GHOST_CreateOpenGLContext(ghost_system_, glSettings);
   GHOST_ActivateOpenGLContext(ghost_context_);

___
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] [801db0d429a] master: Revert "Fix T102306: buildtime shader compilation option fails under Wayland"

2022-11-08 Thread Campbell Barton
Commit: 801db0d429a279d1084d2f61c00088917547407e
Author: Campbell Barton
Date:   Wed Nov 9 13:54:19 2022 +1100
Branches: master
https://developer.blender.org/rB801db0d429a279d1084d2f61c00088917547407e

Revert "Fix T102306: buildtime shader compilation option fails under Wayland"

This reverts commit 6fa05e2c29a28475799fab4a9ce51bd0bc53ca92.

===

M   source/blender/gpu/intern/gpu_shader_builder.cc

===

diff --git a/source/blender/gpu/intern/gpu_shader_builder.cc 
b/source/blender/gpu/intern/gpu_shader_builder.cc
index 96e3eacd6f5..abb45ca074a 100644
--- a/source/blender/gpu/intern/gpu_shader_builder.cc
+++ b/source/blender/gpu/intern/gpu_shader_builder.cc
@@ -59,7 +59,7 @@ void ShaderBuilder::init()
   break;
   }
 
-  ghost_system_ = GHOST_CreateSystemBackground();
+  ghost_system_ = GHOST_CreateSystem();
   ghost_context_ = GHOST_CreateOpenGLContext(ghost_system_, glSettings);
   GHOST_ActivateOpenGLContext(ghost_context_);

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

2022-11-08 Thread Campbell Barton
Commit: 76c308e45d6bb49d25d96030b02c4fad899b
Author: Campbell Barton
Date:   Wed Nov 9 13:57:27 2022 +1100
Branches: master
https://developer.blender.org/rB76c308e45d6bb49d25d96030b02c4fad899b

Merge branch 'blender-v3.4-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] [6fa05e2c29a] blender-v3.4-release: Fix T102306: buildtime shader compilation option fails under Wayland

2022-11-08 Thread Campbell Barton
Commit: 6fa05e2c29a28475799fab4a9ce51bd0bc53ca92
Author: Campbell Barton
Date:   Wed Nov 9 13:32:53 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB6fa05e2c29a28475799fab4a9ce51bd0bc53ca92

Fix T102306: buildtime shader compilation option fails under Wayland

libdecor (for window decorations) was crashing on exit with the shader
builder, avoid the crash by calling the "background" system creation
function which doesn't initialize window management under Wayland.

===

M   source/blender/gpu/intern/gpu_shader_builder.cc

===

diff --git a/source/blender/gpu/intern/gpu_shader_builder.cc 
b/source/blender/gpu/intern/gpu_shader_builder.cc
index abb45ca074a..96e3eacd6f5 100644
--- a/source/blender/gpu/intern/gpu_shader_builder.cc
+++ b/source/blender/gpu/intern/gpu_shader_builder.cc
@@ -59,7 +59,7 @@ void ShaderBuilder::init()
   break;
   }
 
-  ghost_system_ = GHOST_CreateSystem();
+  ghost_system_ = GHOST_CreateSystemBackground();
   ghost_context_ = GHOST_CreateOpenGLContext(ghost_system_, glSettings);
   GHOST_ActivateOpenGLContext(ghost_context_);

___
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] [756538b4a11] master: BLI_math: remove normalize from mat3_normalized_to_quat_fast

2022-11-08 Thread Campbell Barton
Commit: 756538b4a117cb51a15e848fa6170143b6aafcd8
Author: Campbell Barton
Date:   Wed Nov 9 13:17:03 2022 +1100
Branches: master
https://developer.blender.org/rB756538b4a117cb51a15e848fa6170143b6aafcd8

BLI_math: remove normalize from mat3_normalized_to_quat_fast

The quaternion calculated are unit length unless the the input matrix is
degenerate. Detect degenerate cases and remove the normalize_qt call.

===

M   source/blender/blenlib/intern/math_rotation.c

===

diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index 17e43b545d8..180412c4a14 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -292,6 +292,10 @@ void mat3_normalized_to_quat_fast(float q[4], const float 
mat[3][3])
   q[0] = (mat[1][2] - mat[2][1]) * s;
   q[2] = (mat[0][1] + mat[1][0]) * s;
   q[3] = (mat[2][0] + mat[0][2]) * s;
+  if (UNLIKELY((trace == 1.0f) && (q[0] == 0.0f && q[2] == 0.0f && q[3] == 
0.0f))) {
+/* Avoids the need to normalize the degenerate case. */
+q[1] = 1.0f;
+  }
 }
 else {
   const float trace = 1.0f - mat[0][0] + mat[1][1] - mat[2][2];
@@ -305,6 +309,10 @@ void mat3_normalized_to_quat_fast(float q[4], const float 
mat[3][3])
   q[0] = (mat[2][0] - mat[0][2]) * s;
   q[1] = (mat[0][1] + mat[1][0]) * s;
   q[3] = (mat[1][2] + mat[2][1]) * s;
+  if (UNLIKELY((trace == 1.0f) && (q[0] == 0.0f && q[1] == 0.0f && q[3] == 
0.0f))) {
+/* Avoids the need to normalize the degenerate case. */
+q[2] = 1.0f;
+  }
 }
   }
   else {
@@ -320,6 +328,10 @@ void mat3_normalized_to_quat_fast(float q[4], const float 
mat[3][3])
   q[0] = (mat[0][1] - mat[1][0]) * s;
   q[1] = (mat[2][0] + mat[0][2]) * s;
   q[2] = (mat[1][2] + mat[2][1]) * s;
+  if (UNLIKELY((trace == 1.0f) && (q[0] == 0.0f && q[1] == 0.0f && q[2] == 
0.0f))) {
+/* Avoids the need to normalize the degenerate case. */
+q[3] = 1.0f;
+  }
 }
 else {
   /* NOTE(@campbellbarton): A zero matrix will fall through to this block,
@@ -331,11 +343,15 @@ void mat3_normalized_to_quat_fast(float q[4], const float 
mat[3][3])
   q[1] = (mat[1][2] - mat[2][1]) * s;
   q[2] = (mat[2][0] - mat[0][2]) * s;
   q[3] = (mat[0][1] - mat[1][0]) * s;
+  if (UNLIKELY((trace == 1.0f) && (q[1] == 0.0f && q[2] == 0.0f && q[3] == 
0.0f))) {
+/* Avoids the need to normalize the degenerate case. */
+q[0] = 1.0f;
+  }
 }
   }
 
   BLI_assert(!(q[0] < 0.0f));
-  normalize_qt(q);
+  BLI_ASSERT_UNIT_QUAT(q);
 }
 
 static void mat3_normalized_to_quat_with_checks(float q[4], float mat[3][3])

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

2022-11-08 Thread Campbell Barton
Commit: c6612da1e6929374b38fd6e5d3e22c8c5486619d
Author: Campbell Barton
Date:   Wed Nov 9 13:06:05 2022 +1100
Branches: master
https://developer.blender.org/rBc6612da1e6929374b38fd6e5d3e22c8c5486619d

Merge branch 'blender-v3.4-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] [2d9d08677ec] master: Cleanup: fix types from f04f9cc3d021

2022-11-08 Thread Chris Blackbourn
Commit: 2d9d08677ecfa2684a67c39ab1d632865716ccb4
Author: Chris Blackbourn
Date:   Wed Nov 9 14:54:37 2022 +1300
Branches: master
https://developer.blender.org/rB2d9d08677ecfa2684a67c39ab1d632865716ccb4

Cleanup: fix types from f04f9cc3d021

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/editors/include/ED_mesh.h
M   source/blender/editors/mesh/editmesh_utils.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index d0813ebb168..705158bec0b 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -83,7 +83,7 @@ typedef struct UvElementMap {
   struct UvElement **head_table;
 
   /** If Non-NULL, pointer to index of each unique UV. */
-  int **unique_index_table;
+  int *unique_index_table;
 
   /** Number of islands, or zero if not calculated. */
   int total_islands;
diff --git a/source/blender/editors/include/ED_mesh.h 
b/source/blender/editors/include/ED_mesh.h
index 7dfebf58bef..52527f6c1b8 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -150,7 +150,7 @@ struct UvElement *BM_uv_element_get_head(struct 
UvElementMap *element_map,
 int BM_uv_element_get_unique_index(struct UvElementMap *element_map, struct 
UvElement *child);
 
 struct UvElement **BM_uv_element_map_ensure_head_table(struct UvElementMap 
*element_map);
-int **BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map);
+int *BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map);
 
 /**
  * Can we edit UV's for this mesh?
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index 33162cd2256..bbc092d0a99 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -619,7 +619,7 @@ struct UvElement 
**BM_uv_element_map_ensure_head_table(struct UvElementMap *elem
   return element_map->head_table;
 }
 
-int **BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map)
+int *BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map)
 {
   if (!element_map->unique_index_table) {
 element_map->unique_index_table = MEM_callocN(
@@ -650,7 +650,7 @@ int **BM_uv_element_map_ensure_unique_index(struct 
UvElementMap *element_map)
 
 int BM_uv_element_get_unique_index(struct UvElementMap *element_map, struct 
UvElement *child)
 {
-  int **unique_index = BM_uv_element_map_ensure_unique_index(element_map);
+  int *unique_index = BM_uv_element_map_ensure_unique_index(element_map);
   int index = child - element_map->storage;
   BLI_assert(0 <= index);
   BLI_assert(index < element_map->total_uvs);

___
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] [3fa6aacb91f] blender-v3.4-release: Cleanup: add function attributes to BLI_sprintf

2022-11-08 Thread Campbell Barton
Commit: 3fa6aacb91f4a0d04c1ef3c67449df67696cea6b
Author: Campbell Barton
Date:   Wed Nov 9 12:28:34 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB3fa6aacb91f4a0d04c1ef3c67449df67696cea6b

Cleanup: add function attributes to BLI_sprintf

Quiet warning, suggesting to use attributes with GCC.

===

M   source/blender/blenlib/BLI_string.h

===

diff --git a/source/blender/blenlib/BLI_string.h 
b/source/blender/blenlib/BLI_string.h
index fb02ea5fb17..ed15e0871b9 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -206,11 +206,12 @@ char *BLI_sprintfN(const char *__restrict format, ...) 
ATTR_WARN_UNUSED_RESULT
 ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1, 2);
 
 /**
- * A wrapper around ::sprintf() which does not generate security warnings.
+ * A wrapper around `::sprintf()` which does not generate security warnings.
  *
- * \note Use BLI_snprintf for cases when the string size is known.
+ * \note Use #BLI_snprintf for cases when the string size is known.
  */
-int BLI_sprintf(char *__restrict str, const char *__restrict format, ...);
+int BLI_sprintf(char *__restrict str, const char *__restrict format, ...) 
ATTR_NONNULL(1, 2)
+ATTR_PRINTF_FORMAT(2, 3);
 
 /**
  * This roughly matches C and Python's string escaping with double quotes - 
`"`.

___
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] [494385a5bcc] blender-v3.4-release: Fix T101848: Zeroed matrix converted to a quaternion results in rotation

2022-11-08 Thread Campbell Barton
Commit: 494385a5bcc4c08832b50ca57e21cf85981fe922
Author: Campbell Barton
Date:   Wed Nov 9 10:18:05 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB494385a5bcc4c08832b50ca57e21cf85981fe922

Fix T101848: Zeroed matrix converted to a quaternion results in rotation

Re-order checks to ensure a zeroed matrix results in a quaternion
without rotation. Also avoid some redundant calculation where the
'trace' was calculated but not used, flip the scaling value early
on instead of negating the quaternion after calculating it.

===

M   source/blender/blenlib/intern/math_rotation.c
M   source/blender/blenlib/tests/BLI_math_rotation_test.cc

===

diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index ff45bbee5c9..17e43b545d8 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -275,63 +275,66 @@ void mat3_normalized_to_quat_fast(float q[4], const float 
mat[3][3])
   /* Caller must ensure matrices aren't negative for valid results, see: 
T24291, T94231. */
   BLI_assert(!is_negative_m3(mat));
 
-  /* Check the trace of the matrix - bad precision if close to -1. */
-  const float trace = mat[0][0] + mat[1][1] + mat[2][2];
-
-  if (trace > 0) {
-float s = 2.0f * sqrtf(1.0f + trace);
-
-q[0] = 0.25f * s;
-
-s = 1.0f / s;
-
-q[1] = (mat[1][2] - mat[2][1]) * s;
-q[2] = (mat[2][0] - mat[0][2]) * s;
-q[3] = (mat[0][1] - mat[1][0]) * s;
-  }
-  else {
-/* Find the biggest diagonal element to choose the best formula.
- * Here trace should also be always >= 0, avoiding bad precision. */
-if (mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
-  float s = 2.0f * sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]);
-
+  /* Method outlined by Mike Day, ref: 
https://math.stackexchange.com/a/3183435/220949
+   * with an additional `sqrtf(..)` for higher precision result.
+   * Removing the `sqrt` causes tests to fail unless the precision is set to 
1e-6 or larger. */
+
+  if (mat[2][2] < 0.0f) {
+if (mat[0][0] > mat[1][1]) {
+  const float trace = 1.0f + mat[0][0] - mat[1][1] - mat[2][2];
+  float s = 2.0f * sqrtf(trace);
+  if (mat[1][2] < mat[2][1]) {
+/* Ensure W is non-negative for a canonical result. */
+s = -s;
+  }
   q[1] = 0.25f * s;
-
   s = 1.0f / s;
-
   q[0] = (mat[1][2] - mat[2][1]) * s;
-  q[2] = (mat[1][0] + mat[0][1]) * s;
+  q[2] = (mat[0][1] + mat[1][0]) * s;
   q[3] = (mat[2][0] + mat[0][2]) * s;
 }
-else if (mat[1][1] > mat[2][2]) {
-  float s = 2.0f * sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]);
-
+else {
+  const float trace = 1.0f - mat[0][0] + mat[1][1] - mat[2][2];
+  float s = 2.0f * sqrtf(trace);
+  if (mat[2][0] < mat[0][2]) {
+/* Ensure W is non-negative for a canonical result. */
+s = -s;
+  }
   q[2] = 0.25f * s;
-
   s = 1.0f / s;
-
   q[0] = (mat[2][0] - mat[0][2]) * s;
-  q[1] = (mat[1][0] + mat[0][1]) * s;
-  q[3] = (mat[2][1] + mat[1][2]) * s;
+  q[1] = (mat[0][1] + mat[1][0]) * s;
+  q[3] = (mat[1][2] + mat[2][1]) * s;
 }
-else {
-  float s = 2.0f * sqrtf(1.0f + mat[2][2] - mat[0][0] - mat[1][1]);
-
+  }
+  else {
+if (mat[0][0] < -mat[1][1]) {
+  const float trace = 1.0f - mat[0][0] - mat[1][1] + mat[2][2];
+  float s = 2.0f * sqrtf(trace);
+  if (mat[0][1] < mat[1][0]) {
+/* Ensure W is non-negative for a canonical result. */
+s = -s;
+  }
   q[3] = 0.25f * s;
-
   s = 1.0f / s;
-
   q[0] = (mat[0][1] - mat[1][0]) * s;
   q[1] = (mat[2][0] + mat[0][2]) * s;
-  q[2] = (mat[2][1] + mat[1][2]) * s;
+  q[2] = (mat[1][2] + mat[2][1]) * s;
 }
-
-/* Make sure W is non-negative for a canonical result. */
-if (q[0] < 0) {
-  negate_v4(q);
+else {
+  /* NOTE(@campbellbarton): A zero matrix will fall through to this block,
+   * needed so a zero scaled matrices to return a quaternion without 
rotation, see: T101848. */
+  const float trace = 1.0f + mat[0][0] + mat[1][1] + mat[2][2];
+  float s = 2.0f * sqrtf(trace);
+  q[0] = 0.25f * s;
+  s = 1.0f / s;
+  q[1] = (mat[1][2] - mat[2][1]) * s;
+  q[2] = (mat[2][0] - mat[0][2]) * s;
+  q[3] = (mat[0][1] - mat[1][0]) * s;
 }
   }
 
+  BLI_assert(!(q[0] < 0.0f));
   normalize_qt(q);
 }
 
diff --git a/source/blender/blenlib/tests/BLI_math_rotation_test.cc 
b/source/blender/blenlib/tests/BLI_math_rotation_test.cc
index e37b212e1df..0c8ae38c386 100644
--- a/source/blender/blenlib/tests/BLI_math_rotation_test.cc
+++ b/source/blender/blenlib/tests/BLI_math_rotation_test.cc
@@ -3,6 +3,7 @@
 #include "testing/testing.h"
 
 #include "BLI_math_base.h"
+#include "BLI_math_matrix.h"
 

[Bf-blender-cvs] [335082dcd32] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Colin Basnett
Commit: 335082dcd329dc74f3788a14eb7aefd84358aa50
Author: Colin Basnett
Date:   Tue Nov 8 15:31:33 2022 -0800
Branches: master
https://developer.blender.org/rB335082dcd329dc74f3788a14eb7aefd84358aa50

Merge branch 'blender-v3.4-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] [ee5b6f71501] blender-v3.4-release: Hide ratio when using error margin mode in decimate keyframes operator

2022-11-08 Thread Colin Basnett
Commit: ee5b6f7150109a62b2a435ecd011316ffceb9e59
Author: Colin Basnett
Date:   Tue Nov 8 15:29:57 2022 -0800
Branches: blender-v3.4-release
https://developer.blender.org/rBee5b6f7150109a62b2a435ecd011316ffceb9e59

Hide ratio when using error margin mode in decimate keyframes operator

This fixes a bug in the function that determines what properties to show
on the Decimate Keyframes operator.

Before the fix, the "Remove" (i.e., `factor`) slider was visible no
matter what "Mode" was being used. This meant that the slider was
visible and modifiable when it had no effect, creating confusion.

Reviewed By: sybren

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

===

M   source/blender/editors/space_graph/graph_slider_ops.c

===

diff --git a/source/blender/editors/space_graph/graph_slider_ops.c 
b/source/blender/editors/space_graph/graph_slider_ops.c
index f3d92911155..62aecf930d3 100644
--- a/source/blender/editors/space_graph/graph_slider_ops.c
+++ b/source/blender/editors/space_graph/graph_slider_ops.c
@@ -458,16 +458,13 @@ static bool decimate_poll_property(const bContext 
*UNUSED(C),
const PropertyRNA *prop)
 {
   const char *prop_id = RNA_property_identifier(prop);
+  const int mode = RNA_enum_get(op->ptr, "mode");
 
-  if (STRPREFIX(prop_id, "remove")) {
-int mode = RNA_enum_get(op->ptr, "mode");
-
-if (STREQ(prop_id, "factor") && mode != DECIM_RATIO) {
-  return false;
-}
-if (STREQ(prop_id, "remove_error_margin") && mode != DECIM_ERROR) {
-  return false;
-}
+  if (STREQ(prop_id, "factor") && mode != DECIM_RATIO) {
+return false;
+  }
+  if (STREQ(prop_id, "remove_error_margin") && mode != DECIM_ERROR) {
+return false;
   }
 
   return true;

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


[Bf-blender-cvs] [f0b5f94cb56] master: Cleanup: format

2022-11-08 Thread Chris Blackbourn
Commit: f0b5f94cb56dcacd90205a9a0347f220c2b86765
Author: Chris Blackbourn
Date:   Wed Nov 9 11:59:51 2022 +1300
Branches: master
https://developer.blender.org/rBf0b5f94cb56dcacd90205a9a0347f220c2b86765

Cleanup: format

===

M   
source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_vertex.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
index d442a8823cb..459f45ef8fb 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
@@ -49,7 +49,7 @@ class CurveOfPointInput final : public bke::CurvesFieldInput {
 return false;
   }
 
-  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)const final
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/) const final
   {
 return ATTR_DOMAIN_POINT;
   }
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
index 02457043281..7f69503831f 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
@@ -114,7 +114,7 @@ class PointsOfCurveInput final : public 
bke::CurvesFieldInput {
 return false;
   }
 
-  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)const final
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/) const final
   {
 return ATTR_DOMAIN_CURVE;
   }
@@ -152,7 +152,7 @@ class CurvePointCountInput final : public 
bke::CurvesFieldInput {
 return false;
   }
 
-  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)const final
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/) const final
   {
 return ATTR_DOMAIN_CURVE;
   }
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
index 95ae169a6e4..b464832409c 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
@@ -118,7 +118,7 @@ class CornersOfFaceInput final : public bke::MeshFieldInput 
{
 return false;
   }
 
-  std::optional preferred_domain(const Mesh & /*mesh*/)const final
+  std::optional preferred_domain(const Mesh & /*mesh*/) const 
final
   {
 return ATTR_DOMAIN_FACE;
   }
@@ -159,7 +159,7 @@ class CornersOfFaceCountInput final : public 
bke::MeshFieldInput {
 return false;
   }
 
-  std::optional preferred_domain(const Mesh & /*mesh*/)const final
+  std::optional preferred_domain(const Mesh & /*mesh*/) const 
final
   {
 return ATTR_DOMAIN_FACE;
   }
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc
 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc
index cf579e498a5..c01c4149864 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc
@@ -139,7 +139,7 @@ class CornersOfVertInput final : public bke::MeshFieldInput 
{
 return false;
   }
 
-  std::optional preferred_domain(const Mesh & /*mesh*/)const final
+  std::optional preferred_domain(const Mesh & /*mesh*/) const 
final
   {
 return ATTR_DOMAIN_POINT;
   }
@@ -180,7 +180,7 @@ class CornersOfVertCountInput final : public 
bke::MeshFieldInput {
 return false;
   }
 
-  std::optional preferred_domain(const Mesh & /*mesh*/)const final
+  std::optional preferred_domain(const Mesh & /*mesh*/) const 
final
   {
 return ATTR_DOMAIN_POINT;
   }
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc
index af41ae03588..e46061e0d65 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc
+++ 

[Bf-blender-cvs] [f04f9cc3d02] master: Cleanup: add unique_index_table to UvElementMap

2022-11-08 Thread Chris Blackbourn
Commit: f04f9cc3d02168ce6ef779954f9db39c8c734775
Author: Chris Blackbourn
Date:   Wed Nov 9 11:42:30 2022 +1300
Branches: master
https://developer.blender.org/rBf04f9cc3d02168ce6ef779954f9db39c8c734775

Cleanup: add unique_index_table to UvElementMap

In anticipation of UV Copy+Paste, we need fast access to indices
of unique UvElements. Can also be used to improve performance and
simplify code for UV Sculpt tools and UV Stitch.

No user visible changes expected.

Maniphest Tasks: T77911

See also: D16278

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/editors/include/ED_mesh.h
M   source/blender/editors/mesh/editmesh_utils.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index 9d9c2f57f89..d0813ebb168 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -63,6 +63,10 @@ typedef struct UvElement {
  * If islands are calculated, it also stores UvElements
  * belonging to the same uv island in sequence and
  * the number of uvs per island.
+ *
+ * \note in C++, #head_table and #unique_index_table would
+ * be `mutable`, as they are created on demand, and never
+ * changed after creation.
  */
 typedef struct UvElementMap {
   /** UvElement Storage. */
@@ -78,6 +82,9 @@ typedef struct UvElementMap {
   /** If Non-NULL, pointer to local head of each unique UV. */
   struct UvElement **head_table;
 
+  /** If Non-NULL, pointer to index of each unique UV. */
+  int **unique_index_table;
+
   /** Number of islands, or zero if not calculated. */
   int total_islands;
   /** Array of starting index in #storage where each island begins. */
diff --git a/source/blender/editors/include/ED_mesh.h 
b/source/blender/editors/include/ED_mesh.h
index c100bf9b60b..7dfebf58bef 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -142,12 +142,15 @@ struct UvElementMap *BM_uv_element_map_create(struct 
BMesh *bm,
   bool use_seams,
   bool do_islands);
 void BM_uv_element_map_free(struct UvElementMap *element_map);
-struct UvElement *BM_uv_element_get(const struct UvElementMap *map,
+struct UvElement *BM_uv_element_get(const struct UvElementMap *element_map,
 const struct BMFace *efa,
 const struct BMLoop *l);
-struct UvElement *BM_uv_element_get_head(struct UvElementMap *map, struct 
UvElement *child);
+struct UvElement *BM_uv_element_get_head(struct UvElementMap *element_map,
+ struct UvElement *child);
+int BM_uv_element_get_unique_index(struct UvElementMap *element_map, struct 
UvElement *child);
 
 struct UvElement **BM_uv_element_map_ensure_head_table(struct UvElementMap 
*element_map);
+int **BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map);
 
 /**
  * Can we edit UV's for this mesh?
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index f6ffbec094e..33162cd2256 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -619,6 +619,44 @@ struct UvElement 
**BM_uv_element_map_ensure_head_table(struct UvElementMap *elem
   return element_map->head_table;
 }
 
+int **BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map)
+{
+  if (!element_map->unique_index_table) {
+element_map->unique_index_table = MEM_callocN(
+element_map->total_uvs * sizeof(*element_map->unique_index_table), 
__func__);
+
+int j = 0;
+for (int i = 0; i < element_map->total_uvs; i++) {
+  UvElement *element = element_map->storage + i;
+  if (!element->separate) {
+continue;
+  }
+  BLI_assert(0 <= j);
+  BLI_assert(j < element_map->total_unique_uvs);
+  while (element) {
+element_map->unique_index_table[element - element_map->storage] = j;
+element = element->next;
+if (!element || element->separate) {
+  break;
+}
+  }
+  j++;
+}
+BLI_assert(j == element_map->total_unique_uvs);
+  }
+
+  return element_map->unique_index_table;
+}
+
+int BM_uv_element_get_unique_index(struct UvElementMap *element_map, struct 
UvElement *child)
+{
+  int **unique_index = BM_uv_element_map_ensure_unique_index(element_map);
+  int index = child - element_map->storage;
+  BLI_assert(0 <= index);
+  BLI_assert(index < element_map->total_uvs);
+  return unique_index[index];
+}
+
 #define INVALID_ISLAND ((uint)-1)
 
 static void bm_uv_assign_island(UvElementMap *element_map,
@@ -1163,6 +1201,7 @@ void BM_uv_element_map_free(UvElementMap *element_map)
 MEM_SAFE_FREE(element_map->storage);

[Bf-blender-cvs] [75265f27da6] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Richard Antalik
Commit: 75265f27da64d4c18f5c22cd85ef868bc4a573ac
Author: Richard Antalik
Date:   Tue Nov 8 21:21:02 2022 +0100
Branches: master
https://developer.blender.org/rB75265f27da64d4c18f5c22cd85ef868bc4a573ac

Merge branch 'blender-v3.4-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] [62e32e7c2e0] blender-v3.4-release: Fix VSE: Effect strip flickers when moving left handle

2022-11-08 Thread Richard Antalik
Commit: 62e32e7c2e039415f91cb5578c462f98417bad0b
Author: Richard Antalik
Date:   Tue Nov 8 21:05:18 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB62e32e7c2e039415f91cb5578c462f98417bad0b

Fix VSE: Effect strip flickers when moving left handle

The issue was caused by refactoring, see 7afcfe111aacc8bc. Function
`SEQ_transform_fix_single_image_seq_offsets` modified offsets after
handle was moved, but this was not done correctly.

Remove function mentioned above and move strip start when moving left
handle of strips that have only single frame of content by design
(image, text, color, ...).

===

M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/editors/transform/transform_convert_sequencer.c
M   source/blender/makesrna/intern/rna_sequencer.c
M   source/blender/sequencer/SEQ_transform.h
M   source/blender/sequencer/intern/strip_add.c
M   source/blender/sequencer/intern/strip_time.c
M   source/blender/sequencer/intern/strip_transform.c

===

diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index e4c476e1212..b8161a9dc40 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -365,7 +365,6 @@ static void seq_update_meta_disp_range(Scene *scene)
 /* Update meta strip endpoints. */
 SEQ_time_left_handle_frame_set(scene, ms->parseq, ms->disp_range[0]);
 SEQ_time_right_handle_frame_set(scene, ms->parseq, ms->disp_range[1]);
-SEQ_transform_fix_single_image_seq_offsets(scene, ms->parseq);
 
 /* Recalculate effects using meta strip. */
 LISTBASE_FOREACH (Sequence *, seq, ms->oldbasep) {
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index c0c7782c60c..a9e31de2096 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -371,7 +371,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
 else { /* SEQ_RIGHTSEL */
   SEQ_time_right_handle_frame_set(scene, seq, snap_frame);
 }
-SEQ_transform_fix_single_image_seq_offsets(scene, seq);
   }
 }
   }
diff --git a/source/blender/editors/transform/transform_convert_sequencer.c 
b/source/blender/editors/transform/transform_convert_sequencer.c
index 090f1bf1e6c..80c74b81cfa 100644
--- a/source/blender/editors/transform/transform_convert_sequencer.c
+++ b/source/blender/editors/transform/transform_convert_sequencer.c
@@ -615,7 +615,6 @@ static void flushTransSeq(TransInfo *t)
   case SEQ_LEFTSEL: { /* No vertical transform. */
 int old_startdisp = SEQ_time_left_handle_frame_get(scene, seq);
 SEQ_time_left_handle_frame_set(t->scene, seq, new_frame);
-SEQ_transform_fix_single_image_seq_offsets(t->scene, seq);
 
 if (abs(SEQ_time_left_handle_frame_get(scene, seq) - old_startdisp) > 
abs(max_offset)) {
   max_offset = SEQ_time_left_handle_frame_get(scene, seq) - 
old_startdisp;
@@ -625,7 +624,6 @@ static void flushTransSeq(TransInfo *t)
   case SEQ_RIGHTSEL: { /* No vertical transform. */
 int old_enddisp = SEQ_time_right_handle_frame_get(scene, seq);
 SEQ_time_right_handle_frame_set(t->scene, seq, new_frame);
-SEQ_transform_fix_single_image_seq_offsets(t->scene, seq);
 
 if (abs(SEQ_time_right_handle_frame_get(scene, seq) - old_enddisp) > 
abs(max_offset)) {
   max_offset = SEQ_time_right_handle_frame_get(scene, seq) - 
old_enddisp;
diff --git a/source/blender/makesrna/intern/rna_sequencer.c 
b/source/blender/makesrna/intern/rna_sequencer.c
index c952210eecf..a10c64e292e 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -330,7 +330,6 @@ static void rna_Sequence_start_frame_final_set(PointerRNA 
*ptr, int value)
   Scene *scene = (Scene *)ptr->owner_id;
 
   SEQ_time_left_handle_frame_set(scene, seq, value);
-  SEQ_transform_fix_single_image_seq_offsets(scene, seq);
   do_sequence_frame_change_update(scene, seq);
   SEQ_relations_invalidate_cache_composite(scene, seq);
 }
@@ -341,7 +340,6 @@ static void rna_Sequence_end_frame_final_set(PointerRNA 
*ptr, int value)
   Scene *scene = (Scene *)ptr->owner_id;
 
   SEQ_time_right_handle_frame_set(scene, seq, value);
-  SEQ_transform_fix_single_image_seq_offsets(scene, seq);
   do_sequence_frame_change_update(scene, seq);
   SEQ_relations_invalidate_cache_composite(scene, seq);
 }
diff --git a/source/blender/sequencer/SEQ_transform.h 
b/source/blender/sequencer/SEQ_transform.h
index c27a9dc4409..30cf472f55b 100644
--- a/source/blender/sequencer/SEQ_transform.h
+++ 

[Bf-blender-cvs] [1eca4371979] master: Color Management: Parallelize ImBuf conversion to float

2022-11-08 Thread Lukas Stockner
Commit: 1eca4371979b45f6443446f8c7483aca8d9dc3b0
Author: Lukas Stockner
Date:   Tue Nov 8 20:39:40 2022 +0100
Branches: master
https://developer.blender.org/rB1eca4371979b45f6443446f8c7483aca8d9dc3b0

Color Management: Parallelize ImBuf conversion to float

Motivated by long loading times in T101969, reduces render preparation time 
from 14sec to 6sec.

Another possible improvement would be to use C++ and template based on OCIO vs. 
sRGB,
but moving the file to C++ seems nontrivial (and opens up the question whether 
ocio_capi
makes any sense then or we should just use OCIO directly) so I left it at a 
direct 1:1
parallelization of the existing code for now.

Reviewed By: brecht

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

===

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

===

diff --git a/source/blender/imbuf/intern/colormanagement.c 
b/source/blender/imbuf/intern/colormanagement.c
index 5e132826a4c..0678c224e6b 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -31,6 +31,7 @@
 #include "BLI_math_color.h"
 #include "BLI_rect.h"
 #include "BLI_string.h"
+#include "BLI_task.h"
 #include "BLI_threads.h"
 
 #include "BKE_appdir.h"
@@ -2249,6 +2250,43 @@ void IMB_colormanagement_imbuf_to_byte_texture(uchar 
*out_buffer,
   }
 }
 
+typedef struct ImbufByteToFloatData {
+  OCIO_ConstCPUProcessorRcPtr *processor;
+  int width;
+  int offset, stride;
+  const uchar *in_buffer;
+  float *out_buffer;
+  bool use_premultiply;
+} ImbufByteToFloatData;
+
+static void imbuf_byte_to_float_cb(void *__restrict userdata,
+   const int y,
+   const TaskParallelTLS *__restrict 
UNUSED(tls))
+{
+  ImbufByteToFloatData *data = userdata;
+
+  const size_t in_offset = data->offset + y * data->stride;
+  const size_t out_offset = y * data->width;
+  const uchar *in = data->in_buffer + in_offset * 4;
+  float *out = data->out_buffer + out_offset * 4;
+
+  /* Convert to scene linear, to sRGB and premultiply. */
+  for (int x = 0; x < data->width; x++, in += 4, out += 4) {
+float pixel[4];
+rgba_uchar_to_float(pixel, in);
+if (data->processor) {
+  OCIO_cpuProcessorApplyRGB(data->processor, pixel);
+}
+else {
+  srgb_to_linearrgb_v3_v3(pixel, pixel);
+}
+if (data->use_premultiply) {
+  mul_v3_fl(pixel, pixel[3]);
+}
+copy_v4_v4(out, pixel);
+  }
+}
+
 void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer,
 const int offset_x,
 const int offset_y,
@@ -2307,34 +2345,25 @@ void IMB_colormanagement_imbuf_to_float_texture(float 
*out_buffer,
 const uchar *in_buffer = (uchar *)ibuf->rect;
 const bool use_premultiply = IMB_alpha_affects_rgb(ibuf) && 
store_premultiplied;
 
-/* TODO(brecht): make this multi-threaded, or at least process in batches. 
*/
 OCIO_ConstCPUProcessorRcPtr *processor = (ibuf->rect_colorspace) ?
  
colorspace_to_scene_linear_cpu_processor(
  ibuf->rect_colorspace) :
  NULL;
 
-for (int y = 0; y < height; y++) {
-  const size_t in_offset = (offset_y + y) * ibuf->x + offset_x;
-  const size_t out_offset = y * width;
-  const uchar *in = in_buffer + in_offset * 4;
-  float *out = out_buffer + out_offset * 4;
-
-  /* Convert to scene linear, to sRGB and premultiply. */
-  for (int x = 0; x < width; x++, in += 4, out += 4) {
-float pixel[4];
-rgba_uchar_to_float(pixel, in);
-if (processor) {
-  OCIO_cpuProcessorApplyRGB(processor, pixel);
-}
-else {
-  srgb_to_linearrgb_v3_v3(pixel, pixel);
-}
-if (use_premultiply) {
-  mul_v3_fl(pixel, pixel[3]);
-}
-copy_v4_v4(out, pixel);
-  }
-}
+ImbufByteToFloatData data = {
+.processor = processor,
+.width = width,
+.offset = offset_y * ibuf->x + offset_x,
+.stride = ibuf->x,
+.in_buffer = in_buffer,
+.out_buffer = out_buffer,
+.use_premultiply = use_premultiply,
+};
+
+TaskParallelSettings settings;
+BLI_parallel_range_settings_defaults();
+settings.use_threading = (height > 128);
+BLI_task_parallel_range(0, height, , imbuf_byte_to_float_cb, 
);
   }
 }

___
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] [c6aacd718a5] master: Cleanup: Improve precision during UV packing.

2022-11-08 Thread Chris Blackbourn
Commit: c6aacd718a51dea2f0736280a6bd605898a320f2
Author: Chris Blackbourn
Date:   Wed Nov 9 08:37:14 2022 +1300
Branches: master
https://developer.blender.org/rBc6aacd718a51dea2f0736280a6bd605898a320f2

Cleanup: Improve precision during UV packing.

Simplify API and improve accuracy of uv packing placement
by using pre-translation and double precision internally.

Will protect against future precision problems with UDIM.

No user visible changes expected.

Maniphest Tasks: T68889
Differential Revision: https://developer.blender.org/D16362

===

M   source/blender/bmesh/intern/bmesh_query_uv.cc
M   source/blender/bmesh/intern/bmesh_query_uv.h
M   source/blender/editors/uvedit/uvedit_islands.cc

===

diff --git a/source/blender/bmesh/intern/bmesh_query_uv.cc 
b/source/blender/bmesh/intern/bmesh_query_uv.cc
index 33b2ca7a828..0e2385ff4e2 100644
--- a/source/blender/bmesh/intern/bmesh_query_uv.cc
+++ b/source/blender/bmesh/intern/bmesh_query_uv.cc
@@ -113,17 +113,6 @@ void BM_face_uv_minmax(const BMFace *f, float min[2], 
float max[2], const int cd
   } while ((l_iter = l_iter->next) != l_first);
 }
 
-void BM_face_uv_transform(BMFace *f, const float matrix[2][2], const int 
cd_loop_uv_offset)
-{
-  BMLoop *l_iter;
-  BMLoop *l_first;
-  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
-  do {
-MLoopUV *luv = (MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset);
-mul_m2_v2(matrix, luv->uv);
-  } while ((l_iter = l_iter->next) != l_first);
-}
-
 bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, const int 
cd_loop_uv_offset)
 {
   BLI_assert(l_a->e == l_b->e);
diff --git a/source/blender/bmesh/intern/bmesh_query_uv.h 
b/source/blender/bmesh/intern/bmesh_query_uv.h
index 2b0833f9185..6aa82653535 100644
--- a/source/blender/bmesh/intern/bmesh_query_uv.h
+++ b/source/blender/bmesh/intern/bmesh_query_uv.h
@@ -34,7 +34,6 @@ float BM_face_uv_calc_cross(const BMFace *f, int 
cd_loop_uv_offset) ATTR_WARN_UN
 ATTR_NONNULL();
 
 void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], int 
cd_loop_uv_offset);
-void BM_face_uv_transform(BMFace *f, const float matrix[2][2], int 
cd_loop_uv_offset);
 
 bool BM_loop_uv_share_edge_check_with_limit(BMLoop *l_a,
 BMLoop *l_b,
diff --git a/source/blender/editors/uvedit/uvedit_islands.cc 
b/source/blender/editors/uvedit/uvedit_islands.cc
index 92745667505..d8e10435146 100644
--- a/source/blender/editors/uvedit/uvedit_islands.cc
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@ -36,29 +36,48 @@
 
 #include "bmesh.h"
 
-/*  */
-/** \name UV Face Utilities
- * \{ */
+static void mul_v2_m2_add_v2v2(float r[2],
+   const float mat[2][2],
+   const float a[2],
+   const float b[2])
+{
+  /* Compute `r = mat * (a + b)` with high precision. */
+  const double x = static_cast(a[0]) + static_cast(b[0]);
+  const double y = static_cast(a[1]) + static_cast(b[1]);
+
+  r[0] = static_cast(mat[0][0] * x + mat[1][0] * y);
+  r[1] = static_cast(mat[0][1] * x + mat[1][1] * y);
+}
 
-static void bm_face_uv_translate_and_scale_around_pivot(BMFace *f,
-const float offset[2],
-const float scale[2],
-const float pivot[2],
-const int 
cd_loop_uv_offset)
+static void island_uv_transform(FaceIsland *island,
+const float matrix[2][2],/* Scale and 
rotation. */
+const float pre_translate[2] /* (pre) 
Translation. */
+)
 {
-  BMLoop *l_iter;
-  BMLoop *l_first;
-  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
-  do {
-MLoopUV *luv = static_cast(BM_ELEM_CD_GET_VOID_P(l_iter, 
cd_loop_uv_offset));
-for (int i = 0; i < 2; i++) {
-  luv->uv[i] = offset[i] + (((luv->uv[i] - pivot[i]) * scale[i]) + 
pivot[i]);
+  /* Use a pre-transform to compute `A * (x+b)`
+   *
+   * \note Ordinarily, we'd use a post_transform like `A * x + b`
+   * In general, post-transforms are easier to work with when using homogenous 
co-ordinates.
+   *
+   * When UV mapping into the unit square, post-transforms can lose precision 
on small islands.
+   * Instead we're using a pre-transform to maintain precision.
+   *
+   * To convert post-transform to pre-transform, use `A * x + b == A * (x + 
c), c = A^-1 * b`
+   */
+
+  const int cd_loop_uv_offset = island->cd_loop_uv_offset;
+  const int faces_len = island->faces_len;
+  for (int i = 0; i < faces_len; i++) {
+BMFace *f = island->faces[i];
+BMLoop *l;
+BMIter iter;
+BM_ITER_ELEM (l, , f, BM_LOOPS_OF_FACE) 

[Bf-blender-cvs] [e59ebfef3c5] temp-sculpt-brush-channel: Merge branch 'master' into temp-sculpt-brush-channel

2022-11-08 Thread Joseph Eagar
Commit: e59ebfef3c583985553e78492cf8cd07bbe7648e
Author: Joseph Eagar
Date:   Tue Nov 8 09:13:59 2022 -0800
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rBe59ebfef3c583985553e78492cf8cd07bbe7648e

Merge branch 'master' into temp-sculpt-brush-channel

===



===

diff --cc source/blender/editors/sculpt_paint/paint_cursor.c
index de696e889b5,b6e83187c86..c479df43b0e
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@@ -563,17 -562,22 +563,22 @@@ static bool paint_draw_tex_overlay(Scen
  if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
GPU_matrix_push();
  
+   float center[2] = {
+   ups->draw_anchored ? ups->anchored_initial_mouse[0] : x,
+   ups->draw_anchored ? ups->anchored_initial_mouse[1] : y,
+   };
+ 
/* Brush rotation. */
-   GPU_matrix_translate_2f(x, y);
+   GPU_matrix_translate_2fv(center);
GPU_matrix_rotate_2d(-RAD2DEGF(primary ? ups->brush_rotation : 
ups->brush_rotation_sec));
-   GPU_matrix_translate_2f(-x, -y);
+   GPU_matrix_translate_2f(-center[0], -center[1]);
  
/* Scale based on tablet pressure. */
 -  if (primary && ups->stroke_active && 
BKE_brush_use_size_pressure(brush)) {
 +  if (primary && ups->stroke_active && BKE_brush_use_size_pressure(scene, 
brush)) {
  const float scale = ups->size_pressure_value;
- GPU_matrix_translate_2f(x, y);
+ GPU_matrix_translate_2fv(center);
  GPU_matrix_scale_2f(scale, scale);
- GPU_matrix_translate_2f(-x, -y);
+ GPU_matrix_translate_2f(-center[0], -center[1]);
}
  
if (ups->draw_anchored) {
diff --cc source/blender/editors/sculpt_paint/sculpt.c
index 17f564c3051,3477285814e..483ae385765
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@@ -5556,10 -5509,11 +5557,11 @@@ static void sculpt_stroke_update_step(b
  
SCULPT_stroke_modifiers_check(C, ob, brush);
sculpt_update_cache_variants(C, sd, ob, itemptr);
 -  sculpt_restore_mesh(sd, ob);
 +  sculpt_restore_mesh(CTX_data_scene(C), sd, ob);
  
if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | 
SCULPT_DYNTOPO_DETAIL_MANUAL)) {
- float object_space_constant_detail = 1.0f / (sd->constant_detail * 
mat4_to_scale(ob->obmat));
+ float object_space_constant_detail = 1.0f / (sd->constant_detail *
+  
mat4_to_scale(ob->object_to_world));
  BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail);
}
else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) {

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

2022-11-08 Thread Hans Goudey
Commit: 96d8e5e66b9755c2fb77b6ef37b256d78c904166
Author: Hans Goudey
Date:   Tue Nov 8 13:39:45 2022 -0600
Branches: master
https://developer.blender.org/rB96d8e5e66b9755c2fb77b6ef37b256d78c904166

Merge branch 'blender-v3.4-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] [d80d7b8f70d] blender-v3.4-release: Geometry Nodes: Add preferred domain to many field inputs

2022-11-08 Thread Hans Goudey
Commit: d80d7b8f70d8aa676ca8a71fbe6604455c429020
Author: Hans Goudey
Date:   Tue Nov 8 13:33:58 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBd80d7b8f70d8aa676ca8a71fbe6604455c429020

Geometry Nodes: Add preferred domain to many field inputs

The preferred domain is used to decide which domain the viewer node
should use when set to "Auto" domain. This commit adds it to some curve
input nodes and the curve and mesh topology nodes. This makes debugging
node setups with these nodes a bit faster and less frustrating.

===

M   source/blender/blenkernel/BKE_geometry_fields.hh
M   source/blender/blenkernel/intern/geometry_component_curves.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
M   
source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
M   source/blender/nodes/geometry/nodes/node_geo_input_spline_length.cc
M   source/blender/nodes/geometry/nodes/node_geo_input_tangent.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_face.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_corners_of_vertex.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_corner.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_edges_of_vertex.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_face_of_corner.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_offset_corner_in_face.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_topology_vertex_of_corner.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_fields.hh 
b/source/blender/blenkernel/BKE_geometry_fields.hh
index 2eef67dba98..7b493ea5ca9 100644
--- a/source/blender/blenkernel/BKE_geometry_fields.hh
+++ b/source/blender/blenkernel/BKE_geometry_fields.hh
@@ -306,6 +306,7 @@ class CurveLengthFieldInput final : public CurvesFieldInput 
{
  IndexMask mask) const final;
   uint64_t hash() const override;
   bool is_equal_to(const fn::FieldNode ) const override;
+  std::optional preferred_domain(const bke::CurvesGeometry 
) const final;
 };
 
 bool try_capture_field_on_geometry(GeometryComponent ,
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc 
b/source/blender/blenkernel/intern/geometry_component_curves.cc
index d6987d76028..fff9004bc16 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -282,6 +282,12 @@ bool CurveLengthFieldInput::is_equal_to(const 
fn::FieldNode ) const
   return dynamic_cast() != nullptr;
 }
 
+std::optional CurveLengthFieldInput::preferred_domain(
+const bke::CurvesGeometry & /*curves*/) const
+{
+  return ATTR_DOMAIN_CURVE;
+}
+
 /** \} */
 
 }  // namespace blender::bke
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
index 4d60ab939ca..d442a8823cb 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_curve_of_point.cc
@@ -48,6 +48,11 @@ class CurveOfPointInput final : public bke::CurvesFieldInput 
{
 }
 return false;
   }
+
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)const final
+  {
+return ATTR_DOMAIN_POINT;
+  }
 };
 
 class PointIndexInCurveInput final : public bke::CurvesFieldInput {
@@ -86,6 +91,11 @@ class PointIndexInCurveInput final : public 
bke::CurvesFieldInput {
 }
 return false;
   }
+
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)
+  {
+return ATTR_DOMAIN_POINT;
+  }
 };
 
 static void node_geo_exec(GeoNodeExecParams params)
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
index 9f3d3c2caf3..02457043281 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_curve_topology_points_of_curve.cc
@@ -113,6 +113,11 @@ class PointsOfCurveInput final : public 
bke::CurvesFieldInput {
 }
 return false;
   }
+
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)const final
+  {
+return ATTR_DOMAIN_CURVE;
+  }
 };
 
 class CurvePointCountInput final : public bke::CurvesFieldInput {
@@ -146,6 +151,11 @@ class CurvePointCountInput final : public 
bke::CurvesFieldInput {
 }
 return false;
   }
+
+  std::optional preferred_domain(const bke::CurvesGeometry & 
/*curves*/)const final
+  {
+return ATTR_DOMAIN_CURVE;
+  }
 };
 
 static void 

[Bf-blender-cvs] [da41f11a290] blender-v3.4-release: Fix T102358: Sample curve node all curves factor mode incorrect

2022-11-08 Thread Hans Goudey
Commit: da41f11a290d9641fed4e73e140fda33a803d391
Author: Hans Goudey
Date:   Tue Nov 8 13:12:39 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBda41f11a290d9641fed4e73e140fda33a803d391

Fix T102358: Sample curve node all curves factor mode incorrect

The "all curve" sampling is implemented as two functions internally.
The first finds which curve each "global" sample should be on. Then
the second is the regular evaluation and sampling in that curve.
The first operations creates lengths, but they were processed as
factors when passed to the second function.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
index 3170d0aecac..5e551ff66e8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
@@ -528,29 +528,33 @@ static void node_geo_exec(GeoNodeExecParams params)
   mode == GEO_NODE_CURVE_SAMPLE_FACTOR ? "Factor" : "Length");
   GField src_values_field = get_input_attribute_field(params, data_type);
 
-  auto sample_fn = std::make_unique(
-  std::move(geometry_set), mode, std::move(src_values_field));
-
   std::shared_ptr sample_op;
   if (curves.curves_num() == 1) {
-sample_op = FieldOperation::Create(std::move(sample_fn),
-   {fn::make_constant_field(0), 
std::move(length_field)});
+sample_op = FieldOperation::Create(
+std::make_unique(
+std::move(geometry_set), mode, std::move(src_values_field)),
+{fn::make_constant_field(0), std::move(length_field)});
   }
   else {
-Field curve_index;
-Field length_in_curve;
 if (storage.use_all_curves) {
   auto index_fn = std::make_unique(
   curve_accumulated_lengths(curves), mode);
   auto index_op = FieldOperation::Create(std::move(index_fn), 
{std::move(length_field)});
-  curve_index = Field(index_op, 0);
-  length_in_curve = Field(index_op, 1);
+  Field curve_index = Field(index_op, 0);
+  Field length_in_curve = Field(index_op, 1);
+  sample_op = FieldOperation::Create(
+  std::make_unique(
+  std::move(geometry_set), GEO_NODE_CURVE_SAMPLE_LENGTH, 
std::move(src_values_field)),
+  {std::move(curve_index), std::move(length_in_curve)});
 }
 else {
-  curve_index = params.extract_input>("Curve Index");
-  length_in_curve = std::move(length_field);
+  Field curve_index = params.extract_input>("Curve Index");
+  Field length_in_curve = std::move(length_field);
+  sample_op = FieldOperation::Create(
+  std::make_unique(
+  std::move(geometry_set), mode, std::move(src_values_field)),
+  {std::move(curve_index), std::move(length_in_curve)});
 }
-sample_op = FieldOperation::Create(std::move(sample_fn), {curve_index, 
length_in_curve});
   }
 
   params.set_output("Position", Field(sample_op, 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] [4b57bc4e5d4] master: Cleanup: format

2022-11-08 Thread Chris Blackbourn
Commit: 4b57bc4e5d4cada4a40d51745cc951f69f9aab08
Author: Chris Blackbourn
Date:   Wed Nov 9 08:30:18 2022 +1300
Branches: master
https://developer.blender.org/rB4b57bc4e5d4cada4a40d51745cc951f69f9aab08

Cleanup: format

===

M   intern/cycles/device/cuda/device_impl.cpp
M   intern/cycles/device/cuda/device_impl.h
M   source/blender/blenloader/intern/versioning_legacy.c
M   source/blender/nodes/texture/nodes/node_texture_curves.c

===

diff --git a/intern/cycles/device/cuda/device_impl.cpp 
b/intern/cycles/device/cuda/device_impl.cpp
index b56765208ee..c9764d1c21b 100644
--- a/intern/cycles/device/cuda/device_impl.cpp
+++ b/intern/cycles/device/cuda/device_impl.cpp
@@ -232,7 +232,7 @@ string CUDADevice::compile_kernel_get_common_cflags(const 
uint kernel_features)
   return cflags;
 }
 
-string CUDADevice::compile_kernel(const string& common_cflags,
+string CUDADevice::compile_kernel(const string _cflags,
   const char *name,
   const char *base,
   bool force_ptx)
diff --git a/intern/cycles/device/cuda/device_impl.h 
b/intern/cycles/device/cuda/device_impl.h
index bd6d806561b..c18f2811161 100644
--- a/intern/cycles/device/cuda/device_impl.h
+++ b/intern/cycles/device/cuda/device_impl.h
@@ -79,7 +79,7 @@ class CUDADevice : public Device {
 
   string compile_kernel_get_common_cflags(const uint kernel_features);
 
-  string compile_kernel(const string& cflags,
+  string compile_kernel(const string ,
 const char *name,
 const char *base = "cuda",
 bool force_ptx = false);
diff --git a/source/blender/blenloader/intern/versioning_legacy.c 
b/source/blender/blenloader/intern/versioning_legacy.c
index 23d514a7b12..8685db377d4 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -58,11 +58,11 @@
 #include "BKE_lattice.h"
 #include "BKE_main.h" /* for Main */
 #include "BKE_mesh.h" /* for ME_ defines (patching) */
+#include "BKE_mesh_legacy_convert.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
 #include "BKE_pointcache.h"
-#include "BKE_mesh_legacy_convert.h"
 
 #include "SEQ_iterator.h"
 #include "SEQ_sequencer.h"
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c 
b/source/blender/nodes/texture/nodes/node_texture_curves.c
index df75847dbe3..bdee2adb1ba 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -104,9 +104,8 @@ void register_node_type_tex_curve_rgb(void)
   node_type_size_preset(, NODE_SIZE_LARGE);
   ntype.initfunc = rgb_init;
   node_type_storage(, "CurveMapping", node_free_curves, 
node_copy_curves);
-  ntype.init_exec_fn = node_initexec_curves ;
-  ntype.exec_fn =rgb_exec ;
-
+  ntype.init_exec_fn = node_initexec_curves;
+  ntype.exec_fn = rgb_exec;
 
   nodeRegisterType();
 }

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

2022-11-08 Thread Brecht Van Lommel
Commit: b539d425f020086151ef02e81b8a2f079b7011a3
Author: Brecht Van Lommel
Date:   Tue Nov 8 19:47:55 2022 +0100
Branches: master
https://developer.blender.org/rBb539d425f020086151ef02e81b8a2f079b7011a3

Merge branch 'blender-v3.4-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] [c306ccb67fc] blender-v3.4-release: Fix Cycles error with runtime compilation when there is no path to OptiX SDK

2022-11-08 Thread Gon Solo
Commit: c306ccb67fcf44d9bca3c4ed0f20d1af1df29f26
Author: Gon Solo
Date:   Tue Nov 8 19:31:48 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBc306ccb67fcf44d9bca3c4ed0f20d1af1df29f26

Fix Cycles error with runtime compilation when there is no path to OptiX SDK

If no OPTIX_ROOT is set, nvcc fails to compile because there is a stray "-I"
in the arguments. Detect if the include path is empty and act accordingly.

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

===

M   intern/cycles/device/cuda/device_impl.cpp
M   intern/cycles/device/cuda/device_impl.h
M   intern/cycles/device/hip/device_impl.h
M   intern/cycles/device/optix/device_impl.cpp
M   intern/cycles/device/optix/device_impl.h

===

diff --git a/intern/cycles/device/cuda/device_impl.cpp 
b/intern/cycles/device/cuda/device_impl.cpp
index 01c021551f3..b56765208ee 100644
--- a/intern/cycles/device/cuda/device_impl.cpp
+++ b/intern/cycles/device/cuda/device_impl.cpp
@@ -232,7 +232,7 @@ string CUDADevice::compile_kernel_get_common_cflags(const 
uint kernel_features)
   return cflags;
 }
 
-string CUDADevice::compile_kernel(const uint kernel_features,
+string CUDADevice::compile_kernel(const string& common_cflags,
   const char *name,
   const char *base,
   bool force_ptx)
@@ -281,7 +281,6 @@ string CUDADevice::compile_kernel(const uint 
kernel_features,
   /* We include cflags into md5 so changing cuda toolkit or changing other
* compiler command line arguments makes sure cubin gets re-built.
*/
-  string common_cflags = compile_kernel_get_common_cflags(kernel_features);
   const string kernel_md5 = util_md5_string(source_md5 + common_cflags);
 
   const char *const kernel_ext = force_ptx ? "ptx" : "cubin";
@@ -417,7 +416,8 @@ bool CUDADevice::load_kernels(const uint kernel_features)
 
   /* get kernel */
   const char *kernel_name = "kernel";
-  string cubin = compile_kernel(kernel_features, kernel_name);
+  string cflags = compile_kernel_get_common_cflags(kernel_features);
+  string cubin = compile_kernel(cflags, kernel_name);
   if (cubin.empty())
 return false;
 
diff --git a/intern/cycles/device/cuda/device_impl.h 
b/intern/cycles/device/cuda/device_impl.h
index a754c33f79d..bd6d806561b 100644
--- a/intern/cycles/device/cuda/device_impl.h
+++ b/intern/cycles/device/cuda/device_impl.h
@@ -77,9 +77,9 @@ class CUDADevice : public Device {
 
   bool use_adaptive_compilation();
 
-  virtual string compile_kernel_get_common_cflags(const uint kernel_features);
+  string compile_kernel_get_common_cflags(const uint kernel_features);
 
-  string compile_kernel(const uint kernel_features,
+  string compile_kernel(const string& cflags,
 const char *name,
 const char *base = "cuda",
 bool force_ptx = false);
diff --git a/intern/cycles/device/hip/device_impl.h 
b/intern/cycles/device/hip/device_impl.h
index 9afef3789af..efdc15dca79 100644
--- a/intern/cycles/device/hip/device_impl.h
+++ b/intern/cycles/device/hip/device_impl.h
@@ -74,7 +74,7 @@ class HIPDevice : public Device {
 
   bool use_adaptive_compilation();
 
-  virtual string compile_kernel_get_common_cflags(const uint kernel_features);
+  string compile_kernel_get_common_cflags(const uint kernel_features);
 
   string compile_kernel(const uint kernel_features, const char *name, const 
char *base = "hip");
 
diff --git a/intern/cycles/device/optix/device_impl.cpp 
b/intern/cycles/device/optix/device_impl.cpp
index 6c64e7106d5..fabf4d7b69d 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -381,13 +381,44 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
 return false;
   }
 
+  /* Skip creating OptiX module if only doing denoising. */
+  const bool need_optix_kernels = (kernel_features &
+   (KERNEL_FEATURE_PATH_TRACING | 
KERNEL_FEATURE_BAKING));
+
+  /* Detect existence of OptiX kernel and SDK here early. So we can error out
+   * before compiling the CUDA kernels, to avoid failing right after when
+   * compiling the OptiX kernel. */
+  string ptx_filename;
+  if (need_optix_kernels) {
+ptx_filename = path_get(
+(kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | 
KERNEL_FEATURE_MNEE)) ?
+"lib/kernel_optix_shader_raytrace.ptx" :
+"lib/kernel_optix.ptx");
+if (use_adaptive_compilation() || path_file_size(ptx_filename) == -1) {
+  std::string optix_include_dir = get_optix_include_dir();
+  if (optix_include_dir.empty()) {
+set_error(
+"Unable to compile OptiX kernels at runtime. Set OPTIX_ROOT_DIR 
environment variable "
+"to a directory containing the OptiX 

[Bf-blender-cvs] [35eb37c60dc] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Richard Antalik
Commit: 35eb37c60dcb0f378c91ed1e4e5b1f46a3fcd0b6
Author: Richard Antalik
Date:   Tue Nov 8 19:36:06 2022 +0100
Branches: master
https://developer.blender.org/rB35eb37c60dcb0f378c91ed1e4e5b1f46a3fcd0b6

Merge branch 'blender-v3.4-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] [5925b1821a5] blender-v3.4-release: Fix T102328: Incorrect strip state after copying

2022-11-08 Thread Richard Antalik
Commit: 5925b1821a5706d59d1504ab3b426ce5df6aff52
Author: Richard Antalik
Date:   Tue Nov 8 19:10:26 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB5925b1821a5706d59d1504ab3b426ce5df6aff52

Fix T102328: Incorrect strip state after copying

Effect strip start position was translated twice. This is caused by
recent refactoring, see 7afcfe111aacc8bc.

Don't change `seq->start` of attached effect strips during translation
and only rely on `seq_time_update_effects_strip_range` function.

===

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

===

diff --git a/source/blender/sequencer/intern/strip_transform.c 
b/source/blender/sequencer/intern/strip_transform.c
index 2c7bb69da66..4296a8ea35c 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -145,7 +145,7 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, 
Sequence *seq, int delt
 /* Move meta start/end points. */
 seq_time_translate_handles(evil_scene, seq, delta);
   }
-  else { /* All other strip types. */
+  else if (seq->seq1 == NULL && seq->seq2 == NULL) { /* All other strip types. 
*/
 seq->start += delta;
 /* Only to make files usable in older versions. */
 seq->startdisp = SEQ_time_left_handle_frame_get(evil_scene, seq);

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

2022-11-08 Thread Hans Goudey
Commit: ad5814a2a795e66e328e2eac6af75610c0f15490
Author: Hans Goudey
Date:   Tue Nov 8 12:33:31 2022 -0600
Branches: master
https://developer.blender.org/rBad5814a2a795e66e328e2eac6af75610c0f15490

Merge branch 'blender-v3.4-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] [66dda2b902f] blender-v3.4-release: Fix T102003: Spline parameter length wrong for NURBS

2022-11-08 Thread Hans Goudey
Commit: 66dda2b902f0e2d1ee4a6d956ae5144743f7df2d
Author: Hans Goudey
Date:   Tue Nov 8 12:31:11 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rB66dda2b902f0e2d1ee4a6d956ae5144743f7df2d

Fix T102003: Spline parameter length wrong for NURBS

The node has always be a bit confusing for the NURBS case, since it
uses the distance between control points since the evaluated/control
point mapping isn't obvious, but it also went above 1, which wasn't
correct.

Instead, retrieve the total length from the point lengths calculated
in the previous step. The results should be the same for other curve
types.

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
index 3dc89a9058e..159a4661df0 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
@@ -117,9 +117,8 @@ static VArray construct_curve_parameter_varray(const 
bke::CurvesGeometry
 
 threading::parallel_for(curves.curves_range(), 1024, [&](IndexRange range) 
{
   for (const int i_curve : range) {
-const float total_length = 
curves.evaluated_length_total_for_curve(i_curve,
-   
cyclic[i_curve]);
 MutableSpan curve_lengths = 
lengths.slice(curves.points_for_curve(i_curve));
+const float total_length = curve_lengths.last();
 if (total_length > 0.0f) {
   const float factor = 1.0f / total_length;
   for (float  : curve_lengths) {

___
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] [8eab23bc66e] master: Geometry Nodes: Fix alignment of exposed properties in the modifier

2022-11-08 Thread Leon Schittek
Commit: 8eab23bc66e06b9c5a496e0f7865403094e1799b
Author: Leon Schittek
Date:   Tue Nov 8 19:09:28 2022 +0100
Branches: master
https://developer.blender.org/rB8eab23bc66e06b9c5a496e0f7865403094e1799b

Geometry Nodes: Fix alignment of exposed properties in the modifier

The spacing and alignment of the properties in the geometry nodes
modifier could vary depending on the type of the socket or
whether the input can accept attributes.
Wrapping each property in its own `row` layout allows us to make
the spacing and alignment between them consistent.

Reviewed By: Hans Goudey

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

===

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

===

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index c032ee35639..15d7e494c04 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1542,15 +1542,18 @@ static void add_attribute_search_or_value_buttons(const 
bContext ,
   const std::string rna_path_attribute_name = "[\"" + 
std::string(socket_id_esc) +
   attribute_name_suffix + "\"]";
 
+  /* We're handling this manually in this case. */
+  uiLayoutSetPropDecorate(layout, false);
+
   uiLayout *split = uiLayoutSplit(layout, 0.4f, false);
   uiLayout *name_row = uiLayoutRow(split, false);
   uiLayoutSetAlignment(name_row, UI_LAYOUT_ALIGN_RIGHT);
   uiItemL(name_row, socket.name, ICON_NONE);
 
-  uiLayout *row = uiLayoutRow(split, true);
+  uiLayout *prop_row = uiLayoutRow(split, true);
 
   PointerRNA props;
-  uiItemFullO(row,
+  uiItemFullO(prop_row,
   "object.geometry_nodes_input_attribute_toggle",
   "",
   ICON_SPREADSHEET,
@@ -1563,12 +1566,12 @@ static void add_attribute_search_or_value_buttons(const 
bContext ,
 
   const int use_attribute = RNA_int_get(md_ptr, 
rna_path_use_attribute.c_str()) != 0;
   if (use_attribute) {
-add_attribute_search_button(C, row, nmd, md_ptr, rna_path_attribute_name, 
socket, false);
-uiItemL(row, "", ICON_BLANK1);
+add_attribute_search_button(C, prop_row, nmd, md_ptr, 
rna_path_attribute_name, socket, false);
+uiItemL(layout, "", ICON_BLANK1);
   }
   else {
-uiItemR(row, md_ptr, rna_path.c_str(), 0, "", ICON_NONE);
-uiItemDecoratorR(row, md_ptr, rna_path.c_str(), -1);
+uiItemR(prop_row, md_ptr, rna_path.c_str(), 0, "", ICON_NONE);
+uiItemDecoratorR(layout, md_ptr, rna_path.c_str(), -1);
   }
 }
 
@@ -1598,44 +1601,39 @@ static void draw_property_for_socket(const bContext ,
   char rna_path[sizeof(socket_id_esc) + 4];
   BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc);
 
+  uiLayout *row = uiLayoutRow(layout, true);
+  uiLayoutSetPropDecorate(row, true);
+
   /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not 
have enough
* information about what type of ID to select for editing the values. This 
is because
* pointer IDProperties contain no information about their type. */
   switch (socket.type) {
 case SOCK_OBJECT: {
-  uiItemPointerR(
-  layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, 
ICON_OBJECT_DATA);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "objects", socket.name, 
ICON_OBJECT_DATA);
   break;
 }
 case SOCK_COLLECTION: {
-  uiItemPointerR(layout,
- md_ptr,
- rna_path,
- bmain_ptr,
- "collections",
- socket.name,
- ICON_OUTLINER_COLLECTION);
+  uiItemPointerR(
+  row, md_ptr, rna_path, bmain_ptr, "collections", socket.name, 
ICON_OUTLINER_COLLECTION);
   break;
 }
 case SOCK_MATERIAL: {
-  uiItemPointerR(layout, md_ptr, rna_path, bmain_ptr, "materials", 
socket.name, ICON_MATERIAL);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "materials", 
socket.name, ICON_MATERIAL);
   break;
 }
 case SOCK_TEXTURE: {
-  uiItemPointerR(layout, md_ptr, rna_path, bmain_ptr, "textures", 
socket.name, ICON_TEXTURE);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "textures", 
socket.name, ICON_TEXTURE);
   break;
 }
 case SOCK_IMAGE: {
-  uiItemPointerR(layout, md_ptr, rna_path, bmain_ptr, "images", 
socket.name, ICON_IMAGE);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "images", socket.name, 
ICON_IMAGE);
   break;
 }
 default: {
   if (input_has_attribute_toggle(*nmd->node_group, socket_index)) {
-add_attribute_search_or_value_buttons(C, layout, *nmd, md_ptr, socket);
+add_attribute_search_or_value_buttons(C, row, *nmd, md_ptr, socket);
   }
   else {
-uiLayout *row = uiLayoutRow(layout, false);
-

[Bf-blender-cvs] [fd352160253] blender-v3.4-release: Geometry Nodes: Fix alignment of exposed properties in the modifier

2022-11-08 Thread Leon Schittek
Commit: fd352160253c57f14e9ce5aaf8009305fd8bc63d
Author: Leon Schittek
Date:   Tue Nov 8 19:09:28 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBfd352160253c57f14e9ce5aaf8009305fd8bc63d

Geometry Nodes: Fix alignment of exposed properties in the modifier

The spacing and alignment of the properties in the geometry nodes
modifier could vary depending on the type of the socket or
whether the input can accept attributes.
Wrapping each property in its own `row` layout allows us to make
the spacing and alignment between them consistent.

Reviewed By: Hans Goudey

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

===

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

===

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index c032ee35639..15d7e494c04 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1542,15 +1542,18 @@ static void add_attribute_search_or_value_buttons(const 
bContext ,
   const std::string rna_path_attribute_name = "[\"" + 
std::string(socket_id_esc) +
   attribute_name_suffix + "\"]";
 
+  /* We're handling this manually in this case. */
+  uiLayoutSetPropDecorate(layout, false);
+
   uiLayout *split = uiLayoutSplit(layout, 0.4f, false);
   uiLayout *name_row = uiLayoutRow(split, false);
   uiLayoutSetAlignment(name_row, UI_LAYOUT_ALIGN_RIGHT);
   uiItemL(name_row, socket.name, ICON_NONE);
 
-  uiLayout *row = uiLayoutRow(split, true);
+  uiLayout *prop_row = uiLayoutRow(split, true);
 
   PointerRNA props;
-  uiItemFullO(row,
+  uiItemFullO(prop_row,
   "object.geometry_nodes_input_attribute_toggle",
   "",
   ICON_SPREADSHEET,
@@ -1563,12 +1566,12 @@ static void add_attribute_search_or_value_buttons(const 
bContext ,
 
   const int use_attribute = RNA_int_get(md_ptr, 
rna_path_use_attribute.c_str()) != 0;
   if (use_attribute) {
-add_attribute_search_button(C, row, nmd, md_ptr, rna_path_attribute_name, 
socket, false);
-uiItemL(row, "", ICON_BLANK1);
+add_attribute_search_button(C, prop_row, nmd, md_ptr, 
rna_path_attribute_name, socket, false);
+uiItemL(layout, "", ICON_BLANK1);
   }
   else {
-uiItemR(row, md_ptr, rna_path.c_str(), 0, "", ICON_NONE);
-uiItemDecoratorR(row, md_ptr, rna_path.c_str(), -1);
+uiItemR(prop_row, md_ptr, rna_path.c_str(), 0, "", ICON_NONE);
+uiItemDecoratorR(layout, md_ptr, rna_path.c_str(), -1);
   }
 }
 
@@ -1598,44 +1601,39 @@ static void draw_property_for_socket(const bContext ,
   char rna_path[sizeof(socket_id_esc) + 4];
   BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc);
 
+  uiLayout *row = uiLayoutRow(layout, true);
+  uiLayoutSetPropDecorate(row, true);
+
   /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not 
have enough
* information about what type of ID to select for editing the values. This 
is because
* pointer IDProperties contain no information about their type. */
   switch (socket.type) {
 case SOCK_OBJECT: {
-  uiItemPointerR(
-  layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, 
ICON_OBJECT_DATA);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "objects", socket.name, 
ICON_OBJECT_DATA);
   break;
 }
 case SOCK_COLLECTION: {
-  uiItemPointerR(layout,
- md_ptr,
- rna_path,
- bmain_ptr,
- "collections",
- socket.name,
- ICON_OUTLINER_COLLECTION);
+  uiItemPointerR(
+  row, md_ptr, rna_path, bmain_ptr, "collections", socket.name, 
ICON_OUTLINER_COLLECTION);
   break;
 }
 case SOCK_MATERIAL: {
-  uiItemPointerR(layout, md_ptr, rna_path, bmain_ptr, "materials", 
socket.name, ICON_MATERIAL);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "materials", 
socket.name, ICON_MATERIAL);
   break;
 }
 case SOCK_TEXTURE: {
-  uiItemPointerR(layout, md_ptr, rna_path, bmain_ptr, "textures", 
socket.name, ICON_TEXTURE);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "textures", 
socket.name, ICON_TEXTURE);
   break;
 }
 case SOCK_IMAGE: {
-  uiItemPointerR(layout, md_ptr, rna_path, bmain_ptr, "images", 
socket.name, ICON_IMAGE);
+  uiItemPointerR(row, md_ptr, rna_path, bmain_ptr, "images", socket.name, 
ICON_IMAGE);
   break;
 }
 default: {
   if (input_has_attribute_toggle(*nmd->node_group, socket_index)) {
-add_attribute_search_or_value_buttons(C, layout, *nmd, md_ptr, socket);
+add_attribute_search_or_value_buttons(C, row, *nmd, md_ptr, socket);
   }
   else {
-uiLayout *row = uiLayoutRow(layout, false);
-

[Bf-blender-cvs] [5d772ac1fb0] tmp-vfx-platform-2023: deps_builder: add missing oiio dep to USD

2022-11-08 Thread Ray Molenkamp
Commit: 5d772ac1fb0c64fae13a222413a6d9a6d9cf7a8d
Author: Ray Molenkamp
Date:   Tue Nov 8 11:12:11 2022 -0700
Branches: tmp-vfx-platform-2023
https://developer.blender.org/rB5d772ac1fb0c64fae13a222413a6d9a6d9cf7a8d

deps_builder: add missing oiio dep to USD

===

M   build_files/build_environment/cmake/usd.cmake

===

diff --git a/build_files/build_environment/cmake/usd.cmake 
b/build_files/build_environment/cmake/usd.cmake
index 64d64e82110..645632043c2 100644
--- a/build_files/build_environment/cmake/usd.cmake
+++ b/build_files/build_environment/cmake/usd.cmake
@@ -105,6 +105,7 @@ add_dependencies(
   external_boost
   external_opensubdiv
   external_python
+  external_openimageio
   openvdb
 )

___
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] [b090c18ce46] temp-asset-representation: Store ID in asset representation directly

2022-11-08 Thread Julian Eisel
Commit: b090c18ce46697c97a4e1eaba60bb92a4212431d
Author: Julian Eisel
Date:   Tue Nov 8 18:43:25 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rBb090c18ce46697c97a4e1eaba60bb92a4212431d

Store ID in asset representation directly

This should make some things more convenient in future, since we can
directly access the ID if an asset represents one, without having to
look it up. But also, we need to do ID remapping either way, which
currently requires the ID pointer to identify the ID, not other ID data
(like the contained asset metadata).

===

M   source/blender/blenkernel/BKE_asset_library.hh
M   source/blender/blenkernel/BKE_asset_representation.hh
M   source/blender/blenkernel/intern/asset_library.cc
M   source/blender/blenkernel/intern/asset_representation.cc

===

diff --git a/source/blender/blenkernel/BKE_asset_library.hh 
b/source/blender/blenkernel/BKE_asset_library.hh
index 6402799b3a1..3358e37231e 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -60,7 +60,7 @@ struct AssetLibrary {
* loading a different file).
*/
   AssetRepresentation _external_asset(std::unique_ptr 
metadata);
-  AssetRepresentation _local_id_asset(const ID );
+  AssetRepresentation _local_id_asset(ID );
   /** Remove an asset from the library that was added using 
#add_external_asset() or
* #add_local_id_asset().
* \return True on success, false if the asset couldn't be found inside the 
library. */
diff --git a/source/blender/blenkernel/BKE_asset_representation.hh 
b/source/blender/blenkernel/BKE_asset_representation.hh
index 35aecba51e5..0b81f7b05b1 100644
--- a/source/blender/blenkernel/BKE_asset_representation.hh
+++ b/source/blender/blenkernel/BKE_asset_representation.hh
@@ -23,15 +23,15 @@ namespace blender::bke {
 class AssetRepresentation {
   /** Null if the asset represents a local ID, in which case the ID owns the 
metadata. */
   std::unique_ptr metadata_ = nullptr;
-  /** If the asset representation was constructed from a local ID, this points 
to the editable
-   * asset metadata of the ID. */
-  AssetMetaData *local_id_metadata_ = nullptr; /* Non-owning. */
+  /** If this asset represents an ID in the current file, this references the 
ID directly. This
+   * means the represented asset is a fully local, and editable entity. */
+  ID *local_asset_id_ = nullptr; /* Non-owning. */
 
  public:
   explicit AssetRepresentation(std::unique_ptr metadata);
   /** Constructs an asset representation for an ID stored in the current file. 
This makes the asset
* local and fully editable. */
-  explicit AssetRepresentation(const ID );
+  explicit AssetRepresentation(ID );
 
   AssetMetaData _metadata() const;
   /** Returns if this asset is stored inside this current file, and as such 
fully editable. */
diff --git a/source/blender/blenkernel/intern/asset_library.cc 
b/source/blender/blenkernel/intern/asset_library.cc
index edf804f70bc..826c24647a2 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -130,7 +130,7 @@ AssetRepresentation 
::add_external_asset(std::unique_ptr(id));
   return *asset_storage_.last();
diff --git a/source/blender/blenkernel/intern/asset_representation.cc 
b/source/blender/blenkernel/intern/asset_representation.cc
index 7123d7aba55..97f37edfa43 100644
--- a/source/blender/blenkernel/intern/asset_representation.cc
+++ b/source/blender/blenkernel/intern/asset_representation.cc
@@ -4,6 +4,8 @@
  * \ingroup bke
  */
 
+#include 
+
 #include "DNA_ID.h"
 #include "DNA_asset_types.h"
 
@@ -17,18 +19,21 @@ 
AssetRepresentation::AssetRepresentation(std::unique_ptr metadata
 {
 }
 
-AssetRepresentation::AssetRepresentation(const ID ) : 
local_id_metadata_(id.asset_data)
+AssetRepresentation::AssetRepresentation(ID ) : local_asset_id_()
 {
+  if (!id.asset_data) {
+throw std::invalid_argument("Passed ID is not an asset");
+  }
 }
 
 AssetMetaData ::get_metadata() const
 {
-  return local_id_metadata_ ? *local_id_metadata_ : *metadata_;
+  return local_asset_id_ ? *local_asset_id_->asset_data : *metadata_;
 }
 
 bool AssetRepresentation::is_local_id() const
 {
-  return local_id_metadata_ != nullptr;
+  return local_asset_id_ != nullptr;
 }
 
 }  // namespace blender::bke

___
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] [5c342b10003] temp-asset-representation: Do ID remapping for asset libraries

2022-11-08 Thread Julian Eisel
Commit: 5c342b1000388bdad896388e6a86c0d6bd4f1bbc
Author: Julian Eisel
Date:   Tue Nov 8 18:50:54 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB5c342b1000388bdad896388e6a86c0d6bd4f1bbc

Do ID remapping for asset libraries

===

M   source/blender/blenkernel/BKE_asset_library.h
M   source/blender/blenkernel/BKE_asset_library.hh
M   source/blender/blenkernel/BKE_asset_representation.hh
M   source/blender/blenkernel/intern/asset_library.cc
M   source/blender/blenkernel/intern/asset_library_service.cc
M   source/blender/blenkernel/intern/asset_library_service.hh
M   source/blender/blenkernel/intern/lib_id_delete.c

===

diff --git a/source/blender/blenkernel/BKE_asset_library.h 
b/source/blender/blenkernel/BKE_asset_library.h
index e82ebba8d88..4590fbd9647 100644
--- a/source/blender/blenkernel/BKE_asset_library.h
+++ b/source/blender/blenkernel/BKE_asset_library.h
@@ -6,6 +6,7 @@
 
 #pragma once
 
+struct IDRemapper;
 struct Main;
 
 #ifdef __cplusplus
@@ -31,6 +32,8 @@ void BKE_asset_library_refresh_catalog_simplename(struct 
AssetLibrary *asset_lib
 /** Return whether any loaded AssetLibrary has unsaved changes to its 
catalogs. */
 bool BKE_asset_library_has_any_unsaved_catalogs(void);
 
+void BKE_asset_library_remap_ids(struct IDRemapper *mappings);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/BKE_asset_library.hh 
b/source/blender/blenkernel/BKE_asset_library.hh
index 3358e37231e..b78f4a890ec 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -79,6 +79,8 @@ struct AssetLibrary {
 
   void on_blend_save_post(Main *bmain, PointerRNA **pointers, int 
num_pointers);
 
+  void remap_ids(struct IDRemapper );
+
  private:
   bCallbackFuncStore on_save_callback_store_{};
 
diff --git a/source/blender/blenkernel/BKE_asset_representation.hh 
b/source/blender/blenkernel/BKE_asset_representation.hh
index 0b81f7b05b1..d1e390dd5f1 100644
--- a/source/blender/blenkernel/BKE_asset_representation.hh
+++ b/source/blender/blenkernel/BKE_asset_representation.hh
@@ -21,6 +21,8 @@ namespace blender::bke {
  * interact with them. Think of it like a view on an asset.
  */
 class AssetRepresentation {
+  friend class AssetLibrary;
+
   /** Null if the asset represents a local ID, in which case the ID owns the 
metadata. */
   std::unique_ptr metadata_ = nullptr;
   /** If this asset represents an ID in the current file, this references the 
ID directly. This
diff --git a/source/blender/blenkernel/intern/asset_library.cc 
b/source/blender/blenkernel/intern/asset_library.cc
index 826c24647a2..10c8e843388 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -8,11 +8,13 @@
 
 #include "BKE_asset_library.hh"
 #include "BKE_asset_representation.hh"
+#include "BKE_lib_remap.h"
 #include "BKE_main.h"
 #include "BKE_preferences.h"
 
 #include "BLI_fileops.h"
 #include "BLI_path_util.h"
+#include "BLI_set.hh"
 
 #include "DNA_asset_types.h"
 #include "DNA_userdef_types.h"
@@ -99,6 +101,13 @@ void BKE_asset_library_refresh_catalog_simplename(struct 
AssetLibrary *asset_lib
   lib->refresh_catalog_simplename(asset_data);
 }
 
+void BKE_asset_library_remap_ids(IDRemapper *mappings)
+{
+  blender::bke::AssetLibraryService *service = 
blender::bke::AssetLibraryService::get();
+  service->foreach_loaded_asset_library(
+  [mappings](blender::bke::AssetLibrary ) { 
library.remap_ids(*mappings); });
+}
+
 namespace blender::bke {
 
 AssetLibrary::AssetLibrary() : 
catalog_service(std::make_unique())
@@ -204,6 +213,28 @@ void AssetLibrary::on_blend_save_post(struct Main *main,
   }
 }
 
+void AssetLibrary::remap_ids(IDRemapper )
+{
+  Set removed_id_assets;
+
+  for (auto _uptr : asset_storage_) {
+if (!asset_uptr->is_local_id()) {
+  continue;
+}
+
+IDRemapperApplyResult result = BKE_id_remapper_apply(
+, _uptr->local_asset_id_, ID_REMAP_APPLY_DEFAULT);
+if (result == ID_REMAP_RESULT_SOURCE_UNASSIGNED) {
+  removed_id_assets.add(asset_uptr.get());
+}
+  }
+
+  /* Remove the assets from storage. */
+  for (AssetRepresentation *asset : removed_id_assets) {
+remove_asset(*asset);
+  }
+}
+
 void AssetLibrary::refresh_catalog_simplename(struct AssetMetaData *asset_data)
 {
   if (BLI_uuid_is_nil(asset_data->catalog_id)) {
diff --git a/source/blender/blenkernel/intern/asset_library_service.cc 
b/source/blender/blenkernel/intern/asset_library_service.cc
index 295bdbaf5e0..35441b9b795 100644
--- a/source/blender/blenkernel/intern/asset_library_service.cc
+++ b/source/blender/blenkernel/intern/asset_library_service.cc
@@ -6,6 +6,7 @@
 
 #include "asset_library_service.hh"
 
+#include "BKE_asset_library.hh"
 #include "BKE_blender.h"
 #include "BKE_preferences.h"
 
@@ 

[Bf-blender-cvs] [95d36a31b65] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Philipp Oeser
Commit: 95d36a31b6564cdd0a09fa3705d6998e2424920b
Author: Philipp Oeser
Date:   Tue Nov 8 18:23:49 2022 +0100
Branches: master
https://developer.blender.org/rB95d36a31b6564cdd0a09fa3705d6998e2424920b

Merge branch 'blender-v3.4-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] [871c4380c4b] blender-v3.4-release: Fix T102318: crash smoothing vertex weights in editmode

2022-11-08 Thread Philipp Oeser
Commit: 871c4380c4b5ba314bc978b60c3cca9299b0c53d
Author: Philipp Oeser
Date:   Mon Nov 7 09:41:51 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB871c4380c4b5ba314bc978b60c3cca9299b0c53d

Fix T102318: crash smoothing vertex weights in editmode

Not quite sure why {rBd37d17019c52} forcefully set the Mesh to NULL if
in editmode, but this caused the attribute lookup to fail/crash.

Now only use the attribute if we have the mesh (reducing the scope where
it is used), bmesh editmode case does not rely on it.

Maniphest Tasks: T102318

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

===

M   source/blender/editors/object/object_vgroup.cc

===

diff --git a/source/blender/editors/object/object_vgroup.cc 
b/source/blender/editors/object/object_vgroup.cc
index d874226f04e..d3bdf8ca4d3 100644
--- a/source/blender/editors/object/object_vgroup.cc
+++ b/source/blender/editors/object/object_vgroup.cc
@@ -1922,10 +1922,6 @@ static void vgroup_smooth_subset(Object *ob,
   BMesh *bm = em ? em->bm : nullptr;
   Mesh *me = em ? nullptr : static_cast(ob->data);
 
-  const bke::AttributeAccessor attributes = me->attributes();
-  const VArray select_vert = attributes.lookup_or_default(
-  ".select_vert", ATTR_DOMAIN_POINT, false);
-
   MeshElemMap *emap;
   int *emap_mem;
 
@@ -1989,6 +1985,10 @@ static void vgroup_smooth_subset(Object *ob,
 }
   }
   else {
+const bke::AttributeAccessor attributes = me->attributes();
+const VArray select_vert = attributes.lookup_or_default(
+".select_vert", ATTR_DOMAIN_POINT, false);
+
 const blender::Span edges = me->edges();
 for (int i = 0; i < dvert_tot; i++) {
   if (IS_ME_VERT_WRITE(i)) {
@@ -2061,6 +2061,10 @@ static void vgroup_smooth_subset(Object *ob,
   }
 }
 else {
+  const bke::AttributeAccessor attributes = me->attributes();
+  const VArray select_vert = attributes.lookup_or_default(
+  ".select_vert", ATTR_DOMAIN_POINT, false);
+
   int j;
   const blender::Span edges = me->edges();

___
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] [b2b4c695871] asset-lite-greasepencil: Merge branch 'master' into asset-lite-greasepencil

2022-11-08 Thread Antonio Vazquez
Commit: b2b4c6958712ef6ec9d55719072e98791e66854c
Author: Antonio Vazquez
Date:   Tue Nov 8 17:35:45 2022 +0100
Branches: asset-lite-greasepencil
https://developer.blender.org/rBb2b4c6958712ef6ec9d55719072e98791e66854c

Merge branch 'master' into asset-lite-greasepencil

===



===



___
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] [4c182aef7ce] master: GPencil: Make Sculpt Auto-masking Global and not by Brush

2022-11-08 Thread Antonio Vazquez
Commit: 4c182aef7ce0e8c26dd2b85c1fa2cd45c2ef64ea
Author: Antonio Vazquez
Date:   Tue Nov 8 16:55:59 2022 +0100
Branches: master
https://developer.blender.org/rB4c182aef7ce0e8c26dd2b85c1fa2cd45c2ef64ea

GPencil: Make Sculpt Auto-masking Global and not by Brush

The auto-masking was working by Brush and this was very
inconvenient because it was necessary set the options by
Brush, now the options are global and can be set at once.

Also, the automa-masking now works with `and` logic
and not with `or` as before. That means that a stroke
must meet all the conditions of the masking.

Added new Layer and Material options to masking the 
strokes using the same Layer/Material of the selected stroke.
Before, only Active Layer and Active Material could be masked.

The options of masking has been moved to the top-bar using
the same design of Mesh Sculpt masking.

As result of the changes above, the following props changed:

Removed:

`brush.gpencil_settings.use_automasking_strokes`
`brush.gpencil_settings.use_automasking_layer`
`brush.gpencil_settings.use_automasking_material`

Added:

`tool_settings.gpencil_sculpt.use_automasking_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_stroke`
`tool_settings.gpencil_sculpt.use_automasking_material_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_active`
`tool_settings.gpencil_sculpt.use_automasking_material_active`


Reviewed by: Julien Kaspar, Matias Mendiola, Daniel Martinez Lara

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/editors/gpencil/gpencil_sculpt_paint.c
M   source/blender/makesdna/DNA_brush_enums.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_brush.c
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index b83c4916330..60834df285a 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -3969,6 +3969,8 @@ def km_grease_pencil_stroke_sculpt_mode(params):
 op_menu("VIEW3D_MT_gpencil_animation", {"type": 'I', "value": 
'PRESS'}),
 # Context menu
 
*_template_items_context_panel("VIEW3D_PT_gpencil_sculpt_context_menu", 
params.context_menu_event),
+# Automasking Pie menu
+op_menu_pie("VIEW3D_MT_sculpt_gpencil_automasking_pie", {"type": 'A', 
"shift": True, "alt": True, "value": 'PRESS'}),
 ])
 
 return keymap
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 38522a1bf84..83bb0f7dd8c 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -51,11 +51,6 @@ class GreasePencilSculptAdvancedPanel:
 tool = brush.gpencil_sculpt_tool
 gp_settings = brush.gpencil_settings
 
-col = layout.column(heading="Auto-Masking", align=True)
-col.prop(gp_settings, "use_automasking_stroke", text="Stroke")
-col.prop(gp_settings, "use_automasking_layer", text="Layer")
-col.prop(gp_settings, "use_automasking_material", text="Material")
-
 if tool in {'SMOOTH', 'RANDOMIZE'}:
 col = layout.column(heading="Affect", align=True)
 col.prop(gp_settings, "use_edit_position", text="Position")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 83f190ee5d9..5aad2d9b363 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -108,7 +108,7 @@ class VIEW3D_HT_tool_header(Header):
 brush = context.tool_settings.gpencil_sculpt_paint.brush
 if brush:
 tool = brush.gpencil_sculpt_tool
-if tool != 'CLONE':
+if tool in {'SMOOTH', 'RANDOMIZE'}:
 
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_brush_popover")
 
layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
 elif tool_mode == 'WEIGHT_GPENCIL':
@@ -837,14 +837,18 @@ class VIEW3D_HT_header(Header):
 panel="VIEW3D_PT_gpencil_guide",
 text="Guides",
 )
-
+if object_mode == 'SCULPT_GPENCIL':
+layout.popover(
+   panel="VIEW3D_PT_gpencil_sculpt_automasking",
+ 

[Bf-blender-cvs] [2e1ba1ee20d] temp-asset-representation: Free asset representations when no longer displayed

2022-11-08 Thread Julian Eisel
Commit: 2e1ba1ee20dd28292fbacca123e33dac243e9ff8
Author: Julian Eisel
Date:   Tue Nov 8 16:29:58 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB2e1ba1ee20dd28292fbacca123e33dac243e9ff8

Free asset representations when no longer displayed

The lifetime management of assets should still be improved, but
meanwhile each part of the UI loads its own representation of an asset
into memory. This is still done via the file browser backend, so this
should also remove the representations once it frees its file-list.

===

M   source/blender/blenkernel/BKE_asset_library.hh
M   source/blender/blenkernel/intern/asset_library.cc
M   source/blender/editors/space_file/filelist.cc

===

diff --git a/source/blender/blenkernel/BKE_asset_library.hh 
b/source/blender/blenkernel/BKE_asset_library.hh
index d0140b2b3f7..6402799b3a1 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -53,8 +53,18 @@ struct AssetLibrary {
   /** Load catalogs that have changed on disk. */
   void refresh();
 
+  /**
+   * Create a representation of an asset to be considered part of this 
library. Once the
+   * representation is not needed anymore, it must be freed using 
#remove_asset(), or there will be
+   * leaking that's only cleared when the library storage is destructed 
(typically on exit or
+   * loading a different file).
+   */
   AssetRepresentation _external_asset(std::unique_ptr 
metadata);
   AssetRepresentation _local_id_asset(const ID );
+  /** Remove an asset from the library that was added using 
#add_external_asset() or
+   * #add_local_id_asset().
+   * \return True on success, false if the asset couldn't be found inside the 
library. */
+  bool remove_asset(AssetRepresentation );
 
   /**
* Update `catalog_simple_name` by looking up the asset's catalog by its ID.
@@ -72,13 +82,22 @@ struct AssetLibrary {
  private:
   bCallbackFuncStore on_save_callback_store_{};
 
-  /** Container to store asset representations. Assets are not automatically 
loaded into this when
-   * loading an asset library. Assets have to be loaded externally and added 
to this storage via
-   * #add_external_asset() or #add_local_id_asset().
-   * So this really is arbitrary storage as far as #AssetLibrary is concerned 
(allowing the API
-   * user to manage partial library storage and partial loading, so only 
relevant parts of a
-   * library are kept in memory). */
+  /** Storage for assets (better said their representations) that are 
considered to be part of this
+   * library. Assets are not automatically loaded into this when loading an 
asset library. Assets
+   * have to be loaded externally and added to this storage via 
#add_external_asset() or
+   * #add_local_id_asset(). So this really is arbitrary storage as far as 
#AssetLibrary is
+   * concerned (allowing the API user to manage partial library storage and 
partial loading, so
+   * only relevant parts of a library are kept in memory).
+   *
+   * For now, multiple parts of Blender just keep adding their own assets to 
this storage. E.g.
+   * multiple asset browsers might load multiple representations for the same 
asset into this.
+   * Currently there is just no way to properly identify assets, or keep track 
of which assets are
+   * already in memory and which not. Neither do we keep track of how many 
parts of Blender are
+   * using an asset or an asset library, which is needed to know when assets 
can be freed.
+   */
   Vector> asset_storage_;
+
+  std::optional find_asset_index(const AssetRepresentation );
 };
 
 Vector all_valid_asset_library_refs();
diff --git a/source/blender/blenkernel/intern/asset_library.cc 
b/source/blender/blenkernel/intern/asset_library.cc
index 4efa2c33891..edf804f70bc 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -136,6 +136,31 @@ AssetRepresentation 
::add_local_id_asset(const ID )
   return *asset_storage_.last();
 }
 
+std::optional AssetLibrary::find_asset_index(const AssetRepresentation 
)
+{
+  int index = 0;
+  /* Find index of asset. */
+  for (auto _uptr : asset_storage_) {
+if ( == asset_uptr.get()) {
+  return index;
+}
+index++;
+  }
+
+  return {};
+}
+
+bool AssetLibrary::remove_asset(AssetRepresentation )
+{
+  std::optional asset_index = find_asset_index(asset);
+  if (!asset_index) {
+return false;
+  }
+
+  asset_storage_.remove_and_reorder(*asset_index);
+  return true;
+}
+
 namespace {
 void asset_library_on_save_post(struct Main *main,
 struct PointerRNA **pointers,
diff --git a/source/blender/editors/space_file/filelist.cc 
b/source/blender/editors/space_file/filelist.cc
index 221701c9bc0..af72cad9668 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ 

[Bf-blender-cvs] [ffafde7bd67] temp-asset-representation: Cleanup: Remove unncessary stoarage wrapper class

2022-11-08 Thread Julian Eisel
Commit: ffafde7bd672b582fe392119fe91627a7c904b3e
Author: Julian Eisel
Date:   Tue Nov 8 16:26:49 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rBffafde7bd672b582fe392119fe91627a7c904b3e

Cleanup: Remove unncessary stoarage wrapper class

===

M   source/blender/blenkernel/BKE_asset_library.hh
M   source/blender/blenkernel/BKE_asset_representation.hh
M   source/blender/blenkernel/intern/asset_library.cc

===

diff --git a/source/blender/blenkernel/BKE_asset_library.hh 
b/source/blender/blenkernel/BKE_asset_library.hh
index 091df6d8edd..d0140b2b3f7 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -29,13 +29,6 @@ namespace blender::bke {
 
 struct AssetRepresentation;
 
-class AssetStorage {
-  Vector> assets_;
-
- public:
-  AssetRepresentation (std::unique_ptr asset);
-};
-
 /**
  * AssetLibrary provides access to an asset library's data.
  *
@@ -85,7 +78,7 @@ struct AssetLibrary {
* So this really is arbitrary storage as far as #AssetLibrary is concerned 
(allowing the API
* user to manage partial library storage and partial loading, so only 
relevant parts of a
* library are kept in memory). */
-  AssetStorage asset_storage_;
+  Vector> asset_storage_;
 };
 
 Vector all_valid_asset_library_refs();
diff --git a/source/blender/blenkernel/BKE_asset_representation.hh 
b/source/blender/blenkernel/BKE_asset_representation.hh
index 2acf30fbc88..35aecba51e5 100644
--- a/source/blender/blenkernel/BKE_asset_representation.hh
+++ b/source/blender/blenkernel/BKE_asset_representation.hh
@@ -16,7 +16,7 @@ namespace blender::bke {
 /**
  * \brief Abstraction to reference an asset, with necessary data for display & 
interaction.
  *
- * #AssetRepresentation is the core data-structure to store information about 
an asset. It doesn't
+ * #AssetRepresentation is the data-structure to store information about a 
single asset. It doesn't
  * contain the asset itself, but information like the metadata and preview, as 
well as methods to
  * interact with them. Think of it like a view on an asset.
  */
diff --git a/source/blender/blenkernel/intern/asset_library.cc 
b/source/blender/blenkernel/intern/asset_library.cc
index a6243876d34..4efa2c33891 100644
--- a/source/blender/blenkernel/intern/asset_library.cc
+++ b/source/blender/blenkernel/intern/asset_library.cc
@@ -126,12 +126,14 @@ void AssetLibrary::refresh()
 
 AssetRepresentation 
::add_external_asset(std::unique_ptr metadata)
 {
-  return 
asset_storage_.append(std::make_unique(std::move(metadata)));
+  
asset_storage_.append(std::make_unique(std::move(metadata)));
+  return *asset_storage_.last();
 }
 
 AssetRepresentation ::add_local_id_asset(const ID )
 {
-  return asset_storage_.append(std::make_unique(id));
+  asset_storage_.append(std::make_unique(id));
+  return *asset_storage_.last();
 }
 
 namespace {
@@ -213,10 +215,4 @@ Vector 
all_valid_asset_library_refs()
   return result;
 }
 
-AssetRepresentation ::append(std::unique_ptr 
asset)
-{
-  assets_.append(std::move(asset));
-  return *assets_.last();
-}
-
 }  // namespace blender::bke

___
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] [aa9b976e9f9] temp-gpencil-automask: Merge branch 'master' into temp-gpencil-automask

2022-11-08 Thread Antonio Vazquez
Commit: aa9b976e9f9b8baff194f5bfadcf9e7694cf8d15
Author: Antonio Vazquez
Date:   Tue Nov 8 16:29:56 2022 +0100
Branches: temp-gpencil-automask
https://developer.blender.org/rBaa9b976e9f9b8baff194f5bfadcf9e7694cf8d15

Merge branch 'master' into temp-gpencil-automask

===



===



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

2022-11-08 Thread Jacques Lucke
Commit: bbb1d3e5e7eb4059a0324ae786e1e793852963a9
Author: Jacques Lucke
Date:   Tue Nov 8 16:28:11 2022 +0100
Branches: master
https://developer.blender.org/rBbbb1d3e5e7eb4059a0324ae786e1e793852963a9

Merge branch 'blender-v3.4-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] [0a7308a0f14] blender-v3.4-release: Fix: improve CD_ASSIGN handling when adding custom data layer

2022-11-08 Thread Jacques Lucke
Commit: 0a7308a0f1493a5b0d8ab7b764893f1772ab1008
Author: Jacques Lucke
Date:   Tue Nov 8 16:25:49 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB0a7308a0f1493a5b0d8ab7b764893f1772ab1008

Fix: improve CD_ASSIGN handling when adding custom data layer

Previously, the code would incorrectly free the passed in custom data
layer even when `CD_ASSIGN` was not used. Now the function actually
supports assigning the data to the layer. This only fixes the case for
custom data layer types that only support a single layer like `CD_MEDGE`.

Informally reviewed by Hans Goudey.

===

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

===

diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index e4405abdde8..01017466764 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2799,11 +2799,6 @@ static CustomDataLayer 
*customData_add_layer__internal(CustomData *data,
   const LayerTypeInfo *typeInfo = layerType_getInfo(type);
   int flag = 0;
 
-  if (!typeInfo->defaultname && CustomData_has_layer(data, type)) {
-MEM_SAFE_FREE(layerdata);
-return >layers[CustomData_get_layer_index(data, type)];
-  }
-
   void *newlayerdata = nullptr;
   switch (alloctype) {
 case CD_SET_DEFAULT:
@@ -2856,6 +2851,21 @@ static CustomDataLayer 
*customData_add_layer__internal(CustomData *data,
   break;
   }
 
+  /* Some layer types only support a single layer. */
+  const bool reuse_existing_layer = !typeInfo->defaultname && 
CustomData_has_layer(data, type);
+  if (reuse_existing_layer) {
+CustomDataLayer  = data->layers[CustomData_get_layer_index(data, 
type)];
+if (layer.data != nullptr) {
+  if (typeInfo->free) {
+typeInfo->free(layer.data, totelem, typeInfo->size);
+  }
+  MEM_SAFE_FREE(layer.data);
+}
+layer.data = newlayerdata;
+layer.flag = flag;
+return 
+  }
+
   int index = data->totlayer;
   if (index >= data->maxlayer) {
 if (!customData_resize(data, CUSTOMDATA_GROW)) {

___
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] [f3e0685222a] tmp-vfx-platform-2023: Fix missing Python dependency in shaderc

2022-11-08 Thread Brecht Van Lommel
Commit: f3e0685222aca1c66fa2ee6512bcb555c9912c15
Author: Brecht Van Lommel
Date:   Tue Nov 8 13:57:35 2022 +0100
Branches: tmp-vfx-platform-2023
https://developer.blender.org/rBf3e0685222aca1c66fa2ee6512bcb555c9912c15

Fix missing Python dependency in shaderc

===

M   build_files/build_environment/cmake/shaderc.cmake

===

diff --git a/build_files/build_environment/cmake/shaderc.cmake 
b/build_files/build_environment/cmake/shaderc.cmake
index a5275837372..669750913f0 100644
--- a/build_files/build_environment/cmake/shaderc.cmake
+++ b/build_files/build_environment/cmake/shaderc.cmake
@@ -38,6 +38,7 @@ add_dependencies(
   external_shaderc_spirv_tools
   external_shaderc_spirv_headers
   external_shaderc_glslang
+  external_python
 )

___
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] [c73ae711bf4] master: BLI: new basic CacheMutex

2022-11-08 Thread Jacques Lucke
Commit: c73ae711bf403585de403bcfeb7519dd989d4c15
Author: Jacques Lucke
Date:   Tue Nov 8 15:50:49 2022 +0100
Branches: master
https://developer.blender.org/rBc73ae711bf403585de403bcfeb7519dd989d4c15

BLI: new basic CacheMutex

This patch introduces a new `CacheMutex` which makes it easy to implement
lazily computed caches in e.g. `Curves`. For more details see 
`BLI_cache_mutex.hh`.

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

===

M   source/blender/blenkernel/BKE_curves.hh
M   source/blender/blenkernel/intern/curves_geometry.cc
A   source/blender/blenlib/BLI_cache_mutex.hh
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/cache_mutex.cc

===

diff --git a/source/blender/blenkernel/BKE_curves.hh 
b/source/blender/blenkernel/BKE_curves.hh
index 4c7ff8c1813..a479dcb574d 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -11,6 +11,7 @@
 
 #include 
 
+#include "BLI_cache_mutex.hh"
 #include "BLI_float3x3.hh"
 #include "BLI_float4x4.hh"
 #include "BLI_generic_virtual_array.hh"
@@ -80,17 +81,14 @@ class CurvesGeometryRuntime {
*/
   mutable Vector evaluated_offsets_cache;
   mutable Vector bezier_evaluated_offsets;
-  mutable std::mutex offsets_cache_mutex;
-  mutable bool offsets_cache_dirty = true;
+  mutable CacheMutex offsets_cache_mutex;
 
   mutable Vector nurbs_basis_cache;
-  mutable std::mutex nurbs_basis_cache_mutex;
-  mutable bool nurbs_basis_cache_dirty = true;
+  mutable CacheMutex nurbs_basis_cache_mutex;
 
   /** Cache of evaluated positions. */
   mutable Vector evaluated_position_cache;
-  mutable std::mutex position_cache_mutex;
-  mutable bool position_cache_dirty = true;
+  mutable CacheMutex position_cache_mutex;
   /**
* The evaluated positions result, using a separate span in case all curves 
are poly curves,
* in which case a separate array of evaluated positions is unnecessary.
@@ -103,18 +101,15 @@ class CurvesGeometryRuntime {
* make slicing this array for a curve fast, an extra float is stored for 
every curve.
*/
   mutable Vector evaluated_length_cache;
-  mutable std::mutex length_cache_mutex;
-  mutable bool length_cache_dirty = true;
+  mutable CacheMutex length_cache_mutex;
 
   /** Direction of the curve at each evaluated point. */
   mutable Vector evaluated_tangent_cache;
-  mutable std::mutex tangent_cache_mutex;
-  mutable bool tangent_cache_dirty = true;
+  mutable CacheMutex tangent_cache_mutex;
 
   /** Normal direction vectors for each evaluated point. */
   mutable Vector evaluated_normal_cache;
-  mutable std::mutex normal_cache_mutex;
-  mutable bool normal_cache_dirty = true;
+  mutable CacheMutex normal_cache_mutex;
 };
 
 /**
@@ -909,13 +904,13 @@ inline int CurvesGeometry::evaluated_points_num() const
 
 inline IndexRange CurvesGeometry::evaluated_points_for_curve(int index) const
 {
-  BLI_assert(!this->runtime->offsets_cache_dirty);
+  BLI_assert(this->runtime->offsets_cache_mutex.is_cached());
   return offsets_to_range(this->runtime->evaluated_offsets_cache.as_span(), 
index);
 }
 
 inline IndexRange CurvesGeometry::evaluated_points_for_curves(const IndexRange 
curves) const
 {
-  BLI_assert(!this->runtime->offsets_cache_dirty);
+  BLI_assert(this->runtime->offsets_cache_mutex.is_cached());
   BLI_assert(this->curve_num > 0);
   const int offset = this->runtime->evaluated_offsets_cache[curves.start()];
   const int offset_next = 
this->runtime->evaluated_offsets_cache[curves.one_after_last()];
@@ -940,7 +935,7 @@ inline IndexRange 
CurvesGeometry::lengths_range_for_curve(const int curve_index,
 inline Span CurvesGeometry::evaluated_lengths_for_curve(const int 
curve_index,
const bool 
cyclic) const
 {
-  BLI_assert(!this->runtime->length_cache_dirty);
+  BLI_assert(this->runtime->length_cache_mutex.is_cached());
   const IndexRange range = this->lengths_range_for_curve(curve_index, cyclic);
   return this->runtime->evaluated_length_cache.as_span().slice(range);
 }
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc 
b/source/blender/blenkernel/intern/curves_geometry.cc
index 7c338480c71..43bdb8e7b8c 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -511,17 +511,7 @@ static void calculate_evaluated_offsets(const 
CurvesGeometry ,
 
 void CurvesGeometry::ensure_evaluated_offsets() const
 {
-  if (!this->runtime->offsets_cache_dirty) {
-return;
-  }
-
-  /* A double checked lock. */
-  std::scoped_lock lock{this->runtime->offsets_cache_mutex};
-  if (!this->runtime->offsets_cache_dirty) {
-return;
-  }
-
-  threading::isolate_task([&]() {
+  this->runtime->offsets_cache_mutex.ensure([&]() {
 

[Bf-blender-cvs] [84cc68b68f5] temp-asset-representation: Fix uninitialized variable use when dragging in assets

2022-11-08 Thread Julian Eisel
Commit: 84cc68b68f5d11ddc7b132e7d76b99715d590eb5
Author: Julian Eisel
Date:   Tue Nov 8 15:14:07 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB84cc68b68f5d11ddc7b132e7d76b99715d590eb5

Fix uninitialized variable use when dragging in assets

===

M   source/blender/blenkernel/BKE_asset_representation.hh

===

diff --git a/source/blender/blenkernel/BKE_asset_representation.hh 
b/source/blender/blenkernel/BKE_asset_representation.hh
index d2e167b3f35..2acf30fbc88 100644
--- a/source/blender/blenkernel/BKE_asset_representation.hh
+++ b/source/blender/blenkernel/BKE_asset_representation.hh
@@ -22,10 +22,10 @@ namespace blender::bke {
  */
 class AssetRepresentation {
   /** Null if the asset represents a local ID, in which case the ID owns the 
metadata. */
-  std::unique_ptr metadata_;
+  std::unique_ptr metadata_ = nullptr;
   /** If the asset representation was constructed from a local ID, this points 
to the editable
* asset metadata of the ID. */
-  AssetMetaData *local_id_metadata_; /* Non-owning. */
+  AssetMetaData *local_id_metadata_ = nullptr; /* Non-owning. */
 
  public:
   explicit AssetRepresentation(std::unique_ptr metadata);

___
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] [1d71f82033f] master: Texture Paint: sync adding a new texture slot to the Image Editor

2022-11-08 Thread Edward
Commit: 1d71f82033f1ec3ad51195cfa64c59fcf0cd6ccc
Author: Edward
Date:   Tue Nov 8 14:28:44 2022 +0100
Branches: master
https://developer.blender.org/rB1d71f82033f1ec3ad51195cfa64c59fcf0cd6ccc

Texture Paint: sync adding a new texture slot to the Image Editor

When changing the texture paint slot index or activating a Texture Node, the 
texture displayed in the Image Editor changes accordingly.
This patch syncs the Image Editor when a new texture paint slot was added, 
which currently is not the case.

Also deduplicates some code.

===

M   source/blender/editors/include/ED_image.h
M   source/blender/editors/sculpt_paint/paint_image.cc
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/editors/space_image/image_edit.c
M   source/blender/editors/space_node/node_edit.cc
M   source/blender/makesrna/intern/rna_material.c
M   source/blender/makesrna/intern/rna_sculpt_paint.c

===

diff --git a/source/blender/editors/include/ED_image.h 
b/source/blender/editors/include/ED_image.h
index da303f3552b..20e62ac8626 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -51,6 +51,7 @@ void ED_space_image_set(struct Main *bmain,
 struct SpaceImage *sima,
 struct Image *ima,
 bool automatic);
+void ED_space_image_sync(struct Main *bmain, Image *image, bool 
ignore_render_viewer);
 void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage 
*sima);
 struct Mask *ED_space_image_get_mask(const struct SpaceImage *sima);
 void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, 
struct Mask *mask);
diff --git a/source/blender/editors/sculpt_paint/paint_image.cc 
b/source/blender/editors/sculpt_paint/paint_image.cc
index 8c6358520ca..f334b2eb8f8 100644
--- a/source/blender/editors/sculpt_paint/paint_image.cc
+++ b/source/blender/editors/sculpt_paint/paint_image.cc
@@ -780,20 +780,7 @@ void ED_object_texture_paint_mode_enter_ex(Main *bmain, 
Scene *scene, Object *ob
   }
 
   if (ima) {
-wmWindowManager *wm = static_cast(bmain->wm.first);
-LISTBASE_FOREACH (wmWindow *, win, >windows) {
-  const bScreen *screen = WM_window_get_active_screen(win);
-  LISTBASE_FOREACH (ScrArea *, area, >areabase) {
-SpaceLink *sl = static_cast(area->spacedata.first);
-if (sl->spacetype == SPACE_IMAGE) {
-  SpaceImage *sima = (SpaceImage *)sl;
-
-  if (!sima->pin) {
-ED_space_image_set(bmain, sima, ima, true);
-  }
-}
-  }
-}
+ED_space_image_sync(bmain, ima, false);
   }
 
   ob->mode |= OB_MODE_TEXTURE_PAINT;
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c 
b/source/blender/editors/sculpt_paint/paint_image_proj.c
index ea33449f0dd..c85044bf915 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -74,6 +74,7 @@
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
 
+#include "ED_image.h"
 #include "ED_node.h"
 #include "ED_object.h"
 #include "ED_paint.h"
@@ -6704,6 +6705,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator 
*op)
   BKE_texpaint_slot_refresh_cache(scene, ma, ob);
   BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE);
   WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima);
+  ED_space_image_sync(bmain, ima, false);
 }
 if (layer) {
   BKE_texpaint_slot_refresh_cache(scene, ma, ob);
diff --git a/source/blender/editors/space_image/image_edit.c 
b/source/blender/editors/space_image/image_edit.c
index 0122e509c3b..68b1a9e4466 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -67,6 +67,30 @@ void ED_space_image_set(Main *bmain, SpaceImage *sima, Image 
*ima, bool automati
   WM_main_add_notifier(NC_SPACE | ND_SPACE_IMAGE, NULL);
 }
 
+void ED_space_image_sync(struct Main *bmain, struct Image *image, bool 
ignore_render_viewer)
+{
+  wmWindowManager *wm = (wmWindowManager *)bmain->wm.first;
+  LISTBASE_FOREACH (wmWindow *, win, >windows) {
+const bScreen *screen = WM_window_get_active_screen(win);
+LISTBASE_FOREACH (ScrArea *, area, >areabase) {
+  LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
+if (sl->spacetype != SPACE_IMAGE) {
+  continue;
+}
+SpaceImage *sima = (SpaceImage *)sl;
+if (sima->pin) {
+  continue;
+}
+if (ignore_render_viewer && sima->image &&
+ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+  continue;
+}
+ED_space_image_set(bmain, sima, image, true);
+  }
+}
+  }
+}
+
 void ED_space_image_auto_set(const bContext *C, SpaceImage *sima)
 {
   if 

[Bf-blender-cvs] [32f58c0a92c] blender-v3.4-release: Cleanup: fix compiler warning with openjpeg 2.5

2022-11-08 Thread Brecht Van Lommel
Commit: 32f58c0a92cfc56e6986c073a83aac8afc97fba4
Author: Brecht Van Lommel
Date:   Tue Nov 8 13:04:08 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB32f58c0a92cfc56e6986c073a83aac8afc97fba4

Cleanup: fix compiler warning with openjpeg 2.5

===

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

===

diff --git a/source/blender/imbuf/intern/jp2.c 
b/source/blender/imbuf/intern/jp2.c
index d2b94355f85..f3d6d19cb8d 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -885,7 +885,10 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, 
opj_cparameters_t *parameters)
   memset(, 0, sizeof(opj_image_cmptparm_t[4]));
   for (i = 0; i < numcomps; i++) {
 cmptparm[i].prec = prec;
+/* Deprecated in openjpeg 2.5. */
+#if (OPJ_VERSION_MAJOR < 2) || (OPJ_VERSION_MAJOR == 2 && OPJ_VERSION_MINOR < 
5)
 cmptparm[i].bpp = prec;
+#endif
 cmptparm[i].sgnd = 0;
 cmptparm[i].dx = subsampling_dx;
 cmptparm[i].dy = subsampling_dy;

___
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] [0fae43efb25] temp-ghost-vulkan: Apply formatting.

2022-11-08 Thread Jeroen Bakker
Commit: 0fae43efb25da6ea7a56b40da449029d53d12997
Author: Jeroen Bakker
Date:   Tue Nov 8 14:32:27 2022 +0100
Branches: temp-ghost-vulkan
https://developer.blender.org/rB0fae43efb25da6ea7a56b40da449029d53d12997

Apply formatting.

===

M   intern/ghost/GHOST_IWindow.h
M   intern/ghost/intern/GHOST_SystemWayland.cpp
M   intern/ghost/intern/GHOST_WindowWayland.cpp

===

diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 9a8a97ed43f..33b9d160f0f 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -215,12 +215,12 @@ class GHOST_IWindow {
* Needs to be called after each swap events as the framebuffer will change.
* \return  A boolean success indicator.
*/
-  virtual GHOST_TSuccess getVulkanBackbuffer(void * image,
- void * framebuffer,
- void * command_buffer,
- void * render_pass,
- void * extent,
- uint32_t * fb_id) = 0;
+  virtual GHOST_TSuccess getVulkanBackbuffer(void *image,
+ void *framebuffer,
+ void *command_buffer,
+ void *render_pass,
+ void *extent,
+ uint32_t *fb_id) = 0;
 
   /**
* Invalidates the contents of this window.
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 3255d667e41..5e9a1703152 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -5594,9 +5594,13 @@ GHOST_IContext 
*GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glS
   if (glSettings.context_type == GHOST_kDrawingContextTypeVulkan) {
 GHOST_Context *context = new GHOST_ContextVK(false,
  GHOST_kVulkanPlatformWayland,
- 0, NULL,
- wl_surface, 
display_->wl_display,
- 1, 0, debug_context);
+ 0,
+ NULL,
+ wl_surface,
+ display_->wl_display,
+ 1,
+ 0,
+ debug_context);
 
 if (!context->initializeDrawingContext()) {
   delete context;
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp 
b/intern/ghost/intern/GHOST_WindowWayland.cpp
index f3cea98a065..b0484d3ceb8 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -922,10 +922,13 @@ GHOST_Context 
*GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
 case GHOST_kDrawingContextTypeVulkan:
   context = new GHOST_ContextVK(m_wantStereoVisual,
 GHOST_kVulkanPlatformWayland,
-0, NULL,
+0,
+NULL,
 window_->wl_surface,
 system_->wl_display(),
-1, 0, true);
+1,
+0,
+true);
   break;
 #endif

___
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] [31ecc302837] temp-ghost-vulkan: Added support for Linux. Thanks to Qiang Yu for the patch!

2022-11-08 Thread Jeroen Bakker
Commit: 31ecc302837236c22a95286c480155c0ef7e9424
Author: Jeroen Bakker
Date:   Tue Nov 8 14:29:25 2022 +0100
Branches: temp-ghost-vulkan
https://developer.blender.org/rB31ecc302837236c22a95286c480155c0ef7e9424

Added support for Linux. Thanks to Qiang Yu for the patch!

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp
M   intern/ghost/intern/GHOST_SystemX11.cpp
M   intern/ghost/intern/GHOST_WindowWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 770291d6ce6..3255d667e41 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -20,6 +20,10 @@
 
 #include "GHOST_ContextEGL.h"
 
+#ifdef WITH_VULKAN_BACKEND
+#  include "GHOST_ContextVK.h"
+#endif
+
 #ifdef WITH_INPUT_NDOF
 #  include "GHOST_NDOFManagerUnix.h"
 #endif
@@ -5581,12 +5585,18 @@ static GHOST_Context 
*createOffscreenContext_impl(GHOST_SystemWayland *system,
 
 GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings 
glSettings)
 {
+  /* Create new off-screen window. */
+  wl_surface *wl_surface = wl_compositor_create_surface(wl_compositor());
+
 #ifdef WITH_VULKAN_BACKEND
   const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
 
   if (glSettings.context_type == GHOST_kDrawingContextTypeVulkan) {
-GHOST_Context *context = new GHOST_ContextVK(
-false, GHOST_kVulkanPlatformWayland, 0, NULL, NULL, d->display, 1, 0, 
debug_context);
+GHOST_Context *context = new GHOST_ContextVK(false,
+ GHOST_kVulkanPlatformWayland,
+ 0, NULL,
+ wl_surface, 
display_->wl_display,
+ 1, 0, debug_context);
 
 if (!context->initializeDrawingContext()) {
   delete context;
@@ -5598,8 +5608,6 @@ GHOST_IContext 
*GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glS
   (void)glSettings;
 #endif
 
-  /* Create new off-screen window. */
-  wl_surface *wl_surface = wl_compositor_create_surface(wl_compositor());
   wl_egl_window *egl_window = wl_surface ? wl_egl_window_create(wl_surface, 1, 
1) : nullptr;
 
   GHOST_Context *context = createOffscreenContext_impl(this, 
display_->wl_display, egl_window);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 769e1b83476..4baa3ff598f 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -36,6 +36,10 @@
 #include "GHOST_ContextEGL.h"
 #include "GHOST_ContextGLX.h"
 
+#ifdef WITH_VULKAN_BACKEND
+#  include "GHOST_ContextVK.h"
+#endif
+
 #ifdef WITH_XF86KEYSYM
 #  include 
 #endif
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp 
b/intern/ghost/intern/GHOST_WindowWayland.cpp
index c58aca3d72d..f3cea98a065 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -920,7 +920,12 @@ GHOST_Context 
*GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
 
 #ifdef WITH_VULKAN_BACKEND
 case GHOST_kDrawingContextTypeVulkan:
-  context = new GHOST_ContextVK(m_wantStereoVisual, m_metalLayer, 1, 0, 
true);
+  context = new GHOST_ContextVK(m_wantStereoVisual,
+GHOST_kVulkanPlatformWayland,
+0, NULL,
+window_->wl_surface,
+system_->wl_display(),
+1, 0, true);
   break;
 #endif

___
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] [5391060724a] refactor-mesh-uv-map-generic: Try to handle creation of associated bool layers for bmesh.

2022-11-08 Thread Martijn Versteegh
Commit: 5391060724adc280a210d1e5eba2d9cf8c633a73
Author: Martijn Versteegh
Date:   Tue Nov 8 14:09:30 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB5391060724adc280a210d1e5eba2d9cf8c633a73

Try to handle creation of associated bool layers for bmesh.

===

M   source/blender/python/bmesh/bmesh_py_types_customdata.c
M   source/blender/python/bmesh/bmesh_py_types_meshdata.c

===

diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c 
b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index b1e83ac7b2c..ce6fbbc2a96 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -461,6 +461,15 @@ static PyObject 
*bpy_bmlayercollection_verify(BPy_BMLayerCollection *self)
   if (index == -1) {
 BM_data_layer_add(self->bm, data, self->type);
 index = 0;
+/* Because addingCustomData layers to a bmesh will invalidate any existing 
pointers
+ * in Py objects we can't lazily add the associated bool layers. So add 
htem right now.
+ */
+if (self->type == CD_PROP_FLOAT2 && self->htype == BM_LOOP) {
+  const char *active_uv_name = 
CustomData_get_active_layer_name(>bm->ldata, CD_PROP_FLOAT2);
+  BM_uv_map_ensure_vert_selection_attribute(self->bm, active_uv_name);
+  BM_uv_map_ensure_edge_selection_attribute(self->bm, active_uv_name);
+  BM_uv_map_ensure_pin_attribute(self->bm, active_uv_name);
+}
   }
 
   BLI_assert(index >= 0);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c 
b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 0381a969b01..a7dff0d43a9 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -73,10 +73,10 @@ static int bpy_bmloopuv_pin_uv_set(BPy_BMLoopUV *self, 
PyObject *value, void *UN
   if (self->pinned) {
 *self->pinned = PyC_Long_AsBool(value);
   }
-  /* TODO(martijn) if (!self->pinmned) that means the layed does not exist , 
or at least didn't exist
-   * when the PY object was created
-   * we *should* create it here instead of just bailing...
-   * same for vertsel and edgesel
+  /* TODO(martijn) if (!self->pinned) that means the layed does not exist , or 
at least didn't exist
+   * when the PY object was created. We *should* create it here instead of 
just bailing, but we can't
+   * because that would invalidate all existing BPy_BMLoopUV objects' interal 
pointers.
+   * the same goes for vertsel and edgesel below.
*/
   return 0;
 }
@@ -152,19 +152,21 @@ int BPy_BMLoopUV_AssignPyObject(struct BMesh *bm, const 
int loop_index, PyObject
   }
 
   BPy_BMLoopUV *src = (BPy_BMLoopUV *)value;
-  const char *active_uv_name = CustomData_get_active_layer_name(>ldata, 
CD_PROP_FLOAT2);
-  BM_uv_map_ensure_vert_selection_attribute(bm, active_uv_name);
-  BM_uv_map_ensure_edge_selection_attribute(bm, active_uv_name);
-  BM_uv_map_ensure_pin_attribute(bm, active_uv_name);
   const BMUVOffsets offsets = BM_uv_map_get_offsets(bm);
 
   BMLoop *l = BM_loop_at_index_find(bm, loop_index);
   float *luv = BM_ELEM_CD_GET_FLOAT_P(l, offsets.uv);
   copy_v2_v2(luv, src->uv);
 
-  BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, src->vertsel);
-  BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, src->edgesel);
-  BM_ELEM_CD_SET_BOOL(l, offsets.pin, src->pinned);
+  if (offsets.select_vert >=0) {
+BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, *src->vertsel);
+  }
+  if (offsets.select_edge >=0) {
+BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, *src->edgesel);
+  }
+  if (offsets.pin >=0) {
+BM_ELEM_CD_SET_BOOL(l, offsets.pin, *src->pinned);
+  }
 
   return 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] [9fa221e0f85] refactor-mesh-uv-map-generic: Fix the creation of BPy_BMLoopUV python object.

2022-11-08 Thread Martijn Versteegh
Commit: 9fa221e0f85f49f8dd17d8b9f5832236c977de51
Author: Martijn Versteegh
Date:   Tue Nov 8 14:10:07 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB9fa221e0f85f49f8dd17d8b9f5832236c977de51

Fix the creation of BPy_BMLoopUV python object.

===

M   source/blender/python/bmesh/bmesh_py_types_meshdata.c

===

diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c 
b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index a7dff0d43a9..c6df53a734c 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -178,11 +178,10 @@ PyObject *BPy_BMLoopUV_CreatePyObject(struct BMesh *bm, 
const int loop_index)
   const BMUVOffsets offsets = BM_uv_map_get_offsets(bm);
 
   BMLoop *l = BM_loop_at_index_find(bm, loop_index);
-  float *luv = BM_ELEM_CD_GET_FLOAT_P(l, offsets.uv);
+  self->uv = BM_ELEM_CD_GET_FLOAT_P(l, offsets.uv);
   self->vertsel = BM_ELEM_CD_GET_OPT_BOOL_P(l, offsets.select_vert);
   self->edgesel = BM_ELEM_CD_GET_OPT_BOOL_P(l, offsets.select_edge);
   self->pinned = BM_ELEM_CD_GET_OPT_BOOL_P(l, offsets.pin);
-  copy_v2_v2(self->uv, luv);
 
   return (PyObject *)self;
 }

___
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] [8a28d9129a9] refactor-mesh-uv-map-generic: Use the proper types for various CustomData layers.

2022-11-08 Thread Martijn Versteegh
Commit: 8a28d9129a9c905c43a8cde3aeeb2d10395dcac4
Author: Martijn Versteegh
Date:   Tue Nov 8 14:07:27 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB8a28d9129a9c905c43a8cde3aeeb2d10395dcac4

Use the proper types for various CustomData layers.

===

M   release/datafiles/locale
M   release/scripts/addons
M   source/blender/bmesh/intern/bmesh_interp.c
M   source/blender/python/bmesh/bmesh_py_types_customdata.c
M   source/tools

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 7be7aff5a18..fe221a8bc93 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 7be7aff5a18c550465b3f7634539ed4168af7c51
+Subproject commit fe221a8bc934385d9f302c46a5c7cbeacddafe3b
diff --git a/release/scripts/addons b/release/scripts/addons
index eb09be71a96..85c414a2023 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit eb09be71a96c4fe910fdc43373be5ec08b419d2c
+Subproject commit 85c414a2023c1fdf16b6f3c9dc462fe242a625b9
diff --git a/source/blender/bmesh/intern/bmesh_interp.c 
b/source/blender/bmesh/intern/bmesh_interp.c
index 0c13e6d892b..0198cb6818f 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -885,21 +885,21 @@ void BM_uv_map_ensure_vert_selection_attribute(BMesh *bm, 
const char *uv_map_nam
 {
   char name[MAX_CUSTOMDATA_LAYER_NAME];
   BM_data_layer_ensure_named(
-  bm, >ldata, CD_PROP_FLOAT2, 
get_uv_map_vert_selection_name(uv_map_name, name));
+  bm, >ldata, CD_PROP_BOOL, 
get_uv_map_vert_selection_name(uv_map_name, name));
 }
 
 void BM_uv_map_ensure_edge_selection_attribute(BMesh *bm, const char 
*uv_map_name)
 {
   char name[MAX_CUSTOMDATA_LAYER_NAME];
   BM_data_layer_ensure_named(
-  bm, >ldata, CD_PROP_FLOAT2, 
get_uv_map_edge_selection_name(uv_map_name, name));
+  bm, >ldata, CD_PROP_BOOL, 
get_uv_map_edge_selection_name(uv_map_name, name));
 }
 
 void BM_uv_map_ensure_pin_attribute(BMesh *bm, const char *uv_map_name)
 {
   char name[MAX_CUSTOMDATA_LAYER_NAME];
   BM_data_layer_ensure_named(
-  bm, >ldata, CD_PROP_FLOAT2, get_uv_map_pin_name(uv_map_name, name));
+  bm, >ldata, CD_PROP_BOOL, get_uv_map_pin_name(uv_map_name, name));
 }
 
 void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c 
b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index ea588a58f3d..b1e83ac7b2c 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -1130,7 +1130,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, 
BPy_BMLayerItem *py_layer)
   ret = PyBytes_FromStringAndSize(mstring->s, mstring->s_len);
   break;
 }
-case CD_MLOOPUV: {
+case CD_PROP_FLOAT2: {
   if (UNLIKELY(py_ele->bm != py_layer->bm)) {
 PyErr_SetString(PyExc_ValueError, "BMElem[layer]: layer is from 
another mesh");
 return NULL;
diff --git a/source/tools b/source/tools
index 2a541f164a2..dfa16042bf7 16
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 2a541f164a222ef7bcd036d37687738acee8d946
+Subproject commit dfa16042bf7149475ad318d29a8202d969982abb

___
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] [401b3d316a5] refactor-mesh-uv-map-generic: Fix bmesh python UV interface.

2022-11-08 Thread Martijn Versteegh
Commit: 401b3d316a5d9898b37eb7d6c29aec44922b07e3
Author: Martijn Versteegh
Date:   Tue Nov 1 12:06:05 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB401b3d316a5d9898b37eb7d6c29aec44922b07e3

Fix bmesh python UV interface.

Use a pointer in the python object to be able to write back on the set
functions. A problem remaining is that writing to an uninitialized
bool layer does not (lazily) create it but the write is just lost.

===

M   source/blender/bmesh/bmesh_class.h
M   source/blender/python/bmesh/bmesh_py_types_meshdata.c

===

diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index e2d6044f243..5139cbec692 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -532,6 +532,34 @@ typedef bool (*BMLoopPairFilterFunc)(const BMLoop *, const 
BMLoop *, void *user_
 #define BM_ELEM_CD_GET_OPT_BOOL(ele, offset) \
   (offset == -1 ? false : *((bool *)((char *)(ele)->head.data + (offset
 
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+#  define BM_ELEM_CD_GET_BOOL_P(ele, offset) \
+(BLI_assert(offset != -1), \
+ _Generic(ele, \
+  GENERIC_TYPE_ANY((bool *)POINTER_OFFSET((ele)->head.data, 
offset), \
+   _BM_GENERIC_TYPE_ELEM_NONCONST), \
+  GENERIC_TYPE_ANY((const bool *)POINTER_OFFSET((ele)->head.data, 
offset), \
+   _BM_GENERIC_TYPE_ELEM_CONST)))
+#else
+#  define BM_ELEM_CD_GET_BOOL_P(ele, offset) \
+(BLI_assert(offset != -1), (bool *)((char *)(ele)->head.data + (offset)))
+#endif
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+#  define BM_ELEM_CD_GET_OPT_BOOL_P(ele, offset) \
+((offset != -1) ? \
+ _Generic(ele, \
+  GENERIC_TYPE_ANY((bool *)POINTER_OFFSET((ele)->head.data, 
offset), \
+   _BM_GENERIC_TYPE_ELEM_NONCONST), \
+  GENERIC_TYPE_ANY((const bool *)POINTER_OFFSET((ele)->head.data, 
offset), \
+   _BM_GENERIC_TYPE_ELEM_CONST)) : NULL)
+#else
+#  define BM_ELEM_CD_GET_OPT_BOOL_P(ele, offset) \
+((offset != -1) ? (bool *)((char *)(ele)->head.data + (offset)) : NULL)
+#endif
+
+
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
 #  define BM_ELEM_CD_GET_VOID_P(ele, offset) \
 (BLI_assert(offset != -1), \
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c 
b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 81ab5c230b9..0381a969b01 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -36,10 +36,10 @@
 
 typedef struct BPy_BMLoopUV {
   PyObject_VAR_HEAD
-  float uv[2];
-  bool vertsel;
-  bool edgesel;
-  bool pinned;
+  float *uv;
+  bool *vertsel;
+  bool *edgesel;
+  bool *pinned;
 } BPy_BMLoopUV;
 
 PyDoc_STRVAR(bpy_bmloopuv_uv_doc,
@@ -66,31 +66,42 @@ PyDoc_STRVAR(bpy_bmloopuv_select_edge_doc, "UV edge select 
state.\n\n:type: bool
 
 static PyObject *bpy_bmloopuv_pin_uv_get(BPy_BMLoopUV *self, void 
*UNUSED(closure))
 {
-  return PyBool_FromLong(self->pinned);
+  return self->pinned ? PyBool_FromLong(*self->pinned) : false;
 }
 static int bpy_bmloopuv_pin_uv_set(BPy_BMLoopUV *self, PyObject *value, void 
*UNUSED(closure))
 {
-  self->pinned = PyC_Long_AsBool(value);
+  if (self->pinned) {
+*self->pinned = PyC_Long_AsBool(value);
+  }
+  /* TODO(martijn) if (!self->pinmned) that means the layed does not exist , 
or at least didn't exist
+   * when the PY object was created
+   * we *should* create it here instead of just bailing...
+   * same for vertsel and edgesel
+   */
   return 0;
 }
 
 static PyObject *bpy_bmloopuv_select_get(BPy_BMLoopUV *self, void 
*UNUSED(closure))
 {
-  return PyBool_FromLong(self->vertsel);
+  return self->vertsel ? PyBool_FromLong(*self->vertsel) : false;
 }
 static int bpy_bmloopuv_select_set(BPy_BMLoopUV *self, PyObject *value, void 
*UNUSED(closure))
 {
-  self->vertsel = PyC_Long_AsBool(value);
+  if (self->vertsel) {
+*self->vertsel = PyC_Long_AsBool(value);
+  }
   return 0;
 }
 
 static PyObject *bpy_bmloopuv_select_edge_get(BPy_BMLoopUV *self, void 
*UNUSED(closure))
 {
-  return PyBool_FromLong(self->edgesel);
+  return self->edgesel ? PyBool_FromLong(*self->edgesel) : false;
 }
 static int bpy_bmloopuv_select_edge_set(BPy_BMLoopUV *self, PyObject *value, 
void *UNUSED(closure))
 {
-  self->edgesel = PyC_Long_AsBool(value);
+  if (self->edgesel) {
+*self->edgesel = PyC_Long_AsBool(value);
+  }
   return 0;
 }
 
@@ -166,9 +177,9 @@ PyObject *BPy_BMLoopUV_CreatePyObject(struct BMesh *bm, 
const int loop_index)
 
   BMLoop *l = BM_loop_at_index_find(bm, loop_index);
   float *luv = BM_ELEM_CD_GET_FLOAT_P(l, offsets.uv);
-  self->vertsel = BM_ELEM_CD_GET_OPT_BOOL(l, 

[Bf-blender-cvs] [77c4d3154b8] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Philipp Oeser
Commit: 77c4d3154b82ac009598819dda9b7e2fd7cd414f
Author: Philipp Oeser
Date:   Tue Nov 8 13:47:43 2022 +0100
Branches: master
https://developer.blender.org/rB77c4d3154b82ac009598819dda9b7e2fd7cd414f

Merge branch 'blender-v3.4-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] [09faf8a449e] blender-v3.4-release: Fix T102312: anchored brush texture overlay draws in wrong place

2022-11-08 Thread Philipp Oeser
Commit: 09faf8a449e36ce044141e67e792f3d02dd1602d
Author: Philipp Oeser
Date:   Tue Nov 8 12:27:17 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB09faf8a449e36ce044141e67e792f3d02dd1602d

Fix T102312: anchored brush texture overlay draws in wrong place

Rotation and scale was done around the wrong center (always around mouse
position) in paint_draw_tex_overlay [on the other hand,
paint_draw_cursor_overlay already got the center right].

Now make the center dependent on UnifiedPaintSettings "draw_anchored".

Maniphest Tasks: T102312

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c 
b/source/blender/editors/sculpt_paint/paint_cursor.c
index b85b878af7d..b6e83187c86 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -562,31 +562,36 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings 
*ups,
 if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
   GPU_matrix_push();
 
+  float center[2] = {
+  ups->draw_anchored ? ups->anchored_initial_mouse[0] : x,
+  ups->draw_anchored ? ups->anchored_initial_mouse[1] : y,
+  };
+
   /* Brush rotation. */
-  GPU_matrix_translate_2f(x, y);
+  GPU_matrix_translate_2fv(center);
   GPU_matrix_rotate_2d(-RAD2DEGF(primary ? ups->brush_rotation : 
ups->brush_rotation_sec));
-  GPU_matrix_translate_2f(-x, -y);
+  GPU_matrix_translate_2f(-center[0], -center[1]);
 
   /* Scale based on tablet pressure. */
   if (primary && ups->stroke_active && BKE_brush_use_size_pressure(brush)) 
{
 const float scale = ups->size_pressure_value;
-GPU_matrix_translate_2f(x, y);
+GPU_matrix_translate_2fv(center);
 GPU_matrix_scale_2f(scale, scale);
-GPU_matrix_translate_2f(-x, -y);
+GPU_matrix_translate_2f(-center[0], -center[1]);
   }
 
   if (ups->draw_anchored) {
-quad.xmin = ups->anchored_initial_mouse[0] - ups->anchored_size;
-quad.ymin = ups->anchored_initial_mouse[1] - ups->anchored_size;
-quad.xmax = ups->anchored_initial_mouse[0] + ups->anchored_size;
-quad.ymax = ups->anchored_initial_mouse[1] + ups->anchored_size;
+quad.xmin = center[0] - ups->anchored_size;
+quad.ymin = center[1] - ups->anchored_size;
+quad.xmax = center[0] + ups->anchored_size;
+quad.ymax = center[1] + ups->anchored_size;
   }
   else {
 const int radius = BKE_brush_size_get(vc->scene, brush) * zoom;
-quad.xmin = x - radius;
-quad.ymin = y - radius;
-quad.xmax = x + radius;
-quad.ymax = y + radius;
+quad.xmin = center[0] - radius;
+quad.ymin = center[1] - radius;
+quad.xmax = center[0] + radius;
+quad.ymax = center[1] + radius;
   }
 }
 else if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) {

___
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] [ab92154104f] temp-asset-representation: Fix T102242: Underline shortcut keys not working/appearing in sub-menu

2022-11-08 Thread Julian Eisel
Commit: ab92154104f2a527264255a4ce2c5c566fce2cd1
Author: Julian Eisel
Date:   Tue Nov 8 11:32:37 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rBab92154104f2a527264255a4ce2c5c566fce2cd1

Fix T102242: Underline shortcut keys not working/appearing in sub-menu

Upon closer inspection, looks like `UI_BLOCK_NUMSELECT` was previously
set for all code paths and 99e5024e97f1 removed it from one.

===

M   source/blender/editors/interface/interface_region_menu_popup.cc

===

diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc 
b/source/blender/editors/interface/interface_region_menu_popup.cc
index 871fd5c6166..8fd6731d2ec 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.cc
+++ b/source/blender/editors/interface/interface_region_menu_popup.cc
@@ -286,13 +286,13 @@ static uiBlock *ui_block_func_POPUP(bContext *C, 
uiPopupBlockHandle *handle, voi
   int width, height;
   UI_block_layout_resolve(block, , );
 
-  UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
+  UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_NUMSELECT);
 
   if (pup->popup) {
 int offset[2] = {0, 0};
 
 uiBut *but_activate = nullptr;
-UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT);
+UI_block_flag_enable(block, UI_BLOCK_LOOP);
 UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
 UI_block_direction_set(block, direction);

___
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] [3fb8ad93ad6] temp-asset-representation: Merge branch 'master' into temp-asset-representation

2022-11-08 Thread Julian Eisel
Commit: 3fb8ad93ad6195846545f9ca60fda9a297d958ac
Author: Julian Eisel
Date:   Tue Nov 8 12:42:20 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB3fb8ad93ad6195846545f9ca60fda9a297d958ac

Merge branch 'master' into temp-asset-representation

===



===



___
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] [9822a79f909] temp-asset-representation: Fix invalid function signatures for PySequenceMethods callbacks

2022-11-08 Thread Campbell Barton
Commit: 9822a79f909086e5347f6a2255ecf529d872bcd9
Author: Campbell Barton
Date:   Tue Nov 8 12:03:38 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rB9822a79f909086e5347f6a2255ecf529d872bcd9

Fix invalid function signatures for PySequenceMethods callbacks

Function casts hid casting between potentially incompatible type
signatures (using int instead of Py_ssize_t). As it happens this seems
not to have caused any bugs on supported platforms so this change is
mainly for correctness and to avoid problems in the future.

===

M   source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
M   source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
M   source/blender/python/bmesh/bmesh_py_types.c
M   source/blender/python/bmesh/bmesh_py_types_customdata.c
M   source/blender/python/bmesh/bmesh_py_types_meshdata.c
M   source/blender/python/bmesh/bmesh_py_types_select.c
M   source/blender/python/generic/bgl.c
M   source/blender/python/generic/idprop_py_api.c
M   source/blender/python/gpu/gpu_py_buffer.c
M   source/blender/python/intern/bpy_rna.c
M   source/blender/python/mathutils/mathutils_Color.c
M   source/blender/python/mathutils/mathutils_Euler.c
M   source/blender/python/mathutils/mathutils_Matrix.c
M   source/blender/python/mathutils/mathutils_Quaternion.c
M   source/blender/python/mathutils/mathutils_Vector.c

===

diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp 
b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
index c3884e73ebd..9684f96d586 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
@@ -89,7 +89,7 @@ static Py_ssize_t FEdge_sq_length(BPy_FEdge * /*self*/)
   return 2;
 }
 
-static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum)
+static PyObject *FEdge_sq_item(BPy_FEdge *self, Py_ssize_t keynum)
 {
   if (keynum < 0) {
 keynum += FEdge_sq_length(self);
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp 
b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index 2156a91b1f2..8acbfefa995 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -74,7 +74,7 @@ static Py_ssize_t Stroke_sq_length(BPy_Stroke *self)
   return self->s->strokeVerticesSize();
 }
 
-static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum)
+static PyObject *Stroke_sq_item(BPy_Stroke *self, Py_ssize_t keynum)
 {
   if (keynum < 0) {
 keynum += Stroke_sq_length(self);
diff --git a/source/blender/python/bmesh/bmesh_py_types.c 
b/source/blender/python/bmesh/bmesh_py_types.c
index fab23d06ab3..b76f66015a9 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -3118,7 +3118,7 @@ static Py_ssize_t bpy_bmelemseq_length(BPy_BMElemSeq 
*self)
   }
 }
 
-static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, int keynum)
+static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, Py_ssize_t 
keynum)
 {
   BPY_BM_CHECK_OBJ(self);
 
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c 
b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 2d0e31b9e3f..1288083f8e7 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -740,7 +740,8 @@ static PyObject 
*bpy_bmlayercollection_subscript_str(BPy_BMLayerCollection *self
   return NULL;
 }
 
-static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection 
*self, int keynum)
+static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection 
*self,
+ Py_ssize_t keynum)
 {
   Py_ssize_t len;
   BPY_BM_CHECK_OBJ(self);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c 
b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index c58c9caf0a8..9bd98f2df53 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -391,7 +391,7 @@ typedef struct BPy_BMDeformVert {
 /* Mapping Protocols
  * = */
 
-static int bpy_bmdeformvert_len(BPy_BMDeformVert *self)
+static Py_ssize_t bpy_bmdeformvert_len(BPy_BMDeformVert *self)
 {
   return self->data->totweight;
 }
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c 
b/source/blender/python/bmesh/bmesh_py_types_select.c
index 20bf06e8016..ed25caee74d 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -163,7 +163,7 @@ static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq 
*self)
   return 

[Bf-blender-cvs] [49964a5abec] temp-asset-representation: Cleanup: format, remove commented code & unused variable

2022-11-08 Thread Campbell Barton
Commit: 49964a5abec275440001d6683eb4f9bc2f7f3b8e
Author: Campbell Barton
Date:   Tue Nov 8 16:58:37 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rB49964a5abec275440001d6683eb4f9bc2f7f3b8e

Cleanup: format, remove commented code & unused variable

===

M   source/blender/blenkernel/intern/displist.cc
M   source/blender/editors/object/object_remesh.cc
M   source/blender/makesrna/intern/rna_color.c
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/modifiers/intern/MOD_ui_common.c

===

diff --git a/source/blender/blenkernel/intern/displist.cc 
b/source/blender/blenkernel/intern/displist.cc
index f8117a89198..2e285170b93 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -533,7 +533,8 @@ static ModifierData *curve_get_tessellate_point(const Scene 
*scene,
 }
 
 if (md->type == eModifierType_Smooth) {
-  /* Smooth modifier works with mesh edges explicitly (so needs 
tesselation, thus cannnot work on control points). */
+  /* Smooth modifier works with mesh edges explicitly
+   * (so needs tessellation, thus cannot work on control points). */
   md->mode &= ~eModifierMode_ApplyOnSpline;
   return pretessellatePoint;
 }
diff --git a/source/blender/editors/object/object_remesh.cc 
b/source/blender/editors/object/object_remesh.cc
index a50fb28805e..b9acf5ae27b 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -286,7 +286,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d,
   immEnd();
 }
 
-static void voxel_size_edit_draw(const bContext *C, ARegion * /*ar*/, void 
*arg)
+static void voxel_size_edit_draw(const bContext *C, ARegion * /*region*/, void 
*arg)
 {
   VoxelSizeEditCustomData *cd = static_cast(arg);
 
diff --git a/source/blender/makesrna/intern/rna_color.c 
b/source/blender/makesrna/intern/rna_color.c
index fe4d51bafb9..2ba82da09bb 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -577,15 +577,8 @@ static void 
rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA
 }
 
 static const EnumPropertyItem 
*rna_ColorManagedColorspaceSettings_colorspace_itemf(
-bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool 
*r_free)
+bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), 
bool *r_free)
 {
-#  if 0 /* FIXME: Causes blank drop-down, see T102316. */
-  if (C == NULL) {
-return rna_enum_color_space_convert_default_items;
-  }
-#  else
-  UNUSED_VARS(C);
-#  endif
   EnumPropertyItem *items = NULL;
   int totitem = 0;
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 9dc940059dd..cfec020c739 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4512,15 +4512,8 @@ static void 
rna_NodeConvertColorSpace_to_color_space_set(struct PointerRNA *ptr,
 }
 
 static const EnumPropertyItem *rna_NodeConvertColorSpace_color_space_itemf(
-bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool 
*r_free)
+bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), 
bool *r_free)
 {
-#  if 0 /* FIXME: Causes blank drop-down, see T102316. */
-  if (C == NULL) {
-return rna_enum_color_space_convert_default_items;
-  }
-#  else
-  UNUSED_VARS(C);
-#  endif
   EnumPropertyItem *items = NULL;
   int totitem = 0;
 
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c 
b/source/blender/modifiers/intern/MOD_ui_common.c
index e882435077a..0f6c40610a0 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -352,7 +352,8 @@ static void modifier_panel_header(const bContext *C, Panel 
*panel)
   buttons_number++;
 }
 /* Some modifiers can work with pre-tessellated curves only. */
-else if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, 
eModifierType_MeshDeform)) {
+else if (ELEM(
+ md->type, eModifierType_Hook, eModifierType_Softbody, 
eModifierType_MeshDeform)) {
   /* Add button (appearing to be ON) and add tip why this can't be 
changed. */
   sub = uiLayoutRow(row, true);
   uiBlock *block = uiLayoutGetBlock(sub);

___
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] [9ca80d75647] temp-asset-representation: Workaround crash generating Python API documentation

2022-11-08 Thread Campbell Barton
Commit: 9ca80d75647d7d54fea676ced94d753e9a1d633b
Author: Campbell Barton
Date:   Tue Nov 8 16:43:16 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rB9ca80d75647d7d54fea676ced94d753e9a1d633b

Workaround crash generating Python API documentation

Avoid accessing freed memory from dynamically allocated EnumPropertyItem
arrays. Rely on the memory being held by the iterator which isn't the
case when it was converted to a tuple.

===

M   release/scripts/modules/rna_info.py

===

diff --git a/release/scripts/modules/rna_info.py 
b/release/scripts/modules/rna_info.py
index e2bbc4077a1..07daf7c55eb 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -286,7 +286,10 @@ class InfoPropertyRNA:
 
 self.enum_pointer = 0
 if self.type == "enum":
-items = tuple(rna_prop.enum_items)
+# WARNING: don't convert to a tuple as this causes dynamically 
allocated enums to access freed memory
+# since freeing the iterator may free the memory used to store the 
internal `EnumPropertyItem` array.
+# To support this properly RNA would have to support owning the 
dynamically allocated memory.
+items = rna_prop.enum_items
 items_static = tuple(rna_prop.enum_items_static)
 self.enum_items[:] = [(item.identifier, item.name, 
item.description) for item in items]
 self.is_enum_flag = rna_prop.is_enum_flag
@@ -295,6 +298,7 @@ class InfoPropertyRNA:
 item = (items_static or items)
 if item:
 self.enum_pointer = item[0].as_pointer()
+del items, items_static, item
 else:
 self.is_enum_flag = 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] [e1c0e2f7f17] temp-asset-representation: PyAPI: add invalid objects check for RNA struct keys()/values()/items()

2022-11-08 Thread Campbell Barton
Commit: e1c0e2f7f17078194d0f95cf60bcd6eb8a2d84c8
Author: Campbell Barton
Date:   Tue Nov 8 17:17:30 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rBe1c0e2f7f17078194d0f95cf60bcd6eb8a2d84c8

PyAPI: add invalid objects check for RNA struct keys()/values()/items()

===

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

===

diff --git a/source/blender/python/intern/bpy_rna.c 
b/source/blender/python/intern/bpy_rna.c
index ffcc210301c..3525e2459ef 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -3499,6 +3499,8 @@ PyDoc_STRVAR(pyrna_struct_keys_doc,
  "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
 static PyObject *pyrna_struct_keys(BPy_StructRNA *self)
 {
+  PYRNA_STRUCT_CHECK_OBJ(self);
+
   if (RNA_struct_idprops_check(self->ptr.type) == 0) {
 PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't 
support IDProperties");
 return NULL;
@@ -3520,6 +3522,8 @@ PyDoc_STRVAR(pyrna_struct_items_doc,
  "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
 static PyObject *pyrna_struct_items(BPy_StructRNA *self)
 {
+  PYRNA_STRUCT_CHECK_OBJ(self);
+
   if (RNA_struct_idprops_check(self->ptr.type) == 0) {
 PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't 
support IDProperties");
 return NULL;
@@ -3541,6 +3545,8 @@ PyDoc_STRVAR(pyrna_struct_values_doc,
  "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
 static PyObject *pyrna_struct_values(BPy_StructRNA *self)
 {
+  PYRNA_STRUCT_CHECK_OBJ(self);
+
   if (RNA_struct_idprops_check(self->ptr.type) == 0) {
 PyErr_SetString(PyExc_TypeError,
 "bpy_struct.values(): this type doesn't support 
IDProperties");

___
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] [cffb0ba2177] temp-asset-representation: Cleanup: PyMethodDef formatting

2022-11-08 Thread Campbell Barton
Commit: cffb0ba2177845d4f41aacafd3769fb8b526e724
Author: Campbell Barton
Date:   Tue Nov 8 11:13:58 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rBcffb0ba2177845d4f41aacafd3769fb8b526e724

Cleanup: PyMethodDef formatting

Missed these changes in [0].

Also replace designated initializers in some C code, as it's not used
often and would need to be removed when converting to C++.

[0] e555ede626dade2c9b6449ec7dcdda22b2585fd4

===

M   source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
M   source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M   source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
M   source/blender/python/bmesh/bmesh_py_api.c
M   source/blender/python/bmesh/bmesh_py_geometry.c
M   source/blender/python/bmesh/bmesh_py_ops.c
M   source/blender/python/bmesh/bmesh_py_types.c
M   source/blender/python/bmesh/bmesh_py_utils.c
M   source/blender/python/generic/bgl.c
M   source/blender/python/generic/bl_math_py_api.c
M   source/blender/python/generic/blf_py_api.c
M   source/blender/python/generic/idprop_py_api.c
M   source/blender/python/generic/imbuf_py_api.c
M   source/blender/python/gpu/gpu_py_api.c
M   source/blender/python/gpu/gpu_py_capabilities.c
M   source/blender/python/gpu/gpu_py_matrix.c
M   source/blender/python/gpu/gpu_py_platform.c
M   source/blender/python/gpu/gpu_py_select.c
M   source/blender/python/gpu/gpu_py_shader.c
M   source/blender/python/gpu/gpu_py_state.c
M   source/blender/python/gpu/gpu_py_texture.c
M   source/blender/python/gpu/gpu_py_types.c
M   source/blender/python/intern/bpy_app_icons.c
M   source/blender/python/intern/bpy_app_timers.c
M   source/blender/python/intern/bpy_interface.c
M   source/blender/python/intern/bpy_msgbus.c
M   source/blender/python/intern/bpy_operator.c
M   source/blender/python/intern/bpy_path.c
M   source/blender/python/intern/bpy_props.c
M   source/blender/python/intern/bpy_rna.c
M   source/blender/python/intern/bpy_utils_previews.c
M   source/blender/python/intern/bpy_utils_units.c
M   source/blender/python/mathutils/mathutils.c
M   source/blender/python/mathutils/mathutils_bvhtree.c
M   source/blender/python/mathutils/mathutils_geometry.c
M   source/blender/python/mathutils/mathutils_interpolate.c
M   source/blender/python/mathutils/mathutils_kdtree.c
M   source/blender/python/mathutils/mathutils_noise.c

===

diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp 
b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
index d79c2f4d9b0..a4b83b840f3 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
@@ -280,10 +280,14 @@ static PyMethodDef module_functions[] = {
 
 static PyModuleDef module_definition = {
 PyModuleDef_HEAD_INIT,
-"Freestyle.ContextFunctions",
-module_docstring,
--1,
-module_functions,
+/*m_name*/ "Freestyle.ContextFunctions",
+/*m_doc*/ module_docstring,
+/*m_size*/ -1,
+/*m_methods*/ module_functions,
+/*m_slots*/ NULL,
+/*m_traverse*/ NULL,
+/*m_clear*/ NULL,
+/*m_free*/ NULL,
 };
 
 //--- MODULE INITIALIZATION 
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp 
b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
index 237f1802026..f99e66c822d 100644
--- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
@@ -509,10 +509,14 @@ static PyMethodDef module_functions[] = {
 
 static PyModuleDef module_definition = {
 PyModuleDef_HEAD_INIT,
-"_freestyle",
-module_docstring,
--1,
-module_functions,
+/*m_name*/ "_freestyle",
+/*m_doc*/ module_docstring,
+/*m_size*/ -1,
+/*m_methods*/ module_functions,
+/*m_slots*/ NULL,
+/*m_traverse*/ NULL,
+/*m_clear*/ NULL,
+/*m_free*/ NULL,
 };
 
 //---MODULE INITIALIZATION
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp 
b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
index dfebfd3ff73..c862b226271 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
@@ -112,10 +112,14 @@ static PyMethodDef module_functions[] = {
 
 static PyModuleDef module_definition = {
 PyModuleDef_HEAD_INIT,
-"Freestyle.Integrator",
-module_docstring,
--1,
-module_functions,
+/*m_name*/ "Freestyle.Integrator",
+/*m_doc*/ module_docstring,
+/*m_size*/ -1,
+/*m_methods*/ module_functions,
+

[Bf-blender-cvs] [98fc2aa93f1] temp-asset-representation: Fix support for building with ffmpeg < 5.0

2022-11-08 Thread Sebastian Parborg
Commit: 98fc2aa93f1f699744ce7caca5c4032de2786fb5
Author: Sebastian Parborg
Date:   Mon Nov 7 17:44:14 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB98fc2aa93f1f699744ce7caca5c4032de2786fb5

Fix support for building with ffmpeg < 5.0

Seems like the new audio channel api was not as backwards compatible as we 
thought.
Therefore we need to reintroduce the usage of the old api to make older ffmpeg 
version be able to compile Blender.

This change is only intended to stick around for two releases or so. After that 
we hope that most Linux distros ship
ffmpeg >=5.0 so we can switch to it.

Reviewed By: Sergey

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

===

M   intern/ffmpeg/CMakeLists.txt
M   intern/ffmpeg/ffmpeg_compat.h
M   intern/ffmpeg/tests/ffmpeg_codecs.cc
M   source/blender/blenkernel/intern/writeffmpeg.c

===

diff --git a/intern/ffmpeg/CMakeLists.txt b/intern/ffmpeg/CMakeLists.txt
index 0de8496f3f3..4fb5df9d4cd 100644
--- a/intern/ffmpeg/CMakeLists.txt
+++ b/intern/ffmpeg/CMakeLists.txt
@@ -6,6 +6,7 @@ if(WITH_GTESTS)
 tests/ffmpeg_codecs.cc
   )
   set(TEST_INC
+.
   )
   set(TEST_INC_SYS
 ${FFMPEG_INCLUDE_DIRS}
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index f311e04d8e0..f7d87af8bca 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -36,6 +36,14 @@
 #  define FFMPEG_INLINE static inline
 #endif
 
+#if (LIBAVFORMAT_VERSION_MAJOR < 59)
+/* For versions older than ffmpeg 5.0, use the old channel layout variables.
+ * We intend to only keep this  workaround for around two releases (3.5, 3.6).
+ * If it sticks around any longer, then we should consider refactoring this.
+ */
+#  define FFMPEG_USE_OLD_CHANNEL_VARS
+#endif
+
 #if (LIBAVFORMAT_VERSION_MAJOR < 58) || \
 ((LIBAVFORMAT_VERSION_MAJOR == 58) && (LIBAVFORMAT_VERSION_MINOR < 76))
 #  define FFMPEG_USE_DURATION_WORKAROUND 1
diff --git a/intern/ffmpeg/tests/ffmpeg_codecs.cc 
b/intern/ffmpeg/tests/ffmpeg_codecs.cc
index 10cbe4b938b..cd06917f59b 100644
--- a/intern/ffmpeg/tests/ffmpeg_codecs.cc
+++ b/intern/ffmpeg/tests/ffmpeg_codecs.cc
@@ -3,6 +3,8 @@
 #include "testing/testing.h"
 
 extern "C" {
+#include "ffmpeg_compat.h"
+
 #include 
 #include 
 #include 
@@ -40,7 +42,11 @@ bool test_acodec(const AVCodec *codec, AVSampleFormat fmt)
 if (ctx) {
   ctx->sample_fmt = fmt;
   ctx->sample_rate = 48000;
+#ifdef FFMPEG_USE_OLD_CHANNEL_VARS
+  ctx->channel_layout = AV_CH_LAYOUT_MONO;
+#else
   av_channel_layout_from_mask(>ch_layout, AV_CH_LAYOUT_MONO);
+#endif
   ctx->bit_rate = 128000;
   int open = avcodec_open2(ctx, codec, NULL);
   if (open >= 0) {
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c 
b/source/blender/blenkernel/intern/writeffmpeg.c
index d71db8f71a5..4c11a2896a8 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -141,18 +141,25 @@ static int write_audio_frame(FFMpegContext *context)
   frame->pts = context->audio_time / av_q2d(c->time_base);
   frame->nb_samples = context->audio_input_samples;
   frame->format = c->sample_fmt;
+#ifdef FFMPEG_USE_OLD_CHANNEL_VARS
+  frame->channels = c->channels;
+  frame->channel_layout = c->channel_layout;
+  const int num_channels = c->channels;
+#else
   av_channel_layout_copy(>ch_layout, >ch_layout);
+  const int num_channels = c->ch_layout.nb_channels;
+#endif
 
   if (context->audio_deinterleave) {
 int channel, i;
 uint8_t *temp;
 
-for (channel = 0; channel < c->ch_layout.nb_channels; channel++) {
+for (channel = 0; channel < num_channels; channel++) {
   for (i = 0; i < frame->nb_samples; i++) {
 memcpy(context->audio_deinterleave_buffer +
(i + channel * frame->nb_samples) * 
context->audio_sample_size,
context->audio_input_buffer +
-   (c->ch_layout.nb_channels * i + channel) * 
context->audio_sample_size,
+   (num_channels * i + channel) * context->audio_sample_size,
context->audio_sample_size);
   }
 }
@@ -163,10 +170,10 @@ static int write_audio_frame(FFMpegContext *context)
   }
 
   avcodec_fill_audio_frame(frame,
-   c->ch_layout.nb_channels,
+   num_channels,
c->sample_fmt,
context->audio_input_buffer,
-   context->audio_input_samples * 
c->ch_layout.nb_channels *
+   context->audio_input_samples * num_channels *
context->audio_sample_size,
1);
 
@@ -944,25 +951,34 @@ static AVStream *alloc_audio_stream(FFMpegContext 
*context,
   c->sample_rate = 

[Bf-blender-cvs] [0e2a400f112] temp-asset-representation: Fix T102329: assert when cutting node tree link

2022-11-08 Thread Jacques Lucke
Commit: 0e2a400f1126a54d260a746df1dcdf5e2c6f5321
Author: Jacques Lucke
Date:   Mon Nov 7 16:12:07 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB0e2a400f1126a54d260a746df1dcdf5e2c6f5321

Fix T102329: assert when cutting node tree link

===

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

===

diff --git a/source/blender/editors/space_node/drawnode.cc 
b/source/blender/editors/space_node/drawnode.cc
index df31a0342cb..c66b8ad4ff0 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -1581,10 +1581,12 @@ void draw_nodespace_back_pix(const bContext ,
   GPU_matrix_pop();
 }
 
-static float2 socket_link_connection_location(const bNodeSocket , const 
bNodeLink )
+static float2 socket_link_connection_location(const bNode ,
+  const bNodeSocket ,
+  const bNodeLink )
 {
   const float2 socket_location(socket.locx, socket.locy);
-  if (socket.is_multi_input() && socket.is_input() && 
!(socket.owner_node().flag & NODE_HIDDEN)) {
+  if (socket.is_multi_input() && socket.is_input() && !(node.flag & 
NODE_HIDDEN)) {
 return node_link_calculate_multi_input_position(
 socket_location, link.multi_input_socket_index, socket.total_inputs);
   }
@@ -1620,8 +1622,8 @@ static void 
calculate_inner_link_bezier_points(std::array )
 static std::array node_link_bezier_points(const bNodeLink )
 {
   std::array points;
-  points[0] = socket_link_connection_location(*link.fromsock, link);
-  points[3] = socket_link_connection_location(*link.tosock, link);
+  points[0] = socket_link_connection_location(*link.fromnode, *link.fromsock, 
link);
+  points[3] = socket_link_connection_location(*link.tonode, *link.tosock, 
link);
   calculate_inner_link_bezier_points(points);
   return points;
 }
@@ -2212,8 +2214,11 @@ static std::array 
node_link_bezier_points_dragged(const SpaceNode 
 {
   const float2 cursor = snode.runtime->cursor * UI_DPI_FAC;
   std::array points;
-  points[0] = link.fromsock ? socket_link_connection_location(*link.fromsock, 
link) : cursor;
-  points[3] = link.tosock ? socket_link_connection_location(*link.tosock, 
link) : cursor;
+  points[0] = link.fromsock ?
+  socket_link_connection_location(*link.fromnode, 
*link.fromsock, link) :
+  cursor;
+  points[3] = link.tosock ? socket_link_connection_location(*link.tonode, 
*link.tosock, link) :
+cursor;
   calculate_inner_link_bezier_points(points);
   return points;
 }

___
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] [0a8effa0f68] temp-asset-representation: Cleanup: correct type of RNA struct methods

2022-11-08 Thread Campbell Barton
Commit: 0a8effa0f686427a3dd077eb17fa7715b3556e7e
Author: Campbell Barton
Date:   Tue Nov 8 11:26:33 2022 +1100
Branches: temp-asset-representation
https://developer.blender.org/rB0a8effa0f686427a3dd077eb17fa7715b3556e7e

Cleanup: correct type of RNA struct methods

Some BPy_StructRNA methods used BPy_PropertyRNA in their function
signatures, while this didn't case any bugs, it could lead to issues
in the future.

===

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

===

diff --git a/source/blender/python/intern/bpy_rna.c 
b/source/blender/python/intern/bpy_rna.c
index e6e9a3ec2bc..4b767926f7a 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -3497,7 +3497,7 @@ PyDoc_STRVAR(pyrna_struct_keys_doc,
  "   :return: custom property keys.\n"
  "   :rtype: :class:`idprop.type.IDPropertyGroupViewKeys`\n"
  "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
-static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
+static PyObject *pyrna_struct_keys(BPy_StructRNA *self)
 {
   if (RNA_struct_idprops_check(self->ptr.type) == 0) {
 PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't 
support IDProperties");
@@ -3518,7 +3518,7 @@ PyDoc_STRVAR(pyrna_struct_items_doc,
  "   :return: custom property key, value pairs.\n"
  "   :rtype: :class:`idprop.type.IDPropertyGroupViewItems`\n"
  "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
-static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
+static PyObject *pyrna_struct_items(BPy_StructRNA *self)
 {
   if (RNA_struct_idprops_check(self->ptr.type) == 0) {
 PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't 
support IDProperties");
@@ -3539,7 +3539,7 @@ PyDoc_STRVAR(pyrna_struct_values_doc,
  "   :return: custom property values.\n"
  "   :rtype: :class:`idprop.type.IDPropertyGroupViewValues`\n"
  "\n" BPY_DOC_ID_PROP_TYPE_NOTE);
-static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
+static PyObject *pyrna_struct_values(BPy_StructRNA *self)
 {
   if (RNA_struct_idprops_check(self->ptr.type) == 0) {
 PyErr_SetString(PyExc_TypeError,

___
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] [9e67d373df1] temp-asset-representation: Fix T101526: assert due to wrong node tree owner id

2022-11-08 Thread Jacques Lucke
Commit: 9e67d373df11f760aa5c63e4a01957da82a6af8b
Author: Jacques Lucke
Date:   Mon Nov 7 15:48:32 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB9e67d373df11f760aa5c63e4a01957da82a6af8b

Fix T101526: assert due to wrong node tree owner id

===

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

===

diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index e6eba45d45e..192ba2771f4 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -502,6 +502,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
 }
 
 ma->nodetree = ntreeCopyTree(bmain, ma_default->nodetree);
+ma->nodetree->owner_id = >id;
 BKE_ntree_update_main_tree(bmain, ma->nodetree, nullptr);
   }
   else if (ELEM(GS(id->name), ID_WO, ID_LA)) {

___
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] [dc5d7441e7e] temp-asset-representation: Fix T101533: Wrong DoF when a non-camera object is the active camera

2022-11-08 Thread Miguel Pozo
Commit: dc5d7441e7e723393e0568949bb2a001e4afb6d5
Author: Miguel Pozo
Date:   Mon Nov 7 15:30:15 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rBdc5d7441e7e723393e0568949bb2a001e4afb6d5

Fix T101533: Wrong DoF when a non-camera object is the active camera

Make sure non-camera data is not casted to a Camera pointer.

Solution suggested by Damien Picard (@pioverfour).

===

M   source/blender/draw/engines/eevee/eevee_depth_of_field.c
M   source/blender/draw/engines/gpencil/gpencil_engine.c
M   source/blender/draw/engines/workbench/workbench_effect_dof.c

===

diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c 
b/source/blender/draw/engines/eevee/eevee_depth_of_field.c
index 0d14a0c5f61..caa63b9c54c 100644
--- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c
+++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c
@@ -189,7 +189,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData 
*UNUSED(sldata),
   const DRWContextState *draw_ctx = DRW_context_state_get();
   const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
 
-  Camera *cam = (camera != NULL) ? camera->data : NULL;
+  Camera *cam = (camera != NULL && camera->type == OB_CAMERA) ? camera->data : 
NULL;
 
   if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) {
 RegionView3D *rv3d = draw_ctx->rv3d;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 78e658d35eb..6a4312e572a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -289,7 +289,7 @@ void GPENCIL_cache_init(void *ved)
 DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
   }
 
-  Camera *cam = (pd->camera != NULL) ? pd->camera->data : NULL;
+  Camera *cam = (pd->camera != NULL && pd->camera->type == OB_CAMERA) ? 
pd->camera->data : NULL;
 
   /* Pseudo DOF setup. */
   if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) {
diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c 
b/source/blender/draw/engines/workbench/workbench_effect_dof.c
index 58d49cf226e..a7247f4e9a6 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_dof.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c
@@ -128,7 +128,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata)
 camera = wpd->cam_original_ob;
   }
 
-  Camera *cam = camera != NULL ? camera->data : NULL;
+  Camera *cam = camera != NULL && camera->type == OB_CAMERA ? camera->data : 
NULL;
   if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 || (cam == NULL) ||
   ((cam->dof.flag & CAM_DOF_ENABLED) == 0)) {
 wpd->dof_enabled = 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] [8ed8d21f5e9] temp-asset-representation: Fix T100872: restrict Python API on built-in nodes

2022-11-08 Thread Jacques Lucke
Commit: 8ed8d21f5e94851e268364dfa75b63a98ad8e68f
Author: Jacques Lucke
Date:   Mon Nov 7 14:43:24 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB8ed8d21f5e94851e268364dfa75b63a98ad8e68f

Fix T100872: restrict Python API on built-in nodes

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 3ec8d909b9b..9dc940059dd 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2425,21 +2425,13 @@ static bNodeSocket *rna_Node_inputs_new(ID *id,
 const char *name,
 const char *identifier)
 {
-
-  if (ELEM(node->type, NODE_GROUP_INPUT, NODE_FRAME)) {
-BKE_report(reports, RPT_ERROR, "Unable to create socket");
+  if (node->type != NODE_CUSTOM) {
+BKE_report(reports, RPT_ERROR, "Cannot add socket to built-in node");
 return NULL;
   }
-  /* Adding an input to a group node is not working,
-   * simpler to add it to its underlying nodetree. */
-  if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
-return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, reports, 
type, name);
-  }
 
   bNodeTree *ntree = (bNodeTree *)id;
-  bNodeSocket *sock;
-
-  sock = nodeAddSocket(ntree, node, SOCK_IN, type, identifier, name);
+  bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, type, identifier, 
name);
 
   if (sock == NULL) {
 BKE_report(reports, RPT_ERROR, "Unable to create socket");
@@ -2460,20 +2452,13 @@ static bNodeSocket *rna_Node_outputs_new(ID *id,
  const char *name,
  const char *identifier)
 {
-  if (ELEM(node->type, NODE_GROUP_OUTPUT, NODE_FRAME)) {
-BKE_report(reports, RPT_ERROR, "Unable to create socket");
+  if (node->type != NODE_CUSTOM) {
+BKE_report(reports, RPT_ERROR, "Cannot add socket to built-in node");
 return NULL;
   }
-  /* Adding an output to a group node is not working,
-   * simpler to add it to its underlying nodetree. */
-  if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
-return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, reports, 
type, name);
-  }
 
   bNodeTree *ntree = (bNodeTree *)id;
-  bNodeSocket *sock;
-
-  sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, name);
+  bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, 
name);
 
   if (sock == NULL) {
 BKE_report(reports, RPT_ERROR, "Unable to create socket");
@@ -2489,6 +2474,11 @@ static bNodeSocket *rna_Node_outputs_new(ID *id,
 static void rna_Node_socket_remove(
 ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
 {
+  if (node->type != NODE_CUSTOM) {
+BKE_report(reports, RPT_ERROR, "Unable to remove socket from built-in 
node");
+return;
+  }
+
   bNodeTree *ntree = (bNodeTree *)id;
 
   if (BLI_findindex(>inputs, sock) == -1 && 
BLI_findindex(>outputs, sock) == -1) {
@@ -2502,8 +2492,13 @@ static void rna_Node_socket_remove(
   }
 }
 
-static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain)
+static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain, ReportList 
*reports)
 {
+  if (node->type != NODE_CUSTOM) {
+BKE_report(reports, RPT_ERROR, "Unable to remove sockets from built-in 
node");
+return;
+  }
+
   bNodeTree *ntree = (bNodeTree *)id;
   bNodeSocket *sock, *nextsock;
 
@@ -2516,8 +2511,13 @@ static void rna_Node_inputs_clear(ID *id, bNode *node, 
Main *bmain)
   WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
 }
 
-static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain)
+static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain, 
ReportList *reports)
 {
+  if (node->type != NODE_CUSTOM) {
+BKE_report(reports, RPT_ERROR, "Unable to remove socket from built-in 
node");
+return;
+  }
+
   bNodeTree *ntree = (bNodeTree *)id;
   bNodeSocket *sock, *nextsock;
 
@@ -2530,8 +2530,14 @@ static void rna_Node_outputs_clear(ID *id, bNode *node, 
Main *bmain)
   WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
 }
 
-static void rna_Node_inputs_move(ID *id, bNode *node, Main *bmain, int 
from_index, int to_index)
+static void rna_Node_inputs_move(
+ID *id, bNode *node, Main *bmain, ReportList *reports, int from_index, int 
to_index)
 {
+  if (node->type != NODE_CUSTOM) {
+BKE_report(reports, RPT_ERROR, "Unable to move sockets in built-in node");
+return;
+  }
+
   bNodeTree *ntree = (bNodeTree *)id;
   bNodeSocket *sock;
 
@@ -2562,8 +2568,14 @@ static void rna_Node_inputs_move(ID *id, bNode *node, 
Main *bmain, int from_inde
   

[Bf-blender-cvs] [14db6975e67] temp-asset-representation: Fix T102311: crash when opening node add menu with assets

2022-11-08 Thread Jacques Lucke
Commit: 14db6975e671bfe689be09aa32e1b555282a0faa
Author: Jacques Lucke
Date:   Mon Nov 7 14:15:22 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB14db6975e671bfe689be09aa32e1b555282a0faa

Fix T102311: crash when opening node add menu with assets

===

M   source/blender/editors/space_node/add_menu_assets.cc

===

diff --git a/source/blender/editors/space_node/add_menu_assets.cc 
b/source/blender/editors/space_node/add_menu_assets.cc
index 1ba1d67d854..5458a25d74a 100644
--- a/source/blender/editors/space_node/add_menu_assets.cc
+++ b/source/blender/editors/space_node/add_menu_assets.cc
@@ -114,8 +114,11 @@ static AssetItemTree build_catalog_tree(const bContext , 
const bNodeTree *node
   if (BLI_uuid_is_nil(meta_data.catalog_id)) {
 return true;
   }
-  const LibraryCatalog _catalog = 
id_to_catalog_map.lookup(meta_data.catalog_id);
-  assets_per_path.add(library_catalog.catalog->path, 
LibraryAsset{library_ref, asset});
+  const LibraryCatalog *library_catalog = 
id_to_catalog_map.lookup_ptr(meta_data.catalog_id);
+  if (library_catalog == nullptr) {
+return true;
+  }
+  assets_per_path.add(library_catalog->catalog->path, 
LibraryAsset{library_ref, asset});
   return true;
 });
   }

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


[Bf-blender-cvs] [195a1c7fc8a] temp-asset-representation: Fix T102324: reverse curve node breaks crazy space editing

2022-11-08 Thread Jacques Lucke
Commit: 195a1c7fc8adbe9eca71709cb77f36b9db519fca
Author: Jacques Lucke
Date:   Mon Nov 7 14:40:35 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB195a1c7fc8adbe9eca71709cb77f36b9db519fca

Fix T102324: reverse curve node breaks crazy space editing

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc
index 0169ead5bd2..040ebf55ec5 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_reverse.cc
@@ -19,6 +19,8 @@ static void node_geo_exec(GeoNodeExecParams params)
 {
   GeometrySet geometry_set = params.extract_input("Curve");
 
+  
GeometryComponentEditData::remember_deformed_curve_positions_if_necessary(geometry_set);
+
   geometry_set.modify_geometry_sets([&](GeometrySet _set) {
 if (!geometry_set.has_curves()) {
   return;

___
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] [e1b3d911273] master: Refactor: replace Cycles sse/avx types by vectorized float4/int4/float8/int8

2022-11-08 Thread Brecht Van Lommel
Commit: e1b3d9112730bc3b569732a1558752ded146
Author: Brecht Van Lommel
Date:   Tue Nov 1 15:16:55 2022 +0100
Branches: master
https://developer.blender.org/rBe1b3d9112730bc3b569732a1558752ded146

Refactor: replace Cycles sse/avx types by vectorized float4/int4/float8/int8

The distinction existed for legacy reasons, to easily port of Embree
intersection code without affecting the main vector types. However we are now
using SIMD for these types as well, so no good reason to keep the distinction.

Also more consistently pass these vector types by value in inline functions.
Previously it was partially changed for functions used by Metal to avoid having
to add address space qualifiers, simple to do it everywhere.

Also removes function declarations for vector math headers, serves no real
purpose.

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

===

M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/device/cpu/kernel.cpp
M   intern/cycles/kernel/svm/noise.h
M   intern/cycles/test/CMakeLists.txt
D   intern/cycles/test/util_avxf_test.h
R077intern/cycles/test/util_avxf_avx2_test.cpp  
intern/cycles/test/util_float8_avx2_test.cpp
R082intern/cycles/test/util_avxf_avx_test.cpp   
intern/cycles/test/util_float8_avx_test.cpp
A   intern/cycles/test/util_float8_sse2_test.cpp
A   intern/cycles/test/util_float8_test.h
M   intern/cycles/util/CMakeLists.txt
D   intern/cycles/util/avxb.h
D   intern/cycles/util/avxf.h
D   intern/cycles/util/avxi.h
M   intern/cycles/util/color.h
M   intern/cycles/util/half.h
M   intern/cycles/util/hash.h
M   intern/cycles/util/math.h
M   intern/cycles/util/math_float2.h
M   intern/cycles/util/math_float3.h
M   intern/cycles/util/math_float4.h
M   intern/cycles/util/math_float8.h
M   intern/cycles/util/math_int2.h
M   intern/cycles/util/math_int3.h
M   intern/cycles/util/math_int4.h
A   intern/cycles/util/math_int8.h
M   intern/cycles/util/math_intersect.h
D   intern/cycles/util/sseb.h
D   intern/cycles/util/ssef.h
D   intern/cycles/util/ssei.h
M   intern/cycles/util/transform.cpp
M   intern/cycles/util/transform.h
M   intern/cycles/util/transform_inverse.h
M   intern/cycles/util/types.h
M   intern/cycles/util/types_float8.h
M   intern/cycles/util/types_float8_impl.h
A   intern/cycles/util/types_int8.h
A   intern/cycles/util/types_int8_impl.h

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 3779fdc697a..3fbb346e94f 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -328,6 +328,7 @@ set(SRC_UTIL_HEADERS
   ../util/math_int2.h
   ../util/math_int3.h
   ../util/math_int4.h
+  ../util/math_int8.h
   ../util/math_matrix.h
   ../util/projection.h
   ../util/rect.h
@@ -350,6 +351,8 @@ set(SRC_UTIL_HEADERS
   ../util/types_int3_impl.h
   ../util/types_int4.h
   ../util/types_int4_impl.h
+  ../util/types_int8.h
+  ../util/types_int8_impl.h
   ../util/types_spectrum.h
   ../util/types_uchar2.h
   ../util/types_uchar2_impl.h
diff --git a/intern/cycles/kernel/device/cpu/kernel.cpp 
b/intern/cycles/kernel/device/cpu/kernel.cpp
index 01087c96dd6..558431961ab 100644
--- a/intern/cycles/kernel/device/cpu/kernel.cpp
+++ b/intern/cycles/kernel/device/cpu/kernel.cpp
@@ -7,6 +7,7 @@
  * one with SSE2 intrinsics.
  */
 #if defined(__x86_64__) || defined(_M_X64)
+#  define __KERNEL_SSE__
 #  define __KERNEL_SSE2__
 #endif
 
@@ -29,11 +30,15 @@
 #define __KERNEL_SSE41__
 #  endif
 #  ifdef __AVX__
-#define __KERNEL_SSE__
+#ifndef __KERNEL_SSE__
+#  define __KERNEL_SSE__
+#endif
 #define __KERNEL_AVX__
 #  endif
 #  ifdef __AVX2__
-#define __KERNEL_SSE__
+#ifndef __KERNEL_SSE__
+#  define __KERNEL_SSE__
+#endif
 #define __KERNEL_AVX2__
 #  endif
 #endif
diff --git a/intern/cycles/kernel/svm/noise.h b/intern/cycles/kernel/svm/noise.h
index 31e77d87413..209195a03f1 100644
--- a/intern/cycles/kernel/svm/noise.h
+++ b/intern/cycles/kernel/svm/noise.h
@@ -39,11 +39,11 @@ ccl_device_noinline_cpu float perlin_1d(float x)
 }
 
 /* 2D, 3D, and 4D noise can be accelerated using SSE, so we first check if
- * SSE is supported, that is, if __KERNEL_SSE2__ is defined. If it is not
+ * SSE is supported, that is, if __KERNEL_SSE__ is defined. If it is not
  * supported, we do a standard implementation, but if it is supported, we
  * do an implementation using SSE intrinsics.
  */
-#if !defined(__KERNEL_SSE2__)
+#if !defined(__KERNEL_SSE__)
 
 /* ** Standard Implementation ** */
 
@@ -250,18 +250,18 @@ ccl_device_noinline_cpu float perlin_4d(float x, float y, 
float z, float w)
 
 /* SSE Bilinear Interpolation:
  *
- * The function takes two ssef inputs:
+ * The function takes two 

[Bf-blender-cvs] [32ec0521c54] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Julian Eisel
Commit: 32ec0521c542bb78a0080f8091856ec085030f09
Author: Julian Eisel
Date:   Tue Nov 8 12:18:12 2022 +0100
Branches: master
https://developer.blender.org/rB32ec0521c542bb78a0080f8091856ec085030f09

Merge branch 'blender-v3.4-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] [82ba2056462] blender-v3.4-release: Fix T85870: ColorRamp Keyframes crash Blender

2022-11-08 Thread Julian Eisel
Commit: 82ba2056462310b103ad16fba726340886e5b0b7
Author: Julian Eisel
Date:   Tue Nov 8 12:14:31 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB82ba2056462310b103ad16fba726340886e5b0b7

Fix T85870: ColorRamp Keyframes crash Blender

The color-band needs to do some special, rather awkward updating of the
UI state when certain values are changed. As @lichtwerk noted in the
report, this was done to the wrong buttons. Now lookup the proper
buttons, and don't assume that `uiItemR()` only adds a single button
(which often isn't the case).

===

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

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index a3259831c9f..b32aa82ad9e 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -3673,13 +3673,9 @@ static void colorband_buttons_layout(uiLayout *layout,
 
   row = uiLayoutRow(split, false);
   uiItemR(row, , "position", 0, IFACE_("Pos"), ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_func_set(bt, colorband_update_cb, bt, coba);
 
   row = uiLayoutRow(layout, false);
   uiItemR(row, , "color", 0, "", ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 }
 else {
   split = uiLayoutSplit(layout, 0.5f, false);
@@ -3704,13 +3700,28 @@ static void colorband_buttons_layout(uiLayout *layout,
 
   row = uiLayoutRow(subsplit, false);
   uiItemR(row, , "position", UI_ITEM_R_SLIDER, IFACE_("Pos"), 
ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_func_set(bt, colorband_update_cb, bt, coba);
 
   row = uiLayoutRow(split, false);
   uiItemR(row, , "color", 0, "", ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
+}
+
+/* Some special (rather awkward) treatment to update UI state on certain 
property changes. */
+LISTBASE_FOREACH_BACKWARD (uiBut *, but, >buttons) {
+  if (but->rnapoin.data != ptr.data) {
+continue;
+  }
+  if (!but->rnaprop) {
+continue;
+  }
+
+  const char *prop_identifier = RNA_property_identifier(but->rnaprop);
+  if (STREQ(prop_identifier, "position")) {
+UI_but_func_set(but, colorband_update_cb, but, coba);
+  }
+
+  if (STREQ(prop_identifier, "color")) {
+UI_but_funcN_set(but, rna_update_cb, MEM_dupallocN(cb), NULL);
+  }
 }
   }
 }

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


[Bf-blender-cvs] [eef1900d51e] tmp-vfx-platform-2023: Fix failing tests on macOS due wrong library path for idiff

2022-11-08 Thread Brecht Van Lommel
Commit: eef1900d51e20360b1249262b4b63d92fffae048
Author: Brecht Van Lommel
Date:   Tue Nov 8 12:10:59 2022 +0100
Branches: tmp-vfx-platform-2023
https://developer.blender.org/rBeef1900d51e20360b1249262b4b63d92fffae048

Fix failing tests on macOS due wrong library path for idiff

===

M   build_files/cmake/platform/platform_apple.cmake

===

diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index db21ccd3465..07d7036f809 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -470,7 +470,7 @@ if(PLATFORM_BUNDLED_LIBRARIES)
   # Environment variables to run precompiled executables that needed libraries.
   list(JOIN PLATFORM_BUNDLED_LIBRARY_DIRS ":" _library_paths)
   set(PLATFORM_ENV_BUILD 
"DYLD_LIBRARY_PATH=\"${_library_paths};${DYLD_LIBRARY_PATH}\"")
-  set(PLATFORM_ENV_INSTALL 
"DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib/;$DYLD_LIBRARY_PATH")
+  set(PLATFORM_ENV_INSTALL 
"DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX_WITH_CONFIG}Blender.app/Contents/Resources/lib/;$DYLD_LIBRARY_PATH")
   unset(_library_paths)
 endif()

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

2022-11-08 Thread Sergey Sharybin
Commit: c047042adf6a08fcd4b851fb4d0d76dff26832ed
Author: Sergey Sharybin
Date:   Tue Nov 8 12:03:07 2022 +0100
Branches: master
https://developer.blender.org/rBc047042adf6a08fcd4b851fb4d0d76dff26832ed

Merge branch 'blender-v3.4-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] [0d945fe20e8] blender-v3.4-release: Fix deprecation warnings about printf() on macOS

2022-11-08 Thread Sergey Sharybin
Commit: 0d945fe20e87ac7ada2d565f751146c2e8fa1ed6
Author: Sergey Sharybin
Date:   Mon Nov 7 15:43:20 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB0d945fe20e87ac7ada2d565f751146c2e8fa1ed6

Fix deprecation warnings about printf() on macOS

The new Xcode 14.1 brings the new Apple Clang compiler which
considers sprintf unsafe and geenrates deprecation warnings
suggesting to sue snprintf instead. This only happens for C++
code by default, and C code can still use sprintf without any
warning.

This changes does the following:

- Whenever is trivial replace sprintf() with BLI_snprintf.
- For all other cases use the newly introduced BLI_sprintf
  which is a wrapper around sprintf() but without warning.

There is a discouragement note in the BLI_sprintf comment to
suggest use of BLI_snprintf when the size is known.

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

===

M   source/blender/blenkernel/intern/freestyle.c
M   source/blender/blenkernel/intern/image.cc
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/writeffmpeg.c
M   source/blender/blenlib/BLI_string.h
M   source/blender/blenlib/intern/path_util.c
M   source/blender/blenlib/intern/string.c
M   source/blender/blenlib/intern/uuid.cc
M   source/blender/blenlib/intern/winstuff.c
M   source/blender/blenloader/intern/writefile.cc
M   source/blender/compositor/intern/COM_Debug.cc
M   source/blender/draw/intern/draw_manager_profiling.c
M   source/blender/draw/intern/draw_pbvh.cc
M   source/blender/editors/io/io_collada.c
M   source/blender/editors/object/object_bake_api.c
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/render/render_internal.cc
M   source/blender/editors/render/render_preview.cc
M   source/blender/editors/space_node/space_node.cc
M   source/blender/editors/space_outliner/tree/tree_element_rna.cc
M   source/blender/editors/space_view3d/view3d_draw.cc
M   source/blender/io/avi/intern/avi_codecs.c
M   source/blender/io/collada/AnimationExporter.cpp
M   source/blender/io/collada/GeometryExporter.cpp
M   source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
M   source/blender/makesrna/intern/rna_particle.c
M   source/blender/nodes/texture/nodes/node_texture_output.c
M   source/blender/python/bmesh/bmesh_py_types.c
M   source/blender/python/intern/bpy_rna.c
M   source/blender/sequencer/intern/disk_cache.c

===

diff --git a/source/blender/blenkernel/intern/freestyle.c 
b/source/blender/blenkernel/intern/freestyle.c
index a0649930dfc..28d0d1719d7 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -183,7 +183,7 @@ FreestyleLineSet *BKE_freestyle_lineset_add(struct Main 
*bmain,
 BLI_strncpy(lineset->name, name, sizeof(lineset->name));
   }
   else if (lineset_index > 0) {
-sprintf(lineset->name, "LineSet %i", lineset_index + 1);
+BLI_snprintf(lineset->name, sizeof(lineset->name), "LineSet %i", 
lineset_index + 1);
   }
   else {
 strcpy(lineset->name, "LineSet");
diff --git a/source/blender/blenkernel/intern/image.cc 
b/source/blender/blenkernel/intern/image.cc
index eae8b454189..75e3e22afa7 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -3610,12 +3610,12 @@ void BKE_image_set_filepath_from_tile_number(char 
*filepath,
   }
 
   if (tile_format == UDIM_TILE_FORMAT_UDIM) {
-sprintf(filepath, pattern, tile_number);
+BLI_sprintf(filepath, pattern, tile_number);
   }
   else if (tile_format == UDIM_TILE_FORMAT_UVTILE) {
 int u = ((tile_number - 1001) % 10);
 int v = ((tile_number - 1001) / 10);
-sprintf(filepath, pattern, u + 1, v + 1);
+BLI_sprintf(filepath, pattern, u + 1, v + 1);
   }
 }
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index ad9d4e4fcca..eb0c78e9361 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -3436,7 +3436,7 @@ void ntreeRemoveSocketInterface(bNodeTree *ntree, 
bNodeSocket *sock)
 static void ntree_interface_identifier_base(bNodeTree *ntree, char *base)
 {
   /* generate a valid RNA identifier */
-  sprintf(base, "NodeTreeInterface_%s", ntree->id.name + 2);
+  BLI_sprintf(base, "NodeTreeInterface_%s", ntree->id.name + 2);
   RNA_identifier_sanitize(base, false);
 }
 
@@ -3462,8 +3462,8 @@ static void ntree_interface_identifier(bNodeTree *ntree,
   BLI_uniquename_cb(
   ntree_interface_unique_identifier_check, nullptr, base, '_', identifier, 
maxlen);
 
-  sprintf(name, "Node Tree %s Interface", ntree->id.name + 2);
-  sprintf(description, "Interface properties of 

[Bf-blender-cvs] [dc609d9f1f6] blender-v3.4-release: Fix T100988: flickering when using sculpt brush in drag dot mode

2022-11-08 Thread Jacques Lucke
Commit: dc609d9f1f6eadc565e75a6d6823d78c21af96a2
Author: Jacques Lucke
Date:   Tue Nov 8 11:46:44 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBdc609d9f1f6eadc565e75a6d6823d78c21af96a2

Fix T100988: flickering when using sculpt brush in drag dot mode

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

===

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

===

diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c 
b/source/blender/editors/sculpt_paint/paint_stroke.c
index 97f5bd77d47..f1f864fdf82 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -249,7 +249,7 @@ static bool paint_stroke_use_scene_spacing(Brush *brush, 
ePaintMode mode)
 
 static bool paint_tool_raycast_original(Brush *brush, ePaintMode UNUSED(mode))
 {
-  return brush->flag & BRUSH_ANCHORED;
+  return brush->flag & (BRUSH_ANCHORED | BRUSH_DRAG_DOT);
 }
 
 static bool paint_tool_require_inbetween_mouse_events(Brush *brush, ePaintMode 
mode)

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


[Bf-blender-cvs] [f12236d1e3f] master: Merge branch 'blender-v3.4-release'

2022-11-08 Thread Julian Eisel
Commit: f12236d1e3fa485976d7328784e0aef82eb6e1c3
Author: Julian Eisel
Date:   Tue Nov 8 11:34:38 2022 +0100
Branches: master
https://developer.blender.org/rBf12236d1e3fa485976d7328784e0aef82eb6e1c3

Merge branch 'blender-v3.4-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] [1f3be45f1fb] blender-v3.4-release: Fix T102242: Underline shortcut keys not working/appearing in sub-menu

2022-11-08 Thread Julian Eisel
Commit: 1f3be45f1fbf2051436ce640363b0a4277e2fd62
Author: Julian Eisel
Date:   Tue Nov 8 11:32:37 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB1f3be45f1fbf2051436ce640363b0a4277e2fd62

Fix T102242: Underline shortcut keys not working/appearing in sub-menu

Upon closer inspection, looks like `UI_BLOCK_NUMSELECT` was previously
set for all code paths and 99e5024e97f1 removed it from one.

===

M   source/blender/editors/interface/interface_region_menu_popup.cc

===

diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc 
b/source/blender/editors/interface/interface_region_menu_popup.cc
index 871fd5c6166..8fd6731d2ec 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.cc
+++ b/source/blender/editors/interface/interface_region_menu_popup.cc
@@ -286,13 +286,13 @@ static uiBlock *ui_block_func_POPUP(bContext *C, 
uiPopupBlockHandle *handle, voi
   int width, height;
   UI_block_layout_resolve(block, , );
 
-  UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
+  UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_NUMSELECT);
 
   if (pup->popup) {
 int offset[2] = {0, 0};
 
 uiBut *but_activate = nullptr;
-UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT);
+UI_block_flag_enable(block, UI_BLOCK_LOOP);
 UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
 UI_block_direction_set(block, direction);

___
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] [efaeed1c170] temp-asset-representation: Refactor how asset representations are added to an asset library

2022-11-08 Thread Julian Eisel
Commit: efaeed1c1704b84187ff3d17a595c1df1f13c65c
Author: Julian Eisel
Date:   Mon Nov 7 15:11:27 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rBefaeed1c1704b84187ff3d17a595c1df1f13c65c

Refactor how asset representations are added to an asset library

===

M   source/blender/blenkernel/BKE_asset.h
M   source/blender/blenkernel/BKE_asset_library.hh
M   source/blender/blenkernel/BKE_asset_representation.hh
M   source/blender/blenkernel/intern/asset.cc
M   source/blender/blenkernel/intern/asset_library.cc
M   source/blender/blenkernel/intern/asset_representation.cc
M   source/blender/editors/space_file/file_indexer.cc
M   source/blender/editors/space_file/filelist.cc
M   source/blender/makesdna/DNA_asset_types.h

===

diff --git a/source/blender/blenkernel/BKE_asset.h 
b/source/blender/blenkernel/BKE_asset.h
index 379a16432cb..14d1b80c73a 100644
--- a/source/blender/blenkernel/BKE_asset.h
+++ b/source/blender/blenkernel/BKE_asset.h
@@ -79,3 +79,12 @@ bool BKE_asset_representation_is_local_id(const 
AssetRepresentation *asset)
 #ifdef __cplusplus
 }
 #endif
+
+#ifdef __cplusplus
+
+#  include 
+
+[[nodiscard]] std::unique_ptr 
BKE_asset_metadata_move_to_unique_ptr(
+AssetMetaData *asset_data);
+
+#endif
diff --git a/source/blender/blenkernel/BKE_asset_library.hh 
b/source/blender/blenkernel/BKE_asset_library.hh
index e089e30c345..091df6d8edd 100644
--- a/source/blender/blenkernel/BKE_asset_library.hh
+++ b/source/blender/blenkernel/BKE_asset_library.hh
@@ -51,11 +51,6 @@ struct AssetLibrary {
   std::string root_path;
 
   std::unique_ptr catalog_service;
-  /** Container to store asset representations, managed by whatever manages 
this library, not by
-   * the library itself. So this really is arbitrary storage as far as 
#AssetLibrary is concerned
-   * (allowing the API user to manage partial library storage and partial 
loading, so only relevant
-   * parts of a library are kept in memory). */
-  AssetStorage asset_storage;
 
   AssetLibrary();
   ~AssetLibrary();
@@ -65,6 +60,9 @@ struct AssetLibrary {
   /** Load catalogs that have changed on disk. */
   void refresh();
 
+  AssetRepresentation _external_asset(std::unique_ptr 
metadata);
+  AssetRepresentation _local_id_asset(const ID );
+
   /**
* Update `catalog_simple_name` by looking up the asset's catalog by its ID.
*
@@ -80,6 +78,14 @@ struct AssetLibrary {
 
  private:
   bCallbackFuncStore on_save_callback_store_{};
+
+  /** Container to store asset representations. Assets are not automatically 
loaded into this when
+   * loading an asset library. Assets have to be loaded externally and added 
to this storage via
+   * #add_external_asset() or #add_local_id_asset().
+   * So this really is arbitrary storage as far as #AssetLibrary is concerned 
(allowing the API
+   * user to manage partial library storage and partial loading, so only 
relevant parts of a
+   * library are kept in memory). */
+  AssetStorage asset_storage_;
 };
 
 Vector all_valid_asset_library_refs();
diff --git a/source/blender/blenkernel/BKE_asset_representation.hh 
b/source/blender/blenkernel/BKE_asset_representation.hh
index 32f5dd44f43..d2e167b3f35 100644
--- a/source/blender/blenkernel/BKE_asset_representation.hh
+++ b/source/blender/blenkernel/BKE_asset_representation.hh
@@ -31,10 +31,7 @@ class AssetRepresentation {
   explicit AssetRepresentation(std::unique_ptr metadata);
   /** Constructs an asset representation for an ID stored in the current file. 
This makes the asset
* local and fully editable. */
-  explicit AssetRepresentation(ID );
-
-  /* TODO this doesn't make sense. Remove this. */
-  explicit AssetRepresentation(AssetMetaData &);
+  explicit AssetRepresentation(const ID );
 
   AssetMetaData _metadata() const;
   /** Returns if this asset is stored inside this current file, and as such 
fully editable. */
diff --git a/source/blender/blenkernel/intern/asset.cc 
b/source/blender/blenkernel/intern/asset.cc
index 67802b1d6b4..7103e017847 100644
--- a/source/blender/blenkernel/intern/asset.cc
+++ b/source/blender/blenkernel/intern/asset.cc
@@ -27,21 +27,31 @@ using namespace blender;
 
 AssetMetaData *BKE_asset_metadata_create()
 {
-  AssetMetaData *asset_data = (AssetMetaData 
*)MEM_callocN(sizeof(*asset_data), __func__);
-  memcpy(asset_data, DNA_struct_default_get(AssetMetaData), 
sizeof(*asset_data));
-  return asset_data;
+  const AssetMetaData *default_metadata = 
DNA_struct_default_get(AssetMetaData);
+  return MEM_new(__func__, *default_metadata);
 }
 
 void BKE_asset_metadata_free(AssetMetaData **asset_data)
 {
-  if ((*asset_data)->properties) {
-IDP_FreeProperty((*asset_data)->properties);
+  (*asset_data)->~AssetMetaData();
+  MEM_SAFE_FREE(*asset_data);
+}
+
+AssetMetaData::~AssetMetaData()
+{
+  if (properties) {
+

[Bf-blender-cvs] [61eb425db82] temp-asset-representation: Merge branch 'master' into temp-asset-representation

2022-11-08 Thread Julian Eisel
Commit: 61eb425db8269a01aff47845735d0a8a9d991a60
Author: Julian Eisel
Date:   Mon Nov 7 15:35:32 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB61eb425db8269a01aff47845735d0a8a9d991a60

Merge branch 'master' into temp-asset-representation

===



===



___
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] [3de27e2ed97] temp-asset-representation: Merge branch 'master' into temp-asset-representation

2022-11-08 Thread Julian Eisel
Commit: 3de27e2ed976e3c4eb879d6a60d1ee359fbedfa3
Author: Julian Eisel
Date:   Wed Nov 2 19:03:14 2022 +0100
Branches: temp-asset-representation
https://developer.blender.org/rB3de27e2ed976e3c4eb879d6a60d1ee359fbedfa3

Merge branch 'master' into temp-asset-representation

===



===



___
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