[Bf-blender-cvs] [51381c94d8e] master: BLF: Fallback Broken After Cache Removal

2022-08-10 Thread Harley Acheson
Commit: 51381c94d8e046c78ccba190bff137cc9f11dcef
Author: Harley Acheson
Date:   Wed Aug 10 20:50:49 2022 -0700
Branches: master
https://developer.blender.org/rB51381c94d8e046c78ccba190bff137cc9f11dcef

BLF: Fallback Broken After Cache Removal

Font fallback feature not working after reverting the implementation
of the cache system. Missing an blf_ensure_face before
FT_Get_Char_Index. Otherwise glyphs not found in fonts without faces.

Own Code

===

M   source/blender/blenfont/intern/blf_font.c

===

diff --git a/source/blender/blenfont/intern/blf_font.c 
b/source/blender/blenfont/intern/blf_font.c
index 5f904d86b03..b958f3c2336 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -70,7 +70,7 @@ static ft_pix blf_font_width_max_ft_pix(struct FontBLF *font);
 /* Return glyph id from charcode. */
 uint blf_get_char_index(struct FontBLF *font, uint charcode)
 {
-  return FT_Get_Char_Index(font->face, charcode);
+  return blf_ensure_face(font) ? FT_Get_Char_Index(font->face, charcode) : 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] [f35d671f466] master: Cleanup: refactoring uvislands to prepare for python api

2022-08-10 Thread Chris Blackbourn
Commit: f35d671f466da324ebe70eef3edf12bd3b2b63c9
Author: Chris Blackbourn
Date:   Thu Aug 11 14:18:31 2022 +1200
Branches: master
https://developer.blender.org/rBf35d671f466da324ebe70eef3edf12bd3b2b63c9

Cleanup: refactoring uvislands to prepare for python api

Add element_map->island_total_uvs.
Add element_map->island_total_unique_uvs.
Simplify callers based on new members.
Add comments.

Resolves: D15598

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/sculpt_paint/sculpt_uv.c
M   source/blender/editors/transform/transform_convert_mesh_uv.c
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_select.c
M   source/blender/editors/uvedit/uvedit_smart_stitch.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index 455f42366cc..525483bae19 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -68,16 +68,20 @@ typedef struct UvElementMap {
   /** Total number of unique UVs. */
   int total_unique_uvs;
 
-  /* If Non-NULL, address UvElements by `BM_elem_index_get(BMVert*)`. */
+  /** If Non-NULL, address UvElements by `BM_elem_index_get(BMVert*)`. */
   struct UvElement **vertex;
 
-  /* If Non-NULL, pointer to local head of each unique UV. */
+  /** If Non-NULL, pointer to local head of each unique UV. */
   struct UvElement **head_table;
 
-  /* Number of Islands in the mesh */
-  int totalIslands;
-  /* Stores the starting index in buf where each island begins */
-  int *islandIndices;
+  /** Number of islands, or zero if not calculated. */
+  int total_islands;
+  /** Array of starting index in #storage where each island begins. */
+  int *island_indices;
+  /** Array of number of UVs in each island. */
+  int *island_total_uvs;
+  /** Array of number of unique UVs in each island. */
+  int *island_total_unique_uvs;
 } UvElementMap;
 
 /* Connectivity data */
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index a0e20e4db8a..e931dd02a9e 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -820,28 +820,32 @@ static void bm_uv_build_islands(UvElementMap *element_map,
 }
   }
 
-  element_map->islandIndices = MEM_callocN(sizeof(*element_map->islandIndices) 
* nislands,
-   "UvElementMap_island_indices");
+  element_map->island_indices = 
MEM_callocN(sizeof(*element_map->island_indices) * nislands,
+__func__);
+  element_map->island_total_uvs = 
MEM_callocN(sizeof(*element_map->island_total_uvs) * nislands,
+  __func__);
+  element_map->island_total_unique_uvs = MEM_callocN(
+  sizeof(*element_map->island_total_unique_uvs) * nislands, __func__);
   int j = 0;
   for (int i = 0; i < totuv; i++) {
-UvElement *element = element_map->storage[i].next;
-if (element == NULL) {
-  islandbuf[map[i]].next = NULL;
-}
-else {
-  islandbuf[map[i]].next = [map[element - element_map->storage]];
-}
+UvElement *next = element_map->storage[i].next;
+islandbuf[map[i]].next = next ? [map[next - 
element_map->storage]] : NULL;
 
 if (islandbuf[i].island != j) {
   j++;
-  element_map->islandIndices[j] = i;
+  element_map->island_indices[j] = i;
+}
+BLI_assert(islandbuf[i].island == j);
+element_map->island_total_uvs[j]++;
+if (islandbuf[i].separate) {
+  element_map->island_total_unique_uvs[j]++;
 }
   }
 
   MEM_SAFE_FREE(element_map->storage);
   element_map->storage = islandbuf;
   islandbuf = NULL;
-  element_map->totalIslands = nislands;
+  element_map->total_islands = nislands;
   MEM_SAFE_FREE(stack);
   MEM_SAFE_FREE(map);
 }
@@ -1059,7 +1063,9 @@ void BM_uv_element_map_free(UvElementMap *element_map)
 MEM_SAFE_FREE(element_map->storage);
 MEM_SAFE_FREE(element_map->vertex);
 MEM_SAFE_FREE(element_map->head_table);
-MEM_SAFE_FREE(element_map->islandIndices);
+MEM_SAFE_FREE(element_map->island_indices);
+MEM_SAFE_FREE(element_map->island_total_uvs);
+MEM_SAFE_FREE(element_map->island_total_unique_uvs);
 MEM_SAFE_FREE(element_map);
   }
 }
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c 
b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 2e2abd30ea2..14b06f888fe 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -518,13 +518,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, 
wmOperator *op, const wm
 /* Count 'unique' UV's */
 int unique_uvs = data->elementMap->total_unique_uvs;

[Bf-blender-cvs] [d52d71b8344] master: Cleanup: doxy parameters, use static set instead of tuple

2022-08-10 Thread Campbell Barton
Commit: d52d71b834433c7da3ac671ba965305568d64529
Author: Campbell Barton
Date:   Thu Aug 11 11:17:24 2022 +1000
Branches: master
https://developer.blender.org/rBd52d71b834433c7da3ac671ba965305568d64529

Cleanup: doxy parameters, use static set instead of tuple

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_key.h
M   source/blender/blenkernel/BKE_lib_id.h
M   source/blender/blenkernel/BKE_lib_override.h

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 299518935ef..68fe9cafccc 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6136,7 +6136,7 @@ class VIEW3D_PT_shading_compositor(Panel):
 
 @classmethod
 def poll(cls, context):
-return (context.space_data.shading.type in ('MATERIAL', 'RENDERED') and
+return (context.space_data.shading.type in {'MATERIAL', 'RENDERED'} and
 context.preferences.experimental.use_realtime_compositor)
 
 def draw(self, context):
diff --git a/source/blender/blenkernel/BKE_key.h 
b/source/blender/blenkernel/BKE_key.h
index 37b30d63722..9f506ded8e9 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -47,7 +47,7 @@ void key_curve_normal_weights(float t, float data[4], int 
type);
 /**
  * Returns key coordinates (+ tilt) when key applied, NULL otherwise.
  *
- * \param obdata if given, also update that geometry with the result of the 
shape keys evaluation.
+ * \param obdata: if given, also update that geometry with the result of the 
shape keys evaluation.
  */
 float *BKE_key_evaluate_object_ex(
 struct Object *ob, int *r_totelem, float *arr, size_t arr_size, struct ID 
*obdata);
diff --git a/source/blender/blenkernel/BKE_lib_id.h 
b/source/blender/blenkernel/BKE_lib_id.h
index 148e6ec2791..febdad2ca0d 100644
--- a/source/blender/blenkernel/BKE_lib_id.h
+++ b/source/blender/blenkernel/BKE_lib_id.h
@@ -444,18 +444,20 @@ struct ID *BKE_id_copy(struct Main *bmain, const struct 
ID *id);
  * Currently, it only handles the given ID, and their shape keys and actions 
if any, according to
  * the given `duplicate_flags`.
  *
- * \param duplicate_flags is of type #eDupli_ID_Flags, see #UserDef.dupflag. 
Currently only
+ * \param duplicate_flags: is of type #eDupli_ID_Flags, see #UserDef.dupflag. 
Currently only
  * `USER_DUP_LINKED_ID` and `USER_DUP_ACT` have an effect here.
- * \param copy_flags flags passed to #BKE_id_copy_ex.
+ * \param copy_flags: flags passed to #BKE_id_copy_ex.
  */
 struct ID *BKE_id_copy_for_duplicate(struct Main *bmain,
  struct ID *id,
  uint duplicate_flags,
  int copy_flags);
 
-/* Special version of BKE_id_copy which is safe from using evaluated id as 
source with a copy
+/**
+ * Special version of #BKE_id_copy which is safe from using evaluated id as 
source with a copy
  * result appearing in the main database.
- * Takes care of the referenced data-blocks consistency. */
+ * Takes care of the referenced data-blocks consistency.
+ */
 struct ID *BKE_id_copy_for_use_in_bmain(struct Main *bmain, const struct ID 
*id);
 
 /**
diff --git a/source/blender/blenkernel/BKE_lib_override.h 
b/source/blender/blenkernel/BKE_lib_override.h
index f933946164c..d1eb6e01ae3 100644
--- a/source/blender/blenkernel/BKE_lib_override.h
+++ b/source/blender/blenkernel/BKE_lib_override.h
@@ -66,7 +66,7 @@ void BKE_lib_override_library_free(struct IDOverrideLibrary 
**override, bool do_
  * \note This is especially useful when `id` is a non-real override (e.g. 
embedded ID like a master
  * collection or root node tree, or a shape key).
  *
- * \param r_owner_id If given, will be set with the actual ID owning the 
return liboverride data.
+ * \param r_owner_id: If given, will be set with the actual ID owning the 
return liboverride data.
  */
 IDOverrideLibrary *BKE_lib_override_library_get(struct Main *bmain,
 struct ID *id,

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

2022-08-10 Thread Campbell Barton
Commit: fb8e604ff44fc0bd9bec1844e7ffea90a1b71710
Author: Campbell Barton
Date:   Thu Aug 11 11:10:13 2022 +1000
Branches: master
https://developer.blender.org/rBfb8e604ff44fc0bd9bec1844e7ffea90a1b71710

Merge branch 'blender-v3.3-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] [ed55054e57a] blender-v3.3-release: Fix T100204: RMB select (with "Select Tool") causes edit-mesh conflict

2022-08-10 Thread Campbell Barton
Commit: ed55054e57a35278e90d7ecd512521289d450fd8
Author: Campbell Barton
Date:   Thu Aug 11 11:05:48 2022 +1000
Branches: blender-v3.3-release
https://developer.blender.org/rBed55054e57a35278e90d7ecd512521289d450fd8

Fix T100204: RMB select (with "Select Tool") causes edit-mesh conflict

When RMB select activated the selection tool, Alt-RMB would both
tweak and loop-select.

Fix/workaround this by passing though 'enumerate' unless the option
can be used (when selecting objects or armatures).

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index 8eff9ee472f..571c39f30cb 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2893,11 +2893,6 @@ static int view3d_select_exec(bContext *C, wmOperator 
*op)
   bool changed = false;
   int mval[2];
 
-  RNA_int_get_array(op->ptr, "location", mval);
-
-  view3d_operator_needs_opengl(C);
-  BKE_object_update_select_id(CTX_data_main(C));
-
   if (object_only) {
 obedit = NULL;
 obact = NULL;
@@ -2908,6 +2903,19 @@ static int view3d_select_exec(bContext *C, wmOperator 
*op)
 center = false;
   }
 
+  if (obedit && enumerate) {
+/* Enumerate makes no sense in edit-mode unless also explicitly picking 
objects or bones.
+ * Pass the event through so the event may be handled by loop-select for 
e.g. see: T100204. */
+if (obedit->type != OB_ARMATURE) {
+  return OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED;
+}
+  }
+
+  RNA_int_get_array(op->ptr, "location", mval);
+
+  view3d_operator_needs_opengl(C);
+  BKE_object_update_select_id(CTX_data_main(C));
+
   if (obedit && object_only == false) {
 if (obedit->type == OB_MESH) {
   changed = EDBM_select_pick(C, mval, );

___
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] [9015cba5ceb] master: Cleanup: clang-tidy uv_parametrizer.cc

2022-08-10 Thread Campbell Barton
Commit: 9015cba5ceb6cd1e8403160b55472276f60d979a
Author: Campbell Barton
Date:   Thu Aug 11 11:03:23 2022 +1000
Branches: master
https://developer.blender.org/rB9015cba5ceb6cd1e8403160b55472276f60d979a

Cleanup: clang-tidy uv_parametrizer.cc

===

M   source/blender/geometry/intern/uv_parametrizer.cc

===

diff --git a/source/blender/geometry/intern/uv_parametrizer.cc 
b/source/blender/geometry/intern/uv_parametrizer.cc
index ab2cca5d71e..b7526d82ecc 100644
--- a/source/blender/geometry/intern/uv_parametrizer.cc
+++ b/source/blender/geometry/intern/uv_parametrizer.cc
@@ -234,7 +234,7 @@ static void phash_insert(PHash *ph, PHashLink *link)
   uintptr_t hash = PHASH_hash(ph, link->key);
   PHashLink *lookup = ph->buckets[hash];
 
-  if (lookup == NULL) {
+  if (lookup == nullptr) {
 /* insert in front of the list */
 ph->buckets[hash] = link;
 link->next = *(ph->list);
@@ -249,13 +249,13 @@ static void phash_insert(PHash *ph, PHashLink *link)
   ph->size++;
 
   if (ph->size > (size * 3)) {
-PHashLink *next = NULL, *first = *(ph->list);
+PHashLink *next = nullptr, *first = *(ph->list);
 
 ph->cursize = PHashSizes[++ph->cursize_id];
 MEM_freeN(ph->buckets);
 ph->buckets = (PHashLink **)MEM_callocN(ph->cursize * 
sizeof(*ph->buckets), "PHashBuckets");
 ph->size = 0;
-*(ph->list) = NULL;
+*(ph->list) = nullptr;
 
 for (link = first; link; link = next) {
   next = link->next;
@@ -274,7 +274,7 @@ static PHashLink *phash_lookup(PHash *ph, PHashKey key)
   return link;
 }
 if (PHASH_hash(ph, link->key) != hash) {
-  return NULL;
+  return nullptr;
 }
   }
 
@@ -290,7 +290,7 @@ static PHashLink *phash_next(PHash *ph, PHashKey key, 
PHashLink *link)
   return link;
 }
 if (PHASH_hash(ph, link->key) != hash) {
-  return NULL;
+  return nullptr;
 }
   }
 
@@ -456,7 +456,7 @@ static PEdge *p_wheel_edge_next(PEdge *e)
 
 static PEdge *p_wheel_edge_prev(PEdge *e)
 {
-  return (e->pair) ? e->pair->next : NULL;
+  return (e->pair) ? e->pair->next : nullptr;
 }
 
 static PEdge *p_boundary_edge_next(PEdge *e)
@@ -694,7 +694,7 @@ static PEdge *p_edge_lookup(ParamHandle *handle, const 
PHashKey *vkeys)
 e = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)e);
   }
 
-  return NULL;
+  return nullptr;
 }
 
 static int p_face_exists(ParamHandle *handle, const ParamKey *pvkeys, int i1, 
int i2, int i3)
@@ -769,7 +769,7 @@ static bool p_edge_has_pair(ParamHandle *handle, PEdge *e, 
bool topology_from_uv
 
   key = PHASH_edge(key1, key2);
   pe = (PEdge *)phash_lookup(handle->hash_edges, key);
-  *r_pair = NULL;
+  *r_pair = nullptr;
 
   while (pe) {
 if (pe != e) {
@@ -782,7 +782,7 @@ static bool p_edge_has_pair(ParamHandle *handle, PEdge *e, 
bool topology_from_uv
 /* don't connect seams and t-junctions */
 if ((pe->flag & PEDGE_SEAM) || *r_pair ||
 (topology_from_uvs && p_edge_implicit_seam(e, pe))) {
-  *r_pair = NULL;
+  *r_pair = nullptr;
   return false;
 }
 
@@ -796,12 +796,12 @@ static bool p_edge_has_pair(ParamHandle *handle, PEdge 
*e, bool topology_from_uv
   if (*r_pair && (e->vert == (*r_pair)->vert)) {
 if ((*r_pair)->next->pair || (*r_pair)->next->next->pair) {
   /* non unfoldable, maybe mobius ring or klein bottle */
-  *r_pair = NULL;
+  *r_pair = nullptr;
   return false;
 }
   }
 
-  return (*r_pair != NULL);
+  return (*r_pair != nullptr);
 }
 
 static bool p_edge_connect_pair(ParamHandle *handle,
@@ -809,7 +809,7 @@ static bool p_edge_connect_pair(ParamHandle *handle,
 bool topology_from_uvs,
 PEdge ***stack)
 {
-  PEdge *pair = NULL;
+  PEdge *pair = nullptr;
 
   if (!e->pair && p_edge_has_pair(handle, e, topology_from_uvs, )) {
 if (e->vert == pair->vert) {
@@ -825,7 +825,7 @@ static bool p_edge_connect_pair(ParamHandle *handle,
 }
   }
 
-  return (e->pair != NULL);
+  return (e->pair != nullptr);
 }
 
 static int p_connect_pairs(ParamHandle *handle, bool topology_from_uvs)
@@ -880,7 +880,7 @@ static int p_connect_pairs(ParamHandle *handle, bool 
topology_from_uvs)
 
 static void p_split_vert(ParamHandle *handle, PChart *chart, PEdge *e)
 {
-  PEdge *we, *lastwe = NULL;
+  PEdge *we, *lastwe = nullptr;
   PVert *v = e->vert;
   bool copy = true;
 
@@ -993,9 +993,9 @@ static PFace *p_face_add(ParamHandle *handle)
   e2->next = e3;
   e3->next = e1;
 
-  e1->pair = NULL;
-  e2->pair = NULL;
-  e3->pair = NULL;
+  e1->pair = nullptr;
+  e2->pair = nullptr;
+  e3->pair = nullptr;
 
   e1->flag = 0;
   e2->flag = 0;
@@ -1073,7 +1073,7 @@ static PFace *p_face_add_fill(ParamHandle *handle, PChart 
*chart, PVert *v1, PVe
   e2->vert = v2;
   e3->vert = v3;
 
-  e1->orig_uv = e2->orig_uv = e3->orig_uv = NULL;
+  

[Bf-blender-cvs] [b9b45c2036b] master: Cleanup: pass const arguments to smooth-view functions

2022-08-10 Thread Campbell Barton
Commit: b9b45c2036b039e829b9eade3ef2de7a90bb7f8c
Author: Campbell Barton
Date:   Thu Aug 11 10:05:21 2022 +1000
Branches: master
https://developer.blender.org/rBb9b45c2036b039e829b9eade3ef2de7a90bb7f8c

Cleanup: pass const arguments to smooth-view functions

Also move region redraw tag out of view3d_smoothview_apply_with_interp
as it's not always needed.

===

M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_navigate.h
M   source/blender/editors/space_view3d/view3d_navigate_smoothview.c
M   source/blender/editors/space_view3d/view3d_utils.c

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 7d31950c869..e3fb8fcd433 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -1211,8 +1211,8 @@ bool ED_view3d_camera_lock_undo_test(const View3D *v3d,
  * \return true when the call to push an undo step was made.
  */
 bool ED_view3d_camera_lock_undo_push(const char *str,
- View3D *v3d,
- struct RegionView3D *rv3d,
+ const View3D *v3d,
+ const struct RegionView3D *rv3d,
  struct bContext *C);
 
 /**
@@ -1222,8 +1222,8 @@ bool ED_view3d_camera_lock_undo_push(const char *str,
  * where adding a separate undo step each time isn't desirable.
  */
 bool ED_view3d_camera_lock_undo_grouped_push(const char *str,
- View3D *v3d,
- struct RegionView3D *rv3d,
+ const View3D *v3d,
+ const struct RegionView3D *rv3d,
  struct bContext *C);
 
 #define VIEW3D_MARGIN 1.4f
diff --git a/source/blender/editors/space_view3d/view3d_navigate.h 
b/source/blender/editors/space_view3d/view3d_navigate.h
index 721476ace57..925acd90573 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.h
+++ b/source/blender/editors/space_view3d/view3d_navigate.h
@@ -266,12 +266,12 @@ void ED_view3d_smooth_view(struct bContext *C,
  * or when calling #ED_view3d_smooth_view_ex.
  * Otherwise pass in #V3D_SmoothParams.undo_str so an undo step is pushed as 
needed.
  */
-void ED_view3d_smooth_view_undo_begin(struct bContext *C, struct ScrArea 
*area);
+void ED_view3d_smooth_view_undo_begin(struct bContext *C, const struct ScrArea 
*area);
 /**
  * Run after multiple smooth-view operations have run to push undo as needed.
  */
 void ED_view3d_smooth_view_undo_end(struct bContext *C,
-struct ScrArea *area,
+const struct ScrArea *area,
 const char *undo_str,
 bool undo_grouped);
 
diff --git a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c 
b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
index 8125e334492..9c7d493c76d 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
@@ -23,7 +23,7 @@
 #include "view3d_navigate.h" /* own include */
 
 static void view3d_smoothview_apply_with_interp(
-bContext *C, View3D *v3d, ARegion *region, const bool use_autokey, const 
float factor);
+bContext *C, View3D *v3d, RegionView3D *rv3d, const bool use_autokey, 
const float factor);
 
 /*  */
 /** \name Smooth View Undo Handling
@@ -40,7 +40,7 @@ static void view3d_smoothview_apply_with_interp(
  * operations are executed once smooth-view has started.
  * \{ */
 
-void ED_view3d_smooth_view_undo_begin(bContext *C, ScrArea *area)
+void ED_view3d_smooth_view_undo_begin(bContext *C, const ScrArea *area)
 {
   const View3D *v3d = area->spacedata.first;
   Object *camera = v3d->camera;
@@ -53,11 +53,11 @@ void ED_view3d_smooth_view_undo_begin(bContext *C, ScrArea 
*area)
* NOTE: It doesn't matter if the actual object being manipulated is the 
camera or not. */
   camera->id.tag &= ~LIB_TAG_DOIT;
 
-  LISTBASE_FOREACH (ARegion *, region, >regionbase) {
+  LISTBASE_FOREACH (const ARegion *, region, >regionbase) {
 if (region->regiontype != RGN_TYPE_WINDOW) {
   continue;
 }
-RegionView3D *rv3d = region->regiondata;
+const RegionView3D *rv3d = region->regiondata;
 if (ED_view3d_camera_lock_undo_test(v3d, rv3d, C)) {
   camera->id.tag |= LIB_TAG_DOIT;
   break;
@@ -66,7 +66,7 @@ void ED_view3d_smooth_view_undo_begin(bContext *C, ScrArea 
*area)
 }
 
 void ED_view3d_smooth_view_undo_end(bContext *C,
-

[Bf-blender-cvs] [d9c2922a145] master: Cleanup: remove redundant MEM_SAFE_FREE

2022-08-10 Thread Campbell Barton
Commit: d9c2922a14585ed3c83f98617f4023a3b212683b
Author: Campbell Barton
Date:   Thu Aug 11 10:50:51 2022 +1000
Branches: master
https://developer.blender.org/rBd9c2922a14585ed3c83f98617f4023a3b212683b

Cleanup: remove redundant MEM_SAFE_FREE

MEM_SAFE_FREE isn't necessary when the memory is known to be allocated
and clearing the value afterwards isn't necessary.

===

M   source/blender/blenkernel/intern/gpencil_curve.c
M   source/blender/geometry/intern/uv_parametrizer.cc
M   source/blender/modifiers/intern/MOD_surfacedeform.c

===

diff --git a/source/blender/blenkernel/intern/gpencil_curve.c 
b/source/blender/blenkernel/intern/gpencil_curve.c
index d68b322e4c5..bf224a9613e 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -337,7 +337,6 @@ static void gpencil_convert_spline(Main *bmain,
   /* Add stroke to frame. */
   BLI_addtail(>strokes, gps);
 
-  float *coord_array = NULL;
   float init_co[3];
 
   switch (nu->type) {
@@ -376,8 +375,7 @@ static void gpencil_convert_spline(Main *bmain,
 BezTriple *bezt = >bezt[inext];
 bool last = (bool)(s == segments - 1);
 
-coord_array = MEM_callocN((size_t)3 * resolu * sizeof(float), 
__func__);
-
+float *coord_array = MEM_callocN(sizeof(float[3]) * resolu, __func__);
 for (int j = 0; j < 3; j++) {
   BKE_curve_forward_diff_bezier(prevbezt->vec[1][j],
 prevbezt->vec[2][j],
@@ -397,8 +395,9 @@ static void gpencil_convert_spline(Main *bmain,
 
 gpencil_add_new_points(
 gps, coord_array, radius_start, radius_end, init, resolu, init_co, 
last);
+
 /* Free memory. */
-MEM_SAFE_FREE(coord_array);
+MEM_freeN(coord_array);
 
 /* As the last point of segment is the first point of next segment, 
back one array
  * element to avoid duplicated points on the same location.
@@ -419,7 +418,7 @@ static void gpencil_convert_spline(Main *bmain,
   nurb_points = (nu->pntsu - 1) * resolu;
 }
 /* Get all curve points. */
-coord_array = MEM_callocN(sizeof(float[3]) * nurb_points, __func__);
+float *coord_array = MEM_callocN(sizeof(float[3]) * nurb_points, 
__func__);
 BKE_nurb_makeCurve(nu, coord_array, NULL, NULL, NULL, resolu, 
sizeof(float[3]));
 
 /* Allocate memory for storage points. */
@@ -429,7 +428,7 @@ static void gpencil_convert_spline(Main *bmain,
 /* Add points. */
 gpencil_add_new_points(gps, coord_array, 1.0f, 1.0f, 0, 
gps->totpoints, init_co, false);
 
-MEM_SAFE_FREE(coord_array);
+MEM_freeN(coord_array);
   }
   break;
 }
diff --git a/source/blender/geometry/intern/uv_parametrizer.cc 
b/source/blender/geometry/intern/uv_parametrizer.cc
index 27e6ea642f6..ab2cca5d71e 100644
--- a/source/blender/geometry/intern/uv_parametrizer.cc
+++ b/source/blender/geometry/intern/uv_parametrizer.cc
@@ -219,8 +219,8 @@ static void phash_delete(PHash *ph)
 {
   if (ph) {
 MEM_SAFE_FREE(ph->buckets);
+MEM_freeN(ph);
   }
-  MEM_SAFE_FREE(ph);
 }
 
 static int phash_size(PHash *ph)
@@ -873,7 +873,7 @@ static int p_connect_pairs(ParamHandle *handle, bool 
topology_from_uvs)
 ncharts++;
   }
 
-  MEM_SAFE_FREE(stackbase);
+  MEM_freeN(stackbase);
 
   return ncharts;
 }
@@ -3495,8 +3495,8 @@ static bool p_chart_convex_hull(PChart *chart, PVert 
***r_verts, int *r_nverts,
   *r_nverts = npoints;
   *r_right = ulen - 1;
 
-  MEM_SAFE_FREE(U);
-  MEM_SAFE_FREE(L);
+  MEM_freeN(U);
+  MEM_freeN(L);
 
   return true;
 }
@@ -3644,8 +3644,8 @@ static float p_chart_minimum_area_angle(PChart *chart)
 minangle -= (float)M_PI_2;
   }
 
-  MEM_SAFE_FREE(angles);
-  MEM_SAFE_FREE(points);
+  MEM_freeN(angles);
+  MEM_freeN(points);
 
   return minangle;
 }
@@ -3716,7 +3716,7 @@ void GEO_uv_parametrizer_delete(ParamHandle *phandle)
   param_assert(ELEM(phandle->state, PHANDLE_STATE_ALLOCATED, 
PHANDLE_STATE_CONSTRUCTED));
 
   for (int i = 0; i < phandle->ncharts; i++) {
-MEM_SAFE_FREE(phandle->charts[i]);
+MEM_freeN(phandle->charts[i]);
   }
 
   MEM_SAFE_FREE(phandle->charts);
@@ -3943,7 +3943,8 @@ void GEO_uv_parametrizer_construct_end(ParamHandle 
*phandle,
   phandle->ncharts = p_connect_pairs(phandle, topology_from_uvs);
   phandle->charts = p_split_charts(phandle, chart, phandle->ncharts);
 
-  MEM_SAFE_FREE(phandle->construction_chart);
+  MEM_freeN(phandle->construction_chart);
+  phandle->construction_chart = nullptr;
 
   phash_delete(phandle->hash_verts);
   phash_delete(phandle->hash_edges);
@@ -3957,7 +3958,7 @@ void GEO_uv_parametrizer_construct_end(ParamHandle 
*phandle,
 p_chart_boundaries(chart, );
 
 if (!topology_from_uvs && chart->nboundaries == 0) {
-  MEM_SAFE_FREE(chart);
+  

[Bf-blender-cvs] [32c8a28720c] master: Cleanup: spelling in comments

2022-08-10 Thread Campbell Barton
Commit: 32c8a28720cba0202fcc1ce679e6b54401d8d6b4
Author: Campbell Barton
Date:   Thu Aug 11 09:44:33 2022 +1000
Branches: master
https://developer.blender.org/rB32c8a28720cba0202fcc1ce679e6b54401d8d6b4

Cleanup: spelling in comments

===

M   source/blender/blenkernel/BKE_idtype.h
M   source/blender/blenkernel/intern/cryptomatte_test.cc
M   source/blender/compositor/operations/COM_MovieClipOperation.cc
M   source/blender/compositor/realtime_compositor/intern/shader_operation.cc
M   source/blender/depsgraph/intern/node/deg_node_operation.cc
M   source/blender/draw/intern/draw_shader_shared.h
M   source/blender/gpu/metal/mtl_query.mm
M   source/blender/imbuf/IMB_imbuf_types.h
M   source/blender/makesdna/DNA_node_types.h

===

diff --git a/source/blender/blenkernel/BKE_idtype.h 
b/source/blender/blenkernel/BKE_idtype.h
index 30f7ed45859..ec8d6f76a0b 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -109,7 +109,7 @@ typedef struct IDTypeInfo {
*/
   short id_code;
   /**
-   * Bitflag matching id_code, used for filtering (e.g. in file browser), see 
DNA_ID.h's
+   * Bit-flag matching id_code, used for filtering (e.g. in file browser), see 
DNA_ID.h's
* FILTER_ID_XX enums.
*/
   uint64_t id_filter;
diff --git a/source/blender/blenkernel/intern/cryptomatte_test.cc 
b/source/blender/blenkernel/intern/cryptomatte_test.cc
index 2f15242b4a4..bb09b276645 100644
--- a/source/blender/blenkernel/intern/cryptomatte_test.cc
+++ b/source/blender/blenkernel/intern/cryptomatte_test.cc
@@ -163,7 +163,7 @@ TEST(cryptomatte, session_from_stamp_data)
  * best as possible. */
 TEST(cryptomatte, parsing_malformed_manifests)
 {
-  /* Manifest from multilayer.exr in the cryptomatte git-repository. */
+  /* Manifest from `multilayer.exr` in the cryptomatte git-repository. */
   test_cryptomatte_manifest(
   
R"({"/obj/instance1:instances:0":"0d54c6cc","/obj/instance1:instances:1":"293d9340","/obj/instance1:instances:110":"ccb9e1f2","/obj/instance1:instances:111":"f8dd3a48","/obj/instance1:instances:112":"a99e07a8","/obj/instance1:instances:113":"e75599a4","/obj/instance1:instances:114":"794200f3","/obj/instance1:instances:115":"2a3a1728","/obj/instance1:instances:116":"478544a1","/obj/instance1:instances:117":"b2bd969a","/obj/instance1:instances:10":"3a0c8681","/obj/instance1:instances
 [...]
   
R"({"\/obj\/box:polygons:1":"9d416418","\/obj\/instance1:instances:0":"0d54c6cc","\/obj\/instance1:instances:1":"293d9340","\/obj\/instance1:instances:10":"3a0c8681","\/obj\/instance1:instances:100":"2dcd2966","\/obj\/instance1:instances:101":"9331cd82","\/obj\/instance1:instances:102":"df50fccb","\/obj\/instance1:instances:103":"97f8590d","\/obj\/instance1:instances:104":"bbcd220d","\/obj\/instance1:instances:105":"4ae06139","\/obj\/instance1:instances:106":"8873d5ea","\/obj\/inst
 [...]
diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cc 
b/source/blender/compositor/operations/COM_MovieClipOperation.cc
index d7cf41cf422..b62d972e807 100644
--- a/source/blender/compositor/operations/COM_MovieClipOperation.cc
+++ b/source/blender/compositor/operations/COM_MovieClipOperation.cc
@@ -74,7 +74,7 @@ void MovieClipBaseOperation::execute_pixel_sampled(float 
output[4],
 zero_v4(output);
   }
   else if (ibuf->rect == nullptr && ibuf->rect_float == nullptr) {
-/* Happens for multilayer exr, i.e. */
+/* Happens for multi-layer EXR, i.e. */
 zero_v4(output);
   }
   else {
diff --git 
a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc 
b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc
index 931d417acad..a097c81a4c5 100644
--- a/source/blender/compositor/realtime_compositor/intern/shader_operation.cc
+++ b/source/blender/compositor/realtime_compositor/intern/shader_operation.cc
@@ -225,8 +225,8 @@ void ShaderOperation::declare_operation_input(DInputSocket 
input_socket,
 
   /* Add a new GPU attribute representing an input to the GPU material. 
Instead of using the
* attribute directly, we link it to an appropriate set function and use its 
output link instead.
-   * This is needed because the gputype member of the attribute is only 
initialized if it is linked
-   * to a GPU node. */
+   * This is needed because the `gputype` member of the attribute is only 
initialized if it is
+   * linked to a GPU node. */
   GPUNodeLink *attribute_link;
   GPU_link(material,
get_set_function_name(input_descriptor.type),
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc 
b/source/blender/depsgraph/intern/node/deg_node_operation.cc
index 65adfded6b3..016af735fcf 100644
--- a/source/blender/depsgraph/intern/node/deg_node_operation.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc
@@ -227,7 

[Bf-blender-cvs] [4641d6d7b01] master: Cleanup: check if the camera was moved before auto-key in smooth-view

2022-08-10 Thread Campbell Barton
Commit: 4641d6d7b0199b9df765141e00af4ce86155de82
Author: Campbell Barton
Date:   Thu Aug 11 10:31:50 2022 +1000
Branches: master
https://developer.blender.org/rB4641d6d7b0199b9df765141e00af4ce86155de82

Cleanup: check if the camera was moved before auto-key in smooth-view

There is no need to attempt to auto-key when the camera isn't moved.

===

M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/view3d_navigate_smoothview.c

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index e3fb8fcd433..bb95ea97c1c 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -1171,7 +1171,7 @@ void ED_view3d_camera_lock_init(const struct Depsgraph 
*depsgraph,
  *
  * Apply the 3D Viewport transformation back to the camera object.
  *
- * \return true if the camera is moved.
+ * \return true if the camera (or one of it's parents) was moved.
  */
 bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph,
 struct View3D *v3d,
diff --git a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c 
b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
index 9c7d493c76d..6b150d1e771 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c
@@ -410,9 +410,10 @@ static void view3d_smoothview_apply_with_interp(
   v3d->lens = interpf(sms->dst.lens, sms->src.lens, factor);
 
   const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
-  ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d);
-  if (use_autokey) {
-ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true);
+  if (ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d)) {
+if (use_autokey) {
+  ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true);
+}
   }
 }
 
@@ -436,8 +437,9 @@ static void view3d_smoothview_apply_and_finish(bContext *C, 
View3D *v3d, RegionV
 
 view3d_smooth_view_state_restore(>dst, v3d, rv3d);
 
-ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d);
-ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true);
+if (ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d)) {
+  ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true);
+}
   }
 
   if ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ROTATION) == 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] [d1e2988a12d] master: Cleanup: missing newline in GHOST_PRINT

2022-08-10 Thread Campbell Barton
Commit: d1e2988a12d1914fc38b29ca347d6b7949bd5513
Author: Campbell Barton
Date:   Thu Aug 11 10:58:41 2022 +1000
Branches: master
https://developer.blender.org/rBd1e2988a12d1914fc38b29ca347d6b7949bd5513

Cleanup: missing newline in GHOST_PRINT

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index af841d16dc6..954e7167279 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -2489,7 +2489,7 @@ static void xdg_output_handle_logical_size(void *data,
  * done (we can't match exactly because fractional scaling can't be
  * detected otherwise), then override if necessary. */
 if ((output->size_logical[0] == width) && (output->scale_fractional == 
wl_fixed_from_int(1))) {
-  GHOST_PRINT("xdg_output scale did not match, overriding with wl_output 
scale");
+  GHOST_PRINT("xdg_output scale did not match, overriding with wl_output 
scale\n");
 
 #ifdef USE_GNOME_CONFINE_HACK
   /* Use a bug in GNOME to check GNOME is in use. If the bug is fixed this 
won't cause an issue

___
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] [07deb9a71bb] master: Cleanup: replace magic number

2022-08-10 Thread Campbell Barton
Commit: 07deb9a71bbaa7b67341225e678a9919710880c7
Author: Campbell Barton
Date:   Thu Aug 11 09:52:49 2022 +1000
Branches: master
https://developer.blender.org/rB07deb9a71bbaa7b67341225e678a9919710880c7

Cleanup: replace magic number

===

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

===

diff --git a/source/blender/makesrna/intern/rna_action.c 
b/source/blender/makesrna/intern/rna_action.c
index bcfb646ca19..14f4a82c62b 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -177,7 +177,7 @@ static void rna_Action_fcurve_clear(bAction *act)
 static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[])
 {
   TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
-  marker->flag = 1;
+  marker->flag = SELECT;
   marker->frame = 1;
   BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
   BLI_addtail(>markers, marker);

___
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] [d68018cf105] master: License headers: add missing license header

2022-08-10 Thread Campbell Barton
Commit: d68018cf10582dd81df4b61533c3da40e350ed58
Author: Campbell Barton
Date:   Thu Aug 11 09:35:02 2022 +1000
Branches: master
https://developer.blender.org/rBd68018cf10582dd81df4b61533c3da40e350ed58

License headers: add missing license header

===

M   source/blender/draw/intern/shaders/draw_debug_info.hh

===

diff --git a/source/blender/draw/intern/shaders/draw_debug_info.hh 
b/source/blender/draw/intern/shaders/draw_debug_info.hh
index 7fbbc858d61..893a5e537d9 100644
--- a/source/blender/draw/intern/shaders/draw_debug_info.hh
+++ b/source/blender/draw/intern/shaders/draw_debug_info.hh
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "gpu_shader_create_info.hh"

___
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] [0940b357552] temp-sculpt-brush-channel: temp-sculpt-brush-channel: Fix broken BrushMapping custom curves

2022-08-10 Thread Joseph Eagar
Commit: 0940b3575520b5d6ea84d374924e35efd76135cd
Author: Joseph Eagar
Date:   Wed Aug 10 16:31:38 2022 -0700
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rB0940b3575520b5d6ea84d374924e35efd76135cd

temp-sculpt-brush-channel: Fix broken BrushMapping custom curves

===

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

===

diff --git a/source/blender/makesrna/intern/rna_brush_channels.c 
b/source/blender/makesrna/intern/rna_brush_channels.c
index 2a5d6037c94..7c8762e55fa 100644
--- a/source/blender/makesrna/intern/rna_brush_channels.c
+++ b/source/blender/makesrna/intern/rna_brush_channels.c
@@ -275,6 +275,12 @@ PointerRNA rna_BrushCurve_curve_get(PointerRNA *ptr)
 {
   BrushCurve *curve = (BrushCurve *)ptr->data;
 
+  if (!curve->curve) {
+curve->curve = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+rctf bounds = {0.0f, 1.0f, 0.0f, 1.0f};
+BKE_curvemap_reset(curve->curve->cm, , CURVE_PRESET_LINE, 
CURVEMAP_SLOPE_POSITIVE);
+  }
+
   return rna_pointer_inherit_refine(ptr, _CurveMapping, curve->curve);
 }

___
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] [efaade3b30f] temp-sculpt-brush-channel: temp-sculpt-brush-channel: Add missing RNA callbacks

2022-08-10 Thread Joseph Eagar
Commit: efaade3b30f111227dd9ec9623093ce94f3ae529
Author: Joseph Eagar
Date:   Wed Aug 10 16:22:58 2022 -0700
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rBefaade3b30f111227dd9ec9623093ce94f3ae529

temp-sculpt-brush-channel: Add missing RNA callbacks

the RNA properties for controlling brush property visibility
now properly sets their XXX_USER_SET flags.

Also rewrote a few comments.

===

M   source/blender/makesdna/DNA_brush_channel_types.h
M   source/blender/makesrna/intern/rna_brush_channels.c

===

diff --git a/source/blender/makesdna/DNA_brush_channel_types.h 
b/source/blender/makesdna/DNA_brush_channel_types.h
index ea333c519e4..d3aab68ef19 100644
--- a/source/blender/makesdna/DNA_brush_channel_types.h
+++ b/source/blender/makesdna/DNA_brush_channel_types.h
@@ -81,33 +81,23 @@ typedef struct BrushMapping {
 typedef struct BrushChannel {
   struct BrushChannel *next, *prev;
 
-  /** Channel id.  Avoid calling API methods that take strings directly.
-  There are API facilities to check channel idnames at compile time:
-  the BRUSHSET_XXX macros, SCULPT_get_XXX, etc.  On the C++ side
-  BrushChannelSetIF has accessor methods, e.g. BrushChannelSet::radius.
-  */
-  char idname[64];
+  char idname[64]; /* The RNA property name */
   char uiname[64]; /** user-friendly name */
   char *category;  /** category; if NULL, def->category will be used */
 
   struct BrushChannelType *def; /* Brush channel definition */
 
   /*
-Need to investigate whether we
-can use ID properties here.  ID properties
-don't support CurveMappings and do support
-things we don't want, like groups, strings and
-ID pointer properties.
-
-We could implement an ID property CurveMapping
-type and prevent the creation of group properties
-at the API level though.
+  Cached channel values.
   */
   float fvalue;/** floating point value */
   int ivalue;  /** stores integer, boolean, enum and bitmasks */
   float vector[4]; /* stores 3 and 4 component vectors */
+
+  /* For curve channels. */
   BrushCurve curve;
 
+  /* Input device mappings */
   BrushMapping mappings[7]; /* dimension should always be BRUSH_MAPPING_MAX */
 
   short type; /** eBrushChannelType */
@@ -120,7 +110,7 @@ typedef struct BrushChannelSet {
   ListBase channels;
   int channels_num, _pad[1];
 
-  void *channelmap; /** quick lookup ghash, maps idnames to brush channels */
+  void *channelmap; /** idname -> channel map. */
 } BrushChannelSet;
 
 #define BRUSH_CHANNEL_MAX_IDNAME sizeof(((BrushChannel){0}).idname)
@@ -134,11 +124,9 @@ typedef enum eBrushMappingFlags {
 
 /* BrushMapping->inherit_mode */
 typedef enum eBrushMappingInheritMode {
-  /* never inherit */
   BRUSH_MAPPING_INHERIT_NEVER,
-  /* always inherit */
   BRUSH_MAPPING_INHERIT_ALWAYS,
-  /* use channel's inheritance mode */
+  /* Use channel's inheritance mode. */
   BRUSH_MAPPING_INHERIT_CHANNEL
 } eBrushMappingInheritMode;
 
@@ -152,7 +140,7 @@ typedef enum eBrushMappingFunc {
   BRUSH_MAPFUNC_SQUARE, /* square wave */
 } eBrushMappingFunc;
 
-// mapping types
+/* Input device mapping types. */
 typedef enum eBrushMappingType {
   BRUSH_MAPPING_PRESSURE = 0,
   BRUSH_MAPPING_XTILT = 1,
@@ -168,7 +156,6 @@ BLI_STATIC_ASSERT(offsetof(BrushChannel, type) - 
offsetof(BrushChannel, mappings
   sizeof(BrushMapping) * BRUSH_MAPPING_MAX,
   "BrushChannel.mappings must == BRUSH_MAPPING_MAX");
 
-// BrushChannel->flag
 typedef enum eBrushChannelFlag {
   BRUSH_CHANNEL_INHERIT = 1 << 0,
   BRUSH_CHANNEL_INHERIT_IF_UNSET = 1 << 1,
@@ -187,11 +174,11 @@ typedef enum eBrushChannelFlag {
 typedef enum eBrushChannelUIFlag {
   BRUSH_CHANNEL_SHOW_IN_WORKSPACE = 1 << 0,
   /* Has user overriden this, used for version patching. */
-  BRUSH_CHANNEL_SHOW_IN_WORKSPACE_SET = 1 << 1,
+  BRUSH_CHANNEL_SHOW_IN_WORKSPACE_USER_SET = 1 << 1,
   BRUSH_CHANNEL_SHOW_IN_HEADER = 1 << 2,
-  BRUSH_CHANNEL_SHOW_IN_HEADER_SET = 1 << 3,
+  BRUSH_CHANNEL_SHOW_IN_HEADER_USER_SET = 1 << 3,
   BRUSH_CHANNEL_SHOW_IN_CONTEXT_MENU = 1 << 4,
-  BRUSH_CHANNEL_SHOW_IN_CONTEXT_MENU_SET = 1 << 5,
+  BRUSH_CHANNEL_SHOW_IN_CONTEXT_MENU_USER_SET = 1 << 5,
 } eBrushChannelUIFlag;
 
 // BrushChannelType->type
diff --git a/source/blender/makesrna/intern/rna_brush_channels.c 
b/source/blender/makesrna/intern/rna_brush_channels.c
index 89e6cecfee3..2a5d6037c94 100644
--- a/source/blender/makesrna/intern/rna_brush_channels.c
+++ b/source/blender/makesrna/intern/rna_brush_channels.c
@@ -55,7 +55,7 @@ static EnumPropertyItem null_enum[2] = {{0, "null", 
ICON_NONE, "null"}, {0, NULL
 
 #  include "RNA_access.h"
 
-#if 0
+#  if 0
 static void rna_brushchannel_update(Scene *scene, Brush *brush)
 {
 }
@@ -83,7 +83,7 @@ void rna_BrushChannel_update(Main *bmain, Scene *scene, 
PointerRNA *ptr)
   return;
   }
 }

[Bf-blender-cvs] [fb7ef40006b] master: Cleanup: refactoring uvislands to prepare for python api

2022-08-10 Thread Chris Blackbourn
Commit: fb7ef40006b938bab25f4bb60d8a23fc9ef2e8dc
Author: Chris Blackbourn
Date:   Thu Aug 11 11:20:00 2022 +1200
Branches: master
https://developer.blender.org/rBfb7ef40006b938bab25f4bb60d8a23fc9ef2e8dc

Cleanup: refactoring uvislands to prepare for python api

Add #bm_uv_ensure_head_table

See also: D15598

===

M   source/blender/blenkernel/BKE_mesh_mapping.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 2bc6289af85..455f42366cc 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -71,6 +71,9 @@ typedef struct UvElementMap {
   /* If Non-NULL, address UvElements by `BM_elem_index_get(BMVert*)`. */
   struct UvElement **vertex;
 
+  /* If Non-NULL, pointer to local head of each unique UV. */
+  struct UvElement **head_table;
+
   /* Number of Islands in the mesh */
   int totalIslands;
   /* Stores the starting index in buf where each island begins */
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index c446fb8b3e1..a0e20e4db8a 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -593,6 +593,31 @@ UvMapVert *BM_uv_vert_map_at_index(UvVertMap *vmap, uint v)
   return vmap->vert[v];
 }
 
+static void bm_uv_ensure_head_table(UvElementMap *element_map)
+{
+  if (element_map->head_table) {
+return;
+  }
+
+  /* For each UvElement, locate the "separate" UvElement that precedes it in 
the linked list. */
+  element_map->head_table = MEM_mallocN(sizeof(*element_map->head_table) * 
element_map->total_uvs,
+"uv_element_map_head_table");
+  UvElement **head_table = element_map->head_table;
+  for (int i = 0; i < element_map->total_uvs; i++) {
+UvElement *head = element_map->storage + i;
+if (head->separate) {
+  UvElement *element = head;
+  while (element) {
+head_table[element - element_map->storage] = head;
+element = element->next;
+if (element && element->separate) {
+  break;
+}
+  }
+}
+  }
+}
+
 #define INVALID_ISLAND ((unsigned int)-1)
 
 static void bm_uv_assign_island(UvElementMap *element_map,
@@ -620,23 +645,9 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
bool uv_selected,
int cd_loop_uv_offset)
 {
-  int total_uvs = element_map->total_uvs;
+  bm_uv_ensure_head_table(element_map);
 
-  /* For each UvElement, locate the "separate" UvElement that precedes it in 
the linked list. */
-  UvElement **head_table = MEM_mallocN(sizeof(*head_table) * total_uvs, 
"uv_island_head_table");
-  for (int i = 0; i < total_uvs; i++) {
-UvElement *head = element_map->storage + i;
-if (head->separate) {
-  UvElement *element = head;
-  while (element) {
-head_table[element - element_map->storage] = head;
-element = element->next;
-if (element && element->separate) {
-  break;
-}
-  }
-}
-  }
+  int total_uvs = element_map->total_uvs;
 
   /* Depth first search the graph, building islands as we go. */
   int nislands = 0;
@@ -676,7 +687,7 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
 if (!uv_selected || uvedit_edge_select_test(scene, element->l, 
cd_loop_uv_offset)) {
   UvElement *next = BM_uv_element_get(element_map, 
element->l->next->f, element->l->next);
   if (next->island == INVALID_ISLAND) {
-UvElement *tail = head_table[next - element_map->storage];
+UvElement *tail = element_map->head_table[next - 
element_map->storage];
 stack_uv[stacksize_uv++] = tail;
 while (tail) {
   bm_uv_assign_island(element_map, tail, nislands, map, islandbuf, 
islandbufsize++);
@@ -692,7 +703,7 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
 if (!uv_selected || uvedit_edge_select_test(scene, element->l->prev, 
cd_loop_uv_offset)) {
   UvElement *prev = BM_uv_element_get(element_map, 
element->l->prev->f, element->l->prev);
   if (prev->island == INVALID_ISLAND) {
-UvElement *tail = head_table[prev - element_map->storage];
+UvElement *tail = element_map->head_table[prev - 
element_map->storage];
 stack_uv[stacksize_uv++] = tail;
 while (tail) {
   bm_uv_assign_island(element_map, tail, nislands, map, islandbuf, 
islandbufsize++);
@@ -716,7 +727,7 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
   BLI_assert(islandbufsize == total_uvs);
 
   MEM_SAFE_FREE(stack_uv);
-  

[Bf-blender-cvs] [e19986482f1] master: Cleanup: reduce asan lint and clang-tidy warnings on uv_parametrizer

2022-08-10 Thread Chris Blackbourn
Commit: e19986482f1fdb546195b97d82ccff4c7ac44804
Author: Chris Blackbourn
Date:   Wed Aug 10 20:13:17 2022 +1200
Branches: master
https://developer.blender.org/rBe19986482f1fdb546195b97d82ccff4c7ac44804

Cleanup: reduce asan lint and clang-tidy warnings on uv_parametrizer

===

M   source/blender/geometry/GEO_uv_parametrizer.h
M   source/blender/geometry/intern/uv_parametrizer.cc

===

diff --git a/source/blender/geometry/GEO_uv_parametrizer.h 
b/source/blender/geometry/GEO_uv_parametrizer.h
index 5285aefbd4c..ff110f18ffb 100644
--- a/source/blender/geometry/GEO_uv_parametrizer.h
+++ b/source/blender/geometry/GEO_uv_parametrizer.h
@@ -13,8 +13,8 @@ extern "C" {
 #endif
 
 typedef struct ParamHandle ParamHandle; /* Handle to an array of charts. */
-typedef intptr_t ParamKey;  /* Key (hash) for identifying verts 
and faces. */
-#define PARAM_KEY_MAX INTPTR_MAX
+typedef uintptr_t ParamKey; /* Key (hash) for identifying verts 
and faces. */
+#define PARAM_KEY_MAX UINTPTR_MAX
 
 /*  */
 /** \name Chart Construction:
diff --git a/source/blender/geometry/intern/uv_parametrizer.cc 
b/source/blender/geometry/intern/uv_parametrizer.cc
index 26de4679768..27e6ea642f6 100644
--- a/source/blender/geometry/intern/uv_parametrizer.cc
+++ b/source/blender/geometry/intern/uv_parametrizer.cc
@@ -30,7 +30,7 @@
 
 /* Special Purpose Hash */
 
-typedef intptr_t PHashKey;
+typedef uintptr_t PHashKey;
 
 typedef struct PHashLink {
   struct PHashLink *next;
@@ -45,7 +45,7 @@ typedef struct PHash {
 
 /* Simplices */
 
-typedef struct PVert {
+struct PVert {
   struct PVert *nextlink;
 
   union PVertUnion {
@@ -58,9 +58,9 @@ typedef struct PVert {
   float co[3];
   float uv[2];
   uint flag;
-} PVert;
+};
 
-typedef struct PEdge {
+struct PEdge {
   struct PEdge *nextlink;
 
   union PEdgeUnion {
@@ -76,9 +76,9 @@ typedef struct PEdge {
   struct PFace *face;
   float *orig_uv, old_uv[2];
   uint flag;
-} PEdge;
+};
 
-typedef struct PFace {
+struct PFace {
   struct PFace *nextlink;
 
   union PFaceUnion {
@@ -89,8 +89,8 @@ typedef struct PFace {
   } u;
 
   struct PEdge *edge;
-  uchar flag;
-} PFace;
+  uint flag;
+};
 
 enum PVertFlag {
   PVERT_PIN = 1,
@@ -123,7 +123,7 @@ enum PFaceFlag {
 
 /* Chart */
 
-typedef struct PChart {
+struct PChart {
   PVert *verts;
   PEdge *edges;
   PFace *faces;
@@ -151,7 +151,7 @@ typedef struct PChart {
   } u;
 
   bool has_pins;
-} PChart;
+};
 
 enum PHandleState {
   PHANDLE_STATE_ALLOCATED,
@@ -160,7 +160,7 @@ enum PHandleState {
   PHANDLE_STATE_STRETCH,
 };
 
-typedef struct ParamHandle {
+struct ParamHandle {
   enum PHandleState state;
   MemArena *arena;
   MemArena *polyfill_arena;
@@ -181,7 +181,7 @@ typedef struct ParamHandle {
 
   RNG *rng;
   float blend;
-} ParamHandle;
+};
 
 /* PHash
  * - special purpose hash that keeps all its elements in a single linked list.
@@ -3684,9 +3684,9 @@ static void p_chart_rotate_fit_aabb(PChart *chart)
 
 /* Exported */
 
-ParamHandle *GEO_uv_parametrizer_construct_begin(void)
+ParamHandle *GEO_uv_parametrizer_construct_begin()
 {
-  ParamHandle *handle = (ParamHandle *)MEM_callocN(sizeof(*handle), 
"ParamHandle");
+  ParamHandle *handle = new ParamHandle();
   handle->construction_chart = (PChart *)MEM_callocN(sizeof(PChart), "PChart");
   handle->state = PHANDLE_STATE_ALLOCATED;
   handle->arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "param construct 
arena");
@@ -3710,6 +3710,9 @@ void GEO_uv_parametrizer_aspect_ratio(ParamHandle 
*phandle, float aspx, float as
 
 void GEO_uv_parametrizer_delete(ParamHandle *phandle)
 {
+  if (!phandle) {
+return;
+  }
   param_assert(ELEM(phandle->state, PHANDLE_STATE_ALLOCATED, 
PHANDLE_STATE_CONSTRUCTED));
 
   for (int i = 0; i < phandle->ncharts; i++) {
@@ -3738,7 +3741,7 @@ void GEO_uv_parametrizer_delete(ParamHandle *phandle)
 phandle->rng = NULL;
   }
 
-  MEM_freeN(phandle);
+  delete phandle;
 }
 
 typedef struct GeoUVPinIndex {

___
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] [4c3cf3ad17e] temp-sculpt-brush-channel: temp-sculpt-brush-channel: Better unified property api and api cleanup

2022-08-10 Thread Joseph Eagar
Commit: 4c3cf3ad17e6238f2a349d4c2f9ded4280ad4768
Author: Joseph Eagar
Date:   Wed Aug 10 16:11:05 2022 -0700
Branches: temp-sculpt-brush-channel
https://developer.blender.org/rB4c3cf3ad17e6238f2a349d4c2f9ded4280ad4768

temp-sculpt-brush-channel: Better unified property api and api cleanup

* There are now API functions to directly evaluate brush channel
  values from their underlying RNA.
* New API functions to evaluate unified channels; currently used
  in BKE_brush_size_get/set and BKE_brush_alpha_get/set.
* Removed _channelset_ from API functions that operator on a higher
  level.  So BKE_brush_channelset_rna_int_get turned into
  BKE_brush_int_get, similar for BKE_brush_int_get_unified.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/blenkernel/BKE_brush_channel.h
M   source/blender/blenkernel/intern/brush.cc
M   source/blender/blenkernel/intern/brush_channel.cc
M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/editors/sculpt_paint/paint_ops.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/makesdna/DNA_brush_channel_types.h
M   source/blender/makesrna/intern/rna_brush_channels.c
M   source/blender/makesrna/intern/rna_path.cc

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index d08efc6909b..bfc3b87f958 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4669,18 +4669,26 @@ def km_curve(params):
 
 def radial_control_properties(paint, prop, secondary_prop, 
secondary_rotation=False, color=False, zoom=False):
 brush_path = 'tool_settings.' + paint + '.brush'
-unified_path = 'tool_settings.unified_paint_settings'
+unified_path = 'tool_settings.unified_properties'
+channel_path = 'tool_settings.unified_channels'
 rotation = 'mask_texture_slot.angle' if secondary_rotation else 
'texture_slot.angle'
+
+def idprop(key):
+return '["%s"]' % key
+
+def rnaprop(key):
+return "." + key
+
 return {
 "properties": [
 ("data_path_primary", brush_path + '.' + prop),
-("data_path_secondary", unified_path + '.' + prop if 
secondary_prop else ''),
-("use_secondary", unified_path + '.' + secondary_prop if 
secondary_prop else ''),
-("rotation_path", brush_path + '.' + rotation),
-("color_path", brush_path + '.cursor_color_add'),
-("fill_color_path", brush_path + '.color' if color else ''),
-("fill_color_override_path", unified_path + '.color' if color else 
''),
-("fill_color_override_test_path", unified_path + 
'.use_unified_color' if color else ''),
+("data_path_secondary", unified_path + idprop(prop) if 
secondary_prop else ''),
+("use_secondary", channel_path + idprop(prop) + '.unified' if 
secondary_prop else ''),
+("rotation_path", brush_path + rnaprop(rotation)),
+("color_path", brush_path + rnaprop('cursor_color_add')),
+("fill_color_path", brush_path + rnaprop('color') if color else 
''),
+("fill_color_override_path", unified_path + idprop('color') if 
color else ''),
+("fill_color_override_test_path", channel_path + idprop('color') + 
'.unified' if color else ''),
 ("zoom_path", 'space_data.zoom' if zoom else ''),
 ("image_id", brush_path + ''),
 ("secondary_tex", secondary_rotation),
diff --git a/source/blender/blenkernel/BKE_brush_channel.h 
b/source/blender/blenkernel/BKE_brush_channel.h
index 5eaede4c6e3..008b72cbf48 100644
--- a/source/blender/blenkernel/BKE_brush_channel.h
+++ b/source/blender/blenkernel/BKE_brush_channel.h
@@ -36,11 +36,20 @@ a logical parameter with a type, input settings (e.g. pen),
 a falloff curve, etc.
 
 Brush channels have a concept of inheritance.  There is a
-BrushChannelSet (collection of channels) in Sculpt,
-in Brush, and in BrushCommand.  Inheritence behavior
-is controller via BrushChannel->flag.
+BrushChannelSet (collection of channels) in ToolSettings,
+and in Brush (Brush.channels and ToolSettings.unified_channels).
+Unified properties are stored in ToolSettings.unified_properties
+as IDProperties.
+
+Note: Many API functions start with an underscore.  These functions
+support compile-time property name checking.  This is done via macros;
+if you call the function without the underscore you'll go through a macro
+that will transform the property name into a global variable.  If that
+global variable does not exist you'll get an error.
+
+For example `BKE_brush_channelset_lookup(chset, size)` 

[Bf-blender-cvs] [13c5f6e08ff] master: Cleanup: refactoring uvislands to prepare for python api

2022-08-10 Thread Chris Blackbourn
Commit: 13c5f6e08ff783b2bf8060e36b73affa28a5e7ac
Author: Chris Blackbourn
Date:   Wed Aug 10 20:13:17 2022 +1200
Branches: master
https://developer.blender.org/rB13c5f6e08ff783b2bf8060e36b73affa28a5e7ac

Cleanup: refactoring uvislands to prepare for python api

Migrate island calculation to #bm_uv_build_islands.
Simplify connectedness calculation.
Reduce memory pressure.
No functional changes.

See also: D15598

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index 208022326d3..c446fb8b3e1 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -721,6 +721,120 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
   return nislands;
 }
 
+static void bm_uv_build_islands(UvElementMap *element_map,
+BMesh *bm,
+const Scene *scene,
+bool uv_selected)
+{
+  int totuv = element_map->total_uvs;
+  int nislands = 0;
+  int islandbufsize = 0;
+
+  /* map holds the map from current vmap->buf to the new, sorted map */
+  uint *map = MEM_mallocN(sizeof(*map) * totuv, "uvelement_remap");
+  BMFace **stack = MEM_mallocN(sizeof(*stack) * bm->totface, 
"uv_island_face_stack");
+  UvElement *islandbuf = MEM_callocN(sizeof(*islandbuf) * totuv, 
"uvelement_island_buffer");
+  /* Island number for BMFaces. */
+  int *island_number = MEM_callocN(sizeof(*island_number) * bm->totface, 
"uv_island_number_face");
+  copy_vn_i(island_number, bm->totface, INVALID_ISLAND);
+
+  const int cd_loop_uv_offset = CustomData_get_offset(>ldata, CD_MLOOPUV);
+
+  const bool use_uv_edge_connectivity = scene->toolsettings->uv_flag & 
UV_SYNC_SELECTION ?
+scene->toolsettings->selectmode & 
SCE_SELECT_EDGE :
+scene->toolsettings->uv_selectmode 
& UV_SELECT_EDGE;
+  if (use_uv_edge_connectivity) {
+nislands = bm_uv_edge_select_build_islands(
+element_map, scene, islandbuf, map, uv_selected, cd_loop_uv_offset);
+islandbufsize = totuv;
+  }
+
+  for (int i = 0; i < totuv; i++) {
+if (element_map->storage[i].island == INVALID_ISLAND) {
+  int stacksize = 0;
+  element_map->storage[i].island = nislands;
+  stack[0] = element_map->storage[i].l->f;
+  island_number[BM_elem_index_get(stack[0])] = nislands;
+  stacksize = 1;
+
+  while (stacksize > 0) {
+BMFace *efa = stack[--stacksize];
+
+BMLoop *l;
+BMIter liter;
+BM_ITER_ELEM (l, , efa, BM_LOOPS_OF_FACE) {
+  if (uv_selected && !uvedit_uv_select_test(scene, l, 
cd_loop_uv_offset)) {
+continue;
+  }
+
+  UvElement *initelement = 
element_map->vertex[BM_elem_index_get(l->v)];
+
+  for (UvElement *element = initelement; element; element = 
element->next) {
+if (element->separate) {
+  initelement = element;
+}
+
+if (element->l->f == efa) {
+  /* found the uv corresponding to our face and vertex.
+   * Now fill it to the buffer */
+  bm_uv_assign_island(element_map, element, nislands, map, 
islandbuf, islandbufsize++);
+
+  for (element = initelement; element; element = element->next) {
+if (element->separate && element != initelement) {
+  break;
+}
+
+if (island_number[BM_elem_index_get(element->l->f)] == 
INVALID_ISLAND) {
+  stack[stacksize++] = element->l->f;
+  island_number[BM_elem_index_get(element->l->f)] = nislands;
+}
+  }
+  break;
+}
+  }
+}
+  }
+
+  nislands++;
+}
+  }
+
+  MEM_SAFE_FREE(island_number);
+
+  /* remap */
+  for (int i = 0; i < bm->totvert; i++) {
+/* important since we may do selection only. Some of these may be NULL */
+if (element_map->vertex[i]) {
+  element_map->vertex[i] = [map[element_map->vertex[i] - 
element_map->storage]];
+}
+  }
+
+  element_map->islandIndices = MEM_callocN(sizeof(*element_map->islandIndices) 
* nislands,
+   "UvElementMap_island_indices");
+  int j = 0;
+  for (int i = 0; i < totuv; i++) {
+UvElement *element = element_map->storage[i].next;
+if (element == NULL) {
+  islandbuf[map[i]].next = NULL;
+}
+else {
+  islandbuf[map[i]].next = [map[element - element_map->storage]];
+}
+
+if (islandbuf[i].island != j) {
+  j++;
+  element_map->islandIndices[j] = i;
+}
+  }
+
+  MEM_SAFE_FREE(element_map->storage);
+  element_map->storage = islandbuf;
+  islandbuf = 

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

2022-08-10 Thread Aras Pranckevicius
Commit: bb3174e15b63809c733b3a1cc39f05bee5042ed3
Author: Aras Pranckevicius
Date:   Wed Aug 10 18:06:13 2022 +0300
Branches: master
https://developer.blender.org/rBbb3174e15b63809c733b3a1cc39f05bee5042ed3

Merge branch 'blender-v3.3-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] [8c59b93505b] blender-v3.3-release: obj: Also find .mtl images by their basename, if all else fails (T77801)

2022-08-10 Thread Aras Pranckevicius
Commit: 8c59b93505b3066c3fd8aac121d08395eb197307
Author: Aras Pranckevicius
Date:   Wed Aug 10 18:03:27 2022 +0300
Branches: blender-v3.3-release
https://developer.blender.org/rB8c59b93505b3066c3fd8aac121d08395eb197307

obj: Also find .mtl images by their basename, if all else fails (T77801)

While T77801 itself is working as expected in the new C++ obj
importer, the repro file there uses absolute paths to material images,
yet the images themselves are right there in the current folder.

The old python based importer did find them, since it was doing a
really complex image search. My understanding is that while C++
importer was developed, it was decided to not do that -- however
just the "basename file in the mtl directory" sounds simple enough
and gets the repro case file work correctly.

===

M   source/blender/io/wavefront_obj/importer/obj_import_mtl.cc

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
index 0023d1159c5..27bb5aa0d71 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
@@ -134,6 +134,14 @@ static Image *load_texture_image(Main *bmain,
   return image;
 }
   }
+  /* Try taking just the basename from input path. */
+  std::string base_path{tex_map.mtl_dir_path + 
BLI_path_basename(tex_map.image_path.c_str())};
+  if (base_path != tex_path) {
+image = load_image_at_path(bmain, base_path, relative_paths);
+if (image != nullptr) {
+  return image;
+}
+  }
 
   image = create_placeholder_image(bmain, tex_path);
   return image;

___
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] [5689dda6f76] master: Compositor: Limit C linkage of cryptomatte functions

2022-08-10 Thread Omar Emara
Commit: 5689dda6f766b0a49c235ed917d113e2bfdab7a4
Author: Omar Emara
Date:   Wed Aug 10 14:58:51 2022 +0200
Branches: master
https://developer.blender.org/rB5689dda6f766b0a49c235ed917d113e2bfdab7a4

Compositor: Limit C linkage of cryptomatte functions

Most of the functions in the compositor cryptomatte file are declared
with extern "C" linkage, which can cause symbol conflict even when
functions exist in separate namespaces. This is not actually necessary,
as the declaration of the few functions that require C linkage are
already declared as such in the header file, so this patch removes the
extern C scope from that file.

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

Reviewed By: Clement Foucault

===

M   source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc 
b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
index a00f6fd4fcd..7e5544381a4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
@@ -107,7 +107,6 @@ static blender::bke::cryptomatte::CryptomatteSessionPtr 
cryptomatte_init_from_no
   return session;
 }
 
-extern "C" {
 static CryptomatteEntry *cryptomatte_find(const NodeCryptomatte , float 
encoded_hash)
 {
   LISTBASE_FOREACH (CryptomatteEntry *, entry, ) {
@@ -428,4 +427,3 @@ void register_node_type_cmp_cryptomatte_legacy()
 }
 
 /** \} */
-}

___
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] [142ef237398] temp-eevee-next-cryptomatte: Added design comments.

2022-08-10 Thread Jeroen Bakker
Commit: 142ef23739894a356715f3d7950b8534f7da17a0
Author: Jeroen Bakker
Date:   Wed Aug 10 14:46:22 2022 +0200
Branches: temp-eevee-next-cryptomatte
https://developer.blender.org/rB142ef23739894a356715f3d7950b8534f7da17a0

Added design comments.

===

M   
source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl

===

diff --git 
a/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl 
b/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
index 2f2a9b2ee74..5699be9da23 100644
--- a/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
+++ b/source/blender/draw/engines/eevee_next/shaders/eevee_cryptomatte_lib.glsl
@@ -4,8 +4,19 @@ void film_store_cryptomatte_sample(FilmSample dst, int 
cryptomatte_layer_id, flo
 float weight = dst.weight;
 /*
 first need to detect the operation.
-- when hash exists it should be updated and can optionally be moved to 
a new position.
+- when hash exists it should be updated and can optionally be 
reinserted into a new position.
 - when hash doesn't exist we should find an insertion point. only 
samples to a null sample (hash 0, weight 0) should be moved. When no null 
sample exist it will remove the lowest weight.
+
+Second option would be to find the place to fit the sample. Doing the 
sorting in a separate shader
+pro is that the performance when adding samples. Sorting only happens 
once during
+final rendering. When using the viewport compositor this shader could 
be called
+as a post process for active layers. 
+
+perhaps in the viewport the first option would fit better. The second 
option
+is better for final rendering, but at that time performance is 
secondary.
+Technically the order of the samples don't matter that much, But it 
depends on how many
+cryptomatte nodes are used to make sorting more efficient.
+Would need some feedback from Beau/Andy on this subject.
   
 */
 int operation = 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] [27b9538e445] master: Realtime Compositor: Fix missing include in Displace node

2022-08-10 Thread Omar Emara
Commit: 27b9538e445d435c57fa2833579f0e4bbf618d79
Author: Omar Emara
Date:   Wed Aug 10 14:10:07 2022 +0200
Branches: master
https://developer.blender.org/rB27b9538e445d435c57fa2833579f0e4bbf618d79

Realtime Compositor: Fix missing include in Displace node

The displace node was missing an include, which sometimes compiled fine
due to unity builds. This patch adds that missing include.

===

M   source/blender/nodes/composite/nodes/node_composite_displace.cc

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.cc 
b/source/blender/nodes/composite/nodes/node_composite_displace.cc
index b4ba1dd5281..1049f2fa4a9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.cc
@@ -5,6 +5,8 @@
  * \ingroup cmpnodes
  */
 
+#include "COM_node_operation.hh"
+
 #include "node_composite_util.hh"
 
 /*  Displace   */

___
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] [95969073635] master: Realtime Compositor: Allow in material preview mode

2022-08-10 Thread Omar Emara
Commit: 95969073635df089d76ad85b3a66d20bbaf62fcd
Author: Omar Emara
Date:   Wed Aug 10 13:30:31 2022 +0200
Branches: master
https://developer.blender.org/rB95969073635df089d76ad85b3a66d20bbaf62fcd

Realtime Compositor: Allow in material preview mode

This patch allows the viewport compositor to operate in Material Preview
mode.

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

Reviewed By: Clement Foucault

===

M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index b965045a424..4693e5f8e20 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1226,7 +1226,7 @@ static bool is_compositor_enabled(void)
 return false;
   }
 
-  if (!(DST.draw_ctx.v3d->shading.type > OB_MATERIAL)) {
+  if (!(DST.draw_ctx.v3d->shading.type >= OB_MATERIAL)) {
 return 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] [f9589fab602] blender-v3.3-release: Render: remove camera shift hard limits

2022-08-10 Thread Brecht Van Lommel
Commit: f9589fab60243938934892e7588cb307351f7f66
Author: Brecht Van Lommel
Date:   Wed Aug 10 12:56:36 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBf9589fab60243938934892e7588cb307351f7f66

Render: remove camera shift hard limits

There is no need for these to be limited to -10..10, soft limits are enough.

Contributed by fundorin.

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_camera.c 
b/source/blender/makesrna/intern/rna_camera.c
index 99f8c263da6..988e65b4ba8 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -695,14 +695,12 @@ void RNA_def_camera(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_sdna(prop, NULL, "shiftx");
-  RNA_def_property_range(prop, -10.0f, 10.0f);
   RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
   RNA_def_property_ui_text(prop, "Shift X", "Camera horizontal shift");
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
 
   prop = RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_sdna(prop, NULL, "shifty");
-  RNA_def_property_range(prop, -10.0f, 10.0f);
   RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
   RNA_def_property_ui_text(prop, "Shift Y", "Camera vertical shift");
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");

___
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] [79953d54828] master: Realtime Compositor: Fix clang tidy warnings

2022-08-10 Thread Omar Emara
Commit: 79953d548281870a046c4d4babccedb446cdf00a
Author: Omar Emara
Date:   Wed Aug 10 13:04:36 2022 +0200
Branches: master
https://developer.blender.org/rB79953d548281870a046c4d4babccedb446cdf00a

Realtime Compositor: Fix clang tidy warnings

Fix a number of warnings reported by Clang Tidy in the realtime
compositor's code.

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

Reviewed By: Clement Foucault

===

M   source/blender/compositor/realtime_compositor/COM_operation.hh
M   
source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
M   
source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
M   source/blender/compositor/realtime_compositor/intern/evaluator.cc
M   source/blender/draw/engines/compositor/compositor_engine.cc
M   source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc

===

diff --git a/source/blender/compositor/realtime_compositor/COM_operation.hh 
b/source/blender/compositor/realtime_compositor/COM_operation.hh
index 4343401cefb..38518c00c04 100644
--- a/source/blender/compositor/realtime_compositor/COM_operation.hh
+++ b/source/blender/compositor/realtime_compositor/COM_operation.hh
@@ -146,7 +146,7 @@ class Operation {
   void declare_input_descriptor(StringRef identifier, InputDescriptor 
descriptor);
 
   /* Get a reference to the descriptor of the input identified by the given 
identified. */
-  InputDescriptor _input_descriptor(StringRef identified);
+  InputDescriptor _input_descriptor(StringRef identifier);
 
   /* Returns a reference to the compositor context. */
   Context ();
diff --git 
a/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
 
b/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
index 357a3f88bd9..5a842e16008 100644
--- 
a/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
+++ 
b/source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
@@ -35,7 +35,7 @@ class RealizeOnDomainOperation : public SimpleOperation {
   static SimpleOperation *construct_if_needed(Context ,
   const Result _result,
   const InputDescriptor 
_descriptor,
-  const Domain _domain);
+  const Domain _domain);
 
  protected:
   /* The operation domain is just the target domain. */
diff --git 
a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc 
b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
index e1b0814ccd7..d6bf74ffbee 100644
--- 
a/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
+++ 
b/source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
@@ -51,27 +51,32 @@ SimpleOperation 
*ConversionOperation::construct_if_needed(Context ,
 
   /* If the result type differs from the expected type, return an instance of 
an appropriate
* conversion operation. Otherwise, return a null pointer. */
+
   if (result_type == ResultType::Float && expected_type == ResultType::Vector) 
{
 return new ConvertFloatToVectorOperation(context);
   }
-  else if (result_type == ResultType::Float && expected_type == 
ResultType::Color) {
+
+  if (result_type == ResultType::Float && expected_type == ResultType::Color) {
 return new ConvertFloatToColorOperation(context);
   }
-  else if (result_type == ResultType::Color && expected_type == 
ResultType::Float) {
+
+  if (result_type == ResultType::Color && expected_type == ResultType::Float) {
 return new ConvertColorToFloatOperation(context);
   }
-  else if (result_type == ResultType::Color && expected_type == 
ResultType::Vector) {
+
+  if (result_type == ResultType::Color && expected_type == ResultType::Vector) 
{
 return new ConvertColorToVectorOperation(context);
   }
-  else if (result_type == ResultType::Vector && expected_type == 
ResultType::Float) {
+
+  if (result_type == ResultType::Vector && expected_type == ResultType::Float) 
{
 return new ConvertVectorToFloatOperation(context);
   }
-  else if (result_type == ResultType::Vector && expected_type == 
ResultType::Color) {
+
+  if (result_type == ResultType::Vector && expected_type == ResultType::Color) 
{
 return new ConvertVectorToColorOperation(context);
   }
-  else {
-return nullptr;
-  }
+
+  return nullptr;
 }
 
 /* 
-
diff --git a/source/blender/compositor/realtime_compositor/intern/evaluator.cc 
b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
index 597453baf21..d358389f2e9 100644
--- 

[Bf-blender-cvs] [089216067fa] master: Merge branch 'blender-v3.3-release'

2022-08-10 Thread Aras Pranckevicius
Commit: 089216067faa6c99d0282f9bae26f739d7e50ee9
Author: Aras Pranckevicius
Date:   Wed Aug 10 13:36:48 2022 +0300
Branches: master
https://developer.blender.org/rB089216067faa6c99d0282f9bae26f739d7e50ee9

Merge branch 'blender-v3.3-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] [d76583cb4a1] blender-v3.3-release: Fix T100302: New OBJ importer produces too many vertices when faces don't span a continuous range

2022-08-10 Thread Aras Pranckevicius
Commit: d76583cb4a16315c196f07f4acb9340f341bee47
Author: Aras Pranckevicius
Date:   Wed Aug 10 13:34:42 2022 +0300
Branches: blender-v3.3-release
https://developer.blender.org/rBd76583cb4a16315c196f07f4acb9340f341bee47

Fix T100302: New OBJ importer produces too many vertices when faces don't span 
a continuous range

As part of the previous fix (D15410), the importer got code to track
min & max vertex indices used as part of the mesh faces. However, if
faces refer to a "sparse" (i.e. non-contiguous) subset of all vertices,
then the imported mesh would contain all the vertices between min & max
range.

Replace that with proper tracking of actually used vertex indices
for each imported mesh. Fixes T100302.

This does affect import performance a tiny bit, e.g. importing Blender
3.0 splash scene goes 21.7s -> 22.1s, and importing rungholt.obj
goes 2.37s -> 2.48s.

Importer related tests have a bunch of vertex changes in them, since
now vertices are added in the order that the faces are referring
to them. Which incidentally matches the order that the Python based
importer was creating them too.

===

M   source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
M   source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
M   source/blender/io/wavefront_obj/importer/obj_import_objects.hh
M   source/blender/io/wavefront_obj/tests/obj_importer_tests.cc

===

diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 8594603867f..7069e1185e0 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -406,8 +406,7 @@ static void use_all_vertices_if_no_faces(Geometry *geom,
 all_geometries.begin(), all_geometries.end(), [](const 
std::unique_ptr ) {
   return g->get_vertex_count() == 0;
 })) {
-  geom->track_vertex_index(0);
-  geom->track_vertex_index(global_vertices.vertices.size() - 1);
+  geom->track_all_vertices(global_vertices.vertices.size());
 }
   }
 }
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc 
b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
index d7b2bc2e67c..e62470588ec 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
@@ -157,17 +157,17 @@ void MeshFromGeometry::fixup_invalid_faces()
 
 void MeshFromGeometry::create_vertices(Mesh *mesh)
 {
-  const int tot_verts_object{mesh_geometry_.get_vertex_count()};
-  for (int i = 0; i < tot_verts_object; ++i) {
-int vi = mesh_geometry_.vertex_index_min_ + i;
+  int mi = 0;
+  for (int vi : mesh_geometry_.vertices_) {
 if (vi < global_vertices_.vertices.size()) {
-  copy_v3_v3(mesh->mvert[i].co, global_vertices_.vertices[vi]);
+  copy_v3_v3(mesh->mvert[mi].co, global_vertices_.vertices[vi]);
 }
 else {
   std::cerr << "Vertex index:" << vi
 << " larger than total vertices:" << 
global_vertices_.vertices.size() << " ."
 << std::endl;
 }
+++mi;
   }
 }
 
@@ -208,7 +208,7 @@ void MeshFromGeometry::create_polys_loops(Mesh *mesh, bool 
use_vertex_groups)
   const PolyCorner _corner = 
mesh_geometry_.face_corners_[curr_face.start_index_ + idx];
   MLoop  = mesh->mloop[tot_loop_idx];
   tot_loop_idx++;
-  mloop.v = curr_corner.vert_index - mesh_geometry_.vertex_index_min_;
+  mloop.v = 
mesh_geometry_.global_to_local_vertices_.lookup_default(curr_corner.vert_index, 
0);
 
   /* Setup vertex group data, if needed. */
   if (!mesh->dvert) {
@@ -240,8 +240,8 @@ void MeshFromGeometry::create_edges(Mesh *mesh)
   for (int i = 0; i < tot_edges; ++i) {
 const MEdge _edge = mesh_geometry_.edges_[i];
 MEdge _edge = mesh->medge[i];
-dst_edge.v1 = src_edge.v1 - mesh_geometry_.vertex_index_min_;
-dst_edge.v2 = src_edge.v2 - mesh_geometry_.vertex_index_min_;
+dst_edge.v1 = 
mesh_geometry_.global_to_local_vertices_.lookup_default(src_edge.v1, 0);
+dst_edge.v2 = 
mesh_geometry_.global_to_local_vertices_.lookup_default(src_edge.v2, 0);
 BLI_assert(dst_edge.v1 < total_verts && dst_edge.v2 < total_verts);
 dst_edge.flag = ME_LOOSEEDGE;
   }
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_objects.hh 
b/source/blender/io/wavefront_obj/importer/obj_import_objects.hh
index 9f0079d7c53..f48b6dd55e8 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_objects.hh
+++ b/source/blender/io/wavefront_obj/importer/obj_import_objects.hh
@@ -9,6 +9,7 @@
 #include "BKE_lib_id.h"
 
 #include "BLI_map.hh"
+#include "BLI_math_base.hh"
 #include "BLI_math_vec_types.hh"
 #include "BLI_vector.hh"
 #include "BLI_vector_set.hh"
@@ 

[Bf-blender-cvs] [f12f7800c29] master: Depsgraph: Optimize evaluation of dependencies of disabled modifiers

2022-08-10 Thread Sergey Sharybin
Commit: f12f7800c2965c721a4eb4baeb6b1ab129bfa375
Author: Sergey Sharybin
Date:   Thu Aug 4 15:04:25 2022 +0200
Branches: master
https://developer.blender.org/rBf12f7800c2965c721a4eb4baeb6b1ab129bfa375

Depsgraph: Optimize evaluation of dependencies of disabled modifiers

Solves long-standing issue when dependencies of disabled modifiers are
evaluated.

Simple test case: no drivers or animation. Manually enabling modifier
is expected to bring FPS up, enabling modifier will bring FPS (sine
evaluation can not be avoided)

F13336690

More complex test case: modifier visibility is driven by an animated
property. In am ideal world FPS during property being zero is fast
and when property is 1 the FPS is low.

F13336691.

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

===

M   source/blender/depsgraph/intern/builder/deg_builder.cc
M   source/blender/depsgraph/intern/builder/deg_builder.h
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/depsgraph/intern/builder/deg_builder_rna.cc
M   source/blender/depsgraph/intern/depsgraph_relation.h
M   source/blender/depsgraph/intern/eval/deg_eval.cc
M   source/blender/depsgraph/intern/eval/deg_eval_visibility.cc
M   source/blender/depsgraph/intern/eval/deg_eval_visibility.h
M   source/blender/depsgraph/intern/node/deg_node_operation.cc
M   source/blender/depsgraph/intern/node/deg_node_operation.h

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc 
b/source/blender/depsgraph/intern/builder/deg_builder.cc
index 5353f71685c..097c377ece4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@ -13,6 +13,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_layer_types.h"
+#include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 
 #include "BLI_stack.h"
@@ -95,6 +96,24 @@ bool DepsgraphBuilder::is_object_visibility_animated(const 
Object *object)
   return cache_->isPropertyAnimated(>id, property_id);
 }
 
+bool DepsgraphBuilder::is_modifier_visibility_animated(const Object *object,
+   const ModifierData 
*modifier)
+{
+  AnimatedPropertyID property_id;
+  if (graph_->mode == DAG_EVAL_VIEWPORT) {
+property_id = AnimatedPropertyID(
+>id, _Modifier, (void *)modifier, "show_viewport");
+  }
+  else if (graph_->mode == DAG_EVAL_RENDER) {
+property_id = AnimatedPropertyID(>id, _Modifier, (void 
*)modifier, "show_render");
+  }
+  else {
+BLI_assert_msg(0, "Unknown evaluation mode.");
+return false;
+  }
+  return cache_->isPropertyAnimated(>id, property_id);
+}
+
 bool DepsgraphBuilder::check_pchan_has_bbone(const Object *object, const 
bPoseChannel *pchan)
 {
   BLI_assert(object->type == OB_ARMATURE);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.h 
b/source/blender/depsgraph/intern/builder/deg_builder.h
index c44e5fd5f4d..5d043f1fd3a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder.h
@@ -10,6 +10,7 @@
 struct Base;
 struct ID;
 struct Main;
+struct ModifierData;
 struct Object;
 struct bPoseChannel;
 
@@ -25,6 +26,7 @@ class DepsgraphBuilder {
   virtual bool need_pull_base_into_graph(const Base *base);
 
   virtual bool is_object_visibility_animated(const Object *object);
+  virtual bool is_modifier_visibility_animated(const Object *object, const 
ModifierData *modifier);
 
   virtual bool check_pchan_has_bbone(const Object *object, const bPoseChannel 
*pchan);
   virtual bool check_pchan_has_bbone_segments(const Object *object, const 
bPoseChannel *pchan);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 025b2cf21a8..dd62a6cdea2 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -879,9 +879,31 @@ void DepsgraphNodeBuilder::build_object_modifiers(Object 
*object)
 return;
   }
 
+  const ModifierMode modifier_mode = (graph_->mode == DAG_EVAL_VIEWPORT) ? 
eModifierMode_Realtime :
+   
eModifierMode_Render;
+
+  IDNode *id_node = find_id_node(>id);
+
+  add_operation_node(>id,
+ NodeType::GEOMETRY,
+ OperationCode::VISIBILITY,
+ [id_node](::Depsgraph *depsgraph) {
+   
deg_evaluate_object_modifiers_mode_node_visibility(depsgraph, id_node);
+ });
+
   LISTBASE_FOREACH (ModifierData *, modifier, >modifiers) {
-add_operation_node(
+

[Bf-blender-cvs] [54c26f58d02] master: Cleanup: Fix warning in release builds

2022-08-10 Thread Sergey Sharybin
Commit: 54c26f58d023be0471be6e6205ff91a624d87f6b
Author: Sergey Sharybin
Date:   Wed Aug 10 11:02:19 2022 +0200
Branches: master
https://developer.blender.org/rB54c26f58d023be0471be6e6205ff91a624d87f6b

Cleanup: Fix warning in release builds

===

M   source/blender/editors/space_outliner/tree/tree_element_overrides.cc

===

diff --git 
a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc 
b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
index e19459ced61..49cabd5117f 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -371,8 +371,7 @@ void OverrideRNAPathTreeBuilder::ensure_entire_collection(
 const char *coll_prop_path,
 short )
 {
-  AbstractTreeElement *abstract_parent = 
tree_element_cast(_to_expand);
-  BLI_assert(abstract_parent != nullptr);
+  BLI_assert(tree_element_cast(_to_expand) != nullptr);
 
   TreeElement *previous_te = nullptr;
   int item_idx = 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] [cfbe11563a5] master: Depsgrapg: Add per-modifier graph nodes

2022-08-10 Thread Sergey Sharybin
Commit: cfbe11563a5dfd39e5b765b986892382f6f4db99
Author: Sergey Sharybin
Date:   Thu Aug 4 11:52:42 2022 +0200
Branches: master
https://developer.blender.org/rBcfbe11563a5dfd39e5b765b986892382f6f4db99

Depsgrapg: Add per-modifier graph nodes

No functional changes expected.

===

M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.h
M   source/blender/depsgraph/intern/node/deg_node_operation.cc
M   source/blender/depsgraph/intern/node/deg_node_operation.h

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index be087c0b2d4..025b2cf21a8 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -769,11 +769,7 @@ void DepsgraphNodeBuilder::build_object(int base_index,
 build_object(-1, object->parent, DEG_ID_LINKED_INDIRECTLY, is_visible);
   }
   /* Modifiers. */
-  if (object->modifiers.first != nullptr) {
-BuilderWalkUserData data;
-data.builder = this;
-BKE_modifiers_foreach_ID_link(object, modifier_walk, );
-  }
+  build_object_modifiers(object);
   /* Grease Pencil Modifiers. */
   if (object->greasepencil_modifiers.first != nullptr) {
 BuilderWalkUserData data;
@@ -877,6 +873,22 @@ void 
DepsgraphNodeBuilder::build_object_instance_collection(Object *object, bool
   is_parent_collection_visible_ = is_current_parent_collection_visible;
 }
 
+void DepsgraphNodeBuilder::build_object_modifiers(Object *object)
+{
+  if (BLI_listbase_is_empty(>modifiers)) {
+return;
+  }
+
+  LISTBASE_FOREACH (ModifierData *, modifier, >modifiers) {
+add_operation_node(
+>id, NodeType::GEOMETRY, OperationCode::MODIFIER, nullptr, 
modifier->name);
+  }
+
+  BuilderWalkUserData data;
+  data.builder = this;
+  BKE_modifiers_foreach_ID_link(object, modifier_walk, );
+}
+
 void DepsgraphNodeBuilder::build_object_data(Object *object)
 {
   if (object->data == nullptr) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 18e28311132..d5ac601ebff 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -174,6 +174,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
   virtual void build_object_flags(int base_index,
   Object *object,
   eDepsNode_LinkedState_Type linked_state);
+  virtual void build_object_modifiers(Object *object);
   virtual void build_object_data(Object *object);
   virtual void build_object_data_camera(Object *object);
   virtual void build_object_data_geometry(Object *object);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index fc5e5189e82..8b51ed214a2 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -298,7 +298,8 @@ void 
DepsgraphRelationBuilder::add_depends_on_transform_relation(const DepsNodeH
 {
   IDNode *id_node = handle->node->owner->owner;
   ID *id = id_node->id_orig;
-  ComponentKey geometry_key(id, NodeType::GEOMETRY);
+  const OperationKey geometry_key(
+  id, NodeType::GEOMETRY, OperationCode::MODIFIER, 
handle->node->name.c_str());
   /* Wire up the actual relation. */
   add_depends_on_transform_relation(id, geometry_key, description);
 }
@@ -718,11 +719,7 @@ void DepsgraphRelationBuilder::build_object(Object *object)
   }
 
   /* Modifiers. */
-  if (object->modifiers.first != nullptr) {
-BuilderWalkUserData data;
-data.builder = this;
-BKE_modifiers_foreach_ID_link(object, modifier_walk, );
-  }
+  build_object_modifiers(object);
 
   /* Grease Pencil Modifiers. */
   if (object->greasepencil_modifiers.first != nullptr) {
@@ -870,6 +867,53 @@ void 
DepsgraphRelationBuilder::build_object_layer_component_relations(Object *ob
   add_relation(object_from_layer_exit_key, synchronize_key, "Synchronize to 
Original");
 }
 
+void DepsgraphRelationBuilder::build_object_modifiers(Object *object)
+{
+  if (BLI_listbase_is_empty(>modifiers)) {
+return;
+  }
+
+  const OperationKey eval_init_key(
+  >id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT);
+  const OperationKey eval_key(>id, NodeType::GEOMETRY, 
OperationCode::GEOMETRY_EVAL);
+
+  ModifierUpdateDepsgraphContext ctx = {};
+  ctx.scene = scene_;
+  ctx.object = object;
+
+  OperationKey previous_key = 

[Bf-blender-cvs] [fad112be1c6] master: Realtime Compositor: Add stub unsupported nodes

2022-08-10 Thread Omar Emara
Commit: fad112be1c6a06f6412b7c19379032008c733563
Author: Omar Emara
Date:   Wed Aug 10 10:36:57 2022 +0200
Branches: master
https://developer.blender.org/rBfad112be1c6a06f6412b7c19379032008c733563

Realtime Compositor: Add stub unsupported nodes

This patch adds a stub implementation for all unsupported nodes. The
inputs are passed through to the outputs where it make sense, while
other outputs will be allocated a single zero value.

This seems to be preferred by users as opposed to stopping execution and
displaying an error message.

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

Reviewed By: Clement Foucault

===

M   source/blender/compositor/realtime_compositor/intern/evaluator.cc
M   source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
M   source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc
M   source/blender/nodes/composite/nodes/node_composite_blur.cc
M   source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
M   source/blender/nodes/composite/nodes/node_composite_bokehimage.cc
M   
source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc
M   source/blender/nodes/composite/nodes/node_composite_cornerpin.cc
M   source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
M   source/blender/nodes/composite/nodes/node_composite_defocus.cc
M   source/blender/nodes/composite/nodes/node_composite_denoise.cc
M   source/blender/nodes/composite/nodes/node_composite_despeckle.cc
M   source/blender/nodes/composite/nodes/node_composite_dilate.cc
M   source/blender/nodes/composite/nodes/node_composite_directionalblur.cc
M   source/blender/nodes/composite/nodes/node_composite_displace.cc
M   source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc
M   source/blender/nodes/composite/nodes/node_composite_filter.cc
M   source/blender/nodes/composite/nodes/node_composite_glare.cc
M   source/blender/nodes/composite/nodes/node_composite_id_mask.cc
M   source/blender/nodes/composite/nodes/node_composite_inpaint.cc
M   source/blender/nodes/composite/nodes/node_composite_keying.cc
M   source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc
M   source/blender/nodes/composite/nodes/node_composite_levels.cc
M   source/blender/nodes/composite/nodes/node_composite_map_uv.cc
M   source/blender/nodes/composite/nodes/node_composite_mask.cc
M   source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
M   source/blender/nodes/composite/nodes/node_composite_normalize.cc
M   source/blender/nodes/composite/nodes/node_composite_output_file.cc
M   source/blender/nodes/composite/nodes/node_composite_pixelate.cc
M   source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc
M   source/blender/nodes/composite/nodes/node_composite_scale.cc
M   source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc
M   source/blender/nodes/composite/nodes/node_composite_sunbeams.cc
M   source/blender/nodes/composite/nodes/node_composite_texture.cc
M   source/blender/nodes/composite/nodes/node_composite_tonemap.cc
M   source/blender/nodes/composite/nodes/node_composite_trackpos.cc
M   source/blender/nodes/composite/nodes/node_composite_vec_blur.cc
M   source/blender/nodes/composite/nodes/node_composite_zcombine.cc

===

diff --git a/source/blender/compositor/realtime_compositor/intern/evaluator.cc 
b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
index d5cc7f3bc0b..597453baf21 100644
--- a/source/blender/compositor/realtime_compositor/intern/evaluator.cc
+++ b/source/blender/compositor/realtime_compositor/intern/evaluator.cc
@@ -62,22 +62,6 @@ bool Evaluator::validate_node_tree()
 return false;
   }
 
-  /* Find any of the unsupported nodes in the node tree. We only track one of 
them because we
-   * display a message for only one at a time to avoid long messages. */
-  DNode unsupported_node;
-  derived_node_tree_->foreach_node([&](DNode node) {
-if (!is_node_supported(node)) {
-  unsupported_node = node;
-}
-  });
-
-  /* unsupported_node is null if no unsupported node was found. */
-  if (unsupported_node) {
-std::string message = "Compositor node tree has an unsupported node: ";
-context_.set_info_message(message + unsupported_node->idname());
-return false;
-  }
-
   return true;
 }
 
diff --git 
a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc 
b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
index f45b678fc50..55fe3366526 100644
--- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
@@ -8,6 +8,8 @@
 #include "UI_interface.h"
 #include "UI_resources.h"
 

[Bf-blender-cvs] [40c45985a92] master: Realtime Compositor: Add basic distort nodes

2022-08-10 Thread Omar Emara
Commit: 40c45985a924e2e2310d5c51cf399150d557792c
Author: Omar Emara
Date:   Wed Aug 10 10:30:27 2022 +0200
Branches: master
https://developer.blender.org/rB40c45985a924e2e2310d5c51cf399150d557792c

Realtime Compositor: Add basic distort nodes

This patch implements the following nodes for the realtime compositor:

- Crop node.
- Flip node.
- Lens distort node.
- Rotate node.
- Transform node.
- Translate node.

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

Reviewed By: Clement Foucault

===

M   source/blender/gpu/CMakeLists.txt
A   source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl
A   source/blender/gpu/shaders/compositor/compositor_flip.glsl
A   source/blender/gpu/shaders/compositor/compositor_image_crop.glsl
A   
source/blender/gpu/shaders/compositor/compositor_projector_lens_distortion.glsl
A   
source/blender/gpu/shaders/compositor/compositor_screen_lens_distortion.glsl
A   
source/blender/gpu/shaders/compositor/infos/compositor_alpha_crop_info.hh
A   source/blender/gpu/shaders/compositor/infos/compositor_flip_info.hh
A   
source/blender/gpu/shaders/compositor/infos/compositor_image_crop_info.hh
A   
source/blender/gpu/shaders/compositor/infos/compositor_projector_lens_distortion_info.hh
A   
source/blender/gpu/shaders/compositor/infos/compositor_screen_lens_distortion_info.hh
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/composite/nodes/node_composite_crop.cc
M   source/blender/nodes/composite/nodes/node_composite_flip.cc
M   source/blender/nodes/composite/nodes/node_composite_lensdist.cc
M   source/blender/nodes/composite/nodes/node_composite_rotate.cc
M   source/blender/nodes/composite/nodes/node_composite_transform.cc
M   source/blender/nodes/composite/nodes/node_composite_translate.cc

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 0742ca6c9a8..ff12ae5054a 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -323,10 +323,15 @@ set(GLSL_SRC
   shaders/common/gpu_shader_common_math_utils.glsl
   shaders/common/gpu_shader_common_mix_rgb.glsl
 
+  shaders/compositor/compositor_alpha_crop.glsl
   shaders/compositor/compositor_box_mask.glsl
   shaders/compositor/compositor_convert.glsl
   shaders/compositor/compositor_ellipse_mask.glsl
+  shaders/compositor/compositor_flip.glsl
+  shaders/compositor/compositor_image_crop.glsl
+  shaders/compositor/compositor_projector_lens_distortion.glsl
   shaders/compositor/compositor_realize_on_domain.glsl
+  shaders/compositor/compositor_screen_lens_distortion.glsl
   shaders/compositor/compositor_set_alpha.glsl
   shaders/compositor/compositor_split_viewer.glsl
 
@@ -562,10 +567,15 @@ set(SRC_SHADER_CREATE_INFOS
   shaders/infos/gpu_shader_text_info.hh
   shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
 
+  shaders/compositor/infos/compositor_alpha_crop_info.hh
   shaders/compositor/infos/compositor_box_mask_info.hh
   shaders/compositor/infos/compositor_convert_info.hh
   shaders/compositor/infos/compositor_ellipse_mask_info.hh
+  shaders/compositor/infos/compositor_flip_info.hh
+  shaders/compositor/infos/compositor_image_crop_info.hh
+  shaders/compositor/infos/compositor_projector_lens_distortion_info.hh
   shaders/compositor/infos/compositor_realize_on_domain_info.hh
+  shaders/compositor/infos/compositor_screen_lens_distortion_info.hh
   shaders/compositor/infos/compositor_set_alpha_info.hh
   shaders/compositor/infos/compositor_split_viewer_info.hh
 )
diff --git a/source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl 
b/source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl
new file mode 100644
index 000..d55c8efd4c6
--- /dev/null
+++ b/source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl
@@ -0,0 +1,11 @@
+#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
+
+void main()
+{
+  ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
+  /* The lower bound is inclusive and upper bound is exclusive. */
+  bool is_inside = all(greaterThanEqual(texel, lower_bound)) && 
all(lessThan(texel, upper_bound));
+  /* Write the pixel color if it is inside the cropping region, otherwise, 
write zero. */
+  vec4 color = is_inside ? texture_load(input_tx, texel) : vec4(0.0);
+  imageStore(output_img, texel, color);
+}
diff --git a/source/blender/gpu/shaders/compositor/compositor_flip.glsl 
b/source/blender/gpu/shaders/compositor/compositor_flip.glsl
new file mode 100644
index 000..919c454ee63
--- /dev/null
+++ b/source/blender/gpu/shaders/compositor/compositor_flip.glsl
@@ -0,0 +1,15 @@
+#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
+
+void main()
+{
+  ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
+  ivec2 size = texture_size(input_tx);
+  ivec2 

[Bf-blender-cvs] [c014021802c] master: Realtime Compositor: Add basic matte nodes

2022-08-10 Thread Omar Emara
Commit: c014021802c323c3ed55c3c283717975a3d93edf
Author: Omar Emara
Date:   Wed Aug 10 10:21:18 2022 +0200
Branches: master
https://developer.blender.org/rBc014021802c323c3ed55c3c283717975a3d93edf

Realtime Compositor: Add basic matte nodes

This patch implements the following nodes for the realtime compositor:

- Box mask node.
- Channel matte node.
- Chroma matte node.
- Color matte node.
- Color spill node.
- Difference matte node.
- Distance matte node.
- Ellipse matte node.
- Luminance matte node.

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

Reviewed By: Clement Foucault

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/shaders/common/gpu_shader_common_math_utils.glsl
A   source/blender/gpu/shaders/compositor/compositor_box_mask.glsl
A   source/blender/gpu/shaders/compositor/compositor_ellipse_mask.glsl
A   source/blender/gpu/shaders/compositor/infos/compositor_box_mask_info.hh
A   
source/blender/gpu/shaders/compositor/infos/compositor_ellipse_mask_info.hh
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_matte.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_spill.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/composite/nodes/node_composite_boxmask.cc
M   source/blender/nodes/composite/nodes/node_composite_channel_matte.cc
M   source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
M   source/blender/nodes/composite/nodes/node_composite_color_matte.cc
M   source/blender/nodes/composite/nodes/node_composite_color_spill.cc
M   source/blender/nodes/composite/nodes/node_composite_diff_matte.cc
M   source/blender/nodes/composite/nodes/node_composite_distance_matte.cc
M   source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc
M   source/blender/nodes/composite/nodes/node_composite_luma_matte.cc

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 995771847c1..0742ca6c9a8 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -323,21 +323,30 @@ set(GLSL_SRC
   shaders/common/gpu_shader_common_math_utils.glsl
   shaders/common/gpu_shader_common_mix_rgb.glsl
 
+  shaders/compositor/compositor_box_mask.glsl
   shaders/compositor/compositor_convert.glsl
+  shaders/compositor/compositor_ellipse_mask.glsl
   shaders/compositor/compositor_realize_on_domain.glsl
   shaders/compositor/compositor_set_alpha.glsl
   shaders/compositor/compositor_split_viewer.glsl
 
   shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl
   shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
+  shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl
+  shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl
   shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
   shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
+  shaders/compositor/library/gpu_shader_compositor_color_matte.glsl
+  shaders/compositor/library/gpu_shader_compositor_color_spill.glsl
   shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl
+  shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl
+  shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl
   shaders/compositor/library/gpu_shader_compositor_exposure.glsl
   shaders/compositor/library/gpu_shader_compositor_gamma.glsl
   shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
   shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
   shaders/compositor/library/gpu_shader_compositor_invert.glsl
+  shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl
   shaders/compositor/library/gpu_shader_compositor_main.glsl
   shaders/compositor/library/gpu_shader_compositor_map_value.glsl
   shaders/compositor/library/gpu_shader_compositor_normal.glsl
@@ -553,7 +562,9 @@ set(SRC_SHADER_CREATE_INFOS
   shaders/infos/gpu_shader_text_info.hh
   shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
 
+  shaders/compositor/infos/compositor_box_mask_info.hh
   shaders/compositor/infos/compositor_convert_info.hh
+  shaders/compositor/infos/compositor_ellipse_mask_info.hh
   shaders/compositor/infos/compositor_realize_on_domain_info.hh
   

[Bf-blender-cvs] [b5df7a02ac7] master: Realtime Compositor: Add basic convert and vector nodes

2022-08-10 Thread Omar Emara
Commit: b5df7a02ac754de8e04fdeda4d1c3f0fcdf6a7a2
Author: Omar Emara
Date:   Wed Aug 10 10:09:35 2022 +0200
Branches: master
https://developer.blender.org/rBb5df7a02ac754de8e04fdeda4d1c3f0fcdf6a7a2

Realtime Compositor: Add basic convert and vector nodes

This patch implements the following nodes for the realtime compositor:

- Map range node.
- Map value node.
- Math node.
- Normal node.
- Alpha convert node.
- Separate color node.
- Combine color node.
- Separate XYZ node.
- Combine XYZ node.
- Separate RGBA node.
- Combine RGBA node.
- Separate HSVA node.
- Combine HSVA node.
- Separate YCCA node.
- Combine YUVA node.
- Set alpha node.
- Switch node.
- Switch view node.
- RGB to BW node.
- Color ramp node.

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

Reviewed By: Clement Foucault

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_map_value.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_normal.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/composite/CMakeLists.txt
M   source/blender/nodes/composite/nodes/node_composite_map_range.cc
M   source/blender/nodes/composite/nodes/node_composite_map_value.cc
M   source/blender/nodes/composite/nodes/node_composite_math.cc
M   source/blender/nodes/composite/nodes/node_composite_normal.cc
M   source/blender/nodes/composite/nodes/node_composite_premulkey.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_color.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_xyz.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc
M   source/blender/nodes/composite/nodes/node_composite_setalpha.cc
M   source/blender/nodes/composite/nodes/node_composite_switch.cc
M   source/blender/nodes/composite/nodes/node_composite_switchview.cc
M   source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 9c7fb8f290f..995771847c1 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -332,13 +332,18 @@ set(GLSL_SRC
   shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
   shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
   shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
+  shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl
   shaders/compositor/library/gpu_shader_compositor_exposure.glsl
   shaders/compositor/library/gpu_shader_compositor_gamma.glsl
   shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
   shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
   shaders/compositor/library/gpu_shader_compositor_invert.glsl
   shaders/compositor/library/gpu_shader_compositor_main.glsl
+  shaders/compositor/library/gpu_shader_compositor_map_value.glsl
+  shaders/compositor/library/gpu_shader_compositor_normal.glsl
   shaders/compositor/library/gpu_shader_compositor_posterize.glsl
+  shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl
+  shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl
   shaders/compositor/library/gpu_shader_compositor_store_output.glsl
   shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl
   shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl
diff --git 
a/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl 
b/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
index 2ac0ff8c4bb..33108d3a989 100644
--- a/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
+++ b/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
@@ -140,6 +140,82 @@ void hsl_to_rgb(vec4 hsl, out vec4 outcol)
   outcol = vec4((nr - 0.5) * chroma + l, (ng - 0.5) * chroma + l, (nb - 0.5) * 
chroma + l, hsl.w);
 }
 
+/* ** YCCA to RGBA ** */
+
+void ycca_to_rgba_itu_601(vec4 ycca, out vec4 color)
+{
+  ycca.xyz *= 255.0;
+  ycca.xyz -= vec3(16.0, 128.0, 128.0);
+  color.rgb = mat3(vec3(1.164), 0.0, -0.392, 2.017, 1.596, -0.813, 0.0) * 
ycca.xyz;
+  color.rgb 

[Bf-blender-cvs] [6109ad6cce9] master: Realtime Compositor: Add basic color nodes

2022-08-10 Thread Omar Emara
Commit: 6109ad6cce9186bd6e8ff4dbfb281ae8f6742119
Author: Omar Emara
Date:   Wed Aug 10 09:58:44 2022 +0200
Branches: master
https://developer.blender.org/rB6109ad6cce9186bd6e8ff4dbfb281ae8f6742119

Realtime Compositor: Add basic color nodes

This patch implements the following nodes for the realtime compositor:

- Alpha over node.
- Bright contrast node.
- Color balance node.
- Color correction node.
- Exposure node.
- Gamma node.
- Hue correct node.
- Hue saturation value node.
- Invert node.
- Mix node.
- Posterize node.
- Time curve node.
- Vector curve node.

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

Reviewed By: Clement Foucault

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
M   source/blender/gpu/shaders/common/gpu_shader_common_curves.glsl
M   source/blender/gpu/shaders/common/gpu_shader_common_math_utils.glsl
M   source/blender/gpu/shaders/common/gpu_shader_common_mix_rgb.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_exposure.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_gamma.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_invert.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_posterize.glsl
M   source/blender/imbuf/IMB_colormanagement.h
M   source/blender/imbuf/intern/colormanagement_inline.c
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/composite/nodes/node_composite_alpha_over.cc
M   source/blender/nodes/composite/nodes/node_composite_brightness.cc
M   source/blender/nodes/composite/nodes/node_composite_colorbalance.cc
M   source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc
M   source/blender/nodes/composite/nodes/node_composite_curves.cc
M   source/blender/nodes/composite/nodes/node_composite_exposure.cc
M   source/blender/nodes/composite/nodes/node_composite_gamma.cc
M   source/blender/nodes/composite/nodes/node_composite_hue_sat_val.cc
M   source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
M   source/blender/nodes/composite/nodes/node_composite_invert.cc
M   source/blender/nodes/composite/nodes/node_composite_mixrgb.cc
M   source/blender/nodes/composite/nodes/node_composite_posterize.cc
M   source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index c20fff7082e..9c7fb8f290f 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -328,7 +328,17 @@ set(GLSL_SRC
   shaders/compositor/compositor_set_alpha.glsl
   shaders/compositor/compositor_split_viewer.glsl
 
+  shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl
+  shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
+  shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
+  shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
+  shaders/compositor/library/gpu_shader_compositor_exposure.glsl
+  shaders/compositor/library/gpu_shader_compositor_gamma.glsl
+  shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
+  shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
+  shaders/compositor/library/gpu_shader_compositor_invert.glsl
   shaders/compositor/library/gpu_shader_compositor_main.glsl
+  shaders/compositor/library/gpu_shader_compositor_posterize.glsl
   shaders/compositor/library/gpu_shader_compositor_store_output.glsl
   shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl
   shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl
diff --git 
a/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl 
b/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
index fe89985ae7f..2ac0ff8c4bb 100644
--- a/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
+++ b/source/blender/gpu/shaders/common/gpu_shader_common_color_utils.glsl
@@ -140,6 +140,8 @@ void hsl_to_rgb(vec4 hsl, out vec4 outcol)
   outcol = vec4((nr - 0.5) * chroma + l, (ng - 0.5) * chroma + l, (nb - 0.5) * 
chroma + l, 

[Bf-blender-cvs] [865204fef06] master: Realtime Compositor: Add basic input nodes

2022-08-10 Thread Omar Emara
Commit: 865204fef06b1f4e73a3ad82202fe8221d1efae5
Author: Omar Emara
Date:   Wed Aug 10 09:45:28 2022 +0200
Branches: master
https://developer.blender.org/rB865204fef06b1f4e73a3ad82202fe8221d1efae5

Realtime Compositor: Add basic input nodes

This patch implements the following nodes for the realtime compositor:

- Image node.
- Movie clip node.
- Render layers node.
- RGB node.
- Scene time node.
- Value node.

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

Reviewed By: Clement Foucault

===

M   source/blender/nodes/composite/nodes/node_composite_image.cc
M   source/blender/nodes/composite/nodes/node_composite_movieclip.cc
M   source/blender/nodes/composite/nodes/node_composite_rgb.cc
M   source/blender/nodes/composite/nodes/node_composite_scene_time.cc
M   source/blender/nodes/composite/nodes/node_composite_value.cc

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc 
b/source/blender/nodes/composite/nodes/node_composite_image.cc
index d75aa575395..d8852e9333f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_image.cc
@@ -8,6 +8,7 @@
 #include "node_composite_util.hh"
 
 #include "BLI_linklist.h"
+#include "BLI_math_vec_types.hh"
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
@@ -17,6 +18,8 @@
 #include "BKE_main.h"
 #include "BKE_scene.h"
 
+#include "DEG_depsgraph_query.h"
+
 #include "DNA_scene_types.h"
 
 #include "RE_engine.h"
@@ -27,6 +30,12 @@
 #include "UI_interface.h"
 #include "UI_resources.h"
 
+#include "GPU_shader.h"
+#include "GPU_texture.h"
+
+#include "COM_node_operation.hh"
+#include "COM_utilities.hh"
+
 /*  IMAGE (and RenderResult, multilayer image) 
 */
 
 static bNodeSocketTemplate cmp_node_rlayers_out[] = {
@@ -433,6 +442,215 @@ static void node_composit_copy_image(bNodeTree 
*UNUSED(dest_ntree),
   }
 }
 
+using namespace blender::realtime_compositor;
+
+class ImageOperation : public NodeOperation {
+ public:
+  using NodeOperation::NodeOperation;
+
+  void execute() override
+  {
+if (!is_valid()) {
+  allocate_invalid();
+  return;
+}
+
+update_image_frame_number();
+
+for (const OutputSocketRef *output : node()->outputs()) {
+  compute_output(output->identifier());
+}
+  }
+
+  /* Returns true if the node results can be computed, otherwise, returns 
false. */
+  bool is_valid()
+  {
+Image *image = get_image();
+ImageUser *image_user = get_image_user();
+if (!image || !image_user) {
+  return false;
+}
+
+if (BKE_image_is_multilayer(image)) {
+  if (!image->rr) {
+return false;
+  }
+
+  RenderLayer *render_layer = get_render_layer();
+  if (!render_layer) {
+return false;
+  }
+}
+
+return true;
+  }
+
+  /* Allocate all needed outputs as invalid. This should be called when 
is_valid returns false. */
+  void allocate_invalid()
+  {
+for (const OutputSocketRef *output : node()->outputs()) {
+  if (!should_compute_output(output->identifier())) {
+continue;
+  }
+
+  Result  = get_result(output->identifier());
+  result.allocate_invalid();
+}
+  }
+
+  /* Compute the effective frame number of the image if it was animated and 
invalidate the cached
+   * GPU texture if the computed frame number is different. */
+  void update_image_frame_number()
+  {
+BKE_image_user_frame_calc(get_image(), get_image_user(), 
context().get_frame_number());
+  }
+
+  void compute_output(StringRef identifier)
+  {
+if (!should_compute_output(identifier)) {
+  return;
+}
+
+ImageUser image_user = compute_image_user_for_output(identifier);
+GPUTexture *image_texture = BKE_image_get_gpu_texture(get_image(), 
_user, nullptr);
+
+const int2 size = int2(GPU_texture_width(image_texture), 
GPU_texture_height(image_texture));
+Result  = get_result(identifier);
+result.allocate_texture(Domain(size));
+
+GPUShader *shader = shader_manager().get(get_shader_name(identifier));
+GPU_shader_bind(shader);
+
+const int input_unit = GPU_shader_get_texture_binding(shader, "input_tx");
+GPU_texture_bind(image_texture, input_unit);
+
+result.bind_as_image(shader, "output_img");
+
+compute_dispatch_threads_at_least(shader, size);
+
+GPU_shader_unbind();
+GPU_texture_unbind(image_texture);
+result.unbind_as_image();
+  }
+
+  /* Get a copy of the image user that is appropriate to retrieve the image 
buffer for the output
+   * with the given identifier. This essentially sets the appropriate pass and 
view indices that
+   * corresponds to the output.  */
+  ImageUser compute_image_user_for_output(StringRef identifier)
+  {
+ImageUser image_user = *get_image_user();
+
+/* Set the needed view. */
+

[Bf-blender-cvs] [365fbb447e0] master: Realtime Compositor: Add basic output nodes

2022-08-10 Thread Omar Emara
Commit: 365fbb447e0fda9bf4ef1ad04eee1908cefb8e92
Author: Omar Emara
Date:   Wed Aug 10 09:40:07 2022 +0200
Branches: master
https://developer.blender.org/rB365fbb447e0fda9bf4ef1ad04eee1908cefb8e92

Realtime Compositor: Add basic output nodes

This patch implements the following nodes for the realtime compositor:

- Composite node.
- Viewer node.
- Split viewer node.

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

Reviewed By: Clement Foucault

===

M   source/blender/gpu/CMakeLists.txt
A   source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl
A   source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl
M   source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
A   source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh
A   
source/blender/gpu/shaders/compositor/infos/compositor_split_viewer_info.hh
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/composite/CMakeLists.txt
M   source/blender/nodes/composite/nodes/node_composite_composite.cc
M   source/blender/nodes/composite/nodes/node_composite_split_viewer.cc
M   source/blender/nodes/composite/nodes/node_composite_viewer.cc

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index dcb6788c4d8..c20fff7082e 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -325,6 +325,8 @@ set(GLSL_SRC
 
   shaders/compositor/compositor_convert.glsl
   shaders/compositor/compositor_realize_on_domain.glsl
+  shaders/compositor/compositor_set_alpha.glsl
+  shaders/compositor/compositor_split_viewer.glsl
 
   shaders/compositor/library/gpu_shader_compositor_main.glsl
   shaders/compositor/library/gpu_shader_compositor_store_output.glsl
@@ -538,6 +540,8 @@ set(SRC_SHADER_CREATE_INFOS
 
   shaders/compositor/infos/compositor_convert_info.hh
   shaders/compositor/infos/compositor_realize_on_domain_info.hh
+  shaders/compositor/infos/compositor_set_alpha_info.hh
+  shaders/compositor/infos/compositor_split_viewer_info.hh
 )
 
 set(SHADER_CREATE_INFOS_CONTENT "")
diff --git a/source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl 
b/source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl
new file mode 100644
index 000..7dd40581790
--- /dev/null
+++ b/source/blender/gpu/shaders/compositor/compositor_set_alpha.glsl
@@ -0,0 +1,8 @@
+#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
+
+void main()
+{
+  ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
+  vec4 color = vec4(texture_load(image_tx, texel).rgb, texture_load(alpha_tx, 
texel).x);
+  imageStore(output_img, texel, color);
+}
diff --git a/source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl 
b/source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl
new file mode 100644
index 000..866b9045da2
--- /dev/null
+++ b/source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl
@@ -0,0 +1,14 @@
+#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
+
+void main()
+{
+  ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
+#if defined(SPLIT_HORIZONTAL)
+  bool condition = (view_size.x * split_ratio) < texel.x;
+#elif defined(SPLIT_VERTICAL)
+  bool condition = (view_size.y * split_ratio) < texel.y;
+#endif
+  vec4 color = condition ? texture_load(first_image_tx, texel) :
+   texture_load(second_image_tx, texel);
+  imageStore(output_img, texel, color);
+}
diff --git 
a/source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh 
b/source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
index 235525b582b..35e60056736 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
+++ b/source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
@@ -61,3 +61,9 @@ GPU_SHADER_CREATE_INFO(compositor_convert_float_to_half_float)
 .image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
 .define("CONVERT_EXPRESSION(value)", "vec4(value.r, vec3(0.0))")
 .do_static_compilation(true);
+
+GPU_SHADER_CREATE_INFO(compositor_convert_color_to_opaque)
+.additional_info("compositor_convert_shared")
+.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
+.define("CONVERT_EXPRESSION(value)", "vec4(value.rgb, 1.0)")
+.do_static_compilation(true);
diff --git 
a/source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh 
b/source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh
new file mode 100644
index 000..ca28194e921
--- /dev/null
+++ b/source/blender/gpu/shaders/compositor/infos/compositor_set_alpha_info.hh
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "gpu_shader_create_info.hh"
+

[Bf-blender-cvs] [624b0ac656e] master: Realtime Compositor: Add evaluator and engine

2022-08-10 Thread Omar Emara
Commit: 624b0ac656e4876c8518adb479be94e581c46bb8
Author: Omar Emara
Date:   Wed Aug 10 09:14:22 2022 +0200
Branches: master
https://developer.blender.org/rB624b0ac656e4876c8518adb479be94e581c46bb8

Realtime Compositor: Add evaluator and engine

This patch adds the core realtime compositor evaluator as well as a
compositor draw engine powered by the evaluator that operates in the
viewport. The realtime compositor is a new GPU accelerated compositor
that will be used to power the viewport compositor imminently as well as
the existing compositor in the future.

This patch only adds the evaluator and engine as an experimental
feature, the implementation of the nodes themselves will be committed
separately.

See T99210.

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

Reviewed By: Clement Foucault

===

M   release/scripts/startup/bl_ui/space_userpref.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/compositor/CMakeLists.txt
A   source/blender/compositor/realtime_compositor/CMakeLists.txt
A   source/blender/compositor/realtime_compositor/COM_compile_state.hh
A   source/blender/compositor/realtime_compositor/COM_context.hh
A   
source/blender/compositor/realtime_compositor/COM_conversion_operation.hh
A   source/blender/compositor/realtime_compositor/COM_domain.hh
A   source/blender/compositor/realtime_compositor/COM_evaluator.hh
A   source/blender/compositor/realtime_compositor/COM_input_descriptor.hh
A   
source/blender/compositor/realtime_compositor/COM_input_single_value_operation.hh
A   source/blender/compositor/realtime_compositor/COM_node_operation.hh
A   source/blender/compositor/realtime_compositor/COM_operation.hh
A   
source/blender/compositor/realtime_compositor/COM_realize_on_domain_operation.hh
A   
source/blender/compositor/realtime_compositor/COM_reduce_to_single_value_operation.hh
A   source/blender/compositor/realtime_compositor/COM_result.hh
A   source/blender/compositor/realtime_compositor/COM_scheduler.hh
A   source/blender/compositor/realtime_compositor/COM_shader_node.hh
A   source/blender/compositor/realtime_compositor/COM_shader_operation.hh
A   source/blender/compositor/realtime_compositor/COM_simple_operation.hh
A   
source/blender/compositor/realtime_compositor/COM_static_shader_manager.hh
A   source/blender/compositor/realtime_compositor/COM_texture_pool.hh
A   source/blender/compositor/realtime_compositor/COM_utilities.hh
A   source/blender/compositor/realtime_compositor/intern/compile_state.cc
A   source/blender/compositor/realtime_compositor/intern/context.cc
A   
source/blender/compositor/realtime_compositor/intern/conversion_operation.cc
A   source/blender/compositor/realtime_compositor/intern/domain.cc
A   source/blender/compositor/realtime_compositor/intern/evaluator.cc
A   
source/blender/compositor/realtime_compositor/intern/input_single_value_operation.cc
A   source/blender/compositor/realtime_compositor/intern/node_operation.cc
A   source/blender/compositor/realtime_compositor/intern/operation.cc
A   
source/blender/compositor/realtime_compositor/intern/realize_on_domain_operation.cc
A   
source/blender/compositor/realtime_compositor/intern/reduce_to_single_value_operation.cc
A   source/blender/compositor/realtime_compositor/intern/result.cc
A   source/blender/compositor/realtime_compositor/intern/scheduler.cc
A   source/blender/compositor/realtime_compositor/intern/shader_node.cc
A   source/blender/compositor/realtime_compositor/intern/shader_operation.cc
A   source/blender/compositor/realtime_compositor/intern/simple_operation.cc
A   
source/blender/compositor/realtime_compositor/intern/static_shader_manager.cc
A   source/blender/compositor/realtime_compositor/intern/texture_pool.cc
A   source/blender/compositor/realtime_compositor/intern/utilities.cc
M   source/blender/draw/CMakeLists.txt
A   source/blender/draw/engines/compositor/compositor_engine.cc
A   source/blender/draw/engines/compositor/compositor_engine.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/gpu/CMakeLists.txt
A   source/blender/gpu/shaders/compositor/compositor_convert.glsl
A   source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl
A   source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
A   
source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_main.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_store_output.glsl
A   
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl
A

[Bf-blender-cvs] [169216684a7] master: Merge branch 'blender-v3.3-release'

2022-08-10 Thread Campbell Barton
Commit: 169216684a7dd9fff065bad2c0bad60578f9412f
Author: Campbell Barton
Date:   Wed Aug 10 16:43:33 2022 +1000
Branches: master
https://developer.blender.org/rB169216684a7dd9fff065bad2c0bad60578f9412f

Merge branch 'blender-v3.3-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] [b1149933053] blender-v3.3-release: Fix T99963: Fallback actions are used in RCS on left click

2022-08-10 Thread Campbell Barton
Commit: b114993305336be9d1c3403a6cfde6ebf13a0a28
Author: Campbell Barton
Date:   Wed Aug 10 16:39:29 2022 +1000
Branches: blender-v3.3-release
https://developer.blender.org/rBb114993305336be9d1c3403a6cfde6ebf13a0a28

Fix T99963: Fallback actions are used in RCS on left click

Regression in [0].

Disable fallback tools for the 3D cursor so other shortcuts are
available such as lasso-select.

[0]: b0847eff2a29b0f2ba3263afc3f367011703df84

===

M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 470b78ae558..7b00e587f94 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -87,7 +87,6 @@ class _defs_view3d_generic:
 icon="ops.generic.cursor",
 keymap="3D View Tool: Cursor",
 draw_settings=draw_settings,
-options={'KEYMAP_FALLBACK'},
 )
 
 @ToolDef.from_fn
@@ -1715,7 +1714,6 @@ class _defs_image_generic:
 ),
 icon="ops.generic.cursor",
 keymap=(),
-options={'KEYMAP_FALLBACK'},
 )
 
 # Currently a place holder so we can switch away from the annotation tool.
@@ -2546,7 +2544,6 @@ class _defs_sequencer_generic:
 ),
 icon="ops.generic.cursor",
 keymap="Sequencer Tool: Cursor",
-options={'KEYMAP_FALLBACK'},
 )
 
 @ToolDef.from_fn

___
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] [77f41da5f1a] master: Cleanup: spelling

2022-08-10 Thread Campbell Barton
Commit: 77f41da5f1a4f11be37d719722e9bac8e2912604
Author: Campbell Barton
Date:   Wed Aug 10 16:23:11 2022 +1000
Branches: master
https://developer.blender.org/rB77f41da5f1a4f11be37d719722e9bac8e2912604

Cleanup: spelling

===

M   intern/cycles/kernel/integrator/shade_surface.h
M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/draw/intern/draw_debug.cc
M   source/blender/draw/intern/draw_debug.hh
M   source/blender/draw/intern/draw_manager_data.c
M   source/blender/editors/curve/editcurve.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/gpu/intern/gpu_shader_dependency.cc

===

diff --git a/intern/cycles/kernel/integrator/shade_surface.h 
b/intern/cycles/kernel/integrator/shade_surface.h
index 86dbfdd3edc..4eb50171532 100644
--- a/intern/cycles/kernel/integrator/shade_surface.h
+++ b/intern/cycles/kernel/integrator/shade_surface.h
@@ -44,7 +44,7 @@ ccl_device_forceinline float3 
integrate_surface_ray_offset(KernelGlobals kg,
   /* Self intersection tests already account for the case where a ray hits the
* same primitive. However precision issues can still cause neighboring
* triangles to be hit. Here we test if the ray-triangle intersection with
-   * the same primitive would miss, implying that a neighbouring triangle would
+   * the same primitive would miss, implying that a neighboring triangle would
* be hit instead.
*
* This relies on triangle intersection to be watertight, and the object 
inverse
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index 44588a06119..2bc6289af85 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -20,7 +20,7 @@ struct MVert;
 /* UvVertMap */
 #define STD_UV_CONNECT_LIMIT 0.0001f
 
-/* Map from uv vertex to face. Used by select linked, uv subsurf and obj 
exporter. */
+/* Map from uv vertex to face. Used by select linked, uv subdivision-surface 
and obj exporter. */
 typedef struct UvVertMap {
   struct UvMapVert **vert;
   struct UvMapVert *buf;
diff --git a/source/blender/draw/intern/draw_debug.cc 
b/source/blender/draw/intern/draw_debug.cc
index c610d7a2ffc..aaf18014143 100644
--- a/source/blender/draw/intern/draw_debug.cc
+++ b/source/blender/draw/intern/draw_debug.cc
@@ -599,7 +599,7 @@ void drw_debug_draw()
   if (!GPU_shader_storage_buffer_objects_support() || DST.debug == nullptr) {
 return;
   }
-  /* TODO(fclem): Convenience for now. Will have to move to DRWManager. */
+  /* TODO(@fclem): Convenience for now. Will have to move to #DRWManager. */
   reinterpret_cast(DST.debug)->display_to_view();
 #endif
 }
@@ -610,12 +610,12 @@ void drw_debug_draw()
 void drw_debug_init()
 {
   /* Module should not be used in release builds. */
-  /* TODO(fclem): Hide the functions declarations without using ifdefs 
everywhere. */
+  /* TODO(@fclem): Hide the functions declarations without using `ifdefs` 
everywhere. */
 #ifdef DEBUG
   if (!GPU_shader_storage_buffer_objects_support()) {
 return;
   }
-  /* TODO(fclem): Convenience for now. Will have to move to DRWManager. */
+  /* TODO(@fclem): Convenience for now. Will have to move to #DRWManager. */
   if (DST.debug == nullptr) {
 DST.debug = reinterpret_cast(new 
blender::draw::DebugDraw());
   }
diff --git a/source/blender/draw/intern/draw_debug.hh 
b/source/blender/draw/intern/draw_debug.hh
index 4a2a367aef0..730b69ed954 100644
--- a/source/blender/draw/intern/draw_debug.hh
+++ b/source/blender/draw/intern/draw_debug.hh
@@ -98,7 +98,7 @@ class DebugDraw {
   void draw_matrix_as_bbox(float4x4 mat, const float4 color = {1, 0, 0, 1});
 
   /**
-   * Will draw all debug shapes and text cached up until now to the current 
view / framebuffer.
+   * Will draw all debug shapes and text cached up until now to the current 
view / frame-buffer.
* Draw buffers will be emptied and ready for new debug data.
*/
   void display_to_view();
diff --git a/source/blender/draw/intern/draw_manager_data.c 
b/source/blender/draw/intern/draw_manager_data.c
index 5d8537e0f19..9d4a2c58ab6 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -47,8 +47,8 @@
 /**
  * IMPORTANT:
  * In order to be able to write to the same print buffer sequentially, we add 
a barrier to allow
- * multiple shader calls writting to the same buffer.
- * However, this adds explicit synchronisation events which might change the 
rest of the
+ * multiple shader calls writing to the same buffer.
+ * However, this adds explicit synchronization events which might change the 
rest of the
  * application behavior and hide some bugs. If you know you are using shader 
debug print in only
  * one shader pass, you can comment this out to remove the 

[Bf-blender-cvs] [72f388c85e5] master: Cleanup: format

2022-08-10 Thread Campbell Barton
Commit: 72f388c85e5f6d819e9e9f44b3ef29a8ecce3c62
Author: Campbell Barton
Date:   Wed Aug 10 16:15:45 2022 +1000
Branches: master
https://developer.blender.org/rB72f388c85e5f6d819e9e9f44b3ef29a8ecce3c62

Cleanup: format

===

M   intern/cycles/kernel/closure/bssrdf.h
M   source/blender/draw/intern/draw_manager_data.c
M   
source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc

===

diff --git a/intern/cycles/kernel/closure/bssrdf.h 
b/intern/cycles/kernel/closure/bssrdf.h
index 47df0c5533a..cdd4d128c1f 100644
--- a/intern/cycles/kernel/closure/bssrdf.h
+++ b/intern/cycles/kernel/closure/bssrdf.h
@@ -260,8 +260,7 @@ ccl_device_forceinline float bssrdf_pdf(const Spectrum 
radius, float r)
 
 /* Setup */
 
-ccl_device_inline ccl_private Bssrdf *bssrdf_alloc(ccl_private ShaderData *sd,
-   Spectrum weight)
+ccl_device_inline ccl_private Bssrdf *bssrdf_alloc(ccl_private ShaderData *sd, 
Spectrum weight)
 {
   ccl_private Bssrdf *bssrdf = (ccl_private Bssrdf *)closure_alloc(
   sd, sizeof(Bssrdf), CLOSURE_NONE_ID, weight);
diff --git a/source/blender/draw/intern/draw_manager_data.c 
b/source/blender/draw/intern/draw_manager_data.c
index 2f6090b22c4..5d8537e0f19 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -662,7 +662,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, 
Object *ob)
   drw_call_calc_orco(ob, ob_infos->orcotexfac);
   /* Random float value. */
   uint random = (DST.dupli_source) ?
-DST.dupli_source->random_id :
+ DST.dupli_source->random_id :
  /* TODO(fclem): this is rather costly to do at runtime. 
Maybe we can
   * put it in ob->runtime and make depsgraph ensure it is 
up to date. */
  BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc 
b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
index cf29c752257..a6c67cac916 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
@@ -221,7 +221,7 @@ BLI_NOINLINE static void 
update_elimination_mask_based_on_density_factors(
 const float v2_density_factor = std::max(0.0f, density_factors[v2_loop]);
 
 const float probability = v0_density_factor * bary_coord.x + 
v1_density_factor * bary_coord.y +
- v2_density_factor * bary_coord.z;
+  v2_density_factor * bary_coord.z;
 
 const float hash = noise::hash_float_to_float(bary_coord);
 if (hash > probability) {

___
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