[Bf-blender-cvs] [4c340f9bd45] master: Cleanup: Remove outdated comment

2022-08-04 Thread Hans Goudey
Commit: 4c340f9bd454c82eed7ac4b5ef6bf6bbfe46290f
Author: Hans Goudey
Date:   Thu Aug 4 23:41:57 2022 -0500
Branches: master
https://developer.blender.org/rB4c340f9bd454c82eed7ac4b5ef6bf6bbfe46290f

Cleanup: Remove outdated comment

===

M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc

===

diff --git 
a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc 
b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
index 7f16837022c..64ade020418 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
@@ -58,7 +58,6 @@ template struct 
AttributeTypeConverter
   }
 };
 
-/* Similar to the one in #extract_mesh_vcol_vbo.cc */
 struct gpuMeshCol {
   ushort r, g, b, a;
 };

___
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] [fd0c27944f6] master: Cleanup: Reduce indentation

2022-08-04 Thread Hans Goudey
Commit: fd0c27944f6788952183230987579359b0d738c0
Author: Hans Goudey
Date:   Thu Aug 4 23:35:37 2022 -0500
Branches: master
https://developer.blender.org/rBfd0c27944f6788952183230987579359b0d738c0

Cleanup: Reduce indentation

===

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

===

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.cc 
b/source/blender/draw/intern/draw_cache_impl_mesh.cc
index d1eb937d711..5de9f1b44c8 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.cc
@@ -293,26 +293,28 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const 
Object *object,
 
   for (int i = 0; i < gpumat_array_len; i++) {
 GPUMaterial *gpumat = gpumat_array[i];
-if (gpumat) {
-  ListBase gpu_attrs = GPU_material_attributes(gpumat);
-  LISTBASE_FOREACH (GPUMaterialAttribute *, gpu_attr, _attrs) {
-const char *name = gpu_attr->name;
-eCustomDataType type = static_cast(gpu_attr->type);
-int layer = -1;
-std::optional domain;
-
-if (gpu_attr->is_default_color) {
-  name = default_color_name.c_str();
-}
+if (gpumat == nullptr) {
+  continue;
+}
+ListBase gpu_attrs = GPU_material_attributes(gpumat);
+LISTBASE_FOREACH (GPUMaterialAttribute *, gpu_attr, _attrs) {
+  const char *name = gpu_attr->name;
+  eCustomDataType type = static_cast(gpu_attr->type);
+  int layer = -1;
+  std::optional domain;
+
+  if (gpu_attr->is_default_color) {
+name = default_color_name.c_str();
+  }
 
-if (type == CD_AUTO_FROM_NAME) {
-  /* We need to deduce what exact layer is used.
-   *
-   * We do it based on the specified name.
-   */
-  if (name[0] != '\0') {
-layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name);
-type = CD_MTFACE;
+  if (type == CD_AUTO_FROM_NAME) {
+/* We need to deduce what exact layer is used.
+ *
+ * We do it based on the specified name.
+ */
+if (name[0] != '\0') {
+  layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name);
+  type = CD_MTFACE;
 
 #if 0 /* Tangents are always from UV's - this will never happen. */
 if (layer == -1) {
@@ -320,88 +322,87 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const 
Object *object,
   type = CD_TANGENT;
 }
 #endif
-if (layer == -1) {
-  /* Try to match a generic attribute, we use the first attribute 
domain with a
-   * matching name. */
-  if (drw_custom_data_match_attribute(cd_vdata, name, , 
)) {
-domain = ATTR_DOMAIN_POINT;
-  }
-  else if (drw_custom_data_match_attribute(cd_ldata, name, , 
)) {
-domain = ATTR_DOMAIN_CORNER;
-  }
-  else if (drw_custom_data_match_attribute(cd_pdata, name, , 
)) {
-domain = ATTR_DOMAIN_FACE;
-  }
-  else if (drw_custom_data_match_attribute(cd_edata, name, , 
)) {
-domain = ATTR_DOMAIN_EDGE;
-  }
-  else {
-layer = -1;
-  }
+  if (layer == -1) {
+/* Try to match a generic attribute, we use the first attribute 
domain with a
+ * matching name. */
+if (drw_custom_data_match_attribute(cd_vdata, name, , 
)) {
+  domain = ATTR_DOMAIN_POINT;
 }
-
-if (layer == -1) {
-  continue;
+else if (drw_custom_data_match_attribute(cd_ldata, name, , 
)) {
+  domain = ATTR_DOMAIN_CORNER;
+}
+else if (drw_custom_data_match_attribute(cd_pdata, name, , 
)) {
+  domain = ATTR_DOMAIN_FACE;
+}
+else if (drw_custom_data_match_attribute(cd_edata, name, , 
)) {
+  domain = ATTR_DOMAIN_EDGE;
+}
+else {
+  layer = -1;
 }
   }
-  else {
-/* Fall back to the UV layer, which matches old behavior. */
-type = CD_MTFACE;
+
+  if (layer == -1) {
+continue;
   }
 }
+else {
+  /* Fall back to the UV layer, which matches old behavior. */
+  type = CD_MTFACE;
+}
+  }
 
-switch (type) {
-  case CD_MTFACE: {
-if (layer == -1) {
-  layer = (name[0] != '\0') ? CustomData_get_named_layer(cd_ldata, 
CD_MLOOPUV, name) :
-  
CustomData_get_render_layer(cd_ldata, CD_MLOOPUV);
-}
-if (layer != -1) {
-  cd_used.uv |= (1 << layer);
-}
-break;
+  switch 

[Bf-blender-cvs] [96ee89e727f] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-08-04 Thread Jeffrey Liu
Commit: 96ee89e727f108968d59089d59bbc7a27480249d
Author: Jeffrey Liu
Date:   Fri Aug 5 00:08:38 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB96ee89e727f108968d59089d59bbc7a27480249d

Merge branch 'master' into soc-2022-many-lights-sampling

===



===



___
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] [702a2d075e1] soc-2022-many-lights-sampling: Fix: light tree has artifacts with many lights

2022-08-04 Thread Jeffrey Liu
Commit: 702a2d075e141f6c5dfe6ea6a4e29a6a6e8c8d7a
Author: Jeffrey Liu
Date:   Fri Aug 5 00:06:19 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB702a2d075e141f6c5dfe6ea6a4e29a6a6e8c8d7a

Fix: light tree has artifacts with many lights

This fix resolves artifacts when there are many lights. This is because
it was sampling lights when the total importance was 0.

===

M   intern/cycles/kernel/light/light_tree.h

===

diff --git a/intern/cycles/kernel/light/light_tree.h 
b/intern/cycles/kernel/light/light_tree.h
index d44ed34cb15..c15e6ebed37 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -372,6 +372,12 @@ ccl_device bool light_tree_sample(KernelGlobals kg,
 
 const float left_importance = light_tree_cluster_importance(kg, P, N, 
left);
 const float right_importance = light_tree_cluster_importance(kg, P, N, 
right);
+const float total_importance = left_importance + right_importance;
+
+if (total_importance == 0.0f) {
+  stack_index--;
+  continue;
+}
 float left_probability = left_importance / (left_importance + 
right_importance);
 
 if (*randu < left_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


[Bf-blender-cvs] [359aca8d4cf] master: Cleanup: Spelling, remove double negative

2022-08-04 Thread Hans Goudey
Commit: 359aca8d4cf9463d5c3ec7d0ab56ee52b2784eab
Author: Hans Goudey
Date:   Thu Aug 4 23:01:50 2022 -0500
Branches: master
https://developer.blender.org/rB359aca8d4cf9463d5c3ec7d0ab56ee52b2784eab

Cleanup: Spelling, remove double negative

===

M   
source/blender/draw/engines/overlay/shaders/overlay_antialiasing_frag.glsl
M   source/blender/draw/engines/select/select_engine.c
M   source/blender/nodes/shader/nodes/node_shader_geometry.cc
M   source/blender/nodes/shader/nodes/node_shader_hair_info.cc
M   source/blender/nodes/shader/nodes/node_shader_tex_coord.cc

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_antialiasing_frag.glsl 
b/source/blender/draw/engines/overlay/shaders/overlay_antialiasing_frag.glsl
index f28a809fdab..606292bbe83 100644
--- a/source/blender/draw/engines/overlay/shaders/overlay_antialiasing_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/overlay_antialiasing_frag.glsl
@@ -96,7 +96,7 @@ void main()
   float dist_raw = texelFetch(lineTex, center_texel, 0).b;
   float dist = decode_line_dist(dist_raw);
 
-  /* TODO: Opti: use textureGather. */
+  /* TODO: Optimization: use textureGather. */
   vec4 neightbor_col0 = texelFetchOffset(colorTex, center_texel, 0, ivec2(1, 
0));
   vec4 neightbor_col1 = texelFetchOffset(colorTex, center_texel, 0, ivec2(-1, 
0));
   vec4 neightbor_col2 = texelFetchOffset(colorTex, center_texel, 0, ivec2(0, 
1));
diff --git a/source/blender/draw/engines/select/select_engine.c 
b/source/blender/draw/engines/select/select_engine.c
index 88ae5ac707e..026a1f52ac1 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -201,7 +201,7 @@ static void select_cache_populate(void *vedata, Object *ob)
 
   if (!e_data.context.is_dirty && sel_data && sel_data->is_drawn) {
 /* The object indices have already been drawn. Fill depth pass.
- * Opti: Most of the time this depth pass is not used. */
+ * Optimization: Most of the time this depth pass is not used. */
 struct Mesh *me = ob->data;
 if (e_data.context.select_mode & SCE_SELECT_FACE) {
   struct GPUBatch *geom_faces = 
DRW_mesh_batch_cache_get_triangles_with_select_id(me);
diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.cc 
b/source/blender/nodes/shader/nodes/node_shader_geometry.cc
index 47df932f9d4..d23561de7ff 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geometry.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_geometry.cc
@@ -29,10 +29,9 @@ static int node_shader_gpu_geometry(GPUMaterial *mat,
   if (out[5].hasoutput) {
 GPU_material_flag_set(mat, GPU_MATFLAG_BARYCENTRIC);
   }
-  /* Opti: don't request orco if not needed. */
+  /* Optimization: don't request orco if not needed. */
   const float val[4] = {0.0f, 0.0f, 0.0f, 0.0f};
-  GPUNodeLink *orco_link = (!out[2].hasoutput) ? GPU_constant(val) :
- GPU_attribute(mat, CD_ORCO, 
"");
+  GPUNodeLink *orco_link = out[2].hasoutput ? GPU_attribute(mat, CD_ORCO, "") 
: GPU_constant(val);
 
   const bool success = GPU_stack_link(mat, node, "node_geometry", in, out, 
orco_link);
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc 
b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
index 11d23e47735..f46556291ce 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc
@@ -23,8 +23,8 @@ static int node_shader_gpu_hair_info(GPUMaterial *mat,
 {
   /* Length: don't request length if not needed. */
   static const float zero = 0;
-  GPUNodeLink *length_link = (!out[2].hasoutput) ? GPU_constant() :
-   GPU_attribute(mat, 
CD_HAIRLENGTH, "");
+  GPUNodeLink *length_link = out[2].hasoutput ? GPU_attribute(mat, 
CD_HAIRLENGTH, "") :
+GPU_constant();
   return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link);
 }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc 
b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
index fb5971021fc..0a28b34902e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
@@ -41,9 +41,9 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
   GPUNodeLink *inv_obmat = (ob != NULL) ? GPU_uniform(>imat[0][0]) :
   GPU_uniform(_matrix[0][0]);
 
-  /* Opti: don't request orco if not needed. */
+  /* Optimization: don't request orco if not needed. */
   float4 zero(0.0f);
-  GPUNodeLink *orco = (!out[0].hasoutput) ? GPU_constant(zero) : 
GPU_attribute(mat, CD_ORCO, "");
+  GPUNodeLink *orco = out[0].hasoutput ? 

[Bf-blender-cvs] [53c0c3cbd7a] master: Cleanup: spelling, unused arg warning

2022-08-04 Thread Campbell Barton
Commit: 53c0c3cbd7a6be77c002c0e7fe9a3b19ad34c0d2
Author: Campbell Barton
Date:   Fri Aug 5 13:34:26 2022 +1000
Branches: master
https://developer.blender.org/rB53c0c3cbd7a6be77c002c0e7fe9a3b19ad34c0d2

Cleanup: spelling, unused arg warning

===

M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M   source/blender/editors/space_outliner/tree/tree_element_overrides.hh

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 41888e25fb7..b98f8996a2c 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -3319,7 +3319,7 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   {
 /* Keep this block, even when empty. */
 
-/* Image generation information transfered to tiles. */
+/* Image generation information transferred to tiles. */
 if (!DNA_struct_elem_find(fd->filesdna, "ImageTile", "int", "gen_x")) {
   for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
 for (ImageTile *tile = ima->tiles.first; tile; tile = tile->next) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index b8563c92e58..fc5e5189e82 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -239,7 +239,7 @@ DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main 
*bmain,
 {
 }
 
-TimeSourceNode *DepsgraphRelationBuilder::get_node(const TimeSourceKey ) 
const
+TimeSourceNode *DepsgraphRelationBuilder::get_node(const TimeSourceKey & 
/*key*/) const
 {
   return graph_->time_source;
 }
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 7db6b9635ee..e19459ced61 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -153,7 +153,7 @@ void TreeElementOverridesBase::expand(SpaceOutliner 
_outliner) const
 /** \} */
 
 /*  */
-/** \name Overriden Property
+/** \name Overridden Property
  *
  * Represents an RNA property that was overridden.
  *
@@ -187,7 +187,7 @@ StringRefNull TreeElementOverridesProperty::getWarning() 
const
 /** \} */
 
 /*  */
-/** \name Overriden Property Operation
+/** \name Overridden Property Operation
  *
  * See #TreeElementOverridesPropertyOperation.
  * \{ */
diff --git 
a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh 
b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
index acf35033ce1..f8ca146a4ea 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
@@ -66,7 +66,7 @@ class TreeElementOverridesProperty : public 
AbstractTreeElement {
 };
 
 /**
- * Represent a single operation within an overriden property. While usually a 
single override
+ * Represent a single operation within an overridden property. While usually a 
single override
  * property represents a single operation (changing the value), a single 
overridden collection
  * property may have multiple operations, e.g. to insert or remove collection 
items.
  *

___
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] [16ede6584e6] master: Cleanup: format

2022-08-04 Thread Campbell Barton
Commit: 16ede6584e6824f596e4816e86c0c2ed2236d646
Author: Campbell Barton
Date:   Fri Aug 5 13:34:10 2022 +1000
Branches: master
https://developer.blender.org/rB16ede6584e6824f596e4816e86c0c2ed2236d646

Cleanup: format

===

M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/depsgraph/DEG_depsgraph_build.h
M   source/blender/editors/object/object_remesh.cc

===

diff --git a/source/blender/blenkernel/intern/collection.c 
b/source/blender/blenkernel/intern/collection.c
index 09085fa8ffb..934c3053a02 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -713,7 +713,8 @@ void BKE_collection_new_name_get(Collection 
*collection_parent, char *rname)
 name = BLI_strdup(DATA_("Collection"));
   }
   else if (collection_parent->flag & COLLECTION_IS_MASTER) {
-name = BLI_sprintfN(DATA_("Collection %d"), 
BLI_listbase_count(_parent->children) + 1);
+name = BLI_sprintfN(DATA_("Collection %d"),
+BLI_listbase_count(_parent->children) + 1);
   }
   else {
 const int number = BLI_listbase_count(_parent->children) + 1;
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index c2fb11fac97..113fc244086 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -66,8 +66,9 @@
 static bool blo_is_builtin_template(const char *app_template)
 {
   /* For all builtin templates shipped with Blender. */
-  return (!app_template ||
-  STR_ELEM(app_template, N_("2D_Animation"), N_("Sculpting"), 
N_("VFX"), N_("Video_Editing")));
+  return (
+  !app_template ||
+  STR_ELEM(app_template, N_("2D_Animation"), N_("Sculpting"), N_("VFX"), 
N_("Video_Editing")));
 }
 
 static void blo_update_defaults_screen(bScreen *screen,
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h 
b/source/blender/depsgraph/DEG_depsgraph_build.h
index aae5bb2b432..ac6ab5c7666 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -162,7 +162,7 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle 
*node_handle,
  * have transformation for the modifier, taking into account possible 
simulation solvers.
  */
 void DEG_add_depends_on_transform_relation(struct DepsNodeHandle *node_handle,
-const char *description);
+   const char *description);
 
 /**
  * Adds relations from the given component of a given object to the given node
diff --git a/source/blender/editors/object/object_remesh.cc 
b/source/blender/editors/object/object_remesh.cc
index d44af45a015..ac4fb40d832 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -582,7 +582,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator 
*op, const wmEvent *ev
   mat4_to_size(scale, active_object->obmat);
   invert_v3(scale);
   size_to_mat4(scale_mat, scale);
-  
+
   mul_m4_m4_pre(cd->text_mat, scale_mat);
 
   /* Write the text position into the matrix. */

___
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] [0d476bcacd1] master: Merge remote-tracking branch 'origin/blender-v3.3-release'

2022-08-04 Thread Jesse Yurkovich
Commit: 0d476bcacd17b82cf596819229d1937be0321250
Author: Jesse Yurkovich
Date:   Thu Aug 4 19:46:51 2022 -0700
Branches: master
https://developer.blender.org/rB0d476bcacd17b82cf596819229d1937be0321250

Merge remote-tracking branch 'origin/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] [bd467100dd3] blender-v3.3-release: Fix T100142: Compare correct render_slot variable during clear operation

2022-08-04 Thread Jesse Yurkovich
Commit: bd467100dd3bd038b0628993f196b44d880ccc98
Author: Jesse Yurkovich
Date:   Thu Aug 4 19:41:03 2022 -0700
Branches: blender-v3.3-release
https://developer.blender.org/rBbd467100dd3bd038b0628993f196b44d880ccc98

Fix T100142: Compare correct render_slot variable during clear operation

In {rB0ef8a6179d2a773b2570352bd0cb7eb18b666da2} the parameter name was
changed to match the header declaration (slot) but it missed updating
the variable name inside the function correctly in one instance.

This prevents slot 0 from being cleared if the last slot to be rendered
was not also 0.

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

===

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

===

diff --git a/source/blender/blenkernel/intern/image.cc 
b/source/blender/blenkernel/intern/image.cc
index 975373fcf3b..fa3cc06b087 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -5516,7 +5516,7 @@ bool BKE_image_clear_renderslot(Image *ima, ImageUser 
*iuser, int slot)
   }
 
   RenderSlot *render_slot = static_cast(BLI_findlink(>renderslots, slot));
-  if (!slot) {
+  if (!render_slot) {
 return false;
   }
   if (render_slot->render) {

___
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] [9da0cfb86ee] master: Python: Add more useful information when attempting to pass incorrect attributes to GPUVertBuf.attr_fill

2022-08-04 Thread Colin Basnett
Commit: 9da0cfb86ee098b9172da69bb43703aa2efba691
Author: Colin Basnett
Date:   Thu Aug 4 15:51:54 2022 -0700
Branches: master
https://developer.blender.org/rB9da0cfb86ee098b9172da69bb43703aa2efba691

Python: Add more useful information when attempting to pass incorrect 
attributes to GPUVertBuf.attr_fill

This simply adds the name of the incorrect parameter to the error message.

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

Reviewed by Jeroen Bakker

===

M   source/blender/python/gpu/gpu_py_vertex_buffer.c

===

diff --git a/source/blender/python/gpu/gpu_py_vertex_buffer.c 
b/source/blender/python/gpu/gpu_py_vertex_buffer.c
index ac050128a1d..ab2ff59a689 100644
--- a/source/blender/python/gpu/gpu_py_vertex_buffer.c
+++ b/source/blender/python/gpu/gpu_py_vertex_buffer.c
@@ -292,7 +292,7 @@ static PyObject *pygpu_vertbuf_attr_fill(BPyGPUVertBuf 
*self, PyObject *args, Py
 const char *name = PyUnicode_AsUTF8(identifier);
 id = GPU_vertformat_attr_id_get(format, name);
 if (id == -1) {
-  PyErr_SetString(PyExc_ValueError, "Unknown attribute name");
+  PyErr_Format(PyExc_ValueError, "Unknown attribute '%s'", name);
   return NULL;
 }
   }

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


[Bf-blender-cvs] [5b8143287b6] master: Fix: Build error after recent commit

2022-08-04 Thread Hans Goudey
Commit: 5b8143287b607e52a65082fd6a678d0e54f50826
Author: Hans Goudey
Date:   Thu Aug 4 17:20:10 2022 -0500
Branches: master
https://developer.blender.org/rB5b8143287b607e52a65082fd6a678d0e54f50826

Fix: Build error after recent commit

A second try after 8b467313965ac5ea.

===

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 07b66d0728e..17145bdbe99 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -1526,7 +1526,7 @@ bool blf_font_size(FontBLF *font, float size, unsigned 
int dpi)
   }
 
   /* FreeType uses fixed-point integers in 64ths. */
-  FT_UInt ft_size = lroundf(size * 64.0f);
+  FT_UInt ft_size = round_fl_to_uint(size * 64.0f);
   /* Adjust our new size to be on even 64ths. */
   size = (float)ft_size / 64.0f;

___
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] [5b8c07dc50e] master: Cleanup: Remove outdated code for mesh normals

2022-08-04 Thread Hans Goudey
Commit: 5b8c07dc50e0589ba77ae1589e5950fd161a5631
Author: Hans Goudey
Date:   Thu Aug 4 17:05:46 2022 -0500
Branches: master
https://developer.blender.org/rB5b8c07dc50e0589ba77ae1589e5950fd161a5631

Cleanup: Remove outdated code for mesh normals

After recent refactors to mesh normals (cfa53e0fbeed), they are no
longer stored in CustomData. A mechanism to compute them eagerly
should be implemented another way.

===

M   source/blender/blenkernel/intern/data_transfer.c
M   source/blender/blenkernel/intern/mesh_remap.c
M   source/blender/blenkernel/intern/mesh_validate.cc
M   source/blender/blenkernel/intern/object_update.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c

===

diff --git a/source/blender/blenkernel/intern/data_transfer.c 
b/source/blender/blenkernel/intern/data_transfer.c
index 17a74b5564a..be686635d3e 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -70,8 +70,6 @@ void BKE_object_data_transfer_dttypes_to_cdmask(const int 
dtdata_types,
   r_data_masks->lmask |= CD_MASK_MLOOPUV;
 }
 else if (cddata_type == CD_FAKE_LNOR) {
-  r_data_masks->vmask |= CD_MASK_NORMAL;
-  r_data_masks->pmask |= CD_MASK_NORMAL;
   r_data_masks->lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
 }
   }
diff --git a/source/blender/blenkernel/intern/mesh_remap.c 
b/source/blender/blenkernel/intern/mesh_remap.c
index 3a37c29c1d0..5313cc39646 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -312,15 +312,10 @@ void 
BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(const int UNUSED(ver
 {
   /* vert, edge and poly mapping modes never need extra cddata from source 
object. */
   const bool need_lnors_src = (loop_mode & MREMAP_USE_LOOP) && (loop_mode & 
MREMAP_USE_NORMAL);
-  const bool need_pnors_src = need_lnors_src ||
-  ((loop_mode & MREMAP_USE_POLY) && (loop_mode & 
MREMAP_USE_NORMAL));
 
   if (need_lnors_src) {
 r_cddata_mask->lmask |= CD_MASK_NORMAL;
   }
-  if (need_pnors_src) {
-r_cddata_mask->pmask |= CD_MASK_NORMAL;
-  }
 }
 
 void BKE_mesh_remap_init(MeshPairRemap *map, const int items_num)
diff --git a/source/blender/blenkernel/intern/mesh_validate.cc 
b/source/blender/blenkernel/intern/mesh_validate.cc
index 9b2697ecc84..5bcbdb399e4 100644
--- a/source/blender/blenkernel/intern/mesh_validate.cc
+++ b/source/blender/blenkernel/intern/mesh_validate.cc
@@ -1001,10 +1001,6 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata,
   CustomData_MeshMasks mask = {0};
   if (check_meshmask) {
 mask = CD_MASK_MESH;
-/* Normal data isn't in the mask since it is derived data,
- * but it is valid and should not be removed. */
-mask.vmask |= CD_MASK_NORMAL;
-mask.pmask |= CD_MASK_NORMAL;
   }
 
   is_valid &= mesh_validate_customdata(
diff --git a/source/blender/blenkernel/intern/object_update.c 
b/source/blender/blenkernel/intern/object_update.c
index 8ff02c7e698..1f7df2773dc 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -149,10 +149,6 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, 
Scene *scene, Object *o
   cddata_masks.pmask |= CD_MASK_PROP_ALL;
   cddata_masks.lmask |= CD_MASK_PROP_ALL;
 
-  /* Also copy over normal layers to avoid recomputation. */
-  cddata_masks.pmask |= CD_MASK_NORMAL;
-  cddata_masks.vmask |= CD_MASK_NORMAL;
-
   /* Make sure Freestyle edge/face marks appear in DM for render (see 
T40315).
* Due to Line Art implementation, edge marks should also be shown in 
viewport. */
 #ifdef WITH_FREESTYLE
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
index 7d1fea1a47d..74b7efb1d04 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
@@ -202,7 +202,6 @@ static void updateDepsgraph(GpencilModifierData *md,
   CustomData_MeshMasks mask = {0};
 
   if (BKE_shrinkwrap_needs_normals(mmd->shrink_type, mmd->shrink_mode)) {
-mask.vmask |= CD_MASK_NORMAL;
 mask.lmask |= CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL;
   }

___
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] [8b467313965] master: Fix Build Warnings in blf_font.c

2022-08-04 Thread Harley Acheson
Commit: 8b467313965ac5ea86d71e6ac90c0e9f54f2c830
Author: Harley Acheson
Date:   Thu Aug 4 14:40:11 2022 -0700
Branches: master
https://developer.blender.org/rB8b467313965ac5ea86d71e6ac90c0e9f54f2c830

Fix Build Warnings in blf_font.c

Function made static, unused argument, type conversion

Introduced in 9d77b5a0ed7b

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 372dc19d64a..07b66d0728e 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -81,10 +81,10 @@ static void blf_face_finalizer(void *object)
 }
 
 /* Called in response to FTC_Manager_LookupFace. Add a face to our font. */
-FT_Error blf_cache_face_requester(FTC_FaceID faceID,
-  FT_Library lib,
-  FT_Pointer reqData,
-  FT_Face *face)
+static FT_Error blf_cache_face_requester(FTC_FaceID faceID,
+ FT_Library lib,
+ FT_Pointer UNUSED(reqData),
+ FT_Face *face)
 {
   FontBLF *font = (FontBLF *)faceID;
   int err = FT_Err_Cannot_Open_Resource;
@@ -1526,7 +1526,7 @@ bool blf_font_size(FontBLF *font, float size, unsigned 
int dpi)
   }
 
   /* FreeType uses fixed-point integers in 64ths. */
-  FT_F26Dot6 ft_size = lroundf(size * 64.0f);
+  FT_UInt ft_size = lroundf(size * 64.0f);
   /* Adjust our new size to be on even 64ths. */
   size = (float)ft_size / 64.0f;

___
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] [9d77b5a0ed7] master: BLF: Implement FreeType Caching

2022-08-04 Thread Harley Acheson
Commit: 9d77b5a0ed7bed48dcb7483e79945067666eac0b
Author: Harley Acheson
Date:   Thu Aug 4 13:05:19 2022 -0700
Branches: master
https://developer.blender.org/rB9d77b5a0ed7bed48dcb7483e79945067666eac0b

BLF: Implement FreeType Caching

Implementation of the FreeType 2 cache subsystem, which limits the
number of concurrently-opened FT_Face and FT_Size objects, as well as
caching information like character maps to speed up glyph id lookups.

See D13137 for much more detail.

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

Reviewed by Brecht Van Lommel

===

M   source/blender/blenfont/intern/blf.c
M   source/blender/blenfont/intern/blf_font.c
M   source/blender/blenfont/intern/blf_glyph.c
M   source/blender/blenfont/intern/blf_internal.h
M   source/blender/blenfont/intern/blf_internal_types.h

===

diff --git a/source/blender/blenfont/intern/blf.c 
b/source/blender/blenfont/intern/blf.c
index a1fcc17ca3f..36475321d4c 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -122,7 +122,7 @@ bool BLF_has_glyph(int fontid, unsigned int unicode)
 {
   FontBLF *font = blf_get(fontid);
   if (font) {
-return FT_Get_Char_Index(font->face, unicode) != FT_Err_Ok;
+return blf_get_char_index(font, unicode) != FT_Err_Ok;
   }
   return false;
 }
diff --git a/source/blender/blenfont/intern/blf_font.c 
b/source/blender/blenfont/intern/blf_font.c
index 339df9eb269..372dc19d64a 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -17,6 +17,7 @@
 #include 
 
 #include FT_FREETYPE_H
+#include FT_CACHE_H /* FreeType Cache. */
 #include FT_GLYPH_H
 #include FT_MULTIPLE_MASTERS_H /* Variable font support. */
 #include FT_TRUETYPE_IDS_H /* Codepoint coverage constants. */
@@ -54,7 +55,10 @@
 BatchBLF g_batch;
 
 /* freetype2 handle ONLY for this file! */
-static FT_Library ft_lib;
+static FT_Library ft_lib = NULL;
+static FTC_Manager ftc_manager = NULL;
+static FTC_CMapCache ftc_charmap_cache = NULL;
+
 static SpinLock ft_lib_mutex;
 static SpinLock blf_glyph_cache_mutex;
 
@@ -64,6 +68,53 @@ static void (*blf_draw_cache_flush)(void) = NULL;
 static ft_pix blf_font_height_max_ft_pix(struct FontBLF *font);
 static ft_pix blf_font_width_max_ft_pix(struct FontBLF *font);
 
+/*  */
+/** \name FreeType Caching
+ * \{ */
+
+/* Called when a face is removed. FreeType will call FT_Done_Face itself. */
+static void blf_face_finalizer(void *object)
+{
+  FT_Face face = object;
+  FontBLF *font = (FontBLF *)face->generic.data;
+  font->face = NULL;
+}
+
+/* Called in response to FTC_Manager_LookupFace. Add a face to our font. */
+FT_Error blf_cache_face_requester(FTC_FaceID faceID,
+  FT_Library lib,
+  FT_Pointer reqData,
+  FT_Face *face)
+{
+  FontBLF *font = (FontBLF *)faceID;
+  int err = FT_Err_Cannot_Open_Resource;
+
+  BLI_spin_lock(font->ft_lib_mutex);
+
+  if (font->filepath) {
+err = FT_New_Face(lib, font->filepath, 0, face);
+  }
+  else if (font->mem) {
+err = FT_New_Memory_Face(lib, font->mem, (FT_Long)font->mem_size, 0, face);
+  }
+
+  BLI_spin_unlock(font->ft_lib_mutex);
+
+  if (err == FT_Err_Ok) {
+font->face = *face;
+font->face->generic.data = font;
+font->face->generic.finalizer = blf_face_finalizer;
+  }
+
+  return err;
+}
+
+/* Use cache, not blf_get_char_index, to return glyph id from charcode. */
+uint blf_get_char_index(struct FontBLF *font, uint charcode)
+{
+  return FTC_CMapCache_Lookup(ftc_charmap_cache, font, -1, charcode);
+}
+
 /*  */
 /** \name FreeType Utilities (Internal)
  * \{ */
@@ -72,12 +123,12 @@ static ft_pix blf_font_width_max_ft_pix(struct FontBLF 
*font);
 static ft_pix blf_unscaled_F26Dot6_to_pixels(FontBLF *font, FT_Pos value)
 {
   /* Scale value by font size using integer-optimized multiplication. */
-  FT_Long scaled = FT_MulFix(value, font->face->size->metrics.x_scale);
+  FT_Long scaled = FT_MulFix(value, font->ft_size->metrics.x_scale);
 
   /* Copied from FreeType's FT_Get_Kerning (with FT_KERNING_DEFAULT), scaling 
down */
   /* kerning distances at small ppem values so that they don't become too big. 
*/
-  if (font->face->size->metrics.x_ppem < 25) {
-scaled = FT_MulDiv(scaled, font->face->size->metrics.x_ppem, 25);
+  if (font->ft_size->metrics.x_ppem < 25) {
+scaled = FT_MulDiv(scaled, font->ft_size->metrics.x_ppem, 25);
   }
 
   return (ft_pix)scaled;
@@ -296,7 +347,7 @@ BLI_INLINE ft_pix blf_kerning(FontBLF *font, const GlyphBLF 
*g_prev, const Glyph
   /* Small adjust if there is hinting. */
   adjustment += g->lsb_delta - ((g_prev) ? g_prev->rsb_delta : 0);
 
- 

[Bf-blender-cvs] [fca7cb01011] master: Cleanup: Remove incorrect comment

2022-08-04 Thread Hans Goudey
Commit: fca7cb01011a3e34d21fcff6800d0b26b2be6e8e
Author: Hans Goudey
Date:   Thu Aug 4 13:49:07 2022 -0500
Branches: master
https://developer.blender.org/rBfca7cb01011a3e34d21fcff6800d0b26b2be6e8e

Cleanup: Remove incorrect comment

===

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

===

diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index 8444f15cb8b..acb978642aa 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -3479,7 +3479,6 @@ int CustomData_get_n_offset(const CustomData *data, const 
int type, const int n)
 
 int CustomData_get_offset_named(const CustomData *data, int type, const char 
*name)
 {
-  /* get the layer index of the active layer of type */
   int layer_index = CustomData_get_named_layer_index(data, type, name);
   if (layer_index == -1) {
 return -1;

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


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

2022-08-04 Thread Hans Goudey
Commit: 77047d2088016140da2669fcda9ba2a23336e14b
Author: Hans Goudey
Date:   Thu Aug 4 13:48:41 2022 -0500
Branches: master
https://developer.blender.org/rB77047d2088016140da2669fcda9ba2a23336e14b

Merge branch 'blender-v3.3-release'

===



===

diff --cc source/blender/blenkernel/intern/customdata.cc
index 4d11f4daedf,82356e06d2c..8444f15cb8b
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@@ -3477,10 -3450,18 +3477,21 @@@ int CustomData_get_n_offset(const Custo
return data->layers[layer_index].offset;
  }
  
 -int CustomData_get_n_offset(const CustomData *data, int type, int n)
++int CustomData_get_offset_named(const CustomData *data, int type, const char 
*name)
+ {
+   /* get the layer index of the active layer of type */
 -  int layer_index = CustomData_get_layer_index_n(data, type, n);
++  int layer_index = CustomData_get_named_layer_index(data, type, name);
+   if (layer_index == -1) {
+ return -1;
+   }
+ 
+   return data->layers[layer_index].offset;
+ }
+ 
 -bool CustomData_set_layer_name(const CustomData *data, int type, int n, const 
char *name)
 +bool CustomData_set_layer_name(const CustomData *data,
 +   const int type,
 +   const int n,
 +   const char *name)
  {
/* get the layer index of the first layer of type */
const int layer_index = CustomData_get_layer_index_n(data, type, n);

___
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] [bae2ce06951] blender-v3.3-release: Nodes: Disable link drag search for deprecated nodes

2022-08-04 Thread Hans Goudey
Commit: bae2ce069516f7e4524fb5a514afef4d9da32a0e
Author: Hans Goudey
Date:   Thu Aug 4 13:33:40 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rBbae2ce069516f7e4524fb5a514afef4d9da32a0e

Nodes: Disable link drag search for deprecated nodes

===

M   source/blender/nodes/composite/nodes/node_composite_cryptomatte.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_ycca.cc
M   source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc
M   source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc
M   source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc 
b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
index 5462441660c..2d362a39814 100644
--- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
@@ -379,6 +379,8 @@ void register_node_type_cmp_cryptomatte_legacy()
   node_type_init(, file_ns::node_init_cryptomatte_legacy);
   node_type_storage(
   , "NodeCryptomatte", file_ns::node_free_cryptomatte, 
file_ns::node_copy_cryptomatte);
+  ntype.gather_link_search_ops = nullptr;
+
   nodeRegisterType();
 }
 
diff --git 
a/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc 
b/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc
index a0d2485ea5a..a169f7e0dd3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc
@@ -30,6 +30,8 @@ void register_node_type_cmp_sephsva()
 
   cmp_node_type_base(, CMP_NODE_SEPHSVA_LEGACY, "Separate HSVA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_sephsva_declare;
+  ntype.gather_link_search_ops = nullptr;
+
   nodeRegisterType();
 }
 
@@ -56,6 +58,7 @@ void register_node_type_cmp_combhsva()
 
   cmp_node_type_base(, CMP_NODE_COMBHSVA_LEGACY, "Combine HSVA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_combhsva_declare;
+  ntype.gather_link_search_ops = nullptr;
 
   nodeRegisterType();
 }
diff --git 
a/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc 
b/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc
index ae46681b0f4..a243500b56d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc
@@ -29,6 +29,7 @@ void register_node_type_cmp_seprgba()
 
   cmp_node_type_base(, CMP_NODE_SEPRGBA_LEGACY, "Separate RGBA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_seprgba_declare;
+  ntype.gather_link_search_ops = nullptr;
 
   nodeRegisterType();
 }
@@ -56,6 +57,7 @@ void register_node_type_cmp_combrgba()
 
   cmp_node_type_base(, CMP_NODE_COMBRGBA_LEGACY, "Combine RGBA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_combrgba_declare;
+  ntype.gather_link_search_ops = nullptr;
 
   nodeRegisterType();
 }
diff --git 
a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc 
b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
index a3c40b61e64..51d3c18d238 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
@@ -36,6 +36,7 @@ void register_node_type_cmp_sepycca()
   cmp_node_type_base(, CMP_NODE_SEPYCCA_LEGACY, "Separate YCbCrA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_sepycca_declare;
   node_type_init(, file_ns::node_composit_init_mode_sepycca);
+  ntype.gather_link_search_ops = nullptr;
 
   nodeRegisterType();
 }
@@ -69,6 +70,7 @@ void register_node_type_cmp_combycca()
   cmp_node_type_base(, CMP_NODE_COMBYCCA_LEGACY, "Combine YCbCrA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_combycca_declare;
   node_type_init(, file_ns::node_composit_init_mode_combycca);
+  ntype.gather_link_search_ops = nullptr;
 
   nodeRegisterType();
 }
diff --git 
a/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc 
b/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc
index 7fdece5904d..4acd2294114 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc
@@ -30,6 +30,7 @@ void register_node_type_cmp_sepyuva()
 
   cmp_node_type_base(, CMP_NODE_SEPYUVA_LEGACY, "Separate YUVA", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_sepyuva_declare;
+  ntype.gather_link_search_ops = nullptr;
 
   nodeRegisterType();
 }
@@ -57,6 +58,7 @@ void 

[Bf-blender-cvs] [9ea9fc1f34a] blender-v3.3-release: Fix T100099: Cycles crash baking vertex colors in edit mode

2022-08-04 Thread Brecht Van Lommel
Commit: 9ea9fc1f34a90a1db92199293b813319f78795d3
Author: Brecht Van Lommel
Date:   Thu Aug 4 20:10:56 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB9ea9fc1f34a90a1db92199293b813319f78795d3

Fix T100099: Cycles crash baking vertex colors in edit mode

This was not supported, added now.

===

M   source/blender/blenkernel/BKE_customdata.h
M   source/blender/blenkernel/intern/customdata.cc
M   source/blender/editors/object/object_bake_api.c

===

diff --git a/source/blender/blenkernel/BKE_customdata.h 
b/source/blender/blenkernel/BKE_customdata.h
index 010fbb27172..6e27fd2d80f 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -408,6 +408,7 @@ void *CustomData_get_layer(const struct CustomData *data, 
int type);
 void *CustomData_get_layer_n(const struct CustomData *data, int type, int n);
 void *CustomData_get_layer_named(const struct CustomData *data, int type, 
const char *name);
 int CustomData_get_offset(const struct CustomData *data, int type);
+int CustomData_get_offset_named(const CustomData *data, int type, const char 
*name);
 int CustomData_get_n_offset(const struct CustomData *data, int type, int n);
 
 int CustomData_get_layer_index(const struct CustomData *data, int type);
diff --git a/source/blender/blenkernel/intern/customdata.cc 
b/source/blender/blenkernel/intern/customdata.cc
index b12eafa9cef..82356e06d2c 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -3439,6 +3439,17 @@ int CustomData_get_offset(const CustomData *data, int 
type)
   return data->layers[layer_index].offset;
 }
 
+int CustomData_get_offset_named(const CustomData *data, int type, const char 
*name)
+{
+  /* get the layer index of the active layer of type */
+  int layer_index = CustomData_get_named_layer_index(data, type, name);
+  if (layer_index == -1) {
+return -1;
+  }
+
+  return data->layers[layer_index].offset;
+}
+
 int CustomData_get_n_offset(const CustomData *data, int type, int n)
 {
   /* get the layer index of the active layer of type */
diff --git a/source/blender/editors/object/object_bake_api.c 
b/source/blender/editors/object/object_bake_api.c
index a664d93bb2e..708f1d02656 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -24,6 +24,7 @@
 #include "BKE_attribute.h"
 #include "BKE_callbacks.h"
 #include "BKE_context.h"
+#include "BKE_editmesh.h"
 #include "BKE_global.h"
 #include "BKE_image.h"
 #include "BKE_image_format.h"
@@ -933,7 +934,10 @@ static bool bake_targets_output_external(const 
BakeAPIRender *bkr,
 
 /* Vertex Color Bake Targets */
 
-static bool bake_targets_init_vertex_colors(BakeTargets *targets, Object *ob, 
ReportList *reports)
+static bool bake_targets_init_vertex_colors(Main *bmain,
+BakeTargets *targets,
+Object *ob,
+ReportList *reports)
 {
   if (ob->type != OB_MESH) {
 BKE_report(reports, RPT_ERROR, "Color attribute baking is only supported 
for mesh objects");
@@ -946,6 +950,9 @@ static bool bake_targets_init_vertex_colors(BakeTargets 
*targets, Object *ob, Re
 return false;
   }
 
+  /* Ensure mesh and editmesh topology are in sync. */
+  ED_object_editmode_load(bmain, ob);
+
   targets->images = MEM_callocN(sizeof(BakeImage), "BakeTargets.images");
   targets->images_num = 1;
 
@@ -1109,6 +1116,7 @@ static void convert_float_color_to_byte_color(const 
MPropCol *float_colors,
 static bool bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
 {
   Mesh *me = ob->data;
+  BMEditMesh *em = me->edit_mesh;
   CustomDataLayer *active_color_layer = 
BKE_id_attributes_active_color_get(>id);
   BLI_assert(active_color_layer != NULL);
   const eAttrDomain domain = BKE_id_attribute_domain(>id, 
active_color_layer);
@@ -1121,9 +1129,7 @@ static bool bake_targets_output_vertex_colors(BakeTargets 
*targets, Object *ob)
 const int totvert = me->totvert;
 const int totloop = me->totloop;
 
-MPropCol *mcol = active_color_layer->type == CD_PROP_COLOR ?
- active_color_layer->data :
- MEM_malloc_arrayN(totvert, sizeof(MPropCol), 
__func__);
+MPropCol *mcol = MEM_malloc_arrayN(totvert, sizeof(MPropCol), __func__);
 
 /* Accumulate float vertex colors in scene linear color space. */
 int *num_loops_for_vertex = MEM_callocN(sizeof(int) * me->totvert, 
"num_loops_for_vertex");
@@ -1143,24 +1149,75 @@ static bool 
bake_targets_output_vertex_colors(BakeTargets *targets, Object *ob)
   }
 }
 
-if (mcol != active_color_layer->data) {
-  convert_float_color_to_byte_color(mcol, totvert, is_noncolor, 

[Bf-blender-cvs] [b29d6de77a6] blender-v3.3-release: Fix T99055: Cycles vertex color bake + denoising gives bad result

2022-08-04 Thread Brecht Van Lommel
Commit: b29d6de77a61beb7cbb3bc1839658e8c4796d714
Author: Brecht Van Lommel
Date:   Thu Aug 4 19:28:09 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBb29d6de77a61beb7cbb3bc1839658e8c4796d714

Fix T99055: Cycles vertex color bake + denoising gives bad result

No denoising is supported in this case, it only works on images.

===

M   intern/cycles/blender/sync.cpp

===

diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 63e9e1e0e68..429a8e665af 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -412,7 +412,15 @@ void BlenderSync::sync_integrator(BL::ViewLayer 
_view_layer, bool background)
   integrator->set_direct_light_sampling_type(direct_light_sampling_type);
 #endif
 
-  const DenoiseParams denoise_params = get_denoise_params(b_scene, 
b_view_layer, background);
+  DenoiseParams denoise_params = get_denoise_params(b_scene, b_view_layer, 
background);
+
+  /* No denoising support for vertex color baking, vertices packed into image
+   * buffer have no relation to neighbors. */
+  if (scene->bake_manager->get_baking() &&
+  b_scene.render().bake().target() != 
BL::BakeSettings::target_IMAGE_TEXTURES) {
+denoise_params.use = false;
+  }
+
   integrator->set_use_denoise(denoise_params.use);
 
   /* Only update denoiser parameters if the denoiser is actually used. This 
allows to tweak

___
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] [357ca8f128b] soc-2022-many-lights-sampling: Fix: light tree handles spotlights poorly

2022-08-04 Thread Jeffrey Liu
Commit: 357ca8f128b29542138ea818e2c7ceba28efe7cf
Author: Jeffrey Liu
Date:   Thu Aug 4 13:47:54 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB357ca8f128b29542138ea818e2c7ceba28efe7cf

Fix: light tree handles spotlights poorly

This fix has a special case for spotlights, which will check if the
point falls within the spotlight or not.

===

M   intern/cycles/kernel/light/light_tree.h

===

diff --git a/intern/cycles/kernel/light/light_tree.h 
b/intern/cycles/kernel/light/light_tree.h
index decf7db8fe8..d44ed34cb15 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -119,7 +119,31 @@ ccl_device float 
light_tree_emitter_reservoir_weight(KernelGlobals kg,
   return 0.0f;
 }
 
-sampled = light_sample(kg, lamp, randu, randv, P, path_flag, );
+const ccl_global KernelLight *klight = _data_fetch(lights, lamp);
+
+if (klight->type == LIGHT_SPOT) {
+  /* to-do: since spot light importance sampling isn't the best,
+   * we have a special case to check that the point is inside the cone. */
+  const float radius = klight->spot.radius;
+  const float cos_theta = klight->spot.spot_angle;
+  const float theta = fast_acosf(cos_theta);
+  const float3 light_P = make_float3(klight->co[0], klight->co[1], 
klight->co[2]);
+  const float3 light_dir = make_float3(
+  klight->spot.dir[0], klight->spot.dir[1], klight->spot.dir[2]);
+
+  const float h1 = radius * fast_sinf(theta);
+  const float d1 = radius * cos_theta;
+  const float h2 = d1 / fast_tanf(theta);
+
+  const float3 apex = light_P - (h1 + h2) * light_dir;
+  const float3 apex_to_point = normalize(P - apex);
+  if (dot(apex_to_point, light_dir) < cos_theta) {
+return 0.0f;
+  }
+}
+else {
+  sampled = light_sample(kg, lamp, randu, randv, P, path_flag, );
+}
   }

___
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] [fc82cb14167] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-08-04 Thread Jeffrey Liu
Commit: fc82cb14167d1ef7397450f234802482bfaf9d65
Author: Jeffrey Liu
Date:   Thu Aug 4 13:48:50 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBfc82cb14167d1ef7397450f234802482bfaf9d65

Merge branch 'master' into soc-2022-many-lights-sampling

===



===



___
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] [1c2c468abc9] blender-v3.3-release: Fix T100134: Cycles faceted triangle normals with motion blur

2022-08-04 Thread Brecht Van Lommel
Commit: 1c2c468abc9ecbc09eb87eff4da2023ea506d606
Author: Brecht Van Lommel
Date:   Thu Aug 4 19:08:45 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB1c2c468abc9ecbc09eb87eff4da2023ea506d606

Fix T100134: Cycles faceted triangle normals with motion blur

After recent changes to change barycentric coordinate convention.

===

M   intern/cycles/kernel/geom/motion_triangle_shader.h

===

diff --git a/intern/cycles/kernel/geom/motion_triangle_shader.h 
b/intern/cycles/kernel/geom/motion_triangle_shader.h
index 236e737b785..413a61b380a 100644
--- a/intern/cycles/kernel/geom/motion_triangle_shader.h
+++ b/intern/cycles/kernel/geom/motion_triangle_shader.h
@@ -68,8 +68,8 @@ ccl_device_noinline void 
motion_triangle_shader_setup(KernelGlobals kg,
   sd->N = Ng;
   /* Compute derivatives of P w.r.t. uv. */
 #ifdef __DPDU__
-  sd->dPdu = (verts[0] - verts[2]);
-  sd->dPdv = (verts[1] - verts[2]);
+  sd->dPdu = (verts[1] - verts[0]);
+  sd->dPdv = (verts[2] - verts[0]);
 #endif
   /* Compute smooth normal. */
   if (sd->shader & SHADER_SMOOTH_NORMAL) {
@@ -89,7 +89,7 @@ ccl_device_noinline void 
motion_triangle_shader_setup(KernelGlobals kg,
 float u = sd->u;
 float v = sd->v;
 float w = 1.0f - u - v;
-sd->N = (u * normals[0] + v * normals[1] + w * normals[2]);
+sd->N = (w * normals[0] + u * normals[1] + v * normals[2]);
   }
 }

___
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] [91d365f6df5] blender-v3.3-release: Fix T100205: Cycles wrong volume shading with two materials in object

2022-08-04 Thread Brecht Van Lommel
Commit: 91d365f6df51333757a47b8c18cfd9faae974982
Author: Brecht Van Lommel
Date:   Thu Aug 4 18:57:05 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB91d365f6df51333757a47b8c18cfd9faae974982

Fix T100205: Cycles wrong volume shading with two materials in object

Assume that all faces using the smae material form a closed mesh, so that
joining meshes gives the same result as separate meshes.

It does mean that using different materials on different sides of one
closed mesh do not work, but the meaning of that is poorly defined anyway
if there is a volume interior.

===

M   intern/cycles/kernel/integrator/volume_stack.h

===

diff --git a/intern/cycles/kernel/integrator/volume_stack.h 
b/intern/cycles/kernel/integrator/volume_stack.h
index 97a0f0f386c..675e1927fc0 100644
--- a/intern/cycles/kernel/integrator/volume_stack.h
+++ b/intern/cycles/kernel/integrator/volume_stack.h
@@ -39,7 +39,7 @@ ccl_device void volume_stack_enter_exit(KernelGlobals kg,
 break;
   }
 
-  if (entry.object == sd->object) {
+  if (entry.object == sd->object && entry.shader == sd->shader) {
 /* Shift back next stack entries. */
 do {
   entry = stack_read(i + 1);
@@ -61,7 +61,7 @@ ccl_device void volume_stack_enter_exit(KernelGlobals kg,
   }
 
   /* Already in the stack? then we have nothing to do. */
-  if (entry.object == sd->object) {
+  if (entry.object == sd->object && entry.shader == sd->shader) {
 return;
   }
 }

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


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

2022-08-04 Thread Julian Eisel
Commit: dd4c47314e7550da58753c41d0e22fd3762a7fba
Author: Julian Eisel
Date:   Thu Aug 4 18:56:16 2022 +0200
Branches: master
https://developer.blender.org/rBdd4c47314e7550da58753c41d0e22fd3762a7fba

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] [11b4d0a3c37] blender-v3.3-release: Attempt to fix build errors on MSVC

2022-08-04 Thread Julian Eisel
Commit: 11b4d0a3c3787a90e6f1631f7735d0968afbb20a
Author: Julian Eisel
Date:   Thu Aug 4 18:54:32 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB11b4d0a3c3787a90e6f1631f7735d0968afbb20a

Attempt to fix build errors on MSVC

Same as 03cd79411924, but using a different cast (see 9b9417b66150).

===

M   source/blender/makesrna/intern/rna_path.cc

===

diff --git a/source/blender/makesrna/intern/rna_path.cc 
b/source/blender/makesrna/intern/rna_path.cc
index 8d63dab3d8b..c1613e3927e 100644
--- a/source/blender/makesrna/intern/rna_path.cc
+++ b/source/blender/makesrna/intern/rna_path.cc
@@ -611,7 +611,7 @@ char *RNA_path_append(const char *path,
 
 if (strkey) {
   const int strkey_esc_max_size = (strlen(strkey) * 2) + 1;
-  char *strkey_esc = BLI_array_alloca(strkey_esc, strkey_esc_max_size);
+  char *strkey_esc = static_cast(BLI_array_alloca(strkey_esc, 
strkey_esc_max_size));
   BLI_str_escape(strkey_esc, strkey, strkey_esc_max_size);
   BLI_dynstr_append(dynstr, "\"");
   BLI_dynstr_append(dynstr, strkey_esc);
@@ -706,7 +706,7 @@ const char *RNA_path_array_index_token_find(const char 
*rna_path, const Property
 
   /* Valid 'array part' of a rna path can only have '[', ']' and digit 
characters.
* It may have more than one of those (e.g. `[12][1]`) in case of 
multi-dimensional arrays. */
-  off_t rna_path_len = (off_t)strlen(rna_path);
+  size_t rna_path_len = (size_t)strlen(rna_path);
   if (rna_path[rna_path_len] != ']') {
 return NULL;
   }

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


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

2022-08-04 Thread Hans Goudey
Commit: 56848fe967366564e8336da434dde344f8446173
Author: Hans Goudey
Date:   Thu Aug 4 10:47:54 2022 -0500
Branches: master
https://developer.blender.org/rB56848fe967366564e8336da434dde344f8446173

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] [d730940fdb9] blender-v3.3-release: Fix: Store named attribute node incorrect link drag search

2022-08-04 Thread Hans Goudey
Commit: d730940fdb900dbb25b8b0ff0801f73348be82c9
Author: Hans Goudey
Date:   Thu Aug 4 10:47:31 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rBd730940fdb900dbb25b8b0ff0801f73348be82c9

Fix: Store named attribute node incorrect link drag search

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
index 1d3beb8be96..70c33ad6a96 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
@@ -72,7 +72,7 @@ static void 
node_gather_link_searches(GatherLinkSearchOpParams )
   const NodeDeclaration  = *params.node_type().fixed_declaration;
   search_link_ops_for_declarations(params, declaration.inputs().take_front(2));
 
-  if (params.in_out() == SOCK_OUT) {
+  if (params.in_out() == SOCK_IN) {
 const std::optional type = 
node_data_type_to_custom_data_type(
 static_cast(params.other_socket().type));
 if (type && *type != CD_PROP_STRING) {

___
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] [4655ddf3a2b] master: T90535: import UDIM textures from USD

2022-08-04 Thread Michael Kowalski
Commit: 4655ddf3a2b7fee669f7d01f6f70d5f3711205c6
Author: Michael Kowalski
Date:   Thu Aug 4 11:30:48 2022 -0400
Branches: master
https://developer.blender.org/rB4655ddf3a2b7fee669f7d01f6f70d5f3711205c6

T90535: import UDIM textures from USD

Added logic to the USD Preview Surface importer to
convert UDIM textures.

Reviewed by: Sybren and Jesse

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

===

M   source/blender/io/usd/intern/usd_reader_material.cc

===

diff --git a/source/blender/io/usd/intern/usd_reader_material.cc 
b/source/blender/io/usd/intern/usd_reader_material.cc
index 8feceee55ed..f59b8be147e 100644
--- a/source/blender/io/usd/intern/usd_reader_material.cc
+++ b/source/blender/io/usd/intern/usd_reader_material.cc
@@ -9,8 +9,11 @@
 #include "BKE_node.h"
 #include "BKE_node_tree_update.h"
 
+#include "BLI_fileops.h"
 #include "BLI_math_vector.h"
+#include "BLI_path_util.h"
 #include "BLI_string.h"
+#include "BLI_vector.hh"
 
 #include "DNA_material_types.h"
 
@@ -94,6 +97,60 @@ static void link_nodes(
   nodeAddLink(ntree, source, source_socket, dest, dest_socket);
 }
 
+/* Returns a layer handle retrieved from the given attribute's property specs.
+ * Note that the returned handle may be invalid if no layer could be found. */
+static pxr::SdfLayerHandle get_layer_handle(const pxr::UsdAttribute )
+{
+  for (auto PropertySpec : 
attribute.GetPropertyStack(pxr::UsdTimeCode::EarliestTime())) {
+if (PropertySpec->HasDefaultValue() ||
+
PropertySpec->GetLayer()->GetNumTimeSamplesForPath(PropertySpec->GetPath()) > 
0) {
+  return PropertySpec->GetLayer();
+}
+  }
+
+  return pxr::SdfLayerHandle();
+}
+
+static bool is_udim_path(const std::string )
+{
+  return path.find("") != std::string::npos;
+}
+
+/* For the given UDIM path (assumed to contain the UDIM token), returns an 
array
+ * containing valid tile indices. */
+static blender::Vector get_udim_tiles(const std::string _path)
+{
+  char base_udim_path[FILE_MAX];
+  BLI_strncpy(base_udim_path, file_path.c_str(), sizeof(base_udim_path));
+
+  blender::Vector udim_tiles;
+
+  /* Extract the tile numbers from all files on disk. */
+  ListBase tiles = {nullptr, nullptr};
+  int tile_start, tile_range;
+  bool result = BKE_image_get_tile_info(base_udim_path, , _start, 
_range);
+  if (result) {
+LISTBASE_FOREACH (LinkData *, tile, ) {
+  int tile_number = POINTER_AS_INT(tile->data);
+  udim_tiles.append(tile_number);
+}
+  }
+
+  BLI_freelistN();
+
+  return udim_tiles;
+}
+
+/* Add tiles with the given indices to the given image. */
+static void add_udim_tiles(Image *image, const blender::Vector )
+{
+  image->source = IMA_SRC_TILED;
+
+  for (int tile_number : indices) {
+BKE_image_add_tile(image, tile_number, nullptr);
+  }
+}
+
 /* Returns true if the given shader may have opacity < 1.0, based
  * on heuristics. */
 static bool needs_blend(const pxr::UsdShadeShader _shader)
@@ -600,12 +657,32 @@ void USDMaterialReader::load_tex_image(const 
pxr::UsdShadeShader _shader,
 
   const pxr::SdfAssetPath _path = file_val.Get();
   std::string file_path = asset_path.GetResolvedPath();
+  if (file_path.empty()) {
+/* No resolved path, so use the asset path (usually
+ * necessary for UDIM paths). */
+file_path = asset_path.GetAssetPath();
+
+/* Texture paths are frequently relative to the USD, so get
+ * the absolute path. */
+if (pxr::SdfLayerHandle layer_handle = 
get_layer_handle(file_input.GetAttr())) {
+  file_path = layer_handle->ComputeAbsolutePath(file_path);
+}
+  }
+
   if (file_path.empty()) {
 std::cerr << "WARNING: Couldn't resolve image asset '" << asset_path
   << "' for Texture Image node." << std::endl;
 return;
   }
 
+  /* If this is a UDIM texture, this will store the
+   * UDIM tile indices. */
+  blender::Vector udim_tiles;
+
+  if (is_udim_path(file_path)) {
+udim_tiles = get_udim_tiles(file_path);
+  }
+
   const char *im_file = file_path.c_str();
   Image *image = BKE_image_load_exists(bmain_, im_file);
   if (!image) {
@@ -614,6 +691,10 @@ void USDMaterialReader::load_tex_image(const 
pxr::UsdShadeShader _shader,
 return;
   }
 
+  if (udim_tiles.size() > 0) {
+add_udim_tiles(image, udim_tiles);
+  }
+
   tex_image->id = >id;
 
   /* Set texture color space.

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

2022-08-04 Thread Bastien Montagne
Commit: 3faf5d3252479dae426016b33d17f47d83741020
Author: Bastien Montagne
Date:   Thu Aug 4 17:06:05 2022 +0200
Branches: master
https://developer.blender.org/rB3faf5d3252479dae426016b33d17f47d83741020

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] [aa53eca6b59] blender-v3.3-release: I18n: make several parts of the UI translatable

2022-08-04 Thread Damien Picard
Commit: aa53eca6b5984f94b8ab151492355d448abf7d86
Author: Damien Picard
Date:   Thu Aug 4 16:13:18 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBaa53eca6b5984f94b8ab151492355d448abf7d86

I18n: make several parts of the UI translatable

- batch rename
- keyframe settings
- tool name in Tool properties header
- tool name in Tool properties Drag (fake) enum

- new file templates
- new preset
- new text datablock
- new collection datablock
- new geometry nodes (modifier and node group)
- new grease pencil data (layers and materials)

Ref. T43295

Reviewed By: mont29

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

===

M   release/scripts/startup/bl_operators/geometry_nodes.py
M   release/scripts/startup/bl_operators/presets.py
M   release/scripts/startup/bl_operators/wm.py
M   release/scripts/startup/bl_ui/properties_scene.py
M   release/scripts/startup/bl_ui/space_toolsystem_common.py
M   release/scripts/startup/bl_ui/space_topbar.py
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/gpencil.c
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/gpencil/gpencil_add_blank.c
M   source/blender/editors/gpencil/gpencil_add_lineart.c
M   source/blender/editors/gpencil/gpencil_add_monkey.c
M   source/blender/editors/gpencil/gpencil_add_stroke.c
M   source/blender/editors/space_text/text_ops.c

===

diff --git a/release/scripts/startup/bl_operators/geometry_nodes.py 
b/release/scripts/startup/bl_operators/geometry_nodes.py
index ea4d40bb778..1f573543e7b 100644
--- a/release/scripts/startup/bl_operators/geometry_nodes.py
+++ b/release/scripts/startup/bl_operators/geometry_nodes.py
@@ -3,9 +3,11 @@
 import bpy
 from bpy.types import Operator
 
+from bpy.app.translations import pgettext_data as data_
+
 
 def geometry_node_group_empty_new():
-group = bpy.data.node_groups.new("Geometry Nodes", 'GeometryNodeTree')
+group = bpy.data.node_groups.new(data_("Geometry Nodes"), 
'GeometryNodeTree')
 group.inputs.new('NodeSocketGeometry', "Geometry")
 group.outputs.new('NodeSocketGeometry', "Geometry")
 input_node = group.nodes.new('NodeGroupInput')
@@ -45,7 +47,7 @@ class NewGeometryNodesModifier(Operator):
 return geometry_modifier_poll(context)
 
 def execute(self, context):
-modifier = context.object.modifiers.new("GeometryNodes", "NODES")
+modifier = context.object.modifiers.new(data_("GeometryNodes"), 
"NODES")
 
 if not modifier:
 return {'CANCELLED'}
diff --git a/release/scripts/startup/bl_operators/presets.py 
b/release/scripts/startup/bl_operators/presets.py
index cde4348977f..6bfce948412 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -11,11 +11,13 @@ from bpy.props import (
 StringProperty,
 )
 
+from bpy.app.translations import pgettext_data as data_
+
 # For preset popover menu
 WindowManager.preset_name = StringProperty(
 name="Preset Name",
 description="Name for new preset",
-default="New Preset"
+default=data_("New Preset")
 )
 
 
diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index 3ab124bf4cf..7e7dbbc387e 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2483,8 +2483,8 @@ class BatchRenameAction(bpy.types.PropertyGroup):
 )
 
 # Weak, add/remove as properties.
-op_add: BoolProperty()
-op_remove: BoolProperty()
+op_add: BoolProperty(name="Add")
+op_remove: BoolProperty(name="Remove")
 
 
 class WM_OT_batch_rename(Operator):
@@ -2570,7 +2570,7 @@ class WM_OT_batch_rename(Operator):
 if only_selected else
 scene.sequence_editor.sequences_all,
 "name",
-"Strip(s)",
+iface_("Strip(s)"),
 )
 elif space_type == 'NODE_EDITOR':
 data_type_test = 'NODE'
@@ -2582,7 +2582,7 @@ class WM_OT_batch_rename(Operator):
 if only_selected else
 list(space.node_tree.nodes),
 "name",
-"Node(s)",
+iface_("Node(s)"),
 )
 elif space_type == 'OUTLINER':
 data_type_test = 'COLLECTION'
@@ -2594,7 +2594,7 @@ class WM_OT_batch_rename(Operator):
 if only_selected else
 scene.collection.children_recursive,
 "name",
-"Collection(s)",
+iface_("Collection(s)"),
 )
 else:
 if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and 
context.pose_object):
@@ -2607,7 +2607,7 @@ 

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

2022-08-04 Thread Hans Goudey
Commit: 34912b0586b3cc268fb46fb03503440f40a37027
Author: Hans Goudey
Date:   Thu Aug 4 09:34:52 2022 -0500
Branches: master
https://developer.blender.org/rB34912b0586b3cc268fb46fb03503440f40a37027

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] [605fb8571ea] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-08-04 Thread Jeffrey Liu
Commit: 605fb8571eaa3b316648ee1ae64d232aae36ddff
Author: Jeffrey Liu
Date:   Thu Aug 4 10:29:41 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB605fb8571eaa3b316648ee1ae64d232aae36ddff

Merge branch 'master' into soc-2022-many-lights-sampling

===



===



___
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] [50513e69645] master: Cleanup: Better const correctness and inlined key construction in depsgraph

2022-08-04 Thread Sergey Sharybin
Commit: 50513e6964554b059abc8351eb6b5a34b8ec60a8
Author: Sergey Sharybin
Date:   Thu Aug 4 12:24:44 2022 +0200
Branches: master
https://developer.blender.org/rB50513e6964554b059abc8351eb6b5a34b8ec60a8

Cleanup: Better const correctness and inlined key construction in depsgraph

===

M   source/blender/depsgraph/intern/builder/deg_builder_relations.h
M   source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 9d0d0135d22..db237303027 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -91,42 +91,107 @@ struct TimeSourceKey {
 };
 
 struct ComponentKey {
-  ComponentKey();
-  ComponentKey(ID *id, NodeType type, const char *name = "");
+  ComponentKey() = default;
+
+  inline ComponentKey(const ID *id, NodeType type, const char *name = "")
+  : id(id), type(type), name(name)
+  {
+  }
 
   string identifier() const;
 
-  ID *id;
-  NodeType type;
-  const char *name;
+  const ID *id = nullptr;
+  NodeType type = NodeType::UNDEFINED;
+  const char *name = "";
 };
 
 struct OperationKey {
-  OperationKey();
-  OperationKey(ID *id, NodeType component_type, const char *name, int name_tag 
= -1);
-  OperationKey(
-  ID *id, NodeType component_type, const char *component_name, const char 
*name, int name_tag);
+  OperationKey() = default;
+
+  inline OperationKey(const ID *id, NodeType component_type, const char *name, 
int name_tag = -1)
+  : id(id),
+component_type(component_type),
+component_name(""),
+opcode(OperationCode::OPERATION),
+name(name),
+name_tag(name_tag)
+  {
+  }
+
+  OperationKey(const ID *id,
+   NodeType component_type,
+   const char *component_name,
+   const char *name,
+   int name_tag)
+  : id(id),
+component_type(component_type),
+component_name(component_name),
+opcode(OperationCode::OPERATION),
+name(name),
+name_tag(name_tag)
+  {
+  }
+
+  OperationKey(const ID *id, NodeType component_type, OperationCode opcode)
+  : id(id),
+component_type(component_type),
+component_name(""),
+opcode(opcode),
+name(""),
+name_tag(-1)
+  {
+  }
 
-  OperationKey(ID *id, NodeType component_type, OperationCode opcode);
-  OperationKey(ID *id, NodeType component_type, const char *component_name, 
OperationCode opcode);
+  OperationKey(const ID *id,
+   NodeType component_type,
+   const char *component_name,
+   OperationCode opcode)
+  : id(id),
+component_type(component_type),
+component_name(component_name),
+opcode(opcode),
+name(""),
+name_tag(-1)
+  {
+  }
+
+  OperationKey(const ID *id,
+   NodeType component_type,
+   OperationCode opcode,
+   const char *name,
+   int name_tag = -1)
+  : id(id),
+component_type(component_type),
+component_name(""),
+opcode(opcode),
+name(name),
+name_tag(name_tag)
+  {
+  }
 
-  OperationKey(
-  ID *id, NodeType component_type, OperationCode opcode, const char *name, 
int name_tag = -1);
-  OperationKey(ID *id,
+  OperationKey(const ID *id,
NodeType component_type,
const char *component_name,
OperationCode opcode,
const char *name,
-   int name_tag = -1);
+   int name_tag = -1)
+  : id(id),
+component_type(component_type),
+component_name(component_name),
+opcode(opcode),
+name(name),
+name_tag(name_tag)
+  {
+  }
 
   string identifier() const;
 
-  ID *id;
-  NodeType component_type;
-  const char *component_name;
-  OperationCode opcode;
-  const char *name;
-  int name_tag;
+  const ID *id = nullptr;
+  NodeType component_type = NodeType::UNDEFINED;
+  const char *component_name = "";
+  OperationCode opcode = OperationCode::OPERATION;
+  const char *name = "";
+  int name_tag = -1;
 };
 
 struct RNAPathKey {
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
index 13e4b615641..8506a97c408 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
@@ -22,15 +22,6 @@ string TimeSourceKey::identifier() const
 

 // Component.
 
-ComponentKey::ComponentKey() : id(nullptr), 

[Bf-blender-cvs] [839422cf1c2] master: Cleanup: Remove unused ID from depsgraph time source

2022-08-04 Thread Sergey Sharybin
Commit: 839422cf1c2d569ac6e34c04b1f9366b31150878
Author: Sergey Sharybin
Date:   Thu Aug 4 12:18:06 2022 +0200
Branches: master
https://developer.blender.org/rB839422cf1c2d569ac6e34c04b1f9366b31150878

Cleanup: Remove unused ID from depsgraph time source

===

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/builder/deg_builder_relations_keys.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 91ddd759803..b8563c92e58 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -241,11 +241,6 @@ DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main 
*bmain,
 
 TimeSourceNode *DepsgraphRelationBuilder::get_node(const TimeSourceKey ) 
const
 {
-  if (key.id) {
-/* XXX TODO */
-return nullptr;
-  }
-
   return graph_->time_source;
 }
 
@@ -1977,7 +1972,6 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene 
*scene)
 
 void DepsgraphRelationBuilder::build_particle_systems(Object *object)
 {
-  TimeSourceKey time_src_key;
   OperationKey obdata_ubereval_key(>id, NodeType::GEOMETRY, 
OperationCode::GEOMETRY_EVAL);
   OperationKey eval_init_key(
   >id, NodeType::PARTICLE_SYSTEM, 
OperationCode::PARTICLE_SYSTEM_INIT);
@@ -3092,7 +3086,6 @@ void 
DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node)
 return;
   }
 
-  TimeSourceKey time_source_key;
   OperationKey copy_on_write_key(id_orig, NodeType::COPY_ON_WRITE, 
OperationCode::COPY_ON_WRITE);
   /* XXX: This is a quick hack to make Alt-A to work. */
   // add_relation(time_source_key, copy_on_write_key, "Fluxgate capacitor 
hack");
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 7894cf27682..9d0d0135d22 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -85,12 +85,9 @@ struct RootPChanMap;
 struct TimeSourceNode;
 
 struct TimeSourceKey {
-  TimeSourceKey();
-  TimeSourceKey(ID *id);
+  TimeSourceKey() = default;
 
   string identifier() const;
-
-  ID *id;
 };
 
 struct ComponentKey {
diff --git 
a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
index eeaab623482..13e4b615641 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
@@ -14,14 +14,6 @@ namespace blender::deg {
 

 /* Time source. */
 
-TimeSourceKey::TimeSourceKey() : id(nullptr)
-{
-}
-
-TimeSourceKey::TimeSourceKey(ID *id) : id(id)
-{
-}
-
 string TimeSourceKey::identifier() const
 {
   return string("TimeSourceKey");

___
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] [0844781961e] blender-v3.3-release: Fix: Crash on instance on points node with empty mesh

2022-08-04 Thread Hans Goudey
Commit: 0844781961e8fb92c5b3a09de23ca0c3a0fff0c2
Author: Hans Goudey
Date:   Thu Aug 4 09:15:08 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rB0844781961e8fb92c5b3a09de23ca0c3a0fff0c2

Fix: Crash on instance on points node with empty mesh

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc 
b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
index 119d895fead..37f9917f39d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
@@ -70,6 +70,9 @@ static void add_instances_from_component(
   evaluator.evaluate();
 
   const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
+  if (selection.is_empty()) {
+return;
+  }
 
   /* The initial size of the component might be non-zero when this function is 
called for multiple
* component types. */

___
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] [585dd63c6ef] blender-v3.3-release: Cleanup: Move RNA path functions into own C++ file

2022-08-04 Thread Julian Eisel
Commit: 585dd63c6ef1d983558aac41e7e86a32a8649133
Author: Julian Eisel
Date:   Fri Jul 29 16:56:48 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB585dd63c6ef1d983558aac41e7e86a32a8649133

Cleanup: Move RNA path functions into own C++ file

NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

Adds `rna_path.cc` and `RNA_path.h`.

`rna_access.c` is a quite big file, which makes it rather hard and
inconvenient to navigate. RNA path functions form a nicely coherent unit
that can stand well on it's own, so it makes sense to split them off to
mitigate the problem. Moreover, I was looking into refactoring the quite
convoluted/overloaded `rna_path_parse()`, and found that some C++
features may help greatly with that. So having that code compile in C++
would be helpful to attempt that.

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

Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne

===

M   intern/cycles/blender/sync.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/anim_data.c
M   source/blender/blenkernel/intern/anim_sys.c
M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/blenkernel/intern/fcurve_driver.c
M   source/blender/blenkernel/intern/key.c
M   source/blender/blenkernel/intern/lib_override.cc
M   source/blender/depsgraph/intern/builder/deg_builder_cache.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.h
M   source/blender/depsgraph/intern/depsgraph_query.cc
M   source/blender/draw/intern/draw_instance_data.c
M   source/blender/editors/animation/anim_channels_defines.c
M   source/blender/editors/animation/anim_deps.c
M   source/blender/editors/animation/anim_draw.c
M   source/blender/editors/animation/anim_ipo_utils.c
M   source/blender/editors/animation/drivers.c
M   source/blender/editors/animation/keyframes_general.c
M   source/blender/editors/animation/keyframing.c
M   source/blender/editors/animation/keyingsets.c
M   source/blender/editors/armature/pose_slide.c
M   source/blender/editors/armature/pose_utils.c
M   source/blender/editors/interface/eyedroppers/eyedropper_driver.c
M   source/blender/editors/interface/interface_anim.c
M   source/blender/editors/interface/interface_ops.c
M   source/blender/editors/interface/interface_region_menu_pie.cc
M   source/blender/editors/interface/interface_region_tooltip.c
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/screen/screen_user_menu.c
M   source/blender/editors/space_console/space_console.c
M   source/blender/editors/space_graph/graph_buttons.c
M   source/blender/editors/space_node/node_group.cc
M   source/blender/editors/space_outliner/outliner_edit.cc
M   source/blender/editors/space_text/space_text.c
M   source/blender/io/collada/BCAnimationCurve.cpp
M   source/blender/makesrna/RNA_access.h
A   source/blender/makesrna/RNA_path.h
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/makesrna/intern/rna_access.c
M   source/blender/makesrna/intern/rna_access_compare_override.c
M   source/blender/makesrna/intern/rna_access_internal.h
M   source/blender/makesrna/intern/rna_color.c
M   source/blender/makesrna/intern/rna_internal.h
A   source/blender/makesrna/intern/rna_path.cc
M   source/blender/python/intern/bpy_rna.c
M   source/blender/python/intern/bpy_rna_anim.c
M   source/blender/windowmanager/intern/wm_operators.c
M   source/blender/windowmanager/message_bus/intern/wm_message_bus_rna.c

===

diff --git a/intern/cycles/blender/sync.h b/intern/cycles/blender/sync.h
index 5cc18452ac1..0ad4ca6fe83 100644
--- a/intern/cycles/blender/sync.h
+++ b/intern/cycles/blender/sync.h
@@ -7,6 +7,7 @@
 #include "MEM_guardedalloc.h"
 #include "RNA_access.h"
 #include "RNA_blender_cpp.h"
+#include "RNA_path.h"
 #include "RNA_types.h"
 
 #include "blender/id_map.h"
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 3ea595cfaf0..c16d19588ed 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -53,6 +53,7 @@
 #include "BIK_api.h"
 
 #include "RNA_access.h"
+#include "RNA_path.h"
 #include "RNA_prototypes.h"
 
 #include "BLO_read_write.h"
diff --git a/source/blender/blenkernel/intern/anim_data.c 
b/source/blender/blenkernel/intern/anim_data.c
index 861a89ea9d7..b5b00e031b2 100644
--- a/source/blender/blenkernel/intern/anim_data.c
+++ 

[Bf-blender-cvs] [d2a30abff09] blender-v3.3-release: Outliner: Use UI names and grouping for library overrides properties

2022-08-04 Thread Julian Eisel
Commit: d2a30abff09b5403e72541860935c593602153b2
Author: Julian Eisel
Date:   Thu Aug 4 15:52:51 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBd2a30abff09b5403e72541860935c593602153b2

Outliner: Use UI names and grouping for library overrides properties

NOTE: This is committed to the 3.3 branch as decided by Bastien, Dalai
and me. That is because these are important usability fixes/improvements
to have for the LTS release.

Part of T95802.

Showing properties with an RNA path in the UI isn't very user friendly.
Instead, represent the RNA path as a tree, merging together parts of the
RNA path that are shared by multiple properties. Properties and "groups"
(RNA structs/pointers) are now shown with their UI name and an icon if
any. The actually overridden properties still show the Library Overrides
icon. See the patch for screenshots.

Also: When a RNA collection item, like a modifier or constraint was
added via a library override, indicate that item and show all collection
items in the list, since the complete list of items and their orders may
be important context.

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

===

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

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index fd38bcfc5e2..ae9d145 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -1806,18 +1806,17 @@ static void outliner_draw_overrides_rna_buts(uiBlock 
*block,
 if (!outliner_is_element_in_view(te, >v2d)) {
   continue;
 }
-if (tselem->type != TSE_LIBRARY_OVERRIDE) {
+TreeElementOverridesProperty *override_elem = 
tree_element_cast(
+te);
+if (!override_elem) {
   continue;
 }
 
-TreeElementOverridesProperty _elem = 
*tree_element_cast(
-te);
-
-if (!override_elem.is_rna_path_valid) {
+if (!override_elem->is_rna_path_valid) {
   uiBut *but = uiDefBut(block,
 UI_BTYPE_LABEL,
 0,
-override_elem.rna_path.c_str(),
+override_elem->rna_path.c_str(),
 x + pad_x,
 te->ys + pad_y,
 item_max_width,
@@ -1832,8 +1831,28 @@ static void outliner_draw_overrides_rna_buts(uiBlock 
*block,
   continue;
 }
 
-PointerRNA *ptr = _elem.override_rna_ptr;
-PropertyRNA *prop = _elem.override_rna_prop;
+if (const TreeElementOverridesPropertyOperation *override_op_elem =
+tree_element_cast(te)) {
+  StringRefNull op_label = override_op_elem->getOverrideOperationLabel();
+  uiDefBut(block,
+   UI_BTYPE_LABEL,
+   0,
+   op_label.c_str(),
+   x + pad_x,
+   te->ys + pad_y,
+   item_max_width,
+   item_height,
+   nullptr,
+   0,
+   0,
+   0,
+   0,
+   "");
+  continue;
+}
+
+PointerRNA *ptr = _elem->override_rna_ptr;
+PropertyRNA *prop = _elem->override_rna_prop;
 const PropertyType prop_type = RNA_property_type(prop);
 
 uiBut *auto_but = uiDefAutoButR(block,
@@ -3104,6 +3123,7 @@ static void outliner_draw_iconrow(bContext *C,
 TSE_GP_LAYER,
 TSE_LIBRARY_OVERRIDE_BASE,
 TSE_LIBRARY_OVERRIDE,
+TSE_LIBRARY_OVERRIDE_OPERATION,
 TSE_BONE,
 TSE_EBONE,
 TSE_POSE_CHANNEL,
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc 
b/source/blender/editors/space_outliner/outliner_tree.cc
index b2199f18b7b..3357a456e30 100644
--- a/source/blender/editors/space_outliner/outliner_tree.cc
+++ b/source/blender/editors/space_outliner/outliner_tree.cc
@@ -880,7 +880,10 @@ TreeElement *outliner_add_element(SpaceOutliner 
*space_outliner,
   BLI_assert_msg(0, "Expected this ID type to be ported to new Outliner 
tree-element design");
 }
   }
-  else if (ELEM(type, TSE_LIBRARY_OVERRIDE_BASE, TSE_LIBRARY_OVERRIDE)) {
+  else if (ELEM(type,
+TSE_LIBRARY_OVERRIDE_BASE,
+TSE_LIBRARY_OVERRIDE,
+TSE_LIBRARY_OVERRIDE_OPERATION)) {
 if (!te->abstract_element) {
   

[Bf-blender-cvs] [bd909ff990a] blender-v3.3-release: Outliner: Add generic label element type

2022-08-04 Thread Julian Eisel
Commit: bd909ff990afffc67ecb29ab127f609af6dfc523
Author: Julian Eisel
Date:   Thu Aug 4 15:18:29 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBbd909ff990afffc67ecb29ab127f609af6dfc523

Outliner: Add generic label element type

No user visible changes expected.

NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

We have a bunch of "base" element types, just to show a label element
for grouping together other elements. There is no reason to have these
tied to a case, just have a generic label type for this. It requires a
string to display, and can display an icon too. The new element type
isn't used yet, but will be in one of the following commits. Would be
nice if the existing base elements can be replaced by this.

Part of D15606.

===

M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_outliner/outliner_tree.cc
M   source/blender/editors/space_outliner/tree/tree_element.cc
M   source/blender/editors/space_outliner/tree/tree_element.hh
A   source/blender/editors/space_outliner/tree/tree_element_label.cc
A   source/blender/editors/space_outliner/tree/tree_element_label.hh
M   source/blender/makesdna/DNA_outliner_types.h

===

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt 
b/source/blender/editors/space_outliner/CMakeLists.txt
index 97d2957eed2..78ec057f921 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -48,6 +48,7 @@ set(SRC
   tree/tree_element_anim_data.cc
   tree/tree_element_collection.cc
   tree/tree_element_driver.cc
+  tree/tree_element_label.cc
   tree/tree_element_gpencil_layer.cc
   tree/tree_element_id.cc
   tree/tree_element_id_library.cc
@@ -67,6 +68,7 @@ set(SRC
   tree/tree_element_anim_data.hh
   tree/tree_element_collection.hh
   tree/tree_element_driver.hh
+  tree/tree_element_label.hh
   tree/tree_element_gpencil_layer.hh
   tree/tree_element_id.hh
   tree/tree_element_id_library.hh
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index 6bab0b938e8..fd38bcfc5e2 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -2828,10 +2828,20 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem 
*tselem, TreeElement *te)
 data.icon = tree_element_get_icon_from_id(tselem->id);
   }
 
+  if (!te->abstract_element) {
+/* Pass */
+  }
+  else if (auto icon = te->abstract_element->getIcon()) {
+data.icon = *icon;
+  }
+
   return data;
 }
 
-static void tselem_draw_icon(uiBlock *block,
+/**
+ * \return Return true if the element has an icon that was drawn, false if it 
doesn't have an icon.
+ */
+static bool tselem_draw_icon(uiBlock *block,
  int xmax,
  float x,
  float y,
@@ -2842,7 +2852,7 @@ static void tselem_draw_icon(uiBlock *block,
 {
   TreeElementIcon data = tree_element_get_icon(tselem, te);
   if (data.icon == 0) {
-return;
+return false;
   }
 
   const bool is_collection = outliner_is_collection_tree_element(te);
@@ -2866,7 +2876,7 @@ static void tselem_draw_icon(uiBlock *block,
 0.0f,
 btheme->collection_color[collection->color_tag].color,
 true);
-return;
+return true;
   }
 }
 
@@ -2898,6 +2908,8 @@ static void tselem_draw_icon(uiBlock *block,
  alpha,
  (data.drag_id && ID_IS_LINKED(data.drag_id)) ? 
data.drag_id->lib->filepath : "");
   }
+
+  return true;
 }
 
 /**
@@ -3317,15 +3329,15 @@ static void outliner_draw_tree_element(bContext *C,
 offsx += UI_UNIT_X;
 
 /* Data-type icon. */
-if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, 
TSE_ID_BASE))) {
-  tselem_draw_icon(block,
-   xmax,
-   (float)startx + offsx,
-   (float)*starty,
-   tselem,
-   te,
-   (tselem->flag & TSE_HIGHLIGHTED_ICON) ? alpha_fac + 
0.5f : alpha_fac,
-   true);
+if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, 
TSE_ID_BASE)) &&
+tselem_draw_icon(block,
+ xmax,
+ (float)startx + offsx,
+ (float)*starty,
+ tselem,
+ te,
+ (tselem->flag 

[Bf-blender-cvs] [27d31c15e88] blender-v3.3-release: UI: Pass modifier & constraint icon to the corresponding RNA base type

2022-08-04 Thread Julian Eisel
Commit: 27d31c15e88914e87a0a881072a5a9ee0c99eb48
Author: Julian Eisel
Date:   Thu Aug 4 15:39:36 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB27d31c15e88914e87a0a881072a5a9ee0c99eb48

UI: Pass modifier & constraint icon to the corresponding RNA base type

NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

This basically lets the UI use the constraint or modifier icon, whenever
refering to constraints/modifiers via RNA pointers. Used by D15606, so
that the "Modifiers" tree element to group the individual modifiers
together gets the right icon without hardcoded handling.

===

M   source/blender/makesrna/intern/rna_constraint.c
M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/makesrna/intern/rna_constraint.c 
b/source/blender/makesrna/intern/rna_constraint.c
index 986de0930ed..719c7441174 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -3450,6 +3450,7 @@ void RNA_def_constraint(BlenderRNA *brna)
   RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
   RNA_def_struct_path_func(srna, "rna_Constraint_path");
   RNA_def_struct_sdna(srna, "bConstraint");
+  RNA_def_struct_ui_icon(srna, ICON_CONSTRAINT);
 
   /* strings */
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 4810784b3f7..0e420f7556f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -7243,6 +7243,7 @@ void RNA_def_modifier(BlenderRNA *brna)
   RNA_def_struct_refine_func(srna, "rna_Modifier_refine");
   RNA_def_struct_path_func(srna, "rna_Modifier_path");
   RNA_def_struct_sdna(srna, "ModifierData");
+  RNA_def_struct_ui_icon(srna, ICON_MODIFIER);
 
   /* strings */
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);

___
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] [39a68b27b90] master: Depsgraph: More clear function name for transform dependnecy

2022-08-04 Thread Sergey Sharybin
Commit: 39a68b27b90e4dc85e9eb69364bb81fad8e36337
Author: Sergey Sharybin
Date:   Thu Aug 4 12:11:31 2022 +0200
Branches: master
https://developer.blender.org/rB39a68b27b90e4dc85e9eb69364bb81fad8e36337

Depsgraph: More clear function name for transform dependnecy

The name was confusing to a level that it sounded like the relation
goes the opposite direction than it is intended.

===

M   source/blender/depsgraph/DEG_depsgraph_build.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/depsgraph_build.cc
M   source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
M   source/blender/modifiers/intern/MOD_armature.c
M   source/blender/modifiers/intern/MOD_array.c
M   source/blender/modifiers/intern/MOD_boolean.cc
M   source/blender/modifiers/intern/MOD_cast.c
M   source/blender/modifiers/intern/MOD_cloth.c
M   source/blender/modifiers/intern/MOD_collision.c
M   source/blender/modifiers/intern/MOD_curve.c
M   source/blender/modifiers/intern/MOD_datatransfer.c
M   source/blender/modifiers/intern/MOD_displace.c
M   source/blender/modifiers/intern/MOD_hook.c
M   source/blender/modifiers/intern/MOD_lattice.c
M   source/blender/modifiers/intern/MOD_mask.cc
M   source/blender/modifiers/intern/MOD_mesh_to_volume.cc
M   source/blender/modifiers/intern/MOD_meshdeform.c
M   source/blender/modifiers/intern/MOD_mirror.c
M   source/blender/modifiers/intern/MOD_nodes.cc
M   source/blender/modifiers/intern/MOD_normal_edit.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/modifiers/intern/MOD_shrinkwrap.c
M   source/blender/modifiers/intern/MOD_simpledeform.c
M   source/blender/modifiers/intern/MOD_softbody.c
M   source/blender/modifiers/intern/MOD_uvproject.c
M   source/blender/modifiers/intern/MOD_uvwarp.c
M   source/blender/modifiers/intern/MOD_volume_to_mesh.cc
M   source/blender/modifiers/intern/MOD_warp.c
M   source/blender/modifiers/intern/MOD_wave.c
M   source/blender/modifiers/intern/MOD_weightvgedit.c
M   source/blender/modifiers/intern/MOD_weightvgmix.c
M   source/blender/modifiers/intern/MOD_weightvgproximity.c

===

diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h 
b/source/blender/depsgraph/DEG_depsgraph_build.h
index 763d2d29035..aae5bb2b432 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -161,7 +161,7 @@ void DEG_add_generic_id_relation(struct DepsNodeHandle 
*node_handle,
  * This function will take care of checking which operation is required to
  * have transformation for the modifier, taking into account possible 
simulation solvers.
  */
-void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle,
+void DEG_add_depends_on_transform_relation(struct DepsNodeHandle *node_handle,
 const char *description);
 
 /**
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index cbc95a5d1a9..91ddd759803 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -298,8 +298,8 @@ bool DepsgraphRelationBuilder::has_node(const OperationKey 
) const
   return find_node(key) != nullptr;
 }
 
-void DepsgraphRelationBuilder::add_modifier_to_transform_relation(const 
DepsNodeHandle *handle,
-  const char 
*description)
+void DepsgraphRelationBuilder::add_depends_on_transform_relation(const 
DepsNodeHandle *handle,
+ const char 
*description)
 {
   IDNode *id_node = handle->node->owner->owner;
   ID *id = id_node->id_orig;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 7a78280f1f0..7894cf27682 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -177,7 +177,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
   /* Adds relation from proper transformation operation to the modifier.
* Takes care of checking for possible physics solvers modifying position
* of this object. */
-  void add_modifier_to_transform_relation(const DepsNodeHandle *handle, const 
char *description);
+  void add_depends_on_transform_relation(const DepsNodeHandle *handle, const 
char *description);
 
   void add_customdata_mask(Object *object, const DEGCustomDataMeshMasks 
_masks);
   void 

[Bf-blender-cvs] [665d3db3a40] master: Fix T99460: Allow creation new datablocks from evaluated

2022-08-04 Thread Sergey Sharybin
Commit: 665d3db3a40c1e1ec3c5c5371b29bddcf07a6f92
Author: Sergey Sharybin
Date:   Wed Aug 3 10:54:11 2022 +0200
Branches: master
https://developer.blender.org/rB665d3db3a40c1e1ec3c5c5371b29bddcf07a6f92

Fix T99460: Allow creation new datablocks from evaluated

This changes makes it possible to copy evaluated result and put it
to the original bmain.

Prior to this change from the API point of view there was false
perception that it is possible, while in practice it was very fragile:
it only worked if the ID did not reference any evaluated IDs.

This change makes it so `id.copy()` Python API call will make it so
the copied ID only references original data-blocks. This sounds a bit
implicit, so here is motivational aspect why it is considered better
approach to all other:

- There needs to be a way to support the described scenario, in the
  lest fragile way. Requiring to always use an explicit function call
  or an argument is too verbose and is easy to be missed.

- The `id.copy()` is already doing implicit thing: it always adds the
  result to the bmain. So it might as well ensure the copied result
  does not reference evaluated data-blocks.

- Added clarity in the documentation should address possible confusion.

The limitation of this change is that the copy() of evaluated geometry
will clear its reference to the shape key. This is because the key is
only referenced for validness of RNA paths for drivers and the key
itself might not match topology of evaluated geometry due to modifiers.

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

===

M   source/blender/blenkernel/BKE_lib_id.h
M   source/blender/blenkernel/intern/lib_id.c
M   source/blender/makesrna/intern/rna_ID.c

===

diff --git a/source/blender/blenkernel/BKE_lib_id.h 
b/source/blender/blenkernel/BKE_lib_id.h
index 94497d9a487..148e6ec2791 100644
--- a/source/blender/blenkernel/BKE_lib_id.h
+++ b/source/blender/blenkernel/BKE_lib_id.h
@@ -453,6 +453,11 @@ struct ID *BKE_id_copy_for_duplicate(struct Main *bmain,
  uint duplicate_flags,
  int copy_flags);
 
+/* 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. */
+struct ID *BKE_id_copy_for_use_in_bmain(struct Main *bmain, const struct ID 
*id);
+
 /**
  * Does a mere memory swap over the whole IDs data (including type-specific 
memory).
  * \note Most internal ID data itself is not swapped (only IDProperties are).
diff --git a/source/blender/blenkernel/intern/lib_id.c 
b/source/blender/blenkernel/intern/lib_id.c
index 3778e308db6..5a394a05d86 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -59,6 +59,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_access.h"
 
@@ -708,6 +709,58 @@ ID *BKE_id_copy_for_duplicate(Main *bmain,
   return id->newid;
 }
 
+static int foreach_assign_id_to_orig_callback(LibraryIDLinkCallbackData 
*cb_data)
+{
+  ID **id_p = cb_data->id_pointer;
+
+  if (*id_p) {
+ID *id = *id_p;
+*id_p = DEG_get_original_id(id);
+
+/* If the ID changes increase the user count.
+ *
+ * This means that the reference to evaluated ID has been changed with a 
reference to the
+ * original ID which implies that the user count of the original ID is 
increased.
+ *
+ * The evaluated IDs do not maintain their user counter, so do not change 
it to avoid issues
+ * with the user counter going negative. */
+if (*id_p != id) {
+  if ((cb_data->cb_flag & IDWALK_CB_USER) != 0) {
+id_us_plus(*id_p);
+  }
+}
+  }
+
+  return IDWALK_RET_NOP;
+}
+
+ID *BKE_id_copy_for_use_in_bmain(Main *bmain, const ID *id)
+{
+  ID *newid = BKE_id_copy(bmain, id);
+
+  if (newid == NULL) {
+return newid;
+  }
+
+  /* Assign ID references directly used by the given ID to their original 
complementary parts.
+   *
+   * For example, when is called on an evaluated object will assign 
object->data to its original
+   * pointer, the evaluated object->data will be kept unchanged. */
+  BKE_library_foreach_ID_link(NULL, newid, foreach_assign_id_to_orig_callback, 
NULL, IDWALK_NOP);
+
+  /* Shape keys reference on evaluated ID is preserved to keep driver paths 
available, but the key
+   * data is likely to be invalid now due to modifiers, so clear the shape key 
reference avoiding
+   * any possible shape corruption. */
+  if (DEG_is_evaluated_id(id)) {
+Key **key_p = BKE_key_from_id_p(newid);
+if (key_p) {
+  *key_p = NULL;
+}
+  }
+
+  return newid;
+}
+
 /**
  * Does a mere memory swap over the whole IDs data (including type-specific 
memory).
  * \note Most 

[Bf-blender-cvs] [0828361889d] master: Cleanup: Redundant check in depsgraph builder

2022-08-04 Thread Sergey Sharybin
Commit: 0828361889d440f6f978d7f77a809ee9b78f219b
Author: Sergey Sharybin
Date:   Thu Aug 4 15:47:35 2022 +0200
Branches: master
https://developer.blender.org/rB0828361889d440f6f978d7f77a809ee9b78f219b

Cleanup: Redundant check in depsgraph builder

The build_object_data_geometry() is never called on armatures.

===

M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index f36d94c7563..cbc95a5d1a9 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2263,12 +2263,7 @@ void 
DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
 // add geometry collider relations
   }
   /* Make sure uber update is the last in the dependencies. */
-  if (object->type != OB_ARMATURE) {
-/* Armatures does no longer require uber node. */
-OperationKey obdata_ubereval_key(
->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL);
-add_relation(geom_init_key, obdata_ubereval_key, "Object Geometry 
UberEval");
-  }
+  add_relation(geom_init_key, obdata_ubereval_key, "Object Geometry UberEval");
   if (object->type == OB_MBALL) {
 Object *mom = BKE_mball_basis_find(scene_, object);
 ComponentKey mom_geom_key(>id, NodeType::GEOMETRY);

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


[Bf-blender-cvs] [79955e5f85c] master: Docs: Note storage behavior of override operations in comment

2022-08-04 Thread Julian Eisel
Commit: 79955e5f85c2b05ae7f191af987b2ff743e764fc
Author: Julian Eisel
Date:   Thu Aug 4 15:49:37 2022 +0200
Branches: master
https://developer.blender.org/rB79955e5f85c2b05ae7f191af987b2ff743e764fc

Docs: Note storage behavior of override operations in comment

It's not obvious that override property operations are recreated on undo
pushes, which caused me some confusion. Comment on this, so it's clear
that pointers to the operations shouldn't be stored.

===

M   source/blender/makesdna/DNA_ID.h

===

diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 7cecead8230..b3a07f7ff37 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -256,6 +256,7 @@ typedef struct IDOverrideLibraryProperty {
 
   /**
* List of overriding operations (IDOverrideLibraryPropertyOperation) 
applied to this property.
+   * Recreated as part of the diffing, so do not store any of these elsewhere.
*/
   ListBase operations;

___
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] [67b92418ee7] master: Outliner: Use UI names and grouping for library overrides properties

2022-08-04 Thread Julian Eisel
Commit: 67b92418ee7e8519d20c35a685676b41ca3e5c37
Author: Julian Eisel
Date:   Thu Aug 4 15:52:51 2022 +0200
Branches: master
https://developer.blender.org/rB67b92418ee7e8519d20c35a685676b41ca3e5c37

Outliner: Use UI names and grouping for library overrides properties

Part of T95802.

Showing properties with an RNA path in the UI isn't very user friendly.
Instead, represent the RNA path as a tree, merging together parts of the
RNA path that are shared by multiple properties. Properties and "groups"
(RNA structs/pointers) are now shown with their UI name and an icon if
any. The actually overridden properties still show the Library Overrides
icon. See the patch for screenshots.

Also: When a RNA collection item, like a modifier or constraint was
added via a library override, indicate that item and show all collection
items in the list, since the complete list of items and their orders may
be important context.

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

===

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

===

diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index b74964060a8..8bc1ed8c84e 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -1804,18 +1804,17 @@ static void outliner_draw_overrides_rna_buts(uiBlock 
*block,
 if (!outliner_is_element_in_view(te, >v2d)) {
   continue;
 }
-if (tselem->type != TSE_LIBRARY_OVERRIDE) {
+TreeElementOverridesProperty *override_elem = 
tree_element_cast(
+te);
+if (!override_elem) {
   continue;
 }
 
-TreeElementOverridesProperty _elem = 
*tree_element_cast(
-te);
-
-if (!override_elem.is_rna_path_valid) {
+if (!override_elem->is_rna_path_valid) {
   uiBut *but = uiDefBut(block,
 UI_BTYPE_LABEL,
 0,
-override_elem.rna_path.c_str(),
+override_elem->rna_path.c_str(),
 x + pad_x,
 te->ys + pad_y,
 item_max_width,
@@ -1830,8 +1829,28 @@ static void outliner_draw_overrides_rna_buts(uiBlock 
*block,
   continue;
 }
 
-PointerRNA *ptr = _elem.override_rna_ptr;
-PropertyRNA *prop = _elem.override_rna_prop;
+if (const TreeElementOverridesPropertyOperation *override_op_elem =
+tree_element_cast(te)) {
+  StringRefNull op_label = override_op_elem->getOverrideOperationLabel();
+  uiDefBut(block,
+   UI_BTYPE_LABEL,
+   0,
+   op_label.c_str(),
+   x + pad_x,
+   te->ys + pad_y,
+   item_max_width,
+   item_height,
+   nullptr,
+   0,
+   0,
+   0,
+   0,
+   "");
+  continue;
+}
+
+PointerRNA *ptr = _elem->override_rna_ptr;
+PropertyRNA *prop = _elem->override_rna_prop;
 const PropertyType prop_type = RNA_property_type(prop);
 
 uiBut *auto_but = uiDefAutoButR(block,
@@ -3101,6 +3120,7 @@ static void outliner_draw_iconrow(bContext *C,
 TSE_GP_LAYER,
 TSE_LIBRARY_OVERRIDE_BASE,
 TSE_LIBRARY_OVERRIDE,
+TSE_LIBRARY_OVERRIDE_OPERATION,
 TSE_BONE,
 TSE_EBONE,
 TSE_POSE_CHANNEL,
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc 
b/source/blender/editors/space_outliner/outliner_tree.cc
index 98c1d0836cd..0906bbb5797 100644
--- a/source/blender/editors/space_outliner/outliner_tree.cc
+++ b/source/blender/editors/space_outliner/outliner_tree.cc
@@ -880,7 +880,10 @@ TreeElement *outliner_add_element(SpaceOutliner 
*space_outliner,
   BLI_assert_msg(0, "Expected this ID type to be ported to new Outliner 
tree-element design");
 }
   }
-  else if (ELEM(type, TSE_LIBRARY_OVERRIDE_BASE, TSE_LIBRARY_OVERRIDE)) {
+  else if (ELEM(type,
+TSE_LIBRARY_OVERRIDE_BASE,
+TSE_LIBRARY_OVERRIDE,
+TSE_LIBRARY_OVERRIDE_OPERATION)) {
 if (!te->abstract_element) {
   BLI_assert_msg(0,
  "Expected override types to be ported to new Outliner 
tree-element design");
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc 

[Bf-blender-cvs] [735b26053ee] master: Outliner: Add debugging utility to print an elements path

2022-08-04 Thread Julian Eisel
Commit: 735b26053eecd3df7679c16b69910f3c65cfc808
Author: Julian Eisel
Date:   Thu Aug 4 15:33:51 2022 +0200
Branches: master
https://developer.blender.org/rB735b26053eecd3df7679c16b69910f3c65cfc808

Outliner: Add debugging utility to print an elements path

No user visible changes expected.

Adds a function that prints the "path" of an element, that is, the
ancestor elements starting from the root, separated by slashes. This can
be useful for debugging. The function isn't used.

===

M   source/blender/editors/space_outliner/tree/tree_element.cc
M   source/blender/editors/space_outliner/tree/tree_element.hh

===

diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc 
b/source/blender/editors/space_outliner/tree/tree_element.cc
index 5ad8ae0220a..0ee610a91f2 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element.cc
@@ -4,6 +4,9 @@
  * \ingroup spoutliner
  */
 
+#include 
+#include 
+
 #include "DNA_anim_types.h"
 #include "DNA_listBase.h"
 #include "DNA_space_types.h"
@@ -111,6 +114,17 @@ std::optional AbstractTreeElement::getIcon() 
const
   return {};
 }
 
+void AbstractTreeElement::print_path()
+{
+  std::string path = legacy_te_.name;
+
+  for (TreeElement *parent = legacy_te_.parent; parent; parent = 
parent->parent) {
+path = parent->name + std::string_view("/") + path;
+  }
+
+  std::cout << path << std::endl;
+}
+
 void AbstractTreeElement::uncollapse_by_default(TreeElement *legacy_te)
 {
   if (!TREESTORE(legacy_te)->used) {
diff --git a/source/blender/editors/space_outliner/tree/tree_element.hh 
b/source/blender/editors/space_outliner/tree/tree_element.hh
index a3598e7740b..fc6211f20ea 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element.hh
@@ -74,6 +74,16 @@ class AbstractTreeElement {
*/
   virtual std::optional getIcon() const;
 
+  /**
+   * Debugging helper: Print effective path of this tree element, constructed 
out of the
+   * #TreeElement.name of each element. E.g.:
+   * - Lorem
+   *   - ipsum dolor sit
+   * - amet
+   * will print: Lorem/ipsum dolor sit/amet.
+   */
+  void print_path();
+
   /**
* Expand this tree element if it is displayed for the first time (as 
identified by its
* tree-store element).

___
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] [2a3e4d8bcd3] master: Outliner: Add generic label element type

2022-08-04 Thread Julian Eisel
Commit: 2a3e4d8bcd3447ca307108c95b0eeb9ee8bf7323
Author: Julian Eisel
Date:   Thu Aug 4 15:18:29 2022 +0200
Branches: master
https://developer.blender.org/rB2a3e4d8bcd3447ca307108c95b0eeb9ee8bf7323

Outliner: Add generic label element type

No user visible changes expected.

We have a bunch of "base" element types, just to show a label element
for grouping together other elements. There is no reason to have these
tied to a case, just have a generic label type for this. It requires a
string to display, and can display an icon too. The new element type
isn't used yet, but will be in one of the following commits. Would be
nice if the existing base elements can be replaced by this.

Part of D15606.

===

M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_outliner/outliner_draw.cc
M   source/blender/editors/space_outliner/outliner_tree.cc
M   source/blender/editors/space_outliner/tree/tree_element.cc
M   source/blender/editors/space_outliner/tree/tree_element.hh
A   source/blender/editors/space_outliner/tree/tree_element_label.cc
A   source/blender/editors/space_outliner/tree/tree_element_label.hh
M   source/blender/makesdna/DNA_outliner_types.h

===

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt 
b/source/blender/editors/space_outliner/CMakeLists.txt
index 97d2957eed2..78ec057f921 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -48,6 +48,7 @@ set(SRC
   tree/tree_element_anim_data.cc
   tree/tree_element_collection.cc
   tree/tree_element_driver.cc
+  tree/tree_element_label.cc
   tree/tree_element_gpencil_layer.cc
   tree/tree_element_id.cc
   tree/tree_element_id_library.cc
@@ -67,6 +68,7 @@ set(SRC
   tree/tree_element_anim_data.hh
   tree/tree_element_collection.hh
   tree/tree_element_driver.hh
+  tree/tree_element_label.hh
   tree/tree_element_gpencil_layer.hh
   tree/tree_element_id.hh
   tree/tree_element_id_library.hh
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc 
b/source/blender/editors/space_outliner/outliner_draw.cc
index 1828846811a..b74964060a8 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -2825,10 +2825,20 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem 
*tselem, TreeElement *te)
 data.icon = tree_element_get_icon_from_id(tselem->id);
   }
 
+  if (!te->abstract_element) {
+/* Pass */
+  }
+  else if (auto icon = te->abstract_element->getIcon()) {
+data.icon = *icon;
+  }
+
   return data;
 }
 
-static void tselem_draw_icon(uiBlock *block,
+/**
+ * \return Return true if the element has an icon that was drawn, false if it 
doesn't have an icon.
+ */
+static bool tselem_draw_icon(uiBlock *block,
  int xmax,
  float x,
  float y,
@@ -2839,7 +2849,7 @@ static void tselem_draw_icon(uiBlock *block,
 {
   TreeElementIcon data = tree_element_get_icon(tselem, te);
   if (data.icon == 0) {
-return;
+return false;
   }
 
   const bool is_collection = outliner_is_collection_tree_element(te);
@@ -2863,7 +2873,7 @@ static void tselem_draw_icon(uiBlock *block,
 0.0f,
 btheme->collection_color[collection->color_tag].color,
 true);
-return;
+return true;
   }
 }
 
@@ -2895,6 +2905,8 @@ static void tselem_draw_icon(uiBlock *block,
  alpha,
  (data.drag_id && ID_IS_LINKED(data.drag_id)) ? 
data.drag_id->lib->filepath : "");
   }
+
+  return true;
 }
 
 /**
@@ -3314,15 +3326,15 @@ static void outliner_draw_tree_element(bContext *C,
 offsx += UI_UNIT_X;
 
 /* Data-type icon. */
-if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, 
TSE_ID_BASE))) {
-  tselem_draw_icon(block,
-   xmax,
-   (float)startx + offsx,
-   (float)*starty,
-   tselem,
-   te,
-   (tselem->flag & TSE_HIGHLIGHTED_ICON) ? alpha_fac + 
0.5f : alpha_fac,
-   true);
+if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, 
TSE_ID_BASE)) &&
+tselem_draw_icon(block,
+ xmax,
+ (float)startx + offsx,
+ (float)*starty,
+ tselem,
+ te,
+ (tselem->flag & TSE_HIGHLIGHTED_ICON) ? alpha_fac + 
0.5f : alpha_fac,
+ true)) {
   offsx += UI_UNIT_X + 4 * ufac;
 }
 else {
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc 

[Bf-blender-cvs] [f8b5706a1ff] blender-v3.3-release: Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode

2022-08-04 Thread Germano Cavalcante
Commit: f8b5706a1ffe61ae3bdd949ad851d6e9ff3fe188
Author: Germano Cavalcante
Date:   Wed Aug 3 15:12:18 2022 -0300
Branches: blender-v3.3-release
https://developer.blender.org/rBf8b5706a1ffe61ae3bdd949ad851d6e9ff3fe188

Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in 
Edit Mode

Add specific modal keyitem for Vert/Edge Slide or TrackBall.

Note that there is a workround to avoid repeated keys in the status bar.

Reviewed By: campbellbarton

Maniphest Tasks: T100129

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

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index d08efc6909b..10c8c58763b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5751,7 +5751,9 @@ def km_transform_modal_map(_params):
 ("PLANE_Z", {"type": 'Z', "value": 'PRESS', "shift": True}, None),
 ("CONS_OFF", {"type": 'C', "value": 'PRESS'}, None),
 ("TRANSLATE", {"type": 'G', "value": 'PRESS'}, None),
+("VERT_EDGE_SLIDE", {"type": 'G', "value": 'PRESS'}, None),
 ("ROTATE", {"type": 'R', "value": 'PRESS'}, None),
+("TRACKBALL", {"type": 'R', "value": 'PRESS'}, None),
 ("RESIZE", {"type": 'S', "value": 'PRESS'}, None),
 ("SNAP_TOGGLE", {"type": 'TAB', "value": 'PRESS', "shift": True}, 
None),
 ("SNAP_INV_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, 
None),
diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index c9d66afb796..c1e44ffe306 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3968,7 +3968,9 @@ def km_transform_modal_map(_params):
 ("PLANE_Z", {"type": 'Z', "value": 'PRESS', "shift": True}, None),
 ("CONS_OFF", {"type": 'C', "value": 'PRESS'}, None),
 ("TRANSLATE", {"type": 'G', "value": 'PRESS'}, None),
+("VERT_EDGE_SLIDE", {"type": 'G', "value": 'PRESS'}, None),
 ("ROTATE", {"type": 'R', "value": 'PRESS'}, None),
+("TRACKBALL", {"type": 'R', "value": 'PRESS'}, None),
 ("RESIZE", {"type": 'S', "value": 'PRESS'}, None),
 ("SNAP_TOGGLE", {"type": 'TAB', "value": 'PRESS', "shift": True}, 
None),
 ("SNAP_INV_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, 
None),
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 8dcbf07b776..7567fd0a91d 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -641,10 +641,48 @@ static bool transform_modal_item_poll(const wmOperator 
*op, int value)
 }
 case TFM_MODAL_TRANSLATE:
 case TFM_MODAL_ROTATE:
-case TFM_MODAL_RESIZE: {
+case TFM_MODAL_RESIZE:
+case TFM_MODAL_VERT_EDGE_SLIDE:
+case TFM_MODAL_TRACKBALL: {
   if (!transform_mode_is_changeable(t->mode)) {
 return false;
   }
+  if (value == TFM_MODAL_TRANSLATE && t->mode == TFM_TRANSLATION) {
+return false;
+  }
+  if (value == TFM_MODAL_ROTATE && t->mode == TFM_ROTATION) {
+return false;
+  }
+  if (value == TFM_MODAL_RESIZE && t->mode == TFM_RESIZE) {
+return false;
+  }
+  if (value == TFM_MODAL_VERT_EDGE_SLIDE &&
+  (t->data_type != _Mesh ||
+   /* WORKAROUND: Avoid repeated keys in status bar.
+*
+* Previously, `Vert/Edge Slide` and `Move` were triggered by the 
same modal key.
+* But now, to fix T100129, `Vert/Edge Slide` has its own modal key.
+* However by default it uses the same key as `Move` (G).
+* So, to avoid displaying the same key twice (G and G), only 
display this modal key
+* during the `Move` operation.
+*
+* Ideally we should check if it really uses the same key. */
+   t->mode != TFM_TRANSLATION)) {
+return false;
+  }
+  if (value == TFM_MODAL_TRACKBALL &&
+  /* WORKAROUND: Avoid repeated keys in status bar.
+   *
+   * Previously, `Trackball` and `Rotate` were triggered by the same 
modal key.
+   * But now, to fix T100129, `Trackball` has its own modal key.
+   * However by default it uses the same key as `Rotate` 

[Bf-blender-cvs] [8e3eea372d4] master: UI: Pass modifier & constraint icon to the corresponding RNA base type

2022-08-04 Thread Julian Eisel
Commit: 8e3eea372d4a6973dc700fafb3feed2cda511b25
Author: Julian Eisel
Date:   Thu Aug 4 15:39:36 2022 +0200
Branches: master
https://developer.blender.org/rB8e3eea372d4a6973dc700fafb3feed2cda511b25

UI: Pass modifier & constraint icon to the corresponding RNA base type

This basically lets the UI use the constraint or modifier icon, whenever
refering to constraints/modifiers via RNA pointers. Used by D15606, so
that the "Modifiers" tree element to group the individual modifiers
together gets the right icon without hardcoded handling.

===

M   source/blender/makesrna/intern/rna_constraint.c
M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/makesrna/intern/rna_constraint.c 
b/source/blender/makesrna/intern/rna_constraint.c
index 986de0930ed..719c7441174 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -3450,6 +3450,7 @@ void RNA_def_constraint(BlenderRNA *brna)
   RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
   RNA_def_struct_path_func(srna, "rna_Constraint_path");
   RNA_def_struct_sdna(srna, "bConstraint");
+  RNA_def_struct_ui_icon(srna, ICON_CONSTRAINT);
 
   /* strings */
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 4810784b3f7..0e420f7556f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -7243,6 +7243,7 @@ void RNA_def_modifier(BlenderRNA *brna)
   RNA_def_struct_refine_func(srna, "rna_Modifier_refine");
   RNA_def_struct_path_func(srna, "rna_Modifier_path");
   RNA_def_struct_sdna(srna, "ModifierData");
+  RNA_def_struct_ui_icon(srna, ICON_MODIFIER);
 
   /* strings */
   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);

___
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] [791bfae1d64] master: Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode

2022-08-04 Thread Germano Cavalcante
Commit: 791bfae1d64b8969a7edbc6b020f7fba873f77ee
Author: Germano Cavalcante
Date:   Wed Aug 3 15:12:18 2022 -0300
Branches: master
https://developer.blender.org/rB791bfae1d64b8969a7edbc6b020f7fba873f77ee

Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in 
Edit Mode

Add specific modal keyitem for Vert/Edge Slide or TrackBall.

Note that there is a workround to avoid repeated keys in the status bar.

Reviewed By: campbellbarton

Maniphest Tasks: T100129

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

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   
release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index d08efc6909b..10c8c58763b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5751,7 +5751,9 @@ def km_transform_modal_map(_params):
 ("PLANE_Z", {"type": 'Z', "value": 'PRESS', "shift": True}, None),
 ("CONS_OFF", {"type": 'C', "value": 'PRESS'}, None),
 ("TRANSLATE", {"type": 'G', "value": 'PRESS'}, None),
+("VERT_EDGE_SLIDE", {"type": 'G', "value": 'PRESS'}, None),
 ("ROTATE", {"type": 'R', "value": 'PRESS'}, None),
+("TRACKBALL", {"type": 'R', "value": 'PRESS'}, None),
 ("RESIZE", {"type": 'S', "value": 'PRESS'}, None),
 ("SNAP_TOGGLE", {"type": 'TAB', "value": 'PRESS', "shift": True}, 
None),
 ("SNAP_INV_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, 
None),
diff --git 
a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py 
b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index c9d66afb796..c1e44ffe306 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3968,7 +3968,9 @@ def km_transform_modal_map(_params):
 ("PLANE_Z", {"type": 'Z', "value": 'PRESS', "shift": True}, None),
 ("CONS_OFF", {"type": 'C', "value": 'PRESS'}, None),
 ("TRANSLATE", {"type": 'G', "value": 'PRESS'}, None),
+("VERT_EDGE_SLIDE", {"type": 'G', "value": 'PRESS'}, None),
 ("ROTATE", {"type": 'R', "value": 'PRESS'}, None),
+("TRACKBALL", {"type": 'R', "value": 'PRESS'}, None),
 ("RESIZE", {"type": 'S', "value": 'PRESS'}, None),
 ("SNAP_TOGGLE", {"type": 'TAB', "value": 'PRESS', "shift": True}, 
None),
 ("SNAP_INV_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, 
None),
diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 8dcbf07b776..7567fd0a91d 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -641,10 +641,48 @@ static bool transform_modal_item_poll(const wmOperator 
*op, int value)
 }
 case TFM_MODAL_TRANSLATE:
 case TFM_MODAL_ROTATE:
-case TFM_MODAL_RESIZE: {
+case TFM_MODAL_RESIZE:
+case TFM_MODAL_VERT_EDGE_SLIDE:
+case TFM_MODAL_TRACKBALL: {
   if (!transform_mode_is_changeable(t->mode)) {
 return false;
   }
+  if (value == TFM_MODAL_TRANSLATE && t->mode == TFM_TRANSLATION) {
+return false;
+  }
+  if (value == TFM_MODAL_ROTATE && t->mode == TFM_ROTATION) {
+return false;
+  }
+  if (value == TFM_MODAL_RESIZE && t->mode == TFM_RESIZE) {
+return false;
+  }
+  if (value == TFM_MODAL_VERT_EDGE_SLIDE &&
+  (t->data_type != _Mesh ||
+   /* WORKAROUND: Avoid repeated keys in status bar.
+*
+* Previously, `Vert/Edge Slide` and `Move` were triggered by the 
same modal key.
+* But now, to fix T100129, `Vert/Edge Slide` has its own modal key.
+* However by default it uses the same key as `Move` (G).
+* So, to avoid displaying the same key twice (G and G), only 
display this modal key
+* during the `Move` operation.
+*
+* Ideally we should check if it really uses the same key. */
+   t->mode != TFM_TRANSLATION)) {
+return false;
+  }
+  if (value == TFM_MODAL_TRACKBALL &&
+  /* WORKAROUND: Avoid repeated keys in status bar.
+   *
+   * Previously, `Trackball` and `Rotate` were triggered by the same 
modal key.
+   * But now, to fix T100129, `Trackball` has its own modal key.
+   * However by default it uses the same key as `Rotate` (R).
+ 

[Bf-blender-cvs] [1ffb011d677] blender-v3.3-release: Fix T100171: GPencil toggle caps operator does not support multiframe

2022-08-04 Thread Antonio Vazquez
Commit: 1ffb011d677647f6e049e9ca76d1ba31d156308a
Author: Antonio Vazquez
Date:   Wed Aug 3 15:45:08 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB1ffb011d677647f6e049e9ca76d1ba31d156308a

Fix T100171: GPencil toggle caps operator does not support multiframe

This was a missing feature.

===

M   source/blender/editors/gpencil/gpencil_edit.c

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 69a74c36aee..c05ab8c6b28 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3395,6 +3395,7 @@ static int gpencil_stroke_caps_set_exec(bContext *C, 
wmOperator *op)
   bGPdata *gpd = ED_gpencil_data_get_active(C);
   Object *ob = CTX_data_active_object(C);
   const int type = RNA_enum_get(op->ptr, "type");
+  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
 
   /* sanity checks */
   if (ELEM(NULL, gpd)) {
@@ -3404,46 +3405,57 @@ static int gpencil_stroke_caps_set_exec(bContext *C, 
wmOperator *op)
   bool changed = false;
   /* loop all selected strokes */
   CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
-if (gpl->actframe == NULL) {
-  continue;
-}
+bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
 
-for (bGPDstroke *gps = gpl->actframe->strokes.last; gps; gps = gps->prev) {
-  MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, 
gps->mat_nr + 1);
+for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
+  if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && 
(is_multiedit))) {
+if (gpf == NULL) {
+  continue;
+}
 
-  /* skip strokes that are not selected or invalid for current view */
-  if (((gps->flag & GP_STROKE_SELECT) == 0) || 
(ED_gpencil_stroke_can_use(C, gps) == false)) {
-continue;
-  }
-  /* skip hidden or locked colors */
-  if (!gp_style || (gp_style->flag & GP_MATERIAL_HIDE) ||
-  (gp_style->flag & GP_MATERIAL_LOCKED)) {
-continue;
-  }
+for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+  MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, 
gps->mat_nr + 1);
 
-  short prev_first = gps->caps[0];
-  short prev_last = gps->caps[1];
+  /* skip strokes that are not selected or invalid for current view */
+  if (((gps->flag & GP_STROKE_SELECT) == 0) ||
+  (ED_gpencil_stroke_can_use(C, gps) == false)) {
+continue;
+  }
+  /* skip hidden or locked colors */
+  if (!gp_style || (gp_style->flag & GP_MATERIAL_HIDE) ||
+  (gp_style->flag & GP_MATERIAL_LOCKED)) {
+continue;
+  }
+
+  short prev_first = gps->caps[0];
+  short prev_last = gps->caps[1];
+
+  if (ELEM(type, GP_STROKE_CAPS_TOGGLE_BOTH, 
GP_STROKE_CAPS_TOGGLE_START)) {
+++gps->caps[0];
+if (gps->caps[0] >= GP_STROKE_CAP_MAX) {
+  gps->caps[0] = GP_STROKE_CAP_ROUND;
+}
+  }
+  if (ELEM(type, GP_STROKE_CAPS_TOGGLE_BOTH, 
GP_STROKE_CAPS_TOGGLE_END)) {
+++gps->caps[1];
+if (gps->caps[1] >= GP_STROKE_CAP_MAX) {
+  gps->caps[1] = GP_STROKE_CAP_ROUND;
+}
+  }
+  if (type == GP_STROKE_CAPS_TOGGLE_DEFAULT) {
+gps->caps[0] = GP_STROKE_CAP_ROUND;
+gps->caps[1] = GP_STROKE_CAP_ROUND;
+  }
 
-  if (ELEM(type, GP_STROKE_CAPS_TOGGLE_BOTH, GP_STROKE_CAPS_TOGGLE_START)) 
{
-++gps->caps[0];
-if (gps->caps[0] >= GP_STROKE_CAP_MAX) {
-  gps->caps[0] = GP_STROKE_CAP_ROUND;
+  if (prev_first != gps->caps[0] || prev_last != gps->caps[1]) {
+changed = true;
+  }
 }
-  }
-  if (ELEM(type, GP_STROKE_CAPS_TOGGLE_BOTH, GP_STROKE_CAPS_TOGGLE_END)) {
-++gps->caps[1];
-if (gps->caps[1] >= GP_STROKE_CAP_MAX) {
-  gps->caps[1] = GP_STROKE_CAP_ROUND;
+/* If not multi-edit, exit loop. */
+if (!is_multiedit) {
+  break;
 }
   }
-  if (type == GP_STROKE_CAPS_TOGGLE_DEFAULT) {
-gps->caps[0] = GP_STROKE_CAP_ROUND;
-gps->caps[1] = GP_STROKE_CAP_ROUND;
-  }
-
-  if (prev_first != gps->caps[0] || prev_last != gps->caps[1]) {
-changed = true;
-  }
 }
   }
   CTX_DATA_END;
@@ -3550,9 +3562,9 @@ static int gpencil_stroke_join_exec(bContext *C, 
wmOperator *op)
   bGPdata *gpd = ED_gpencil_data_get_active(C);
   bGPDlayer *activegpl = BKE_gpencil_layer_active_get(gpd);
   Object *ob = CTX_data_active_object(C);
-  /* Limit the number of strokes to join. It makes no sense to allow an very 
high number of strokes
-   * for 

[Bf-blender-cvs] [c67d4117d4b] master: Fix broken build due to missing include.

2022-08-04 Thread Bastien Montagne
Commit: c67d4117d4bd40d18681eecbcf72108c3d9829b6
Author: Bastien Montagne
Date:   Thu Aug 4 14:52:51 2022 +0200
Branches: master
https://developer.blender.org/rBc67d4117d4bd40d18681eecbcf72108c3d9829b6

Fix broken build due to missing include.

Caused by rBa95103f6f4abda2b. Please build blender before committing!

===

M   intern/ghost/intern/GHOST_DropTargetX11.cpp

===

diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp 
b/intern/ghost/intern/GHOST_DropTargetX11.cpp
index b4cb088cbeb..4da3c7c996d 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp
@@ -7,6 +7,7 @@
 
 #include "GHOST_DropTargetX11.h"
 #include "GHOST_Debug.h"
+#include "GHOST_PathUtils.h"
 #include "GHOST_utildefines.h"
 
 #include 

___
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] [a95103f6f4a] master: GHOST/Wayland: support URL decoding for file drag & drop

2022-08-04 Thread Campbell Barton
Commit: a95103f6f4abda2be9020f13df1256bf0f62c255
Author: Campbell Barton
Date:   Thu Aug 4 22:33:23 2022 +1000
Branches: master
https://developer.blender.org/rBa95103f6f4abda2be9020f13df1256bf0f62c255

GHOST/Wayland: support URL decoding for file drag & drop

Paths that contained characters that needed escaping as URL's failed
to import.

Move URL decoding to a new file (GHOST_PathUtils), shared with X11 but
maybe be useful for other platforms too.

===

M   intern/ghost/CMakeLists.txt
M   intern/ghost/intern/GHOST_DropTargetX11.cpp
M   intern/ghost/intern/GHOST_DropTargetX11.h
A   intern/ghost/intern/GHOST_PathUtils.cpp
A   intern/ghost/intern/GHOST_PathUtils.h
M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index cf0d4b1e35d..0ac3a234946 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -26,6 +26,7 @@ set(SRC
   intern/GHOST_ISystemPaths.cpp
   intern/GHOST_ModifierKeys.cpp
   intern/GHOST_Path-api.cpp
+  intern/GHOST_PathUtils.cpp
   intern/GHOST_Rect.cpp
   intern/GHOST_System.cpp
   intern/GHOST_TimerManager.cpp
@@ -60,6 +61,7 @@ set(SRC
   intern/GHOST_EventTrackpad.h
   intern/GHOST_EventWheel.h
   intern/GHOST_ModifierKeys.h
+  intern/GHOST_PathUtils.h
   intern/GHOST_System.h
   intern/GHOST_SystemPaths.h
   intern/GHOST_TimerManager.h
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp 
b/intern/ghost/intern/GHOST_DropTargetX11.cpp
index 252a8bfd095..b4cb088cbeb 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp
@@ -97,89 +97,10 @@ GHOST_DropTargetX11::~GHOST_DropTargetX11()
   }
 }
 
-/* Based on: https://stackoverflow.com/a/2766963/432509 */
-
-using DecodeState_e = enum DecodeState_e {
-  /** Searching for an ampersand to convert. */
-  STATE_SEARCH = 0,
-  /** Convert the two proceeding characters from hex. */
-  STATE_CONVERTING
-};
-
-void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const 
char *encodedIn)
-{
-  unsigned int i;
-  unsigned int len = strlen(encodedIn);
-  DecodeState_e state = STATE_SEARCH;
-  int j;
-  unsigned int asciiCharacter;
-  char tempNumBuf[3] = {0};
-  bool bothDigits = true;
-
-  memset(decodedOut, 0, bufferSize);
-
-  for (i = 0; i < len; ++i) {
-switch (state) {
-  case STATE_SEARCH:
-if (encodedIn[i] != '%') {
-  strncat(decodedOut, [i], 1);
-  assert((int)strlen(decodedOut) < bufferSize);
-  break;
-}
-
-/* We are now converting */
-state = STATE_CONVERTING;
-break;
-
-  case STATE_CONVERTING:
-bothDigits = true;
-
-/* Create a buffer to hold the hex. For example, if %20, this
- * buffer would hold 20 (in ASCII) */
-memset(tempNumBuf, 0, sizeof(tempNumBuf));
-
-/* Conversion complete (i.e. don't convert again next iter) */
-state = STATE_SEARCH;
-
-strncpy(tempNumBuf, [i], 2);
-
-/* Ensure both characters are hexadecimal */
-
-for (j = 0; j < 2; ++j) {
-  if (!isxdigit(tempNumBuf[j])) {
-bothDigits = false;
-  }
-}
-
-if (!bothDigits) {
-  break;
-}
-/* Convert two hexadecimal characters into one character */
-sscanf(tempNumBuf, "%x", );
-
-/* Ensure we aren't going to overflow */
-assert((int)strlen(decodedOut) < bufferSize);
-
-/* Concatenate this character onto the output */
-strncat(decodedOut, (char *), 1);
-
-/* Skip the next character */
-i++;
-break;
-}
-  }
-}
-
 char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl)
 {
   if (strncmp(fileUrl, "file://", 7) == 0) {
-/* assume one character of encoded URL can be expanded to 4 chars max */
-int decodedSize = 4 * strlen(fileUrl) + 1;
-char *decodedPath = (char *)malloc(decodedSize);
-
-UrlDecode(decodedPath, decodedSize, fileUrl + 7);
-
-return decodedPath;
+return GHOST_URL_decode_alloc(fileUrl + 7);
   }
 
   return nullptr;
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h 
b/intern/ghost/intern/GHOST_DropTargetX11.h
index f0ef27697e1..db73ddff70f 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.h
+++ b/intern/ghost/intern/GHOST_DropTargetX11.h
@@ -64,14 +64,6 @@ class GHOST_DropTargetX11 {
*/
   void *getURIListGhostData(unsigned char *dropBuffer, int dropBufferSize);
 
-  /**
-   * Decode URL (i.e. converts `file:///a%20b/test` to `file:///a b/test`)
-   * \param decodedOut: - buffer for decoded URL.
-   * \param bufferSize: - size of output buffer.
-   * \param encodedIn: - input encoded buffer to be decoded.
-   */
-  void UrlDecode(char *decodedOut, int bufferSize, const char *encodedIn);
-
   /**
* Fully decode file URL (i.e. converts 

[Bf-blender-cvs] [6af963ca811] master: Fix leak when the cursor leaves the window while dragging in Wayland

2022-08-04 Thread Campbell Barton
Commit: 6af963ca811037cfd4e7e91577dd6e3bb8d42430
Author: Campbell Barton
Date:   Thu Aug 4 22:33:28 2022 +1000
Branches: master
https://developer.blender.org/rB6af963ca811037cfd4e7e91577dd6e3bb8d42430

Fix leak when the cursor leaves the window while dragging in Wayland

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 627b97a9190..af841d16dc6 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1139,6 +1139,7 @@ static void data_device_handle_enter(void *data,
   input_t *input = static_cast(data);
   std::lock_guard lock{input->data_offer_dnd_mutex};
 
+  delete input->data_offer_dnd;
   input->data_offer_dnd = static_cast(wl_data_offer_get_user_data(id));
   data_offer_t *data_offer = input->data_offer_dnd;

___
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] [a10cac413e3] master: Fix the menu popup location when dropping blend files under Wayland

2022-08-04 Thread Campbell Barton
Commit: a10cac413e3c612ce2aaa93cf71348df3966859c
Author: Campbell Barton
Date:   Thu Aug 4 22:33:26 2022 +1000
Branches: master
https://developer.blender.org/rBa10cac413e3c612ce2aaa93cf71348df3966859c

Fix the menu popup location when dropping blend files under Wayland

Even though the event's location matched the drop event,
the `wmWindow.eventstate` was not updated which was used for the
pop-up menu location.

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index a1ebe1fc76f..a5690b52a5a 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1367,6 +1367,10 @@ static bool ghost_event_proc(GHOST_EventHandle evt, 
GHOST_TUserDataPtr C_void_pt
 event.xy[0] = ddd->x;
 event.xy[1] = ddd->y;
 
+/* The values from #wm_window_update_eventstate may not match (under 
WAYLAND they don't)
+ * Write this into the event state. */
+copy_v2_v2_int(win->eventstate->xy, event.xy);
+
 event.flag = 0;
 
 /* No context change! C->wm->windrawable is drawable, or for area 
queues. */

___
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] [ff286a9fcfd] master: Fix double-free after drag & drop with GHOST/Wayland

2022-08-04 Thread Campbell Barton
Commit: ff286a9fcfd13f264258f807dcea8f9aa5328d96
Author: Campbell Barton
Date:   Thu Aug 4 22:33:25 2022 +1000
Branches: master
https://developer.blender.org/rBff286a9fcfd13f264258f807dcea8f9aa5328d96

Fix double-free after drag & drop with GHOST/Wayland

Resolve crash on exit after drag & drop in Wayland.

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index e6366d25788..627b97a9190 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1221,6 +1221,9 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
 wl_data_offer_finish(data_offer->id);
 wl_data_offer_destroy(data_offer->id);
 
+if (input->data_offer_dnd == data_offer) {
+  input->data_offer_dnd = nullptr;
+}
 delete data_offer;
 data_offer = nullptr;

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


[Bf-blender-cvs] [cdd718dbb24] master: GHOST/Wayland: improve logging for drag & drop

2022-08-04 Thread Campbell Barton
Commit: cdd718dbb242f614a8d8588c4996e7159ba737ea
Author: Campbell Barton
Date:   Thu Aug 4 22:33:20 2022 +1000
Branches: master
https://developer.blender.org/rBcdd718dbb242f614a8d8588c4996e7159ba737ea

GHOST/Wayland: improve logging for drag & drop

Log the response for dropping events to simplify troubleshooting
drag & drop failure.

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index ebb52bf08cb..5eea90015b1 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1197,8 +1197,6 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
   input_t *input = static_cast(data);
   std::lock_guard lock{input->data_offer_dnd_mutex};
 
-  CLOG_INFO(LOG, 2, "drop");
-
   data_offer_t *data_offer = input->data_offer_dnd;
 
   const std::string mime_receive = 
*std::find_first_of(mime_preference_order.begin(),
@@ -1206,6 +1204,8 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat

data_offer->types.begin(),

data_offer->types.end());
 
+  CLOG_INFO(LOG, 2, "drop mime_recieve=%s", mime_receive.c_str());
+
   auto read_uris_fn = [](input_t *const input,
  data_offer_t *data_offer,
  wl_surface *surface,
@@ -1214,6 +1214,9 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
 
 const std::string data = read_pipe(data_offer, mime_receive, nullptr);
 
+CLOG_INFO(
+LOG, 2, "drop_read_uris mime_receive=%s, data=%s", 
mime_receive.c_str(), data.c_str());
+
 wl_data_offer_finish(data_offer->id);
 wl_data_offer_destroy(data_offer->id);
 
@@ -1240,6 +1243,7 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
   break;
 }
 uris.push_back(data.substr(start, end - start));
+CLOG_INFO(LOG, 2, "drop_read_uris pos=%zu, text_uri=\"%s\"", start, 
uris.back().c_str());
   }
 
   GHOST_TStringArray *flist = static_cast(
@@ -1251,6 +1255,7 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
 memcpy(flist->strings[i], uris[i].data(), uris[i].size() + 1);
   }
 
+  CLOG_INFO(LOG, 2, "drop_read_uris_fn file_count=%d", flist->count);
   const wl_fixed_t scale = win->scale();
   system->pushEvent(new GHOST_EventDragnDrop(system->getMilliSeconds(),
  GHOST_kEventDraggingDropDone,
@@ -1263,12 +1268,13 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
 else if (ELEM(mime_receive, mime_text_plain, mime_text_utf8)) {
   /* TODO: enable use of internal functions 'txt_insert_buf' and
* 'text_update_edited' to behave like dropped text was pasted. */
+  CLOG_INFO(LOG, 2, "drop_read_uris_fn (text_plain, text_utf8), 
unhandled!");
 }
 wl_display_roundtrip(system->display());
   };
 
   /* Pass in `input->focus_dnd` instead of accessing it from `input` since the 
leave callback
-   * (#data_device_leave) will clear the value once this function starts. */
+   * (#data_device_handle_leave) will clear the value once this function 
starts. */
   std::thread read_thread(read_uris_fn, input, data_offer, input->focus_dnd, 
mime_receive);
   read_thread.detach();
 }

___
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] [727cc426bc7] master: Fix drag & drop in Wayland with some applications

2022-08-04 Thread Campbell Barton
Commit: 727cc426bc723c8757941ce9bf23745ee5f6ab9d
Author: Campbell Barton
Date:   Thu Aug 4 22:33:22 2022 +1000
Branches: master
https://developer.blender.org/rB727cc426bc723c8757941ce9bf23745ee5f6ab9d

Fix drag & drop in Wayland with some applications

Drag & drop worked with GTK3 apps but not QT5 (pcmanfm-qt for eg)
as files are separated by '\n' instead of '\r\n'.

Resolve by supporting both (follow up to T99737).

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 5eea90015b1..7da8d56ed0d 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1227,7 +1227,9 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
 
 if (mime_receive == mime_text_uri) {
   static constexpr const char *file_proto = "file://";
-  static constexpr const char *crlf = "\r\n";
+  /* NOTE: some applications CRLF (`\r\n`) GTK3 for e.g. & others don't 
`pcmanfm-qt`.
+   * So support both, once `\n` is found, strip the preceding `\r` if 
found. */
+  static constexpr const char *lf = "\n";
 
   GHOST_WindowWayland *win = ghost_wl_surface_user_data(surface);
   std::vector uris;
@@ -1236,12 +1238,16 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
   while (true) {
 pos = data.find(file_proto, pos);
 const size_t start = pos + sizeof(file_proto) - 1;
-pos = data.find(crlf, pos);
-const size_t end = pos;
+pos = data.find(lf, pos);
 
 if (pos == std::string::npos) {
   break;
 }
+/* Account for 'CRLF' case. */
+size_t end = pos;
+if (data[end - 1] == '\r') {
+  end -= 1;
+}
 uris.push_back(data.substr(start, end - start));
 CLOG_INFO(LOG, 2, "drop_read_uris pos=%zu, text_uri=\"%s\"", start, 
uris.back().c_str());
   }

___
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] [28e0cc424da] master: Guarded allocator: Function to rename block for debugging

2022-08-04 Thread Julian Eisel
Commit: 28e0cc424da8fb0b2cc0a58396d2fbb6e9d7be15
Author: Julian Eisel
Date:   Thu Aug 4 11:12:15 2022 +0200
Branches: master
https://developer.blender.org/rB28e0cc424da8fb0b2cc0a58396d2fbb6e9d7be15

Guarded allocator: Function to rename block for debugging

We have plenty of sorta generic functions, that allocate memory with
some generic name for debugging. When such a function is called and the
memory leaks, it may be unclear which call to it allocated the unfreed
memory (and thus which execution path leads to the leak).

The added function is only available if `NDEBUG` is not defined.

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

Reviewed by: Sergey Sharybin, Bastien Montagne

===

M   intern/guardedalloc/MEM_guardedalloc.h
M   intern/guardedalloc/intern/mallocn.c
M   intern/guardedalloc/intern/mallocn_guarded_impl.c
M   intern/guardedalloc/intern/mallocn_intern.h
M   intern/guardedalloc/intern/mallocn_lockfree_impl.c

===

diff --git a/intern/guardedalloc/MEM_guardedalloc.h 
b/intern/guardedalloc/MEM_guardedalloc.h
index fca19fb9731..64987548a11 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -199,6 +199,15 @@ extern size_t (*MEM_get_peak_memory)(void) 
ATTR_WARN_UNUSED_RESULT;
 
 #ifndef NDEBUG
 extern const char *(*MEM_name_ptr)(void *vmemh);
+/**
+ * Change the debugging name/string assigned to the memory allocated at \a 
vmemh. Only affects the
+ * guarded allocator. The name must be a static string, because only a pointer 
to it is stored!
+ *
+ * Handy when debugging leaking memory allocated by some often called, generic 
function with a
+ * unspecific name. A caller with more info can set a more specific name, and 
see which call to the
+ * generic function allocates the leaking memory.
+ */
+extern void (*MEM_name_ptr_set)(void *vmemh, const char *str) ATTR_NONNULL();
 #endif
 
 /**
diff --git a/intern/guardedalloc/intern/mallocn.c 
b/intern/guardedalloc/intern/mallocn.c
index f7979168799..63f06ced31d 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -49,6 +49,7 @@ size_t (*MEM_get_peak_memory)(void) = 
MEM_lockfree_get_peak_memory;
 
 #ifndef NDEBUG
 const char *(*MEM_name_ptr)(void *vmemh) = MEM_lockfree_name_ptr;
+void (*MEM_name_ptr_set)(void *vmemh, const char *str) = 
MEM_lockfree_name_ptr_set;
 #endif
 
 void *aligned_malloc(size_t size, size_t alignment)
@@ -128,6 +129,7 @@ void MEM_use_lockfree_allocator(void)
 
 #ifndef NDEBUG
   MEM_name_ptr = MEM_lockfree_name_ptr;
+  MEM_name_ptr_set = MEM_lockfree_name_ptr_set;
 #endif
 }
 
@@ -159,5 +161,6 @@ void MEM_use_guarded_allocator(void)
 
 #ifndef NDEBUG
   MEM_name_ptr = MEM_guarded_name_ptr;
+  MEM_name_ptr_set = MEM_guarded_name_ptr_set;
 #endif
 }
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c 
b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index 8bf1680e6f8..cd4b99ecde8 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -1199,4 +1199,18 @@ const char *MEM_guarded_name_ptr(void *vmemh)
 
   return "MEM_guarded_name_ptr(NULL)";
 }
+
+void MEM_guarded_name_ptr_set(void *vmemh, const char *str)
+{
+  if (!vmemh) {
+return;
+  }
+
+  MemHead *memh = vmemh;
+  memh--;
+  memh->name = str;
+  if (memh->prev) {
+MEMNEXT(memh->prev)->nextname = str;
+  }
+}
 #endif /* NDEBUG */
diff --git a/intern/guardedalloc/intern/mallocn_intern.h 
b/intern/guardedalloc/intern/mallocn_intern.h
index f8b16ff6ddf..ce5683a04ae 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -131,6 +131,7 @@ void MEM_lockfree_reset_peak_memory(void);
 size_t MEM_lockfree_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT;
 #ifndef NDEBUG
 const char *MEM_lockfree_name_ptr(void *vmemh);
+void MEM_lockfree_name_ptr_set(void *vmemh, const char *str);
 #endif
 
 /* Prototypes for fully guarded allocator functions */
@@ -174,6 +175,7 @@ void MEM_guarded_reset_peak_memory(void);
 size_t MEM_guarded_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT;
 #ifndef NDEBUG
 const char *MEM_guarded_name_ptr(void *vmemh);
+void MEM_guarded_name_ptr_set(void *vmemh, const char *str);
 #endif
 
 #ifdef __cplusplus
diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c 
b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
index 300e2000a14..b5ee539ff4d 100644
--- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c
+++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -426,4 +426,8 @@ const char *MEM_lockfree_name_ptr(void *vmemh)
 
   return "MEM_lockfree_name_ptr(NULL)";
 }
+
+void MEM_lockfree_name_ptr_set(void *UNUSED(vmemh), const char *UNUSED(str))
+{
+}
 #endif /* NDEBUG */

___
Bf-blender-cvs mailing list

[Bf-blender-cvs] [fdd282021a9] master: Cleanup: Fix compile warnings

2022-08-04 Thread Jesse Yurkovich
Commit: fdd282021a98ac89f40cff7d33f646fb96a96133
Author: Jesse Yurkovich
Date:   Thu Aug 4 00:45:25 2022 -0700
Branches: master
https://developer.blender.org/rBfdd282021a98ac89f40cff7d33f646fb96a96133

Cleanup: Fix compile warnings

===

M   source/blender/editors/space_image/image_buttons.c
M   source/blender/editors/space_image/image_undo.cc

===

diff --git a/source/blender/editors/space_image/image_buttons.c 
b/source/blender/editors/space_image/image_buttons.c
index 48f43e05315..2109d3f9701 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -869,7 +869,8 @@ void uiTemplateImage(uiLayout *layout,
 uiItemS(col);
 
 uiItemR(col, , "generated_type", UI_ITEM_R_EXPAND, IFACE_("Type"), 
ICON_NONE);
-if (ima->gen_type == IMA_GENTYPE_BLANK) {
+ImageTile *base_tile = BKE_image_get_tile(ima, 0);
+if (base_tile->gen_type == IMA_GENTYPE_BLANK) {
   uiItemR(col, , "generated_color", 0, NULL, ICON_NONE);
 }
   }
diff --git a/source/blender/editors/space_image/image_undo.cc 
b/source/blender/editors/space_image/image_undo.cc
index 9e8db58ccc2..065641c4051 100644
--- a/source/blender/editors/space_image/image_undo.cc
+++ b/source/blender/editors/space_image/image_undo.cc
@@ -454,7 +454,6 @@ struct UndoImageBuf {
   struct {
 short source;
 bool use_float;
-char gen_type;
   } image_state;
 };
 
@@ -473,7 +472,6 @@ static UndoImageBuf *ubuf_from_image_no_tiles(Image *image, 
const ImBuf *ibuf)
   MEM_callocN(sizeof(*ubuf->tiles) * ubuf->tiles_len, __func__));
 
   BLI_strncpy(ubuf->ibuf_name, ibuf->name, sizeof(ubuf->ibuf_name));
-  ubuf->image_state.gen_type = image->gen_type;
   ubuf->image_state.source = image->source;
   ubuf->image_state.use_float = ibuf->rect_float != nullptr;

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


[Bf-blender-cvs] [550ebc5c8f4] master: Cleanup: quiet unused warning

2022-08-04 Thread Campbell Barton
Commit: 550ebc5c8f484210239fb515c7cdaead4826999d
Author: Campbell Barton
Date:   Thu Aug 4 17:00:19 2022 +1000
Branches: master
https://developer.blender.org/rB550ebc5c8f484210239fb515c7cdaead4826999d

Cleanup: quiet unused warning

===

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

===

diff --git a/source/blender/makesrna/intern/rna_image.c 
b/source/blender/makesrna/intern/rna_image.c
index 8f6aa55b9ac..b7ab7689dd7 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -417,7 +417,9 @@ static void rna_UDIMTile_tile_number_set(PointerRNA *ptr, 
int value)
   }
 }
 
-static void rna_UDIMTile_generated_update(Main *bmain, Scene *UNUSED(scene), 
PointerRNA *ptr)
+static void rna_UDIMTile_generated_update(Main *UNUSED(bmain),
+  Scene *UNUSED(scene),
+  PointerRNA *ptr)
 {
   Image *ima = (Image *)ptr->owner_id;
   ImageTile *tile = (ImageTile *)ptr->data;

___
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