[Bf-blender-cvs] [3fcf50d37af] geometry-nodes-simulation: Make the simulation always run, remove run socket

2022-12-09 Thread Hans Goudey
Commit: 3fcf50d37af95b1c64d122ce31cb54cb627bbe8e
Author: Hans Goudey
Date:   Sat Dec 10 00:01:20 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB3fcf50d37af95b1c64d122ce31cb54cb627bbe8e

Make the simulation always run, remove run socket

Note: Still unstable. Simulation resets when playback stops bug.

Since the "Run" behavior can basically be implemented with the switch
node already, it's just adding unnecessary complexity to the interface
now, when it's use case isn't clear. We decided to remove it for now,
and only consider it later as a possible convenience feature, rather
than an essential part of the design.

Also, the simulation nodes are now considered "side effect nodes"
for the evaluator, meaning they are *always* evaluated, even if they
aren't needed because of switch nodes, etc. This was the best way
we thought of to make simulations run consistently even through
situations like that.

===

M   source/blender/modifiers/intern/MOD_nodes.cc
M   source/blender/nodes/NOD_geometry_exec.hh
M   source/blender/nodes/NOD_geometry_nodes_lazy_function.hh
M   source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index 95b926ee172..cc16a2fe758 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -839,6 +839,12 @@ static const lf::FunctionNode &find_group_lf_node(const 
bNode &group_bnode)
   ->mapping.group_node_map.lookup(&group_bnode);
 }
 
+static const lf::FunctionNode &find_sim_output_lf_node(const bNode &node)
+{
+  return 
*blender::nodes::ensure_geometry_nodes_lazy_function_graph(node.owner_tree())
+  ->mapping.sim_output_node_map.lookup(&node);
+}
+
 static void find_side_effect_nodes_for_viewer_path(
 const ViewerPath &viewer_path,
 const NodesModifierData &nmd,
@@ -895,6 +901,28 @@ static void find_side_effect_nodes_for_viewer_path(
   }
 }
 
+static void add_simulation_output_side_effect_nodes(
+blender::ComputeContextBuilder &compute_context_builder,
+const bNodeTree &group,
+MultiValueMap 
&r_side_effect_nodes)
+{
+  group.ensure_topology_cache();
+
+  const blender::ComputeContextHash hash = compute_context_builder.hash();
+  for (const bNode *sim_output_node : 
group.nodes_by_type("GeometryNodeSimulationOutput")) {
+r_side_effect_nodes.add(hash, &find_sim_output_lf_node(*sim_output_node));
+  }
+
+  for (const bNode *group_node : group.group_nodes()) {
+if (group_node->id) {
+  
compute_context_builder.push(*group_node);
+  add_simulation_output_side_effect_nodes(compute_context_builder,
+  *reinterpret_cast(group_node->id),
+  r_side_effect_nodes);
+}
+  }
+}
+
 static void find_side_effect_nodes(
 const NodesModifierData &nmd,
 const ModifierEvalContext &ctx,
@@ -922,6 +950,15 @@ static void find_side_effect_nodes(
   }
 }
   }
+
+  {
+/* Simulation output nodes are treated as side effect nodes because they 
always execute,
+ * even when their output is not needed, and because they potentially 
store caches. */
+blender::ComputeContextBuilder compute_context_builder;
+
compute_context_builder.push(nmd.modifier.name);
+add_simulation_output_side_effect_nodes(
+compute_context_builder, *nmd.node_group, r_side_effect_nodes);
+  }
 }
 
 static void clear_runtime_data(NodesModifierData *nmd)
diff --git a/source/blender/nodes/NOD_geometry_exec.hh 
b/source/blender/nodes/NOD_geometry_exec.hh
index 73e82f741ab..2c1dd6d9b16 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -197,6 +197,10 @@ class GeoNodeExecParams {
   bool lazy_output_is_required(StringRef identifier)
   {
 const int index = this->get_output_index(identifier);
+/* TODO: Why was this necessary to make the Delta Time socket not crash? */
+// if (params_.output_was_set(index)) {
+//   return false;
+// }
 return params_.get_output_usage(index) == lf::ValueUsage::Used;
   }
 
diff --git a/source/blender/nodes/NOD_geometry_nodes_lazy_function.hh 
b/source/blender/nodes/NOD_geometry_nodes_lazy_function.hh
index ee706a7e9df..e3d92dae06d 100644
--- a/source/blender/nodes/NOD_geometry_nodes_lazy_function.hh
+++ b/source/blender/nodes/NOD_geometry_nodes_lazy_function.hh
@@ -95,6 +95,7 @@ struct GeometryNodeLazyFunctionGraphMapping {
*/
   Map group_node_map;
   Map viewer_node_map;
+  Map sim_output_node_map;
 };
 
 /**
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc 
b/source/blender/nodes/geometry/nodes/node_geo_sim

[Bf-blender-cvs] [49e8218edfc] geometry-nodes-simulation: Remove Started and Ended booleans

2022-12-09 Thread Hans Goudey
Commit: 49e8218edfcefa6866f4d60fb64a35ad9d63f2f0
Author: Hans Goudey
Date:   Fri Dec 9 17:13:23 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB49e8218edfcefa6866f4d60fb64a35ad9d63f2f0

Remove Started and Ended booleans

These aren't theoretically necessary, since you can just created them
as regular outputs. Maybe we will eventually add them back for
convenience, but that's not clear.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
index 43d913163a1..295fb92d3f6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -19,8 +19,6 @@ static void node_declare(NodeDeclarationBuilder &b)
 {
   b.add_input(N_("Run")).default_value(true);
   b.add_input(N_("Geometry"));
-  b.add_output(N_("Started"));
-  b.add_output(N_("Ended"));
   b.add_output(N_("Geometry"));
 }
 
@@ -51,15 +49,6 @@ static void node_geo_exec(GeoNodeExecParams params)
 
   const float elapsed_time = cache.is_empty() ? 0.0f : scene_ctime - 
cache.start_time()->time;
   const bool run = params.get_input("Run");
-  const bool started = !cache.is_empty();
-  const bool ended = !cache.is_empty() && !run;
-
-  if (params.lazy_output_is_required("Started")) {
-params.set_output("Started", started);
-  }
-  if (params.lazy_output_is_required("Ended")) {
-params.set_output("Ended", ended);
-  }
 
   if (!run) {
 if (std::optional value = 
cache.value_at_or_before_time("Geometry", time)) {

___
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] [3dcb437d5ce] geometry-nodes-simulation: Remove elapsed time sockets

2022-12-09 Thread Hans Goudey
Commit: 3dcb437d5ce48b6db1eb063248a5f3fb867059f2
Author: Hans Goudey
Date:   Fri Dec 9 17:11:05 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB3dcb437d5ce48b6db1eb063248a5f3fb867059f2

Remove elapsed time sockets

Since this is theoretically redundant with simulating a float
with the delta time value, we decided to remove it for now to
make the whole interface simpler.

===

M   source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
M   source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
index 147fecc616a..c8c038b748b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -20,7 +20,6 @@ static void node_declare(NodeDeclarationBuilder &b)
   b.add_input(N_("Geometry"));
 
   b.add_output(N_("Delta Time"));
-  b.add_output(N_("Elapsed Time"));
   b.add_output(N_("Geometry"));
 }
 
@@ -84,15 +83,10 @@ static void node_geo_exec(GeoNodeExecParams params)
 return;
   }
 
-  const float elapsed_time = cache->is_empty() ? 0.0f : scene_ctime - 
cache->start_time()->time;
-  const float delta_time = cache->is_empty() ? 0.0f : scene_ctime - 
cache->last_run_time()->time;
-
   if (params.lazy_output_is_required("Delta Time")) {
+const float delta_time = cache->is_empty() ? 0.0f : scene_ctime - 
cache->last_run_time()->time;
 params.set_output("Delta Time", delta_time);
   }
-  if (params.lazy_output_is_required("Elapsed Time")) {
-params.set_output("Elapsed Time", elapsed_time);
-  }
 
   if (std::optional cached_value = 
cache->value_before_time("Geometry", time)) {
 if (params.lazy_output_is_required("Geometry")) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
index 97ad87f9718..cdbdb4678c3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -21,7 +21,6 @@ static void node_declare(NodeDeclarationBuilder &b)
   b.add_input(N_("Geometry"));
   b.add_output(N_("Started"));
   b.add_output(N_("Ended"));
-  b.add_output(N_("Elapsed Time"));
   b.add_output(N_("Geometry"));
 }
 
@@ -60,9 +59,6 @@ static void node_geo_exec(GeoNodeExecParams params)
   const bool started = !cache.is_empty();
   const bool ended = !cache.is_empty() && !run;
 
-  if (params.lazy_output_is_required("Elapsed Time")) {
-params.set_output("Elapsed Time", elapsed_time);
-  }
   if (params.lazy_output_is_required("Started")) {
 params.set_output("Started", started);
   }

___
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] [94e6f87ebc5] geometry-nodes-simulation: Remove "Persistent Cache" option from the UI

2022-12-09 Thread Hans Goudey
Commit: 94e6f87ebc5249b88839e7236bc2aed42b07f4eb
Author: Hans Goudey
Date:   Fri Dec 9 17:12:12 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB94e6f87ebc5249b88839e7236bc2aed42b07f4eb

Remove "Persistent Cache" option from the UI

I will keep it internally, but for the simulation MVP we want to focus
on the most basic "last frame's cache" features at first.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
index cdbdb4678c3..43d913163a1 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -24,11 +24,6 @@ static void node_declare(NodeDeclarationBuilder &b)
   b.add_output(N_("Geometry"));
 }
 
-static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
-{
-  uiItemR(layout, ptr, "use_persistent_cache", 0, IFACE_("Persistent Cache"), 
ICON_NONE);
-}
-
 static void node_init(bNodeTree * /*tree*/, bNode *node)
 {
   NodeGeometrySimulationOutput *data = 
MEM_cnew(__func__);
@@ -118,7 +113,6 @@ void register_node_type_geo_simulation_output()
   ntype.initfunc = file_ns::node_init;
   ntype.geometry_node_execute = file_ns::node_geo_exec;
   ntype.declare = file_ns::node_declare;
-  ntype.draw_buttons = file_ns::node_layout;
   node_type_storage(&ntype,
 "NodeGeometrySimulationOutput",
 node_free_standard_storage,

___
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] [ffe0db184a4] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-09 Thread Hans Goudey
Commit: ffe0db184a42ccb37bfc9f4e79f397607d7119cd
Author: Hans Goudey
Date:   Fri Dec 9 17:05:29 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBffe0db184a42ccb37bfc9f4e79f397607d7119cd

Merge branch 'master' into geometry-nodes-simulation

===



===



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


[Bf-blender-cvs] [99c0fc0c217] refactor-mesh-corners-generic: Merge branch 'refactor-mesh-position-generic' into refactor-mesh-corners-generic

2022-12-09 Thread Hans Goudey
Commit: 99c0fc0c217e48b8b08e3e1d7c9eed6e428cb558
Author: Hans Goudey
Date:   Fri Dec 9 17:05:14 2022 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rB99c0fc0c217e48b8b08e3e1d7c9eed6e428cb558

Merge branch 'refactor-mesh-position-generic' into refactor-mesh-corners-generic

===



===

diff --cc source/blender/blenkernel/BKE_mesh.h
index 68dfadec64f,75fe56f1e05..aa39dfb887d
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@@ -493,13 -493,10 +493,11 @@@ void BKE_mesh_ensure_normals_for_displa
   * Used when defining an empty custom loop normals data layer,
   * to keep same shading as with auto-smooth!
   */
- void BKE_edges_sharp_from_angle_set(const float (*positions)[3],
- int numVerts,
- struct MEdge *medges,
+ void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
  int numEdges,
 -const struct MLoop *mloops,
 -int numLoops,
 +const int *corner_verts,
 +const int *corner_edges,
 +int corners_num,
  const struct MPoly *mpolys,
  const float (*polynors)[3],
  int numPolys,
diff --cc source/blender/blenkernel/intern/mesh.cc
index 24d55d4d9ca,f50d6651170..b40b5afb98f
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -1812,77 -1823,75 +1812,75 @@@ struct SplitFaceNewEdge 
int v2;
  };
  
- /* Detect needed new vertices, and update accordingly loops' vertex indices.
-  * WARNING! Leaves mesh in invalid state. */
- static int split_faces_prepare_new_verts(Mesh *mesh,
-  MLoopNorSpaceArray *lnors_spacearr,
+ /**
+  * Detect necessary new vertices, and update loop vertex indices accordingly.
+  * \warning Leaves mesh in invalid state.
+  * \param lnors_spacearr: Mandatory because trying to do the job in simple 
way without that data is
+  * doomed to fail, even when only dealing with smooth/flat faces one can find 
cases that no simple
+  * algorithm can handle properly.
+  */
+ static int split_faces_prepare_new_verts(Mesh &mesh,
+  const MLoopNorSpaceArray 
&lnors_spacearr,
   SplitFaceNewVert **new_verts,
-  MemArena *memarena)
+  MemArena &memarena)
  {
-   /* This is now mandatory, trying to do the job in simple way without that 
data is doomed to fail,
-* even when only dealing with smooth/flat faces one can find cases that no 
simple algorithm
-* can handle properly. */
-   BLI_assert(lnors_spacearr != nullptr);
- 
-   const int loops_len = mesh->totloop;
-   int verts_len = mesh->totvert;
-   MutableSpan corner_verts = mesh->corner_verts_for_write();
-   BKE_mesh_vertex_normals_ensure(mesh);
-   float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(mesh);
+   const int loops_len = mesh.totloop;
+   int verts_len = mesh.totvert;
 -  MutableSpan loops = mesh.loops_for_write();
++  MutableSpan corner_verts = mesh.corner_verts_for_write();
+   BKE_mesh_vertex_normals_ensure(&mesh);
+   float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(&mesh);
  
BitVector<> verts_used(verts_len, false);
BitVector<> done_loops(loops_len, false);
  
-   MLoopNorSpace **lnor_space = lnors_spacearr->lspacearr;
- 
-   BLI_assert(lnors_spacearr->data_type == MLNOR_SPACEARR_LOOP_INDEX);
- 
-   for (int loop_idx = 0; loop_idx < loops_len; loop_idx++, lnor_space++) {
- if (!done_loops[loop_idx]) {
-   const int vert_idx = corner_verts[loop_idx];
-   const bool vert_used = verts_used[vert_idx];
-   /* If vert is already used by another smooth fan, we need a new vert 
for this one. */
-   const int new_vert_idx = vert_used ? verts_len++ : vert_idx;
+   BLI_assert(lnors_spacearr.data_type == MLNOR_SPACEARR_LOOP_INDEX);
  
-   BLI_assert(*lnor_space);
- 
-   if ((*lnor_space)->flags & MLNOR_SPACE_IS_SINGLE) {
- /* Single loop in this fan... */
- BLI_assert(POINTER_AS_INT((*lnor_space)->loops) == loop_idx);
- done_loops[loop_idx].set();
- if (vert_used) {
-   corner_verts[loop_idx] = new_vert_idx;
- }
+   for (int loop_idx = 0; loop_idx < loops_len; loop_idx++) {
+ if (done_loops[loop_idx]) {
+   continue;
+ }
+ const MLoopNorSpace &lnor_space = *lnors_spacearr.lspacearr[loop_idx];
 -const int vert_idx = loops[loop_idx].v;
++const int vert_idx = corner_verts[loop_idx];
+ cons

[Bf-blender-cvs] [0fe2a9c9019] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-position-generic

2022-12-09 Thread Hans Goudey
Commit: 0fe2a9c901933b1ae8f747ee62431aa311e59b89
Author: Hans Goudey
Date:   Fri Dec 9 16:15:08 2022 -0600
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB0fe2a9c901933b1ae8f747ee62431aa311e59b89

Merge branch 'master' into refactor-mesh-position-generic

===



===

diff --cc source/blender/blenkernel/intern/mesh_normals.cc
index 23a026b56db,f32b23476b6..1cc298039bf
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@@ -772,11 -821,11 +773,11 @@@ struct LoopSplitTaskDataCommon 
MutableSpan clnors_data;
  
/* Read-only. */
 -  Span verts;
 +  Span positions;
-   MutableSpan edges;
+   Span edges;
Span loops;
Span polys;
-   int (*edge_to_loops)[2];
+   MutableSpan edge_to_loops;
Span loop_to_poly;
Span polynors;
Span vert_normals;
@@@ -1613,10 -1638,10 +1591,10 @@@ void BKE_mesh_normals_loop_split(const 
common_data.lnors_spacearr = r_lnors_spacearr;
common_data.loopnors = {reinterpret_cast(r_loopnors), numLoops};
common_data.clnors_data = {reinterpret_cast(clnors_data), 
clnors_data ? numLoops : 0};
 -  common_data.verts = {mverts, numVerts};
 +  common_data.positions = {reinterpret_cast(positions), 
numVerts};
-   common_data.edges = {const_cast(medges), numEdges};
-   common_data.polys = {mpolys, numPolys};
-   common_data.loops = {mloops, numLoops};
+   common_data.edges = {medges, numEdges};
+   common_data.polys = polys;
+   common_data.loops = loops;
common_data.edge_to_loops = edge_to_loops;
common_data.loop_to_poly = loop_to_poly;
common_data.polynors = {reinterpret_cast(polynors), 
numPolys};
diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
index 00087fe6388,dc65ffd60a4..730f7c400a7
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
@@@ -2042,8 -2043,9 +2042,9 @@@ static void lineart_geometry_object_loa
  
TriData tri_data;
tri_data.ob_info = ob_info;
 +  tri_data.positions = me->positions();
tri_data.mlooptri = mlooptri;
 -  tri_data.verts = me->verts();
+   tri_data.loops = me->loops();
tri_data.material_indices = material_indices;
tri_data.vert_arr = la_v_arr;
tri_data.tri_arr = la_tri_arr;
diff --cc source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 658b87c1305,d390a33245d..3f39dd4a47c
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@@ -1255,9 -1268,9 +1275,9 @@@ static void extrude_individual_mesh_fac
/* Offset the new vertices. */
threading::parallel_for(poly_selection.index_range(), 1024, [&](const 
IndexRange range) {
  for (const int i_selection : range) {
-   const IndexRange poly_corner_range = 
selected_corner_range(index_offsets, i_selection);
-   for (float3 &position : new_positions.slice(poly_corner_range)) {
+   const IndexRange extrude_range = selected_corner_range(index_offsets, 
i_selection);
 -  for (MVert &vert : new_verts.slice(extrude_range)) {
 -add_v3_v3(vert.co, poly_offset[poly_selection[i_selection]]);
++  for (float3 &position : new_positions.slice(extrude_range)) {
 +position += poly_offset[poly_selection[i_selection]];
}
  }
});

___
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] [19d90c7a333] master: UI: fix several labels and tooltips

2022-12-09 Thread Damien Picard
Commit: 19d90c7a33372beb52b88726203fe4b4903c507f
Author: Damien Picard
Date:   Fri Dec 9 16:00:42 2022 -0600
Branches: master
https://developer.blender.org/rB19d90c7a33372beb52b88726203fe4b4903c507f

UI: fix several labels and tooltips

See the differential revision for details about each change.

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

===

M   release/datafiles/colormanagement/config.ocio
M   release/scripts/startup/bl_ui/properties_physics_fluid.py
M   release/scripts/startup/bl_ui/properties_physics_softbody.py
M   source/blender/blenkernel/intern/object.cc
M   source/blender/editors/space_node/node_add.cc
M   source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M   source/blender/makesrna/intern/rna_camera.c
M   source/blender/makesrna/intern/rna_gpencil_modifier.c
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/makesrna/intern/rna_object_force.c
M   source/blender/makesrna/intern/rna_rigidbody.c
M   source/blender/makesrna/intern/rna_shader_fx.c

===

diff --git a/release/datafiles/colormanagement/config.ocio 
b/release/datafiles/colormanagement/config.ocio
index 8f7f2b9aaf4..91d722a311f 100644
--- a/release/datafiles/colormanagement/config.ocio
+++ b/release/datafiles/colormanagement/config.ocio
@@ -171,7 +171,7 @@ colorspaces:
 name: Non-Color
 family: raw
 description: |
-Color space used for images which contains non-color data (i.e. normal 
maps)
+Color space used for images which contain non-color data (e.g. normal 
maps)
 equalitygroup:
 bitdepth: 32f
 isdata: true
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py 
b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index 3cd4e8d2d0e..ef8ee7712e5 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -428,7 +428,7 @@ class PHYSICS_PT_fire(PhysicButtonsPanel, Panel):
 col.prop(domain, "flame_max_temp", text="Temperature Maximum")
 col.prop(domain, "flame_ignition", text="Minimum")
 row = col.row()
-row.prop(domain, "flame_smoke_color", text="Flame Color")
+row.prop(domain, "flame_smoke_color", text="Smoke Color")
 
 
 class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py 
b/release/scripts/startup/bl_ui/properties_physics_softbody.py
index 14211d35261..ade331ac649 100644
--- a/release/scripts/startup/bl_ui/properties_physics_softbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py
@@ -214,8 +214,12 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, Panel):
 
 col = flow.column()
 col.prop(softbody, "spring_length", text="Length")
-col.prop(softbody, "use_edge_collision", text="Collision Edge")
-col.prop(softbody, "use_face_collision", text="Face")
+
+col.separator()
+
+col = flow.column(align=True, heading="Collision")
+col.prop(softbody, "use_edge_collision", text="Edge", toggle=False)
+col.prop(softbody, "use_face_collision", text="Face", toggle=False)
 
 
 class PHYSICS_PT_softbody_edge_aerodynamics(PhysicButtonsPanel, Panel):
diff --git a/source/blender/blenkernel/intern/object.cc 
b/source/blender/blenkernel/intern/object.cc
index b90e66c7401..f4911663942 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -883,13 +883,13 @@ static void object_blend_read_lib(BlendLibReader *reader, 
ID *id)
   if (ob->id.lib) {
 BLO_reportf_wrap(reports,
  RPT_INFO,
- TIP_("Proxy lost from  object %s lib %s\n"),
+ TIP_("Proxy lost from object %s lib %s\n"),
  ob->id.name + 2,
  ob->id.lib->filepath);
   }
   else {
 BLO_reportf_wrap(
-reports, RPT_INFO, TIP_("Proxy lost from  object %s lib 
\n"), ob->id.name + 2);
+reports, RPT_INFO, TIP_("Proxy lost from object %s lib \n"), 
ob->id.name + 2);
   }
   reports->count.missing_obproxies++;
 }
diff --git a/source/blender/editors/space_node/node_add.cc 
b/source/blender/editors/space_node/node_add.cc
index 805342a884a..4bb550a553f 100644
--- a/source/blender/editors/space_node/node_add.cc
+++ b/source/blender/editors/space_node/node_add.cc
@@ -622,7 +622,7 @@ void NODE_OT_add_collection(wmOperatorType *ot)
 {
   /* identifiers */
   ot->name = "Add Node Collection";
-  ot->description = "Add an collection info node to the current node editor";
+  ot->description = "Add a collection info node to the current node editor";
   ot->idname = "NODE_OT_add_collection";
 
   /* callbacks */
diff --git a/source/blender/

[Bf-blender-cvs] [538d4cc998c] master: UI: Fix and improve various labels and tooltips

2022-12-09 Thread Damien Picard
Commit: 538d4cc998c0a919773df4697cf7cfc5a69c62c3
Author: Damien Picard
Date:   Fri Dec 9 15:41:05 2022 -0600
Branches: master
https://developer.blender.org/rB538d4cc998c0a919773df4697cf7cfc5a69c62c3

UI: Fix and improve various labels and tooltips

Improve a few messages, but mostly fix typos in many areas of the UI.
See inline comments in the differential revisiion for the rationale
behind the various changes.

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

===

M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py
M   release/scripts/startup/bl_operators/presets.py
M   release/scripts/startup/bl_operators/uvcalc_lightmap.py
M   release/scripts/startup/bl_operators/wm.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenkernel/intern/blendfile_link_append.c
M   source/blender/blenkernel/intern/crazyspace.cc
M   source/blender/draw/engines/eevee/eevee_lightprobes.c
M   source/blender/editors/io/io_cache.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/editors/object/object_add.cc
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_remesh.cc
M   source/blender/editors/object/object_transform.cc
M   source/blender/editors/space_action/action_edit.c
M   source/blender/editors/space_sequencer/sequencer_add.c
M   source/blender/editors/space_view3d/view3d_navigate_walk.c
M   source/blender/editors/space_view3d/view3d_select.cc
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesrna/intern/rna_ID.c
M   source/blender/makesrna/intern/rna_access.c
M   source/blender/makesrna/intern/rna_color.c
M   source/blender/makesrna/intern/rna_curve.c
M   source/blender/makesrna/intern/rna_gpencil.c
M   source/blender/makesrna/intern/rna_gpencil_modifier.c
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_modifier.c
M   source/blender/makesrna/intern/rna_object.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/makesrna/intern/rna_sequencer.c
M   source/blender/makesrna/intern/rna_space.c
M   source/blender/makesrna/intern/rna_tracking.c
M   source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index b535571138a..2da763b9eb1 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1206,7 +1206,7 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
 )
 homogeneous_volume: BoolProperty(
 name="Homogeneous Volume",
-description="When using volume rendering, assume volume has the same 
density everywhere"
+description="When using volume rendering, assume volume has the same 
density everywhere "
 "(not using any textures), for faster rendering",
 default=False,
 )
diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index d0d66d09442..c3477ae0284 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -193,7 +193,7 @@ class 
CYCLES_RENDER_PT_sampling_viewport(CyclesButtonsPanel, Panel):
 
 if cscene.use_preview_adaptive_sampling:
 col = layout.column(align=True)
-col.prop(cscene, "preview_samples", text=" Max Samples")
+col.prop(cscene, "preview_samples", text="Max Samples")
 col.prop(cscene, "preview_adaptive_min_samples", text="Min 
Samples")
 else:
 layout.prop(cscene, "preview_samples", text="Samples")
@@ -255,7 +255,7 @@ class CYCLES_RENDER_PT_sampling_render(CyclesButtonsPanel, 
Panel):
 
 col = layout.column(align=True)
 if cscene.use_adaptive_sampling:
-col.prop(cscene, "samples", text=" Max Samples")
+col.prop(cscene, "samples", text="Max Samples")
 col.prop(cscene, "adaptive_min_samples", text="Min Samples")
 else:
 col.prop(cscene, "samples", text="Samples")
diff --git a/release/scripts/startup/bl_operators/presets.py 
b/release/scripts/startup/bl_operators/presets.py
index 2af310ddfdf..203eb128f0f 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -214,7 +214,7 @@ class AddPresetBase:
 
 
 class ExecutePreset(Operator):
-"""Execute a preset"""
+"""Load a preset"""
 bl_idname = "script.execute_preset"
 bl_label = "Execute a Python Preset"
 
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py 
b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index 995ec721046..8c78424f5

[Bf-blender-cvs] [a3251e66a72] master: Geometry Nodes: Image Input Node

2022-12-09 Thread Iliya Katueshenock
Commit: a3251e66a723368cbc553e8c4e4ffc46e4b96fc9
Author: Iliya Katueshenock
Date:   Fri Dec 9 15:50:00 2022 -0600
Branches: master
https://developer.blender.org/rBa3251e66a723368cbc553e8c4e4ffc46e4b96fc9

Geometry Nodes: Image Input Node

Add a simple node to choose an image data-block.

Ref T102854

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

===

M   release/scripts/startup/bl_ui/node_add_menu_geometry.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/CMakeLists.txt
M   source/blender/nodes/geometry/node_geometry_register.cc
M   source/blender/nodes/geometry/node_geometry_register.hh
A   source/blender/nodes/geometry/nodes/node_geo_image.cc

===

diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py 
b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
index d75d617c3ac..cc5f210e536 100644
--- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py
+++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
@@ -140,6 +140,7 @@ class NODE_MT_geometry_node_GEO_INPUT(Menu):
 node_add_menu.add_node_type(layout, "FunctionNodeInputBool")
 node_add_menu.add_node_type(layout, "GeometryNodeCollectionInfo")
 node_add_menu.add_node_type(layout, "FunctionNodeInputColor")
+node_add_menu.add_node_type(layout, "GeometryNodeInputImage")
 node_add_menu.add_node_type(layout, "GeometryNodeImageInfo")
 node_add_menu.add_node_type(layout, "FunctionNodeInputInt")
 node_add_menu.add_node_type(layout, "GeometryNodeIsViewport")
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 88f9c801aa8..fd45d698785 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1542,6 +1542,7 @@ struct TexResult;
 #define GEO_NODE_SET_CURVE_NORMAL 1188
 #define GEO_NODE_IMAGE_INFO 1189
 #define GEO_NODE_BLUR_ATTRIBUTE 1190
+#define GEO_NODE_IMAGE 1191
 
 /** \} */
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 5cb7cbd63c3..ffbc0651fab 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -10604,6 +10604,18 @@ static void def_geo_attribute_capture(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_geo_image(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+  RNA_def_property_pointer_sdna(prop, NULL, "id");
+  RNA_def_property_struct_type(prop, "Image");
+  RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+  RNA_def_property_ui_text(prop, "Image", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
 static void def_geo_delete_geometry(StructRNA *srna)
 {
   PropertyRNA *prop;
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index 6b892dfc5cf..a8190d6194f 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -320,6 +320,7 @@ DefNode(GeometryNode, GEO_NODE_FILL_CURVE, 
def_geo_curve_fill, "FILL_CURVE", Fil
 DefNode(GeometryNode, GEO_NODE_FILLET_CURVE, def_geo_curve_fillet, 
"FILLET_CURVE", FilletCurve, "Fillet Curve", "Round corners by generating 
circular arcs on each control point")
 DefNode(GeometryNode, GEO_NODE_FLIP_FACES, 0, "FLIP_FACES", FlipFaces, "Flip 
Faces", "Reverse the order of the vertices and edges of selected faces, 
flipping their normal direction")
 DefNode(GeometryNode, GEO_NODE_GEOMETRY_TO_INSTANCE, 0, 
"GEOMETRY_TO_INSTANCE", GeometryToInstance, "Geometry to Instance", "Convert 
each input geometry into an instance, which can be much faster than the Join 
Geometry node when the inputs are large")
+DefNode(GeometryNode, GEO_NODE_IMAGE, def_geo_image, "IMAGE", InputImage, 
"Image", "Input image")
 DefNode(GeometryNode, GEO_NODE_IMAGE_INFO, 0, "IMAGE_INFO", ImageInfo, "Image 
Info", "Retrieve information about an image")
 DefNode(GeometryNode, GEO_NODE_IMAGE_TEXTURE, def_geo_image_texture, 
"IMAGE_TEXTURE", ImageTexture, "Image Texture", "Sample values from an image 
texture")
 DefNode(GeometryNode, GEO_NODE_INPUT_CURVE_HANDLES, 0, "INPUT_CURVE_HANDLES", 
InputCurveHandlePositions,"Curve Handle Positions", "Retrieve the position of 
each Bézier control point's handles")
diff --git a/source/blender/nodes/geometry/CMakeLists.txt 
b/source/blender/nodes/geometry/CMakeLists.txt
index 840be95ce1a..c6151022ac5 100644
--- a/source/blender/nodes/geometry/CMakeLists.txt
+++ b/source/blender/nodes/geometry/CMakeLists.txt
@@ -73,6 +73,7 @@ set(SRC
   nodes/node_geo_field_at_index.cc
   nodes/node_geo_f

[Bf-blender-cvs] [a9cc10b5bb3] master: Geometry Node: Make collection info socket tooltips more consistent

2022-12-09 Thread Iliya Katueshenock
Commit: a9cc10b5bb363937afe0fe4bd1ecdee6f40498a2
Author: Iliya Katueshenock
Date:   Fri Dec 9 15:57:47 2022 -0600
Branches: master
https://developer.blender.org/rBa9cc10b5bb363937afe0fe4bd1ecdee6f40498a2

Geometry Node: Make collection info socket tooltips more consistent

Make hints and descriptions consistent with the new socket name.

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

===

M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_static_types.h

===

diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index ffbc0651fab..6d827cf757a 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -10015,7 +10015,10 @@ static void def_geo_collection_info(StructRNA *srna)
 
   prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, 
rna_node_geometry_collection_info_transform_space_items);
-  RNA_def_property_ui_text(prop, "Transform Space", "The transformation of the 
geometry output");
+  RNA_def_property_ui_text(
+  prop,
+  "Transform Space",
+  "The transformation of the instances output. Does not affect the 
internal geometry");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, 
"rna_Node_update_relations");
 }
 
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index a8190d6194f..d94b0b56072 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -286,7 +286,7 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_STATISTIC, 
def_geo_attribute_statistic,
 DefNode(GeometryNode, GEO_NODE_BLUR_ATTRIBUTE, def_geo_blur_attribute, 
"BLUR_ATTRIBUTE", BlurAttribute, "Blur Attribute", "Mix attribute values of 
neighboring elements")
 DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, 
"Bounding Box", "Calculate the limits of a geometry's positions and generate a 
box mesh with those dimensions")
 DefNode(GeometryNode, GEO_NODE_CAPTURE_ATTRIBUTE, 
def_geo_attribute_capture,"CAPTURE_ATTRIBUTE", CaptureAttribute, "Capture 
Attribute", "Store the result of a field on a geometry and output the data as a 
node socket. Allows remembering or interpolating data as the geometry changes, 
such as positions before deformation")
-DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "Retrieve geometry from a 
collection")
+DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "Retrieve geometry 
instances from a collection")
 DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, 
"Convex Hull", "Create a mesh that encloses all points in the input geometry 
with the smallest number of points")
 DefNode(GeometryNode, GEO_NODE_CURVE_ENDPOINT_SELECTION, 0, 
"CURVE_ENDPOINT_SELECTION", CurveEndpointSelection, "Endpoint Selection", 
"Provide a selection for an arbitrary number of endpoints in each spline")
 DefNode(GeometryNode, GEO_NODE_CURVE_HANDLE_TYPE_SELECTION, 
def_geo_curve_handle_type_selection, "CURVE_HANDLE_TYPE_SELECTION", 
CurveHandleTypeSelection, "Handle Type Selection", "Provide a selection based 
on the handle types of Bézier control points")

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


[Bf-blender-cvs] [ad05b78d092] master: Geometry Nodes: Improve viewer node domain choice for blur node

2022-12-09 Thread Iliya Katueshenock
Commit: ad05b78d092ae0c837d96598322fcce1fb3be12f
Author: Iliya Katueshenock
Date:   Fri Dec 9 15:29:03 2022 -0600
Branches: master
https://developer.blender.org/rBad05b78d092ae0c837d96598322fcce1fb3be12f

Geometry Nodes: Improve viewer node domain choice for blur node

Add preferred domain based on the "Value" input field. Most often,
the domain must match the original domain for the value.

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

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
index f53364aebdb..ca373cdf4d9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
@@ -14,6 +14,7 @@
 
 #include "BKE_attribute_math.hh"
 #include "BKE_curves.hh"
+#include "BKE_geometry_fields.hh"
 #include "BKE_mesh.h"
 #include "BKE_mesh_mapping.h"
 
@@ -443,6 +444,11 @@ class BlurAttributeFieldInput final : public 
bke::GeometryFieldInput {
 }
 return false;
   }
+
+  std::optional preferred_domain(const GeometryComponent 
&component) const override
+  {
+return bke::try_detect_field_domain(component, value_field_);
+  }
 };
 
 static StringRefNull identifier_suffix(eCustomDataType data_type)

___
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] [fc5f7a1e2d5] master: Cleanup: Use topology cache of group output node

2022-12-09 Thread Iliya Katueshenock
Commit: fc5f7a1e2d5ec9a3a10b83ef09fdf5bb77cf18fd
Author: Iliya Katueshenock
Date:   Fri Dec 9 15:35:38 2022 -0600
Branches: master
https://developer.blender.org/rBfc5f7a1e2d5ec9a3a10b83ef09fdf5bb77cf18fd

Cleanup: Use topology cache of group output node

Using a cache greatly simplifies access to the output node.
I touched on the most common and understandable cases for me.
The texture nodes were touched because it looked pretty generic.

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

===

M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/nodes/shader/nodes/node_shader_common.cc
M   source/blender/nodes/texture/nodes/node_texture_common.cc

===

diff --git a/source/blender/blenkernel/intern/node_tree_update.cc 
b/source/blender/blenkernel/intern/node_tree_update.cc
index bb063dadb06..ef4076a9b6e 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -509,20 +509,15 @@ static void determine_group_output_states(const bNodeTree 
&tree,
   FieldInferencingInterface 
&new_inferencing_interface,
   const Span 
field_state_by_socket_id)
 {
-  for (const bNode *group_output_node : tree.nodes_by_type("NodeGroupOutput")) 
{
-/* Ignore inactive group output nodes. */
-if (!(group_output_node->flag & NODE_DO_OUTPUT)) {
-  continue;
-}
-/* Determine dependencies of all group outputs. */
-for (const bNodeSocket *group_output_socket :
- group_output_node->input_sockets().drop_back(1)) {
-  OutputFieldDependency field_dependency = find_group_output_dependencies(
-  *group_output_socket, field_state_by_socket_id);
-  new_inferencing_interface.outputs[group_output_socket->index()] = 
std::move(
-  field_dependency);
-}
-break;
+  const bNode *group_output_node = tree.group_output_node();
+  if (!group_output_node) {
+return;
+  }
+
+  for (const bNodeSocket *group_output_socket : 
group_output_node->input_sockets().drop_back(1)) {
+OutputFieldDependency field_dependency = find_group_output_dependencies(
+*group_output_socket, field_state_by_socket_id);
+new_inferencing_interface.outputs[group_output_socket->index()] = 
std::move(field_dependency);
   }
 }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.cc 
b/source/blender/nodes/shader/nodes/node_shader_common.cc
index 613fa101d29..48937b1213b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_common.cc
@@ -43,19 +43,20 @@ static void group_gpu_copy_inputs(bNode *gnode, 
GPUNodeStack *in, bNodeStack *gs
  */
 static void group_gpu_move_outputs(bNode *gnode, GPUNodeStack *out, bNodeStack 
*gstack)
 {
-  bNodeTree *ngroup = (bNodeTree *)gnode->id;
+  const bNodeTree &ngroup = *reinterpret_cast(gnode->id);
 
-  for (bNode *node : ngroup->all_nodes()) {
-if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
-  int a;
-  LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, a) {
-bNodeStack *ns = node_get_socket_stack(gstack, sock);
-if (ns) {
-  /* convert the node stack data result back to gpu stack */
-  node_gpu_stack_from_data(&out[a], sock->type, ns);
-}
-  }
-  break; /* only one active output node */
+  ngroup.ensure_topology_cache();
+  const bNode *group_output_node = ngroup.group_output_node();
+  if (!group_output_node) {
+return;
+  }
+
+  int a;
+  LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &group_output_node->inputs, a) {
+bNodeStack *ns = node_get_socket_stack(gstack, sock);
+if (ns) {
+  /* convert the node stack data result back to gpu stack */
+  node_gpu_stack_from_data(&out[a], sock->type, ns);
 }
   }
 }
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.cc 
b/source/blender/nodes/texture/nodes/node_texture_common.cc
index 5302182a6f6..603e2d39046 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.cc
+++ b/source/blender/nodes/texture/nodes/node_texture_common.cc
@@ -84,24 +84,24 @@ static void group_copy_inputs(bNode *gnode, bNodeStack 
**in, bNodeStack *gstack)
  */
 static void group_copy_outputs(bNode *gnode, bNodeStack **out, bNodeStack 
*gstack)
 {
-  bNodeTree *ngroup = (bNodeTree *)gnode->id;
-  bNode *node;
-  bNodeSocket *sock;
-  bNodeStack *ns;
+  const bNodeTree &ngroup = *reinterpret_cast(gnode->id);
+
+  ngroup.ensure_topology_cache();
+  const bNode *group_output_node = ngroup.group_output_node();
+  if (!group_output_node) {
+return;
+  }
+
   int a;
+  LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &group_output_node->inputs, a) {
+if (!out[a]) {
+  /* shouldn't need to check this T36694. */

[Bf-blender-cvs] [07b67894e8d] master: Fix macOS precompiled libraries built on Xcode 14 not working in Xcode 13

2022-12-09 Thread Brecht Van Lommel
Commit: 07b67894e8db446edbaaf4eb2a49019ac61080c5
Author: Brecht Van Lommel
Date:   Fri Dec 9 21:27:36 2022 +0100
Branches: master
https://developer.blender.org/rB07b67894e8db446edbaaf4eb2a49019ac61080c5

Fix macOS precompiled libraries built on Xcode 14 not working in Xcode 13

Disable some symbols amd linking features not available in Xcode 13.

===

M   build_files/build_environment/patches/python_unix.diff
M   build_files/build_environment/patches/sdl.diff

===

diff --git a/build_files/build_environment/patches/python_unix.diff 
b/build_files/build_environment/patches/python_unix.diff
index a9baae8ce32..3969c706758 100644
--- a/build_files/build_environment/patches/python_unix.diff
+++ b/build_files/build_environment/patches/python_unix.diff
@@ -36,3 +36,39 @@ index a97a755..07ce853 100644
  if (self.compiler.find_library_file(self.lib_dirs, lib_name)):
  ffi_lib = lib_name
  break
+--- a/Modules/posixmodule.c2022-12-09 21:44:03
 b/Modules/posixmodule.c2022-12-09 21:39:46
+@@ -10564,10 +10564,15 @@
+ Py_BEGIN_ALLOW_THREADS
+ #ifdef HAVE_MKFIFOAT
+ if (dir_fd != DEFAULT_DIR_FD) {
++// BLENDER: disable also at compile time for compatibility when linking with 
older Xcode.
++// https://github.com/python/cpython/issues/97897
++#ifndef __APPLE__
+ if (HAVE_MKFIFOAT_RUNTIME) {
+ result = mkfifoat(dir_fd, path->narrow, mode);
+ 
++} else
++#endif
++{
+-} else {
+ mkfifoat_unavailable = 1;
+ result = 0;
+ }
+@@ -10638,10 +10633,15 @@
+ Py_BEGIN_ALLOW_THREADS
+ #ifdef HAVE_MKNODAT
+ if (dir_fd != DEFAULT_DIR_FD) {
++// BLENDER: disable also at compile time for compatibility when linking with 
older Xcode.
++// https://github.com/python/cpython/issues/97897
++#ifndef __APPLE__
+ if (HAVE_MKNODAT_RUNTIME) {
+ result = mknodat(dir_fd, path->narrow, mode, device);
+ 
++} else
++#endif
++{
+-} else {
+ mknodat_unavailable = 1;
+ result = 0;
+ }
diff --git a/build_files/build_environment/patches/sdl.diff 
b/build_files/build_environment/patches/sdl.diff
index 742183ecb4c..6caa98f9d68 100644
--- a/build_files/build_environment/patches/sdl.diff
+++ b/build_files/build_environment/patches/sdl.diff
@@ -30,3 +30,19 @@ diff -ru ./src/video/SDL_video.c ./src/video/SDL_video.c
  if (SDL_strcmp(_this->name, "cocoa") == 0) {  /* don't do this for X11, 
etc */
  if (Cocoa_IsWindowInFullscreenSpace(window)) {
  return SDL_FALSE;
+--- CMakeLists.txt 2022-12-09 20:40:00
 CMakeLists.txt 2022-12-09 20:40:00
+@@ -526,6 +526,13 @@
+ list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing")
+   endif()
+ 
++  # BLENDER: make libs compatible with older Xcode.
++  # https://github.com/KhronosGroup/MoltenVK/issues/1756
++  check_c_compiler_flag(-fno-objc-msgsend-selector-stubs 
HAVE_GCC_NO_OBJC_MSGSEND_SELECTOR_STUBS)
++  if(HAVE_GCC_NO_OBJC_MSGSEND_SELECTOR_STUBS)
++list(APPEND EXTRA_CFLAGS "-fno-objc-msgsend-selector-stubs")
++  endif()
++
+   check_c_compiler_flag(-Wdeclaration-after-statement 
HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
+   if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
+ check_c_compiler_flag(-Werror=declaration-after-statement 
HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)

___
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] [3552f5d83c6] master: Build: don't bundle versioned dylib symbolic links on macOS

2022-12-09 Thread Brecht Van Lommel
Commit: 3552f5d83c692228dd13321cdcbf17084e065b60
Author: Brecht Van Lommel
Date:   Fri Dec 9 15:35:58 2022 +0100
Branches: master
https://developer.blender.org/rB3552f5d83c692228dd13321cdcbf17084e065b60

Build: don't bundle versioned dylib symbolic links on macOS

Apple notarization rejects packages containing them.

Similar to rpaths we handle generically this as part of the harvest step rather
than patches individual library builds systems.

Ref T99618

===

M   build_files/build_environment/cmake/harvest.cmake
M   build_files/build_environment/darwin/set_rpath.py

===

diff --git a/build_files/build_environment/cmake/harvest.cmake 
b/build_files/build_environment/cmake/harvest.cmake
index 893042afa00..8c9cf1fb878 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -63,6 +63,8 @@ endfunction()
 # Ideally this would be done as part of the Blender build since it makes 
assumptions
 # about where the files will be installed. However it would add patchelf as a 
new
 # dependency for building.
+#
+# Also removes versioned symlinks, which give errors with macOS notarization.
 if(APPLE)
   set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py 
@loader_path)
 else()
@@ -76,7 +78,11 @@ function(harvest_rpath_lib from to pattern)
 cmake_policy(SET CMP0009 NEW)\n
 file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
 foreach(f \${shared_libs}) \n
-  if(NOT IS_SYMLINK \${f})\n
+  if(IS_SYMLINK \${f})\n
+if(APPLE)\n
+  file(REMOVE_RECURSE \${f})
+endif()\n
+  else()\n
 execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
   endif()\n
 endforeach()")
@@ -101,15 +107,21 @@ function(harvest_rpath_python from to pattern)
   install(CODE "\
 file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
 foreach(f \${shared_libs}) \n
-  get_filename_component(f_dir \${f} DIRECTORY) \n
-  file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
-  execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
+  if(IS_SYMLINK \${f})\n
+if(APPLE)\n
+  file(REMOVE_RECURSE \${f})
+endif()\n
+  else()\n
+get_filename_component(f_dir \${f} DIRECTORY) \n
+file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
+execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) 
\n
+  endif()\n
 endforeach()")
 endfunction()
 
 harvest(alembic/include alembic/include "*.h")
 harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
-harvest(alembic/bin alembic/bin "*")
+harvest_rpath_bin(alembic/bin alembic/bin "*")
 harvest(brotli/include brotli/include "*.h")
 harvest(brotli/lib brotli/lib "*.a")
 harvest(boost/include boost/include "*")
@@ -151,7 +163,7 @@ harvest(llvm/lib llvm/lib "libLLVM*.a")
 harvest(llvm/lib llvm/lib "libclang*.a")
 harvest(llvm/lib/clang llvm/lib/clang "*.h")
 if(APPLE)
-  harvest(openmp/lib openmp/lib "*")
+  harvest(openmp/lib openmp/lib "libomp.dylib")
   harvest(openmp/include openmp/include "*.h")
 endif()
 if(BLENDER_PLATFORM_ARM)
@@ -242,9 +254,8 @@ harvest(usd/lib/usd usd/lib/usd "*")
 harvest_rpath_python(usd/lib/python/pxr 
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr "*")
 harvest(usd/plugin usd/plugin "*")
 harvest(materialx/include materialx/include "*.h")
-harvest(materialx/lib materialx/lib "*")
+harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*")
 harvest(materialx/libraries materialx/libraries "*")
-harvest(materialx/python materialx/python "*")
 harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
 harvest_rpath_python(materialx/python/MaterialX 
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX "*")
 # We do not need anything from the resources folder, but the MaterialX config
diff --git a/build_files/build_environment/darwin/set_rpath.py 
b/build_files/build_environment/darwin/set_rpath.py
index 190e619a5ba..6ca58875ac1 100644
--- a/build_files/build_environment/darwin/set_rpath.py
+++ b/build_files/build_environment/darwin/set_rpath.py
@@ -1,9 +1,19 @@
 #!/usr/bin/env python3
 # macOS utility to remove all rpaths and add a new one.
 
+import os
+import re
 import subprocess
 import sys
 
+# Strip version numbers from dependenciesm macOS notarizatiom fails
+# with version symlinks.
+def strip_lib_version(name):
+name = re.sub(r'(\.[0-9]+)+.dylib', '.dylib', name)
+name = re.sub(r'(\.[0-9]+)+.so', '.so', name)
+name = re.sub(r'(\.[0-9]+)+.cpython', '.cpython', name)
+return name
+
 rpath = sys.argv[1]
 file = sys.argv[2]
 
@@ -17,3 +27,18 @@ for i, token in enumerate(tokens):
 subprocess.run(['install_name_tool', '-delete_rpath', old_rpath, file])
 
 subprocess.run(['inst

[Bf-blender-cvs] [019b930d6b9] master: Fix build error with new USD libraries in debug mode

2022-12-09 Thread Brecht Van Lommel
Commit: 019b930d6b9ca87938032bef1eacadf70668c1aa
Author: Brecht Van Lommel
Date:   Fri Dec 9 17:08:35 2022 +0100
Branches: master
https://developer.blender.org/rB019b930d6b9ca87938032bef1eacadf70668c1aa

Fix build error with new USD libraries in debug mode

Solve conflict between TBB and Boost Python.

===

M   build_files/build_environment/cmake/boost.cmake
A   build_files/build_environment/patches/boost.diff

===

diff --git a/build_files/build_environment/cmake/boost.cmake 
b/build_files/build_environment/cmake/boost.cmake
index 495b419e69c..0daf38f0bf9 100644
--- a/build_files/build_environment/cmake/boost.cmake
+++ b/build_files/build_environment/cmake/boost.cmake
@@ -23,13 +23,11 @@ elseif(APPLE)
   set(BOOST_BUILD_COMMAND ./b2)
   set(BOOST_BUILD_OPTIONS toolset=clang-darwin cxxflags=${PLATFORM_CXXFLAGS} 
linkflags=${PLATFORM_LDFLAGS} visibility=global --disable-icu 
boost.locale.icu=off)
   set(BOOST_HARVEST_CMD echo .)
-  set(BOOST_PATCH_COMMAND echo .)
 else()
   set(BOOST_HARVEST_CMD echo .)
   set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
   set(BOOST_BUILD_COMMAND ./b2)
   set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu 
boost.locale.icu=off)
-  set(BOOST_PATCH_COMMAND echo .)
 endif()
 
 set(JAM_FILE ${BUILD_DIR}/boost.user-config.jam)
@@ -72,7 +70,7 @@ ExternalProject_Add(external_boost
   URL_HASH ${BOOST_HASH_TYPE}=${BOOST_HASH}
   PREFIX ${BUILD_DIR}/boost
   UPDATE_COMMAND  ""
-  PATCH_COMMAND ${BOOST_PATCH_COMMAND}
+  PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/boost/src/external_boost < 
${PATCH_DIR}/boost.diff
   CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
   BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} 
-j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} 
address-model=${BOOST_ADDRESS_MODEL} link=shared threading=multi 
${BOOST_OPTIONS}--prefix=${LIBDIR}/boost install
   BUILD_IN_SOURCE 1
diff --git a/build_files/build_environment/patches/boost.diff 
b/build_files/build_environment/patches/boost.diff
new file mode 100644
index 000..e2bc06dc747
--- /dev/null
+++ b/build_files/build_environment/patches/boost.diff
@@ -0,0 +1,12 @@
+--- a/boost/python//detail/wrap_python.hpp 2022-12-09 19:16:17
 b/boost/python//detail/wrap_python.hpp 2022-12-09 19:18:08
+@@ -206,7 +206,8 @@
+ 
+ #ifdef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
+ # undef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
+-# define _DEBUG
++// BLENDER: TBB excepts this to have a value.
++# define _DEBUG 1
+ # ifdef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
+ #  undef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
+ #  undef _CRT_NOFORCE_MANIFEST

___
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] [8648cf47175] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-09 Thread Hans Goudey
Commit: 8648cf4717544fd2b8532723c5e70fccfe30bf4d
Author: Hans Goudey
Date:   Fri Dec 9 15:23:58 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB8648cf4717544fd2b8532723c5e70fccfe30bf4d

Merge branch 'master' into geometry-nodes-simulation

===



===



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


[Bf-blender-cvs] [d5bcc1ef16b] master: Cleanup: Tweak variable name in extrude node

2022-12-09 Thread Hans Goudey
Commit: d5bcc1ef16bd98e0da3bc374bed9eaa5d412de91
Author: Hans Goudey
Date:   Fri Dec 9 15:22:28 2022 -0600
Branches: master
https://developer.blender.org/rBd5bcc1ef16bd98e0da3bc374bed9eaa5d412de91

Cleanup: Tweak variable name in extrude node

These ranges aren't only used to index corners, also other arrays.
Also use const for some variables, mostly for aesthetic reasons.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index d09c7eaa1a9..d390a33245d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -186,7 +186,7 @@ void copy_with_mixing(MutableSpan dst, Span src, 
GetMixIndicesFn get_mix_i
 }
 
 static Array> create_vert_to_edge_map(const int vert_size,
-  Span edges,
+  const Span edges,
   const int vert_offset = 0)
 {
   Array> vert_to_edge_map(vert_size);
@@ -205,7 +205,7 @@ static void extrude_mesh_vertices(Mesh &mesh,
   const int orig_vert_size = mesh.totvert;
   const int orig_edge_size = mesh.totedge;
 
-  bke::MeshFieldContext context{mesh, ATTR_DOMAIN_POINT};
+  const bke::MeshFieldContext context{mesh, ATTR_DOMAIN_POINT};
   FieldEvaluator evaluator{context, mesh.totvert};
   evaluator.add(offset_field);
   evaluator.set_selection(selection_field);
@@ -294,8 +294,8 @@ static void extrude_mesh_vertices(Mesh &mesh,
 
 static Array> mesh_calculate_polys_of_edge(const Mesh &mesh)
 {
-  Span polys = mesh.polys();
-  Span loops = mesh.loops();
+  const Span polys = mesh.polys();
+  const Span loops = mesh.loops();
   Array> polys_of_edge(mesh.totedge);
 
   for (const int i_poly : polys.index_range()) {
@@ -371,11 +371,11 @@ static void extrude_mesh_edges(Mesh &mesh,
const AttributeOutputs &attribute_outputs)
 {
   const int orig_vert_size = mesh.totvert;
-  Span orig_edges = mesh.edges();
-  Span orig_polys = mesh.polys();
+  const Span orig_edges = mesh.edges();
+  const Span orig_polys = mesh.polys();
   const int orig_loop_size = mesh.totloop;
 
-  bke::MeshFieldContext edge_context{mesh, ATTR_DOMAIN_EDGE};
+  const bke::MeshFieldContext edge_context{mesh, ATTR_DOMAIN_EDGE};
   FieldEvaluator edge_evaluator{edge_context, mesh.totedge};
   edge_evaluator.set_selection(selection_field);
   edge_evaluator.add(offset_field);
@@ -453,7 +453,7 @@ static void extrude_mesh_edges(Mesh &mesh,
 const int extrude_index_1 = new_vert_1 - orig_vert_size;
 const int extrude_index_2 = new_vert_2 - orig_vert_size;
 
-Span connected_polys = edge_to_poly_map[orig_edge_index];
+const Span connected_polys = edge_to_poly_map[orig_edge_index];
 
 /* When there was a single polygon connected to the new polygon, we can 
use the old one to keep
  * the face direction consistent. When there is more than one connected 
edge, the new face
@@ -532,7 +532,7 @@ static void extrude_mesh_edges(Mesh &mesh,
 for (const int i_edge_selection : range) {
   const int orig_edge_index = edge_selection[i_edge_selection];
 
-  Span connected_polys = edge_to_poly_map[orig_edge_index];
+  const Span connected_polys = 
edge_to_poly_map[orig_edge_index];
   if (connected_polys.is_empty()) {
 /* If there are no connected polygons, there is no corner data 
to
  * interpolate. */
@@ -650,11 +650,11 @@ static void extrude_mesh_face_regions(Mesh &mesh,
   const AttributeOutputs 
&attribute_outputs)
 {
   const int orig_vert_size = mesh.totvert;
-  Span orig_edges = mesh.edges();
-  Span orig_polys = mesh.polys();
-  Span orig_loops = mesh.loops();
+  const Span orig_edges = mesh.edges();
+  const Span orig_polys = mesh.polys();
+  const Span orig_loops = mesh.loops();
 
-  bke::MeshFieldContext poly_context{mesh, ATTR_DOMAIN_FACE};
+  const bke::MeshFieldContext poly_context{mesh, ATTR_DOMAIN_FACE};
   FieldEvaluator poly_evaluator{poly_context, mesh.totpoly};
   poly_evaluator.set_selection(selection_field);
   poly_evaluator.add(offset_field);
@@ -713,7 +713,7 @@ static void extrude_mesh_face_regions(Mesh &mesh,
* other connected faces, or because all of the other faces aren't selected. 
*/
   VectorSet boundary_edge_indices;
   for (const int i_edge : orig_edges.index_range()) {
-Span polys = edge_to_poly_map[i_edge];
+const Span polys = edge_to_poly_map[i_edge];
 
 int i_selected_poly = -1;
 int deselected_poly_count = 0;
@@ -1054,13 +1054,13 @@ static void extrude_individual_mesh_faces(Mesh &mesh,
 {
   const int ori

[Bf-blender-cvs] [d17db1d11aa] master: Geometry Nodes: Support original indices in extrude node

2022-12-09 Thread Hans Goudey
Commit: d17db1d11aa1383fcb5bc52aa977008abb9efb23
Author: Hans Goudey
Date:   Fri Dec 9 14:19:11 2022 -0600
Branches: master
https://developer.blender.org/rBd17db1d11aa1383fcb5bc52aa977008abb9efb23

Geometry Nodes: Support original indices in extrude node

This allows using the "On Cage" feature in edit mode to interact with
original mesh elements via the newly created geometry. The original
indices are only set for new elements that copy attribute values
from original elements directly, so it can also be a helpful way
to visualize attribute propagation.

The change was simplified by refactoring the individual mode slightly
to create separate index maps for the new edges and vertices. That
simplified attribute copying a bit too.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 5a1a4e2c796..d09c7eaa1a9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -272,7 +272,10 @@ static void extrude_mesh_vertices(Mesh &mesh,
   });
 
   MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
-  vert_orig_indices.slice_safe(new_vert_range).fill(ORIGINDEX_NONE);
+  if (!vert_orig_indices.is_empty()) {
+array_utils::gather(
+vert_orig_indices.as_span(), selection, 
vert_orig_indices.slice(new_vert_range));
+  }
 
   MutableSpan new_edge_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_EDGE);
   new_edge_orig_indices.slice_safe(new_edge_range).fill(ORIGINDEX_NONE);
@@ -608,11 +611,19 @@ static void extrude_mesh_edges(Mesh &mesh,
   }
 
   MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
-  vert_orig_indices.slice_safe(new_vert_range).fill(ORIGINDEX_NONE);
+  if (!vert_orig_indices.is_empty()) {
+array_utils::gather(vert_orig_indices.as_span(),
+new_vert_indices.as_span(),
+vert_orig_indices.slice(new_vert_range));
+  }
 
   MutableSpan edge_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_EDGE);
-  edge_orig_indices.slice_safe(connect_edge_range).fill(ORIGINDEX_NONE);
-  edge_orig_indices.slice_safe(duplicate_edge_range).fill(ORIGINDEX_NONE);
+  if (!edge_orig_indices.is_empty()) {
+edge_orig_indices.slice(connect_edge_range).fill(ORIGINDEX_NONE);
+array_utils::gather(edge_orig_indices.as_span(),
+edge_selection,
+edge_orig_indices.slice(duplicate_edge_range));
+  }
 
   MutableSpan poly_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_FACE);
   poly_orig_indices.slice_safe(new_poly_range).fill(ORIGINDEX_NONE);
@@ -992,15 +1003,29 @@ static void extrude_mesh_face_regions(Mesh &mesh,
   }
 
   MutableSpan vert_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_POINT);
-  vert_orig_indices.slice_safe(new_vert_range).fill(ORIGINDEX_NONE);
+  if (!vert_orig_indices.is_empty()) {
+array_utils::gather(vert_orig_indices.as_span(),
+new_vert_indices.as_span(),
+vert_orig_indices.slice(new_vert_range));
+  }
 
   MutableSpan edge_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_EDGE);
-  edge_orig_indices.slice_safe(connect_edge_range).fill(ORIGINDEX_NONE);
-  edge_orig_indices.slice_safe(new_inner_edge_range).fill(ORIGINDEX_NONE);
-  edge_orig_indices.slice_safe(boundary_edge_range).fill(ORIGINDEX_NONE);
+  if (!edge_orig_indices.is_empty()) {
+edge_orig_indices.slice(connect_edge_range).fill(ORIGINDEX_NONE);
+array_utils::gather(edge_orig_indices.as_span(),
+new_inner_edge_indices.as_span(),
+edge_orig_indices.slice(new_inner_edge_range));
+array_utils::gather(edge_orig_indices.as_span(),
+boundary_edge_indices.as_span(),
+edge_orig_indices.slice(boundary_edge_range));
+  }
 
   MutableSpan poly_orig_indices = get_orig_index_layer(mesh, 
ATTR_DOMAIN_FACE);
-  poly_orig_indices.slice_safe(side_poly_range).fill(ORIGINDEX_NONE);
+  if (!poly_orig_indices.is_empty()) {
+array_utils::gather(poly_orig_indices.as_span(),
+edge_extruded_face_indices.as_span(),
+poly_orig_indices.slice(side_poly_range));
+  }
 
   if (attribute_outputs.top_id) {
 save_selection_as_attribute(
@@ -1077,21 +1102,32 @@ static void extrude_individual_mesh_faces(Mesh &mesh,
   MutableSpan new_polys = polys.slice(side_poly_range);
   MutableSpan loops = mesh.loops_for_write();
 
-  /* For every selected polygon, build the faces that form the sides of the 
extrusion. Filling some
-   * of this data like the new edges or polygons could be easily split into 
separ

[Bf-blender-cvs] [46993958fd5] master: Geometry Nodes: Support original index layer in split edges node

2022-12-09 Thread Hans Goudey
Commit: 46993958fd57a430f2a56c6549730990ae683806
Author: Hans Goudey
Date:   Fri Dec 9 14:01:49 2022 -0600
Branches: master
https://developer.blender.org/rB46993958fd57a430f2a56c6549730990ae683806

Geometry Nodes: Support original index layer in split edges node

This is partially a bug fix, since the original index layer wasn't
handled at all before, and could be left initialized. That was caused
by my recent change to modify a mesh in place rather than create a
new one. Also copy over any orco data, which was another unhandled
layer type.

It's also a new feature though, since it allows using the "On Cage"
feature of edit mode to adjust original mesh elements by selecting
the new ones. This brings the functionality inline with the Edge Split
modifier.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc 
b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
index 6f0449019d8..f44ab44aacd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc
@@ -27,6 +27,14 @@ static inline bool naive_edges_equal(const MEdge &edge1, 
const MEdge &edge2)
   return edge1.v1 == edge2.v1 && edge1.v2 == edge2.v2;
 }
 
+template
+static void copy_to_new_verts(MutableSpan data, const Span 
new_to_old_verts_map)
+{
+  const Span old_data = data.drop_back(new_to_old_verts_map.size());
+  MutableSpan new_data = data.take_back(new_to_old_verts_map.size());
+  array_utils::gather(old_data, new_to_old_verts_map, new_data);
+}
+
 static void add_new_vertices(Mesh &mesh, const Span new_to_old_verts_map)
 {
   CustomData_realloc(&mesh.vdata, mesh.totvert, mesh.totvert + 
new_to_old_verts_map.size());
@@ -44,14 +52,17 @@ static void add_new_vertices(Mesh &mesh, const Span 
new_to_old_verts_map)
 
 attribute_math::convert_to_static_type(attribute.span.type(), [&](auto 
dummy) {
   using T = decltype(dummy);
-  MutableSpan span = attribute.span.typed();
-  const Span old_data = span.drop_back(new_to_old_verts_map.size());
-  MutableSpan new_data = span.take_back(new_to_old_verts_map.size());
-  array_utils::gather(old_data, new_to_old_verts_map, new_data);
+  copy_to_new_verts(attribute.span.typed(), new_to_old_verts_map);
 });
 
 attribute.finish();
   }
+  if (float3 *orco = static_cast(CustomData_get_layer(&mesh.vdata, 
CD_ORCO))) {
+copy_to_new_verts({orco, mesh.totvert}, new_to_old_verts_map);
+  }
+  if (int *orig_indices = static_cast(CustomData_get_layer(&mesh.vdata, 
CD_ORIGINDEX))) {
+copy_to_new_verts({orig_indices, mesh.totvert}, new_to_old_verts_map);
+  }
 }
 
 static void add_new_edges(Mesh &mesh,
@@ -116,11 +127,25 @@ static void add_new_edges(Mesh &mesh,
 dst_attributes.append({id, type, new_data});
   }
 
+  int *new_orig_indices = nullptr;
+  if (const int *orig_indices = static_cast(
+  CustomData_get_layer(&mesh.edata, CD_ORIGINDEX))) {
+new_orig_indices = static_cast(
+MEM_malloc_arrayN(new_edges.size(), sizeof(int), __func__));
+array_utils::gather(Span(orig_indices, mesh.totedge),
+new_to_old_edges_map,
+{new_orig_indices, new_edges.size()});
+  }
+
   CustomData_free(&mesh.edata, mesh.totedge);
   mesh.totedge = new_edges.size();
   CustomData_add_layer(&mesh.edata, CD_MEDGE, CD_CONSTRUCT, nullptr, 
mesh.totedge);
   mesh.edges_for_write().copy_from(new_edges);
 
+  if (new_orig_indices != nullptr) {
+CustomData_add_layer(&mesh.edata, CD_ORIGINDEX, CD_ASSIGN, 
new_orig_indices, mesh.totedge);
+  }
+
   for (NewAttributeData &new_data : dst_attributes) {
 attributes.add(new_data.local_id,
ATTR_DOMAIN_EDGE,

___
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] [b000fc308b9] master: Cleanup: Resolve unused variable warnings in modifier

2022-12-09 Thread Hans Goudey
Commit: b000fc308b963c60bd9a053e30de55371e84fdc1
Author: Hans Goudey
Date:   Fri Dec 9 13:51:52 2022 -0600
Branches: master
https://developer.blender.org/rBb000fc308b963c60bd9a053e30de55371e84fdc1

Cleanup: Resolve unused variable warnings in modifier

===

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

===

diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.cc 
b/source/blender/modifiers/intern/MOD_meshsequencecache.cc
index 4e52d8152b8..ecbb8ebe607 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.cc
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.cc
@@ -106,6 +106,8 @@ static bool isDisabled(const struct Scene * /*scene*/, 
ModifierData *md, bool /*
   return (mcmd->cache_file == nullptr) || (mcmd->object_path[0] == '\0');
 }
 
+#if defined(WITH_USD) || defined(WITH_ALEMBIC)
+
 /* Return true if the modifier evaluation is for the ORCO mesh and the mesh 
hasn't changed
  * topology.
  */
@@ -123,18 +125,18 @@ static bool 
can_use_mesh_for_orco_evaluation(MeshSeqCacheModifierData *mcmd,
 
   switch (cache_file->type) {
 case CACHEFILE_TYPE_ALEMBIC:
-#ifdef WITH_ALEMBIC
+#  ifdef WITH_ALEMBIC
   if (!ABC_mesh_topology_changed(mcmd->reader, ctx->object, mesh, time, 
err_str)) {
 return true;
   }
-#endif
+#  endif
   break;
 case CACHEFILE_TYPE_USD:
-#ifdef WITH_USD
+#  ifdef WITH_USD
   if (!USD_mesh_topology_changed(mcmd->reader, ctx->object, mesh, time, 
err_str)) {
 return true;
   }
-#endif
+#  endif
   break;
 case CACHE_FILE_TYPE_INVALID:
   break;
@@ -158,6 +160,8 @@ static Mesh *generate_bounding_box_mesh(const Mesh 
*org_mesh)
   return result;
 }
 
+#endif
+
 static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh 
*mesh)
 {
 #if defined(WITH_USD) || defined(WITH_ALEMBIC)
@@ -261,7 +265,7 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *ctx, Mesh *
 
   return result ? result : mesh;
 #else
-  UNUSED_VARS(ctx, md, generate_bounding_box_mesh);
+  UNUSED_VARS(ctx, md);
   return mesh;
 #endif
 }

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


[Bf-blender-cvs] [bcbd13201a2] master: deps_builder: python updates

2022-12-09 Thread Ray Molenkamp
Commit: bcbd13201a24753fec15b449f61f7e13ed4b75d9
Author: Ray Molenkamp
Date:   Fri Dec 9 12:27:44 2022 -0700
Branches: master
https://developer.blender.org/rBbcbd13201a24753fec15b449f61f7e13ed4b75d9

deps_builder: python updates

- Added comment for additional tasks to do when bumping python
- updated sqlite to 3.39.4
- downgrade setuptools to 63.2.0 to avoid numpy build issues
- numpy 1.23.5

===

M   build_files/build_environment/cmake/python.cmake
M   build_files/build_environment/cmake/python_site_packages.cmake
M   build_files/build_environment/cmake/versions.cmake

===

diff --git a/build_files/build_environment/cmake/python.cmake 
b/build_files/build_environment/cmake/python.cmake
index 3d055a8af0b..4d9f892e729 100644
--- a/build_files/build_environment/cmake/python.cmake
+++ b/build_files/build_environment/cmake/python.cmake
@@ -32,13 +32,11 @@ if(WIN32)
 # Python will download its own deps and there's very little we can do about
 # that beyond placing some code in their externals dir before it tries.
 # the foldernames *HAVE* to match the ones inside pythons 
get_externals.cmd.
-# python 3.10.8 still ships zlib 1.2.12, replace it with our 1.2.13
-# copy until they update. Same rules apply to openssl foldernames HAVE to 
match
 # regardless of the version actually in there.
 PATCH_COMMAND mkdir ${PYTHON_EXTERNALS_FOLDER_DOS} &&
-  mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.12 
${ZLIB_SOURCE_FOLDER_DOS} &&
+  mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\zlib-1.2.13 
${ZLIB_SOURCE_FOLDER_DOS} &&
   mklink /J ${PYTHON_EXTERNALS_FOLDER_DOS}\\openssl-1.1.1q 
${SSL_SOURCE_FOLDER_DOS} &&
-  ${CMAKE_COMMAND} -E copy 
${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h 
${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.12/zconf.h &&
+  ${CMAKE_COMMAND} -E copy 
${ZLIB_SOURCE_FOLDER}/../external_zlib-build/zconf.h 
${PYTHON_EXTERNALS_FOLDER}/zlib-1.2.13/zconf.h &&
   ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < 
${PATCH_DIR}/python_windows.diff
 CONFIGURE_COMMAND echo "."
 BUILD_COMMAND ${CONFIGURE_ENV_MSVC} && cd 
${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && 
set LDFLAGS=/DEBUG && call prepare_ssl.bat && call build.bat -e -p x64 -c 
${BUILD_MODE}
diff --git a/build_files/build_environment/cmake/python_site_packages.cmake 
b/build_files/build_environment/cmake/python_site_packages.cmake
index 91baaa4df0f..4c0e7b1996c 100644
--- a/build_files/build_environment/cmake/python_site_packages.cmake
+++ b/build_files/build_environment/cmake/python_site_packages.cmake
@@ -15,7 +15,9 @@ ExternalProject_Add(external_python_site_packages
   CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
   BUILD_COMMAND ""
   PREFIX ${BUILD_DIR}/site_packages
-  INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir 
${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} 
charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} 
certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} 
zstandard==${ZSTANDARD_VERSION} autopep8==${AUTOPEP8_VERSION} 
pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} 
meson==${MESON_VERSION} --no-binary :all:
+  # setuptools is downgraded to 63.2.0 (same as python 3.10.8) since numpy 
1.23.x seemingly has 
+  # issues building on windows with the newer versions that ships with python 
3.10.9+
+  INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir 
${SITE_PACKAGES_EXTRA} setuptools==63.2.0 cython==${CYTHON_VERSION} 
idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} 
urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} 
requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} 
autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} 
toml==${TOML_VERSION} meson==${MESON_VERSION} --no-binary :all:
 )
 
 if(USE_PIP_NUMPY)
diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index b4c51da9093..86f9d8349b1 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -201,6 +201,11 @@ set(OSL_HASH 53211da86c34ba6e0344998c1a6d219c)
 set(OSL_HASH_TYPE MD5)
 set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
 
+# NOTE: When updating the python version, it's required to check the versions 
of
+# it wants to use in PCbuild/get_externals.bat for the following dependencies:
+# BZIP2, FFI, SQLITE and change the versions in this file as well. For 
compliance 
+# reasons there can be no exceptions to this.
+
 set(PYTHON_VERSION 3.10.9)
 set(PYTHON_SHORT_VERSION 3.10)
 set(PYTHON_SHORT_VERSION_NO_DOTS 310)
@@ -240,10 +245,10 @@ set(PYCODESTYLE_VERSION 2.8.0)
 set(TOML_VERSION 0.10.2)
 set(MESON_VERSION 0.63.0)
 
-set(NUMPY_VERSION 1.23.2)
+set(NUM

[Bf-blender-cvs] [874319a3443] master: Fix T103031: ViewLayer: Crash in indirect_only_get due to missing null check

2022-12-09 Thread Aras Pranckevicius
Commit: 874319a3443f7150f78b34f5737b1bc159e5262e
Author: Aras Pranckevicius
Date:   Fri Dec 9 20:20:11 2022 +0200
Branches: master
https://developer.blender.org/rB874319a3443f7150f78b34f5737b1bc159e5262e

Fix T103031: ViewLayer: Crash in indirect_only_get due to missing null check

Previous fix (rBe00f76c6a8cca) accidentally lost a null check.
Fixes T103031.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_object_api.c 
b/source/blender/makesrna/intern/rna_object_api.c
index 366a3597ce6..3d4d72cefaf 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -205,6 +205,10 @@ static bool rna_Object_holdout_get(Object *ob, bContext 
*C, PointerRNA *view_lay
 static bool rna_Object_indirect_only_get(Object *ob, bContext *C, PointerRNA 
*view_layer_ptr)
 {
   Base *base = find_view_layer_base_with_synced_ensure(ob, C, view_layer_ptr, 
NULL, NULL);
+  if (!base) {
+return false;
+  }
+
   return ((base->flag & BASE_INDIRECT_ONLY) != 0);
 }

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


[Bf-blender-cvs] [0a561981394] master: Cleanup: Split sharp edge tagging from face corner normal calculation

2022-12-09 Thread Hans Goudey
Commit: 0a561981394dca327d8cb0975d17498f2c783ba0
Author: Hans Goudey
Date:   Thu Dec 8 16:09:19 2022 -0600
Branches: master
https://developer.blender.org/rB0a561981394dca327d8cb0975d17498f2c783ba0

Cleanup: Split sharp edge tagging from face corner normal calculation

Don't use the same "context" struct for tagging sharp edges from auto-
smooth / poly flags and actually calculating face corner normals. That
required more arguments, and it required breaking const slightly to
reuse the code. Also split apart pre-populating corner normals
with vertex normals, since it isn't related at all and is only used
in one code path.

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/editors/mesh/mesh_data.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 66974dbedb5..a2067169506 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -496,9 +496,7 @@ void BKE_mesh_ensure_normals_for_display(struct Mesh *mesh);
  * Used when defining an empty custom loop normals data layer,
  * to keep same shading as with auto-smooth!
  */
-void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
-int numVerts,
-struct MEdge *medges,
+void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
 int numEdges,
 const struct MLoop *mloops,
 int numLoops,
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc 
b/source/blender/blenkernel/intern/mesh_normals.cc
index 76bcc0f1c21..f32b23476b6 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -822,7 +822,7 @@ struct LoopSplitTaskDataCommon {
 
   /* Read-only. */
   Span verts;
-  MutableSpan edges;
+  Span edges;
   Span loops;
   Span polys;
   MutableSpan edge_to_loops;
@@ -836,75 +836,57 @@ struct LoopSplitTaskDataCommon {
 /* See comment about edge_to_loops below. */
 #define IS_EDGE_SHARP(_e2l) ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID)
 
-static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon *data,
+static void mesh_edges_sharp_tag(const Span edges,
+ const Span polys,
+ const Span loops,
+ const Span loop_to_poly_map,
+ const Span poly_normals,
  const bool check_angle,
  const float split_angle,
- const bool do_sharp_edges_tag)
+ MutableSpan edge_to_loops,
+ BitVector<> *r_sharp_edges)
 {
-  MutableSpan edges = data->edges;
-  const Span polys = data->polys;
-  const Span loops = data->loops;
-  const Span loop_to_poly = data->loop_to_poly;
-
-  MutableSpan loopnors = data->loopnors; /* NOTE: loopnors may be 
empty here. */
-  const Span polynors = data->polynors;
-
-  MutableSpan edge_to_loops = data->edge_to_loops;
-
-  BitVector sharp_edges;
-  if (do_sharp_edges_tag) {
-sharp_edges.resize(edges.size(), false);
-  }
-
+  using namespace blender;
   const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f;
 
-  for (const int mp_index : polys.index_range()) {
-const MPoly &poly = polys[mp_index];
-int ml_curr_index = poly.loopstart;
-const int ml_last_index = (ml_curr_index + poly.totloop) - 1;
-
-const MLoop *ml_curr = &loops[ml_curr_index];
-
-for (; ml_curr_index <= ml_last_index; ml_curr++, ml_curr_index++) {
-  int2 &e2l = edge_to_loops[ml_curr->e];
+  for (const int poly_i : polys.index_range()) {
+const MPoly &poly = polys[poly_i];
+for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
+  const int vert_i = loops[loop_index].v;
+  const int edge_i = loops[loop_index].e;
 
-  /* Pre-populate all loop normals as if their verts were all-smooth,
-   * this way we don't have to compute those later!
-   */
-  if (!loopnors.is_empty()) {
-copy_v3_v3(loopnors[ml_curr_index], data->vert_normals[ml_curr->v]);
-  }
+  int2 &e2l = edge_to_loops[edge_i];
 
   /* Check whether current edge might be smooth or sharp */
   if ((e2l[0] | e2l[1]) == 0) {
 /* 'Empty' edge until now, set e2l[0] (and e2l[1] to INDEX_UNSET to 
tag it as unset). */
-e2l[0] = ml_curr_index;
+e2l[0] = loop_index;
 /* We have to check this here too, else we might miss some flat 
faces!!! */
 e2l[1] = (poly.flag & ME_SMOOTH) ? INDEX_UNSET : INDEX_INVALID;
   }
   else if (e2l[1] == INDEX_UNSET) {
 const bool is

[Bf-blender-cvs] [9a7fa1b3e98] master: Cleanup: Use array in face corner normals calculation

2022-12-09 Thread Hans Goudey
Commit: 9a7fa1b3e9894cc620f12456831551da49926a65
Author: Hans Goudey
Date:   Thu Dec 8 15:39:55 2022 -0600
Branches: master
https://developer.blender.org/rB9a7fa1b3e9894cc620f12456831551da49926a65

Cleanup: Use array in face corner normals calculation

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_normals.cc 
b/source/blender/blenkernel/intern/mesh_normals.cc
index c6faedf2531..76bcc0f1c21 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -39,6 +39,7 @@
 
 using blender::BitVector;
 using blender::float3;
+using blender::int2;
 using blender::MutableSpan;
 using blender::short2;
 using blender::Span;
@@ -824,7 +825,7 @@ struct LoopSplitTaskDataCommon {
   MutableSpan edges;
   Span loops;
   Span polys;
-  int (*edge_to_loops)[2];
+  MutableSpan edge_to_loops;
   Span loop_to_poly;
   Span polynors;
   Span vert_normals;
@@ -848,7 +849,7 @@ static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon 
*data,
   MutableSpan loopnors = data->loopnors; /* NOTE: loopnors may be 
empty here. */
   const Span polynors = data->polynors;
 
-  int(*edge_to_loops)[2] = data->edge_to_loops;
+  MutableSpan edge_to_loops = data->edge_to_loops;
 
   BitVector sharp_edges;
   if (do_sharp_edges_tag) {
@@ -859,14 +860,13 @@ static void mesh_edges_sharp_tag(LoopSplitTaskDataCommon 
*data,
 
   for (const int mp_index : polys.index_range()) {
 const MPoly &poly = polys[mp_index];
-int *e2l;
 int ml_curr_index = poly.loopstart;
 const int ml_last_index = (ml_curr_index + poly.totloop) - 1;
 
 const MLoop *ml_curr = &loops[ml_curr_index];
 
 for (; ml_curr_index <= ml_last_index; ml_curr++, ml_curr_index++) {
-  e2l = edge_to_loops[ml_curr->e];
+  int2 &e2l = edge_to_loops[ml_curr->e];
 
   /* Pre-populate all loop normals as if their verts were all-smooth,
* this way we don't have to compute those later!
@@ -950,8 +950,7 @@ void BKE_edges_sharp_from_angle_set(const MVert *mverts,
   }
 
   /* Mapping edge -> loops. See #BKE_mesh_normals_loop_split for details. */
-  int(*edge_to_loops)[2] = (int(*)[2])MEM_calloc_arrayN(
-  size_t(numEdges), sizeof(*edge_to_loops), __func__);
+  Array edge_to_loops(numEdges, int2(0));
 
   /* Simple mapping from a loop to its polygon index. */
   const Array loop_to_poly = 
mesh_topology::build_loop_to_poly_map({mpolys, numPolys},
@@ -967,8 +966,6 @@ void BKE_edges_sharp_from_angle_set(const MVert *mverts,
   common_data.polynors = {reinterpret_cast(polynors), 
numPolys};
 
   mesh_edges_sharp_tag(&common_data, true, split_angle, true);
-
-  MEM_freeN(edge_to_loops);
 }
 
 static void loop_manifold_fan_around_vert_next(const Span loops,
@@ -1086,7 +1083,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon 
*common_data, LoopSpli
   const Span edges = common_data->edges;
   const Span polys = common_data->polys;
   const Span loops = common_data->loops;
-  const int(*edge_to_loops)[2] = common_data->edge_to_loops;
+  const Span edge_to_loops = common_data->edge_to_loops;
   const Span loop_to_poly = common_data->loop_to_poly;
   const Span polynors = common_data->polynors;
 
@@ -1332,7 +1329,7 @@ static void loop_split_worker(TaskPool *__restrict pool, 
void *taskdata)
  */
 static bool loop_split_generator_check_cyclic_smooth_fan(const Span 
mloops,
  const Span 
mpolys,
- const int 
(*edge_to_loops)[2],
+ const Span 
edge_to_loops,
  const Span 
loop_to_poly,
  const int *e2l_prev,
  BitVector<> 
&skip_loops,
@@ -1406,7 +1403,7 @@ static void loop_split_generator(TaskPool *pool, 
LoopSplitTaskDataCommon *common
   const Span loops = common_data->loops;
   const Span polys = common_data->polys;
   const Span loop_to_poly = common_data->loop_to_poly;
-  const int(*edge_to_loops)[2] = common_data->edge_to_loops;
+  const Span edge_to_loops = common_data->edge_to_loops;
 
   BitVector<> skip_loops(loops.size(), false);
 
@@ -1624,8 +1621,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
* However, if needed, we can store the negated value of loop index instead 
of INDEX_INVALID
* to retrieve the real value later in code).
* Note also that loose edges always have both values set to 0! */
-  int(*edge_to_loops)[2] = (int(*)[2])MEM_calloc_arrayN(
-  size_t(numEdges), sizeof(*edge_to_loops), __func__);
+  Array edge_to_loops(numEdges, int2(0));
 
   /* Simple mapping from a loop to its polygon index. */
   Span loop_to_poly;
@

[Bf-blender-cvs] [34722fa8a0d] master: Cleanup: Reduce indentation in mesh operator

2022-12-09 Thread Hans Goudey
Commit: 34722fa8a0d5a6ab18a74711c9b30482a2ae72b4
Author: Hans Goudey
Date:   Thu Dec 8 15:22:21 2022 -0600
Branches: master
https://developer.blender.org/rB34722fa8a0d5a6ab18a74711c9b30482a2ae72b4

Cleanup: Reduce indentation in mesh operator

Also use local variable for BMesh.

===

M   source/blender/editors/mesh/mesh_data.cc

===

diff --git a/source/blender/editors/mesh/mesh_data.cc 
b/source/blender/editors/mesh/mesh_data.cc
index 58b700b3a2e..1ecdc52ef0a 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -781,49 +781,48 @@ void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
 static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, 
wmOperator * /*op*/)
 {
   Mesh *me = ED_mesh_context(C);
+  if (BKE_mesh_has_custom_loop_normals(me)) {
+return OPERATOR_CANCELLED;
+  }
 
-  if (!BKE_mesh_has_custom_loop_normals(me)) {
-CustomData *data = GET_CD_DATA(me, ldata);
-
-if (me->edit_mesh) {
-  /* Tag edges as sharp according to smooth threshold if needed,
-   * to preserve auto-smooth shading. */
-  if (me->flag & ME_AUTOSMOOTH) {
-BM_edges_sharp_from_angle_set(me->edit_mesh->bm, me->smoothresh);
-  }
-
-  BM_data_layer_add(me->edit_mesh->bm, data, CD_CUSTOMLOOPNORMAL);
+  if (me->edit_mesh) {
+BMesh &bm = *me->edit_mesh->bm;
+/* Tag edges as sharp according to smooth threshold if needed,
+ * to preserve auto-smooth shading. */
+if (me->flag & ME_AUTOSMOOTH) {
+  BM_edges_sharp_from_angle_set(&bm, me->smoothresh);
 }
-else {
-  /* Tag edges as sharp according to smooth threshold if needed,
-   * to preserve auto-smooth shading. */
-  if (me->flag & ME_AUTOSMOOTH) {
-const Span verts = me->verts();
-MutableSpan edges = me->edges_for_write();
-const Span polys = me->polys();
-const Span loops = me->loops();
-
-BKE_edges_sharp_from_angle_set(verts.data(),
-   verts.size(),
-   edges.data(),
-   edges.size(),
-   loops.data(),
-   loops.size(),
-   polys.data(),
-   BKE_mesh_poly_normals_ensure(me),
-   polys.size(),
-   me->smoothresh);
-  }
 
-  CustomData_add_layer(data, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, nullptr, 
me->totloop);
+BM_data_layer_add(&bm, &bm.ldata, CD_CUSTOMLOOPNORMAL);
+  }
+  else {
+/* Tag edges as sharp according to smooth threshold if needed,
+ * to preserve auto-smooth shading. */
+if (me->flag & ME_AUTOSMOOTH) {
+  const Span verts = me->verts();
+  MutableSpan edges = me->edges_for_write();
+  const Span polys = me->polys();
+  const Span loops = me->loops();
+
+  BKE_edges_sharp_from_angle_set(verts.data(),
+ verts.size(),
+ edges.data(),
+ edges.size(),
+ loops.data(),
+ loops.size(),
+ polys.data(),
+ BKE_mesh_poly_normals_ensure(me),
+ polys.size(),
+ me->smoothresh);
 }
 
-DEG_id_tag_update(&me->id, 0);
-WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
-
-return OPERATOR_FINISHED;
+CustomData_add_layer(&me->ldata, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, 
nullptr, me->totloop);
   }
-  return OPERATOR_CANCELLED;
+
+  DEG_id_tag_update(&me->id, 0);
+  WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+
+  return OPERATOR_FINISHED;
 }
 
 void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)

___
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] [c85ca5e365f] master: Fix T103015: Line art crash after recent refactor

2022-12-09 Thread Hans Goudey
Commit: c85ca5e365f8ca7128043e5665c6c1a58ed9b899
Author: Hans Goudey
Date:   Fri Dec 9 09:24:57 2022 -0600
Branches: master
https://developer.blender.org/rBc85ca5e365f8ca7128043e5665c6c1a58ed9b899

Fix T103015: Line art crash after recent refactor

Caused by 0940719b5ab3a35b6 which neglected to assign the
mesh loops data.

===

M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
index 446c079cd54..dc65ffd60a4 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
@@ -2045,6 +2045,7 @@ static void 
lineart_geometry_object_load(LineartObjectInfo *ob_info,
   tri_data.ob_info = ob_info;
   tri_data.mlooptri = mlooptri;
   tri_data.verts = me->verts();
+  tri_data.loops = me->loops();
   tri_data.material_indices = material_indices;
   tri_data.vert_arr = la_v_arr;
   tri_data.tri_arr = la_tri_arr;

___
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] [255c7f26af6] master: Cleanup: Use enum class for image drawing flags.

2022-12-09 Thread Jeroen Bakker
Commit: 255c7f26af60debde0cf1fc16143d912c885c9f1
Author: Jeroen Bakker
Date:   Fri Dec 9 12:12:55 2022 +0100
Branches: master
https://developer.blender.org/rB255c7f26af60debde0cf1fc16143d912c885c9f1

Cleanup: Use enum class for image drawing flags.

===

M   source/blender/draw/engines/image/image_drawing_mode.hh
A   source/blender/draw/engines/image/image_enums.hh
M   source/blender/draw/engines/image/image_private.hh
M   source/blender/draw/engines/image/image_shader_params.hh
M   source/blender/draw/engines/image/image_space_image.hh
M   source/blender/draw/engines/image/image_space_node.hh

===

diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh 
b/source/blender/draw/engines/image/image_drawing_mode.hh
index 49205e633c9..a7a482053d4 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -166,7 +166,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 DRWShadingGroup *shgrp = DRW_shgroup_create(shader, 
instance_data->passes.image_pass);
 DRW_shgroup_uniform_vec2_copy(shgrp, "farNearDistances", 
sh_params.far_near);
 DRW_shgroup_uniform_vec4_copy(shgrp, "shuffle", sh_params.shuffle);
-DRW_shgroup_uniform_int_copy(shgrp, "drawFlags", sh_params.flags);
+DRW_shgroup_uniform_int_copy(shgrp, "drawFlags", 
static_cast(sh_params.flags));
 DRW_shgroup_uniform_bool_copy(shgrp, "imgPremultiplied", 
sh_params.use_premul_alpha);
 DRW_shgroup_uniform_texture(shgrp, "depth_texture", dtxl->depth);
 float image_mat[4][4];
diff --git a/source/blender/draw/engines/image/image_enums.hh 
b/source/blender/draw/engines/image/image_enums.hh
new file mode 100644
index 000..3b0eb5cb1c6
--- /dev/null
+++ b/source/blender/draw/engines/image/image_enums.hh
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2021 Blender Foundation. */
+
+/** \file
+ * \ingroup draw_engine
+ */
+
+#pragma once
+
+#include "BLI_utildefines.h"
+
+namespace blender::draw::image_engine {
+
+/* Shader parameters. */
+enum class ImageDrawFlags {
+  Default = 0,
+  ShowAlpha = (1 << 0),
+  ApplyAlpha = (1 << 1),
+  Shuffling = (1 << 2),
+  Depth = (1 << 3)
+};
+ENUM_OPERATORS(ImageDrawFlags, ImageDrawFlags::Depth);
+
+}  // namespace blender::draw::image_engine
diff --git a/source/blender/draw/engines/image/image_private.hh 
b/source/blender/draw/engines/image/image_private.hh
index ec514dfd50d..7fa58f43d06 100644
--- a/source/blender/draw/engines/image/image_private.hh
+++ b/source/blender/draw/engines/image/image_private.hh
@@ -34,11 +34,6 @@ struct IMAGE_Data {
   IMAGE_InstanceData *instance_data;
 };
 
-/* Shader parameters. */
-#define IMAGE_DRAW_FLAG_SHOW_ALPHA (1 << 0)
-#define IMAGE_DRAW_FLAG_APPLY_ALPHA (1 << 1)
-#define IMAGE_DRAW_FLAG_SHUFFLING (1 << 2)
-#define IMAGE_DRAW_FLAG_DEPTH (1 << 3)
 
 /**
  * Abstract class for a drawing mode of the image engine.
diff --git a/source/blender/draw/engines/image/image_shader_params.hh 
b/source/blender/draw/engines/image/image_shader_params.hh
index 41159d85e05..f2515783b45 100644
--- a/source/blender/draw/engines/image/image_shader_params.hh
+++ b/source/blender/draw/engines/image/image_shader_params.hh
@@ -17,19 +17,20 @@
 
 #include "BLI_math.h"
 
+#include "image_enums.hh"
 #include "image_space.hh"
 
 namespace blender::draw::image_engine {
 
 struct ShaderParameters {
-  int flags = 0;
+  ImageDrawFlags flags = ImageDrawFlags::Default;
   float shuffle[4];
   float far_near[2];
   bool use_premul_alpha = false;
 
   void update(AbstractSpaceAccessor *space, const Scene *scene, Image *image, 
ImBuf *image_buffer)
   {
-flags = 0;
+flags = ImageDrawFlags::Default;
 copy_v4_fl(shuffle, 1.0f);
 copy_v2_fl2(far_near, 100.0f, 0.0f);
 
diff --git a/source/blender/draw/engines/image/image_space_image.hh 
b/source/blender/draw/engines/image/image_space_image.hh
index c9563d464cc..0356e1213f6 100644
--- a/source/blender/draw/engines/image/image_space_image.hh
+++ b/source/blender/draw/engines/image/image_space_image.hh
@@ -44,40 +44,40 @@ class SpaceImageAccessor : public AbstractSpaceAccessor {
 const int sima_flag = sima->flag & 
ED_space_image_get_display_channel_mask(image_buffer);
 if ((sima_flag & SI_USE_ALPHA) != 0) {
   /* Show RGBA */
-  r_shader_parameters.flags |= IMAGE_DRAW_FLAG_SHOW_ALPHA | 
IMAGE_DRAW_FLAG_APPLY_ALPHA;
+  r_shader_parameters.flags |= ImageDrawFlags::ShowAlpha | 
ImageDrawFlags::ApplyAlpha;
 }
 else if ((sima_flag & SI_SHOW_ALPHA) != 0) {
-  r_shader_parameters.flags |= IMAGE_DRAW_FLAG_SHUFFLING;
+  r_shader_parameters.flags |= ImageDrawFlags::Shuffling;
   copy_v4_fl4(r_shader_parameters.shuffle, 0.0f, 0.0f, 0.0f, 1.0f);
 }
 else if ((sima_flag & SI_SHOW_ZBUF) != 0) {
-  r_shader_parameter

[Bf-blender-cvs] [c20e456ee04] master: ImageEngine: Reduce memory size by dividing the region in smaller parts.

2022-12-09 Thread Jeroen Bakker
Commit: c20e456ee04f2ad72f3483f7bd3eb0506bc27bc7
Author: Jeroen Bakker
Date:   Fri Dec 9 15:57:44 2022 +0100
Branches: master
https://developer.blender.org/rBc20e456ee04f2ad72f3483f7bd3eb0506bc27bc7

ImageEngine: Reduce memory size by dividing the region in smaller parts.

Image engine uses 4 gpu textures that are as large as the area being
drawn. The amount of needed GPU memory can be reduced by dividing the
region in smaller parts. Reducing the GPU memory also reduces the stalls
when updating the textures, improving the performance as well.

This optimization works, but is disabled for now due to some rounding
errors that drawn lines on the screen where the screen is divided.

===

M   source/blender/draw/engines/image/image_drawing_mode.hh
M   source/blender/draw/engines/image/image_engine.cc
M   source/blender/draw/engines/image/image_texture_info.hh

===

diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh 
b/source/blender/draw/engines/image/image_drawing_mode.hh
index f6ae463f844..6d1b0e8918c 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -22,12 +22,28 @@ namespace blender::draw::image_engine {
 constexpr float EPSILON_UV_BOUNDS = 0.1f;
 
 /**
- * \brief Screen space method using a 4 textures spawning the whole screen.
+ * \brief Screen space method using a multiple textures covering the region.
+ *
  */
-struct FullScreenTextures {
+template class ScreenTileTextures {
+ public:
+  static const size_t TexturesPerDimension = Divisions + 1;
+  static const size_t TexturesRequired = TexturesPerDimension * 
TexturesPerDimension;
+  static const size_t VerticesPerDimension = TexturesPerDimension + 1;
+
+ private:
+  /**
+   * \brief Helper struct to pair a texture info and a region in uv space of 
the area.
+   */
+  struct TextureInfoBounds {
+TextureInfo *info = nullptr;
+rctf uv_bounds;
+  };
+
   IMAGE_InstanceData *instance_data;
 
-  FullScreenTextures(IMAGE_InstanceData *instance_data) : 
instance_data(instance_data)
+ public:
+  ScreenTileTextures(IMAGE_InstanceData *instance_data) : 
instance_data(instance_data)
   {
   }
 
@@ -36,7 +52,7 @@ struct FullScreenTextures {
*/
   void ensure_texture_infos()
   {
-instance_data->texture_infos.resize(4);
+instance_data->texture_infos.resize(TexturesRequired);
   }
 
   /**
@@ -44,112 +60,105 @@ struct FullScreenTextures {
*/
   void update_bounds(const ARegion *region)
   {
-// determine uv_area of the region.
+/* determine uv_area of the region. */
+Vector unassigned_textures;
 float4x4 mat = float4x4(instance_data->ss_to_texture).inverted();
 float2 region_uv_min = float2(mat * float3(0.0f, 0.0f, 0.0f));
 float2 region_uv_max = float2(mat * float3(1.0f, 1.0f, 0.0f));
 float2 region_uv_span = region_uv_max - region_uv_min;
+
+/* Calculate uv coordinates of each vert in the grid of textures. */
+
+/* Construct the uv bounds of the 4 textures that are needed to fill the 
region. */
+Vector info_bounds = create_uv_bounds(region_uv_span, 
region_uv_min);
+assign_texture_infos_by_uv_bounds(info_bounds, unassigned_textures);
+assign_unused_texture_infos(info_bounds, unassigned_textures);
+
+/* Calculate the region bounds from the uv bounds. */
 rctf region_uv_bounds;
 BLI_rctf_init(
 ®ion_uv_bounds, region_uv_min.x, region_uv_max.x, region_uv_min.y, 
region_uv_max.y);
+update_region_bounds_from_uv_bounds(region_uv_bounds, float2(region->winx, 
region->winy));
+  }
+
+  void ensure_gpu_textures_allocation()
+  {
+float2 viewport_size = DRW_viewport_size_get();
+int2 texture_size(ceil(viewport_size.x / Divisions), ceil(viewport_size.y 
/ Divisions));
+for (TextureInfo &info : instance_data->texture_infos) {
+  info.ensure_gpu_texture(texture_size);
+}
+  }
 
-/* Calculate 9 coordinates that will be used as uv bounds of the textures. 
*/
-float2 onscreen_multiple = (blender::math::floor(region_uv_min / 
region_uv_span) +
+ private:
+  Vector create_uv_bounds(float2 region_uv_span, float2 
region_uv_min)
+  {
+float2 uv_coords[VerticesPerDimension][VerticesPerDimension];
+float2 region_tile_uv_span = region_uv_span / float2(float(Divisions));
+float2 onscreen_multiple = (blender::math::floor(region_uv_min / 
region_tile_uv_span) +
 float2(1.0f)) *
-   region_uv_span;
-BLI_assert(onscreen_multiple.x > region_uv_min.x);
-BLI_assert(onscreen_multiple.y > region_uv_min.y);
-BLI_assert(onscreen_multiple.x < region_uv_max.x);
-BLI_assert(onscreen_multiple.y < region_uv_max.y);
-float2 uv_coords[3][3];
-uv_coords[0][0] = onscreen_multiple + float2(-region_uv_span.x, 
-region_uv_span.y);
-uv_coords[0][1] =

[Bf-blender-cvs] [bdd196661ee] master: Cleanup: ImageEngine-Move Responsibility of Texture Creation.

2022-12-09 Thread Jeroen Bakker
Commit: bdd196661eefffac9b57532dc8b46a5193547764
Author: Jeroen Bakker
Date:   Fri Dec 9 13:01:57 2022 +0100
Branches: master
https://developer.blender.org/rBbdd196661eefffac9b57532dc8b46a5193547764

Cleanup: ImageEngine-Move Responsibility of Texture Creation.

It used to be a number of fixed full screen images where the
responsibility was at image engine. Now moved the responsibility to the
drawing mode to make sure we can allocate non-full region-size textures
in a future refactoring.

===

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

===

diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh 
b/source/blender/draw/engines/image/image_drawing_mode.hh
index a7a482053d4..f6ae463f844 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -31,6 +31,14 @@ struct FullScreenTextures {
   {
   }
 
+  /**
+   * \brief Ensure enough texture infos are allocated in `instance_data`.
+   */
+  void ensure_texture_infos()
+  {
+instance_data->texture_infos.resize(4);
+  }
+
   /**
* \brief Update the uv and region bounds of all texture_infos of 
instance_data.
*/
@@ -45,7 +53,7 @@ struct FullScreenTextures {
 BLI_rctf_init(
 ®ion_uv_bounds, region_uv_min.x, region_uv_max.x, region_uv_min.y, 
region_uv_max.y);
 
-/* Calculate 9 coordinates that will be used as uv bounds of the 4 
textures. */
+/* Calculate 9 coordinates that will be used as uv bounds of the textures. 
*/
 float2 onscreen_multiple = (blender::math::floor(region_uv_min / 
region_uv_span) +
 float2(1.0f)) *
region_uv_span;
@@ -135,6 +143,15 @@ struct FullScreenTextures {
   info.calc_region_bounds_from_uv_bounds(uv_to_screen);
 }
   }
+
+  void ensure_gpu_textures_allocation()
+  {
+float2 viewport_size = DRW_viewport_size_get();
+int2 texture_size(viewport_size.x, viewport_size.y);
+for (TextureInfo &info : instance_data->texture_infos) {
+  info.ensure_gpu_texture(texture_size);
+}
+  }
 };
 
 using namespace blender::bke::image::partial_update;
@@ -171,8 +188,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 DRW_shgroup_uniform_texture(shgrp, "depth_texture", dtxl->depth);
 float image_mat[4][4];
 unit_m4(image_mat);
-for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
-  const TextureInfo &info = instance_data->texture_infos[i];
+for (const TextureInfo &info : instance_data->texture_infos) {
   DRWShadingGroup *shgrp_sub = DRW_shgroup_create_sub(shgrp);
   DRW_shgroup_uniform_ivec2_copy(shgrp_sub, "offset", info.offset());
   DRW_shgroup_uniform_texture_ex(shgrp_sub, "imageTexture", info.texture, 
GPU_SAMPLER_DEFAULT);
@@ -200,8 +216,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
   tile_user = *image_user;
 }
 
-for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
-  const TextureInfo &info = instance_data.texture_infos[i];
+for (const TextureInfo &info : instance_data.texture_infos) {
   LISTBASE_FOREACH (ImageTile *, image_tile_ptr, &image->tiles) {
 const ImageTileWrapper image_tile(image_tile_ptr);
 const int tile_x = image_tile.get_tile_x_offset();
@@ -305,8 +320,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
   const float tile_width = float(iterator.tile_data.tile_buffer->x);
   const float tile_height = float(iterator.tile_data.tile_buffer->y);
 
-  for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
-const TextureInfo &info = instance_data.texture_infos[i];
+  for (const TextureInfo &info : instance_data.texture_infos) {
 /* Dirty images will receive a full update. No need to do a partial 
one now. */
 if (info.need_full_update) {
   continue;
@@ -407,8 +421,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
   void do_full_update_for_dirty_textures(IMAGE_InstanceData &instance_data,
  const ImageUser *image_user) const
   {
-for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
-  TextureInfo &info = instance_data.texture_infos[i];
+for (TextureInfo &info : instance_data.texture_infos) {
   if (!info.need_full_update) {
 continue;
   }
@@ -518,6 +531,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 
 /* Step: Find out which screen space textures are needed to draw on the 
screen. Remove the
  * screen space textures that aren't needed. */
+method.ensure_texture_infos();
 const ARegion *region = draw_ctx->region;
 method

[Bf-blender-cvs] [595b3022317] master: Cleanup: Remove unused method BatchUpdater::discard_batch.

2022-12-09 Thread Jeroen Bakker
Commit: 595b30223175cb691816366557cda2bdbecfb11c
Author: Jeroen Bakker
Date:   Fri Dec 9 12:28:05 2022 +0100
Branches: master
https://developer.blender.org/rB595b30223175cb691816366557cda2bdbecfb11c

Cleanup: Remove unused method BatchUpdater::discard_batch.

Batch discarding is done by the owner of the batch.

===

M   source/blender/draw/engines/image/image_batches.hh

===

diff --git a/source/blender/draw/engines/image/image_batches.hh 
b/source/blender/draw/engines/image/image_batches.hh
index 34dca043ccc..1d7e7a0b548 100644
--- a/source/blender/draw/engines/image/image_batches.hh
+++ b/source/blender/draw/engines/image/image_batches.hh
@@ -31,11 +31,6 @@ class BatchUpdater {
 init_batch();
   }
 
-  void discard_batch()
-  {
-GPU_BATCH_DISCARD_SAFE(info.batch);
-  }
-
  private:
   void ensure_clear_batch()
   {

___
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] [83b78b19769] master: Cleanup: Equalize ImageEngine method names with Eevee-next.

2022-12-09 Thread Jeroen Bakker
Commit: 83b78b19769101f04abbb91114db7c8badfe9d6c
Author: Jeroen Bakker
Date:   Fri Dec 9 11:50:54 2022 +0100
Branches: master
https://developer.blender.org/rB83b78b19769101f04abbb91114db7c8badfe9d6c

Cleanup: Equalize ImageEngine method names with Eevee-next.

- `cache_init` -> `begin_sync`
- `cache_populate` -> `image_sync`
- `draw_scene` -> `draw_viewport`

===

M   source/blender/draw/engines/image/image_drawing_mode.hh
M   source/blender/draw/engines/image/image_engine.cc
M   source/blender/draw/engines/image/image_private.hh

===

diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh 
b/source/blender/draw/engines/image/image_drawing_mode.hh
index 70e8fc3b47a..49205e633c9 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -499,14 +499,14 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
   }
 
  public:
-  void cache_init(IMAGE_Data *vedata) const override
+  void begin_sync(IMAGE_Data *vedata) const override
   {
 IMAGE_InstanceData *instance_data = vedata->instance_data;
 instance_data->passes.image_pass = create_image_pass();
 instance_data->passes.depth_pass = create_depth_pass();
   }
 
-  void cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser) const 
override
+  void image_sync(IMAGE_Data *vedata, Image *image, ImageUser *iuser) const 
override
   {
 const DRWContextState *draw_ctx = DRW_context_state_get();
 IMAGE_InstanceData *instance_data = vedata->instance_data;
@@ -542,7 +542,7 @@ template class 
ScreenSpaceDrawingMode : public AbstractD
 instance_data->float_buffers.remove_unused_buffers();
   }
 
-  void draw_scene(IMAGE_Data *vedata) const override
+  void draw_viewport(IMAGE_Data *vedata) const override
   {
 IMAGE_InstanceData *instance_data = vedata->instance_data;
 
diff --git a/source/blender/draw/engines/image/image_engine.cc 
b/source/blender/draw/engines/image/image_engine.cc
index 1284231d5e9..3aaceaec142 100644
--- a/source/blender/draw/engines/image/image_engine.cc
+++ b/source/blender/draw/engines/image/image_engine.cc
@@ -69,10 +69,10 @@ class ImageEngine {
 
   virtual ~ImageEngine() = default;
 
-  void cache_init()
+  void begin_sync()
   {
 IMAGE_InstanceData *instance_data = vedata->instance_data;
-drawing_mode.cache_init(vedata);
+drawing_mode.begin_sync(vedata);
 
 /* Setup full screen view matrix. */
 const ARegion *region = draw_ctx->region;
@@ -82,7 +82,7 @@ class ImageEngine {
 instance_data->view = DRW_view_create(viewmat, winmat, nullptr, nullptr, 
nullptr);
   }
 
-  void cache_populate()
+  void image_sync()
   {
 IMAGE_InstanceData *instance_data = vedata->instance_data;
 Main *bmain = CTX_data_main(draw_ctx->evil_C);
@@ -113,7 +113,7 @@ class ImageEngine {
 else {
   BKE_image_multiview_index(instance_data->image, iuser);
 }
-drawing_mode.cache_image(vedata, instance_data->image, iuser);
+drawing_mode.image_sync(vedata, instance_data->image, iuser);
   }
 
   void draw_finish()
@@ -124,9 +124,9 @@ class ImageEngine {
 instance_data->image = nullptr;
   }
 
-  void draw_scene()
+  void draw_viewport()
   {
-drawing_mode.draw_scene(vedata);
+drawing_mode.draw_viewport(vedata);
   }
 };
 
@@ -146,8 +146,8 @@ static void IMAGE_cache_init(void *vedata)
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   ImageEngine image_engine(draw_ctx, static_cast(vedata));
-  image_engine.cache_init();
-  image_engine.cache_populate();
+  image_engine.begin_sync();
+  image_engine.image_sync();
 }
 
 static void IMAGE_cache_populate(void * /*vedata*/, Object * /*ob*/)
@@ -159,7 +159,7 @@ static void IMAGE_draw_scene(void *vedata)
 {
   const DRWContextState *draw_ctx = DRW_context_state_get();
   ImageEngine image_engine(draw_ctx, static_cast(vedata));
-  image_engine.draw_scene();
+  image_engine.draw_viewport();
   image_engine.draw_finish();
 }
 
diff --git a/source/blender/draw/engines/image/image_private.hh 
b/source/blender/draw/engines/image/image_private.hh
index 8d4b8eee7fb..ec514dfd50d 100644
--- a/source/blender/draw/engines/image/image_private.hh
+++ b/source/blender/draw/engines/image/image_private.hh
@@ -49,9 +49,9 @@ struct IMAGE_Data {
 class AbstractDrawingMode {
  public:
   virtual ~AbstractDrawingMode() = default;
-  virtual void cache_init(IMAGE_Data *vedata) const = 0;
-  virtual void cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser) 
const = 0;
-  virtual void draw_scene(IMAGE_Data *vedata) const = 0;
+  virtual void begin_sync(IMAGE_Data *vedata) const = 0;
+  virtual void image_sync(IMAGE_Data *vedata, Image *image, ImageUser *iuser) 
const = 0;
+  virtual void draw_viewport(IMAGE_Data *vedata) const = 0;
   virtual void draw_finish(IMAGE_Data *vedata) const = 0;
 };

__

[Bf-blender-cvs] [50ef008c61d] master: Cleanup: Remove unused method from image_engine.

2022-12-09 Thread Jeroen Bakker
Commit: 50ef008c61d9eab753d1bb7f260e9b5529520e1d
Author: Jeroen Bakker
Date:   Fri Dec 9 10:57:48 2022 +0100
Branches: master
https://developer.blender.org/rB50ef008c61d9eab753d1bb7f260e9b5529520e1d

Cleanup: Remove unused method from image_engine.

`get_gpu_textures` was created when the image engine didn't support
texture streaming and used the gpu textures that were stored in the
image buffer itself.

===

M   source/blender/draw/engines/image/image_space.hh
M   source/blender/draw/engines/image/image_space_image.hh
M   source/blender/draw/engines/image/image_space_node.hh

===

diff --git a/source/blender/draw/engines/image/image_space.hh 
b/source/blender/draw/engines/image/image_space.hh
index fa9c68efb05..086c02af7bf 100644
--- a/source/blender/draw/engines/image/image_space.hh
+++ b/source/blender/draw/engines/image/image_space.hh
@@ -61,16 +61,6 @@ class AbstractSpaceAccessor {
   virtual void get_shader_parameters(ShaderParameters &r_shader_parameters,
  ImBuf *image_buffer) = 0;
 
-  /**
-   * Retrieve the gpu textures to draw.
-   */
-  virtual void get_gpu_textures(Image *image,
-ImageUser *iuser,
-ImBuf *image_buffer,
-GPUTexture **r_gpu_texture,
-bool *r_owns_texture,
-GPUTexture **r_tex_tile_data) = 0;
-
   /** \brief Is (wrap) repeat option enabled in the space. */
   virtual bool use_tile_drawing() const = 0;
 
diff --git a/source/blender/draw/engines/image/image_space_image.hh 
b/source/blender/draw/engines/image/image_space_image.hh
index 5de31e219ee..c9563d464cc 100644
--- a/source/blender/draw/engines/image/image_space_image.hh
+++ b/source/blender/draw/engines/image/image_space_image.hh
@@ -82,77 +82,6 @@ class SpaceImageAccessor : public AbstractSpaceAccessor {
 }
   }
 
-  void get_gpu_textures(Image *image,
-ImageUser *iuser,
-ImBuf *image_buffer,
-GPUTexture **r_gpu_texture,
-bool *r_owns_texture,
-GPUTexture **r_tex_tile_data) override
-  {
-if (image->rr != nullptr) {
-  /* Update multi-index and pass for the current eye. */
-  BKE_image_multilayer_index(image->rr, iuser);
-}
-else {
-  BKE_image_multiview_index(image, iuser);
-}
-
-if (image_buffer == nullptr) {
-  return;
-}
-
-if (image_buffer->rect == nullptr && image_buffer->rect_float == nullptr) {
-  /* This code-path is only supposed to happen when drawing a 
lazily-allocatable render result.
-   * In all the other cases the `ED_space_image_acquire_buffer()` is 
expected to return nullptr
-   * as an image buffer when it has no pixels. */
-
-  BLI_assert(image->type == IMA_TYPE_R_RESULT);
-
-  float zero[4] = {0, 0, 0, 0};
-  *r_gpu_texture = GPU_texture_create_2d_ex(
-  __func__, 1, 1, 0, GPU_RGBA16F, GPU_TEXTURE_USAGE_SHADER_READ, zero);
-  *r_owns_texture = true;
-  return;
-}
-
-const int sima_flag = sima->flag & 
ED_space_image_get_display_channel_mask(image_buffer);
-if (sima_flag & SI_SHOW_ZBUF &&
-(image_buffer->zbuf || image_buffer->zbuf_float || 
(image_buffer->channels == 1))) {
-  if (image_buffer->zbuf) {
-BLI_assert_msg(0, "Integer based depth buffers not supported");
-  }
-  else if (image_buffer->zbuf_float) {
-*r_gpu_texture = GPU_texture_create_2d_ex(__func__,
-  image_buffer->x,
-  image_buffer->y,
-  0,
-  GPU_R16F,
-  
GPU_TEXTURE_USAGE_SHADER_READ,
-  image_buffer->zbuf_float);
-*r_owns_texture = true;
-  }
-  else if (image_buffer->rect_float && image_buffer->channels == 1) {
-*r_gpu_texture = GPU_texture_create_2d_ex(__func__,
-  image_buffer->x,
-  image_buffer->y,
-  0,
-  GPU_R16F,
-  
GPU_TEXTURE_USAGE_SHADER_READ,
-  image_buffer->rect_float);
-*r_owns_texture = true;
-  }
-}
-else if (image->source == IMA_SRC_TILED) {
-  *r_gpu_texture = BKE_image_get_gpu_tiles(image, iuser, image_buffer);
-  *r_tex_tile_data = BKE_image_get_gpu_tilemap(image, iuser, nullptr);
-  *r_owns_texture = false;
- 

[Bf-blender-cvs] [5ee116d4489] master: Realtime Compositor: Implement Simple Star Glare node

2022-12-09 Thread Omar Emara
Commit: 5ee116d4489ae9d6cbef4acec75f5bf12a5adcd7
Author: Omar Emara
Date:   Fri Dec 9 17:04:34 2022 +0200
Branches: master
https://developer.blender.org/rB5ee116d4489ae9d6cbef4acec75f5bf12a5adcd7

Realtime Compositor: Implement Simple Star Glare node

This patch implements the Simple Star Glare node. This is only an approximation
of the existing implementation in the CPU compositor, an approximation that
removes the row-column dependency in the original algorithm, yielding an order
of magnitude faster computations. The difference due to the approximation is
readily visible in artificial test cases, but is less visible in actual use
cases, so it was agreed that this approximation is worthwhile.

For the future, we can look into approximating this further using a closed form
IIR recursive filter with parallel interconnection and block-based parallelism.
Which is expected to yield another order of magnitude faster computations.

The different passes can potentially be combined into a single shader with some
preprocessor tricks, but doing that complicated that code in a way that makes
it difficult to experiment with future optimizations, so I decided to leave it
as is for now.

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

Reviewed By: Clement Foucault

===

M   source/blender/compositor/realtime_compositor/CMakeLists.txt
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_diagonal_pass.glsl
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_horizontal_pass.glsl
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_vertical_pass.glsl
M   
source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh
A   
source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_image_diagonals.glsl
M   source/blender/nodes/composite/nodes/node_composite_glare.cc

===

diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt 
b/source/blender/compositor/realtime_compositor/CMakeLists.txt
index 7d7448a448f..0881982c6d3 100644
--- a/source/blender/compositor/realtime_compositor/CMakeLists.txt
+++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt
@@ -102,6 +102,10 @@ set(GLSL_SRC
   shaders/compositor_glare_ghost_base.glsl
   shaders/compositor_glare_highlights.glsl
   shaders/compositor_glare_mix.glsl
+  shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl
+  shaders/compositor_glare_simple_star_diagonal_pass.glsl
+  shaders/compositor_glare_simple_star_horizontal_pass.glsl
+  shaders/compositor_glare_simple_star_vertical_pass.glsl
   shaders/compositor_image_crop.glsl
   shaders/compositor_morphological_distance.glsl
   shaders/compositor_morphological_distance_feather.glsl
@@ -135,6 +139,7 @@ set(GLSL_SRC
   shaders/library/gpu_shader_compositor_gamma.glsl
   shaders/library/gpu_shader_compositor_hue_correct.glsl
   shaders/library/gpu_shader_compositor_hue_saturation_value.glsl
+  shaders/library/gpu_shader_compositor_image_diagonals.glsl
   shaders/library/gpu_shader_compositor_invert.glsl
   shaders/library/gpu_shader_compositor_luminance_matte.glsl
   shaders/library/gpu_shader_compositor_main.glsl
diff --git 
a/source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl
 
b/source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl
new file mode 100644
index 000..7cfec6c4d95
--- /dev/null
+++ 
b/source/blender/compositor/realtime_compositor/shaders/compositor_glare_simple_star_anti_diagonal_pass.glsl
@@ -0,0 +1,55 @@
+#pragma BLENDER_REQUIRE(gpu_shader_compositor_image_diagonals.glsl)
+#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
+
+void main()
+{
+  ivec2 size = imageSize(anti_diagonal_img);
+  int index = int(gl_GlobalInvocationID.x);
+  int anti_diagonal_length = compute_anti_diagonal_length(size, index);
+  ivec2 start = compute_anti_diagonal_start(size, index);
+  ivec2 direction = get_anti_diagonal_direction();
+  ivec2 end = start + (anti_diagonal_length - 1) * direction;
+
+  /* For each iteration, apply a causal filter followed by a non causal 
filters along the anti
+   * diagonal mapped to the current thread invocation. */
+  for (int i = 0; i < iterations; i++) {
+/* Causal Pass:
+ * Sequentially apply a causal filter running from the start of the anti 
diagonal to its end by
+ * mixing the value of the pixel in the anti diagonal with the average 
value of the previous
+ * output and next input in the same anti diagonal. */
+for (int j = 0; j < anti_diagonal_length; j++) {
+  ivec2 texel = 

[Bf-blender-cvs] [0d21b9e2da3] master: Cleanup: fix compile error on macos

2022-12-09 Thread Jacques Lucke
Commit: 0d21b9e2da33670cb9bb1e1a409637a3e74fa48e
Author: Jacques Lucke
Date:   Fri Dec 9 15:57:58 2022 +0100
Branches: master
https://developer.blender.org/rB0d21b9e2da33670cb9bb1e1a409637a3e74fa48e

Cleanup: fix compile error on macos

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc 
b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
index 8e5e84fd94a..fad71adae3d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
@@ -215,7 +215,7 @@ static void 
initialize_volume_component_from_points(GeoNodeExecParams ¶ms,
 
   const float max_radius = *std::max_element(radii.begin(), radii.end());
   const float voxel_size = compute_voxel_size(params, positions, max_radius);
-  const double determinant = std::pow(voxel_size, 3.0);
+  const double determinant = std::pow(double(voxel_size), 3.0);
   if (!BKE_volume_grid_determinant_valid(determinant)) {
 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] [fa27a5d066a] master: Realtime Compositor: Implement Ghost Glare node

2022-12-09 Thread Omar Emara
Commit: fa27a5d066a1d6b04e77bfa4088dca83644bceaf
Author: Omar Emara
Date:   Fri Dec 9 16:50:52 2022 +0200
Branches: master
https://developer.blender.org/rBfa27a5d066a1d6b04e77bfa4088dca83644bceaf

Realtime Compositor: Implement Ghost Glare node

This patch implements the Ghost Glare node. It is implemented using
direct convolution as opposed to a recursive one, which produces
slightly different results---more accurate ones, however, since the
ghosts are attenuated where it matters, the difference is barely
visible and is acceptable as far as I can tell.

A possible performance improvement is to implement all passes in a
single shader dispatch, where an array of all scales and color
modulators is computed recursively on the host then used in the shader
to add all ghosts, avoiding usage of global memory and unnecessary
copies. This optimization will be implemented separately.

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

Reviewed By: Clement Foucault

===

M   source/blender/compositor/realtime_compositor/CMakeLists.txt
M   source/blender/compositor/realtime_compositor/COM_result.hh
A   
source/blender/compositor/realtime_compositor/algorithms/COM_algorithm_symmetric_separable_blur.hh
A   
source/blender/compositor/realtime_compositor/algorithms/intern/symmetric_separable_blur.cc
M   source/blender/compositor/realtime_compositor/intern/result.cc
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_ghost_accumulate.glsl
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_ghost_base.glsl
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_highlights.glsl
A   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_mix.glsl
A   
source/blender/compositor/realtime_compositor/shaders/infos/compositor_glare_info.hh
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/composite/nodes/node_composite_blur.cc
M   source/blender/nodes/composite/nodes/node_composite_glare.cc

===

diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt 
b/source/blender/compositor/realtime_compositor/CMakeLists.txt
index b4352248b5b..7d7448a448f 100644
--- a/source/blender/compositor/realtime_compositor/CMakeLists.txt
+++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt
@@ -60,8 +60,10 @@ set(SRC
   COM_utilities.hh
 
   algorithms/intern/algorithm_parallel_reduction.cc
+  algorithms/intern/symmetric_separable_blur.cc
 
   algorithms/COM_algorithm_parallel_reduction.hh
+  algorithms/COM_algorithm_symmetric_separable_blur.hh
 
   cached_resources/intern/morphological_distance_feather_weights.cc
   cached_resources/intern/symmetric_blur_weights.cc
@@ -96,6 +98,10 @@ set(GLSL_SRC
   shaders/compositor_ellipse_mask.glsl
   shaders/compositor_filter.glsl
   shaders/compositor_flip.glsl
+  shaders/compositor_glare_ghost_accumulate.glsl
+  shaders/compositor_glare_ghost_base.glsl
+  shaders/compositor_glare_highlights.glsl
+  shaders/compositor_glare_mix.glsl
   shaders/compositor_image_crop.glsl
   shaders/compositor_morphological_distance.glsl
   shaders/compositor_morphological_distance_feather.glsl
@@ -181,6 +187,7 @@ set(SRC_SHADER_CREATE_INFOS
   shaders/infos/compositor_ellipse_mask_info.hh
   shaders/infos/compositor_filter_info.hh
   shaders/infos/compositor_flip_info.hh
+  shaders/infos/compositor_glare_info.hh
   shaders/infos/compositor_image_crop_info.hh
   shaders/infos/compositor_morphological_distance_feather_info.hh
   shaders/infos/compositor_morphological_distance_info.hh
diff --git a/source/blender/compositor/realtime_compositor/COM_result.hh 
b/source/blender/compositor/realtime_compositor/COM_result.hh
index f5ecc4c2112..3f8378bc4c2 100644
--- a/source/blender/compositor/realtime_compositor/COM_result.hh
+++ b/source/blender/compositor/realtime_compositor/COM_result.hh
@@ -105,6 +105,11 @@ class Result {
* and release the result's texture. */
   Result(ResultType type, TexturePool &texture_pool);
 
+  /* Identical to the standard constructor but initializes the reference count 
to 1. This is useful
+   * to construct temporary results that are created and released by the 
developer manually, which
+   * are typically used in operations that need temporary intermediate 
results. */
+  static Result Temporary(ResultType type, TexturePool &texture_pool);
+
   /* Declare the result to be a texture result, allocate a texture of an 
appropriate type with
* the size of the given domain from the result's texture pool, and set the 
domain of the result
* to the given domain. */
@@ -125,8 +130,9 @@ class Result {
   void bind_as_texture(GPUShader *shader, const char *texture_name) const;
 
   /* Bind the texture of the result to the image unit with the given name in 
the currently bound
-   * gi

[Bf-blender-cvs] [a45284b855d] master: BLI: remove deduplicated memory utility functions

2022-12-09 Thread Jacques Lucke
Commit: a45284b855d4fef54d91412cdf169dd721110db1
Author: Jacques Lucke
Date:   Fri Dec 9 14:10:15 2022 +0100
Branches: master
https://developer.blender.org/rBa45284b855d4fef54d91412cdf169dd721110db1

BLI: remove deduplicated memory utility functions

These functions were originally implemented because:
- Not all of them existed pre C++17, but now we are using C++17.
- The call stack depth is quite a bit deeper with the std functions, making
  debugging slower and more annoying. I didn't find this to be a problem
  anymore recently.

No functional changes are expected.

===

M   source/blender/blenlib/BLI_memory_utils.hh
M   source/blender/blenlib/tests/BLI_memory_utils_test.cc

===

diff --git a/source/blender/blenlib/BLI_memory_utils.hh 
b/source/blender/blenlib/BLI_memory_utils.hh
index b6ffa6d8b4a..6f119a49f01 100644
--- a/source/blender/blenlib/BLI_memory_utils.hh
+++ b/source/blender/blenlib/BLI_memory_utils.hh
@@ -4,11 +4,9 @@
 
 /** \file
  * \ingroup bli
- * Some of the functions below have very similar alternatives in the standard 
library. However, it
- * is rather annoying to use those when debugging. Therefore, some more 
specialized and easier to
- * debug functions are provided here.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -33,280 +31,66 @@ template
 inline constexpr bool is_trivially_move_constructible_extended_v =
 is_trivial_extended_v || std::is_trivially_move_constructible_v;
 
-/**
- * Call the destructor on n consecutive values. For trivially destructible 
types, this does
- * nothing.
- *
- * Exception Safety: Destructors shouldn't throw exceptions.
- *
- * Before:
- *  ptr: initialized
- * After:
- *  ptr: uninitialized
- */
 template void destruct_n(T *ptr, int64_t n)
 {
-  BLI_assert(n >= 0);
-
-  static_assert(std::is_nothrow_destructible_v,
-"This should be true for all types. Destructors are noexcept 
by default.");
-
-  /* This is not strictly necessary, because the loop below will be optimized 
away anyway. It is
-   * nice to make behavior this explicitly, though. */
   if (is_trivially_destructible_extended_v) {
 return;
   }
 
-  for (int64_t i = 0; i < n; i++) {
-ptr[i].~T();
-  }
+  std::destroy_n(ptr, n);
 }
 
-/**
- * Call the default constructor on n consecutive elements. For trivially 
constructible types, this
- * does nothing.
- *
- * Exception Safety: Strong.
- *
- * Before:
- *  ptr: uninitialized
- * After:
- *  ptr: initialized
- */
 template void default_construct_n(T *ptr, int64_t n)
 {
-  BLI_assert(n >= 0);
-
-  /* This is not strictly necessary, because the loop below will be optimized 
away anyway. It is
-   * nice to make behavior this explicitly, though. */
-  if (std::is_trivially_constructible_v) {
-return;
-  }
-
-  int64_t current = 0;
-  try {
-for (; current < n; current++) {
-  new (static_cast(ptr + current)) T;
-}
-  }
-  catch (...) {
-destruct_n(ptr, current);
-throw;
-  }
+  std::uninitialized_default_construct_n(ptr, n);
 }
 
-/**
- * Copy n values from src to dst.
- *
- * Exception Safety: Basic.
- *
- * Before:
- *  src: initialized
- *  dst: initialized
- * After:
- *  src: initialized
- *  dst: initialized
- */
 template void initialized_copy_n(const T *src, int64_t n, T *dst)
 {
-  BLI_assert(n >= 0);
-
-  for (int64_t i = 0; i < n; i++) {
-dst[i] = src[i];
-  }
+  std::copy_n(src, n, dst);
 }
 
-/**
- * Copy n values from src to dst.
- *
- * Exception Safety: Strong.
- *
- * Before:
- *  src: initialized
- *  dst: uninitialized
- * After:
- *  src: initialized
- *  dst: initialized
- */
 template void uninitialized_copy_n(const T *src, int64_t n, T *dst)
 {
-  BLI_assert(n >= 0);
-
-  int64_t current = 0;
-  try {
-for (; current < n; current++) {
-  new (static_cast(dst + current)) T(src[current]);
-}
-  }
-  catch (...) {
-destruct_n(dst, current);
-throw;
-  }
+  std::uninitialized_copy_n(src, n, dst);
 }
 
-/**
- * Convert n values from type `From` to type `To`.
- *
- * Exception Safety: Strong.
- *
- * Before:
- *  src: initialized
- *  dst: uninitialized
- * After:
- *  src: initialized
- *  dst: initialized
- */
 template
 void uninitialized_convert_n(const From *src, int64_t n, To *dst)
 {
-  BLI_assert(n >= 0);
-
-  int64_t current = 0;
-  try {
-for (; current < n; current++) {
-  new (static_cast(dst + current)) 
To(static_cast(src[current]));
-}
-  }
-  catch (...) {
-destruct_n(dst, current);
-throw;
-  }
+  std::uninitialized_copy_n(src, n, dst);
 }
 
-/**
- * Move n values from src to dst.
- *
- * Exception Safety: Basic.
- *
- * Before:
- *  src: initialized
- *  dst: initialized
- * After:
- *  src: initialized, moved-from
- *  dst: initialized
- */
 template void initialized_move_n(T *src, int64_t n, T *dst)
 {
-  BLI_assert(n >= 0);
-
-  for (int64_t i = 0; i < n; i++) {
-   

[Bf-blender-cvs] [3696dff676c] cycles_path_guiding: Merge branch 'master' into cycles_path_guiding

2022-12-09 Thread Sebastian Herholz
Commit: 3696dff676cb2e69237701b2cabec29aced59a1d
Author: Sebastian Herholz
Date:   Fri Dec 9 13:17:22 2022 +0100
Branches: cycles_path_guiding
https://developer.blender.org/rB3696dff676cb2e69237701b2cabec29aced59a1d

Merge branch 'master' into cycles_path_guiding

===



===



___
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] [7c5b7713f12] master: Fix T103001: Width of some compositor nodes is incorrect

2022-12-09 Thread Pratik Borhade
Commit: 7c5b7713f12ceb3d0704925d9e86adac839da9a9
Author: Pratik Borhade
Date:   Fri Dec 9 16:51:34 2022 +0530
Branches: master
https://developer.blender.org/rB7c5b7713f12ceb3d0704925d9e86adac839da9a9

Fix T103001: Width of some compositor nodes is incorrect

Nodes which are common in multiple editors (RGB, Value, Switch, RGB to BW)
has less width in compositor editor. Patch changes compositor node width to
140 for consistency.

Reviewed by: HooglyBoogly

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

===

M   source/blender/nodes/composite/nodes/node_composite_rgb.cc
M   source/blender/nodes/composite/nodes/node_composite_switch.cc
M   source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
M   source/blender/nodes/composite/nodes/node_composite_value.cc

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.cc 
b/source/blender/nodes/composite/nodes/node_composite_rgb.cc
index f107961f301..c4b5e12ea60 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rgb.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.cc
@@ -55,7 +55,7 @@ void register_node_type_cmp_rgb()
 
   cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT);
   ntype.declare = file_ns::cmp_node_rgb_declare;
-  node_type_size_preset(&ntype, NODE_SIZE_SMALL);
+  node_type_size_preset(&ntype, NODE_SIZE_DEFAULT);
   ntype.get_compositor_operation = file_ns::get_compositor_operation;
 
   nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.cc 
b/source/blender/nodes/composite/nodes/node_composite_switch.cc
index c62ae652029..22b56f4b50c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switch.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.cc
@@ -63,7 +63,7 @@ void register_node_type_cmp_switch()
   cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT);
   ntype.declare = file_ns::cmp_node_switch_declare;
   ntype.draw_buttons = file_ns::node_composit_buts_switch;
-  node_type_size_preset(&ntype, NODE_SIZE_SMALL);
+  node_type_size_preset(&ntype, NODE_SIZE_DEFAULT);
   ntype.get_compositor_operation = file_ns::get_compositor_operation;
 
   nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc 
b/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
index d083051e9d2..35a1261001a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
@@ -191,7 +191,7 @@ void register_node_type_cmp_rgbtobw()
 
   cmp_node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", 
NODE_CLASS_CONVERTER);
   ntype.declare = file_ns::cmp_node_rgbtobw_declare;
-  node_type_size_preset(&ntype, NODE_SIZE_SMALL);
+  node_type_size_preset(&ntype, NODE_SIZE_DEFAULT);
   ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
 
   nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_value.cc 
b/source/blender/nodes/composite/nodes/node_composite_value.cc
index a96e1db14ad..5b873c9800e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_value.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_value.cc
@@ -51,7 +51,7 @@ void register_node_type_cmp_value()
 
   cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT);
   ntype.declare = file_ns::cmp_node_value_declare;
-  node_type_size_preset(&ntype, NODE_SIZE_SMALL);
+  node_type_size_preset(&ntype, NODE_SIZE_DEFAULT);
   ntype.get_compositor_operation = file_ns::get_compositor_operation;
 
   nodeRegisterType(&ntype);

___
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] [ed4fc6aabe0] blender-v2.93-release: Release cycle: Version bump to 2.93.12 rc

2022-12-09 Thread Thomas Dinges
Commit: ed4fc6aabe02482be2059c79059870d4294d586a
Author: Thomas Dinges
Date:   Fri Dec 9 12:23:54 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rBed4fc6aabe02482be2059c79059870d4294d586a

Release cycle: Version bump to 2.93.12 rc

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index edcbc6949cc..d5bdbf0ec01 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -33,9 +33,9 @@ extern "C" {
 /* Blender major and minor version. */
 #define BLENDER_VERSION 293
 /* Blender patch version for bugfix releases. */
-#define BLENDER_VERSION_PATCH 11
+#define BLENDER_VERSION_PATCH 12
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE release
+#define BLENDER_VERSION_CYCLE rc
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION

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


[Bf-blender-cvs] [dd444323f31] blender-v2.93-release: Fix Cycles integrator presets.

2022-12-09 Thread Thomas Dinges
Commit: dd444323f31ab4a9515acea4ed97711f51e7f4cf
Author: Thomas Dinges
Date:   Mon Nov 1 19:52:27 2021 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rBdd444323f31ab4a9515acea4ed97711f51e7f4cf

Fix Cycles integrator presets.

New presets couldn't be added.

===

M   intern/cycles/blender/addon/presets.py

===

diff --git a/intern/cycles/blender/addon/presets.py 
b/intern/cycles/blender/addon/presets.py
index bf33e5dc010..a28f41a0288 100644
--- a/intern/cycles/blender/addon/presets.py
+++ b/intern/cycles/blender/addon/presets.py
@@ -40,10 +40,10 @@ class AddPresetIntegrator(AddPresetBase, Operator):
 "cycles.transparent_max_bounces",
 "cycles.caustics_reflective",
 "cycles.caustics_refractive",
-"cycles.blur_glossy"
-"cycles.use_fast_gi"
-"cycles.ao_bounces"
-"cycles.ao_bounces_render"
+"cycles.blur_glossy",
+"cycles.use_fast_gi",
+"cycles.ao_bounces",
+"cycles.ao_bounces_render",
 ]
 
 preset_subdir = "cycles/integrator"

___
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] [bf1791ba92d] master: BLI: add clear-and-shrink method to more data structures

2022-12-09 Thread Jacques Lucke
Commit: bf1791ba92d280392cc3f00709d7da395b2a58f4
Author: Jacques Lucke
Date:   Fri Dec 9 12:00:37 2022 +0100
Branches: master
https://developer.blender.org/rBbf1791ba92d280392cc3f00709d7da395b2a58f4

BLI: add clear-and-shrink method to more data structures

Also renames the existing `clear_and_make_inline` to `clear_and_shrink`
which is more concise.

===

M   source/blender/blenkernel/intern/curves_geometry.cc
M   source/blender/blenlib/BLI_map.hh
M   source/blender/blenlib/BLI_multi_value_map.hh
M   source/blender/blenlib/BLI_set.hh
M   source/blender/blenlib/BLI_stack.hh
M   source/blender/blenlib/BLI_vector.hh
M   source/blender/blenlib/BLI_vector_set.hh
M   source/blender/compositor/intern/COM_WorkScheduler.cc
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc

===

diff --git a/source/blender/blenkernel/intern/curves_geometry.cc 
b/source/blender/blenkernel/intern/curves_geometry.cc
index 94ab5ceeace..5cbb0709c91 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -519,7 +519,7 @@ void CurvesGeometry::ensure_evaluated_offsets() const
   this->runtime->bezier_evaluated_offsets.resize(this->points_num());
 }
 else {
-  this->runtime->bezier_evaluated_offsets.clear_and_make_inline();
+  this->runtime->bezier_evaluated_offsets.clear_and_shrink();
 }
 
 calculate_evaluated_offsets(
@@ -605,7 +605,7 @@ Span CurvesGeometry::evaluated_positions() const
   this->runtime->position_cache_mutex.ensure([&]() {
 if (this->is_single_type(CURVE_TYPE_POLY)) {
   this->runtime->evaluated_positions_span = this->positions();
-  this->runtime->evaluated_position_cache.clear_and_make_inline();
+  this->runtime->evaluated_position_cache.clear_and_shrink();
   return;
 }
 
diff --git a/source/blender/blenlib/BLI_map.hh 
b/source/blender/blenlib/BLI_map.hh
index fb048102153..e7958ee49ac 100644
--- a/source/blender/blenlib/BLI_map.hh
+++ b/source/blender/blenlib/BLI_map.hh
@@ -990,6 +990,15 @@ class Map {
 occupied_and_removed_slots_ = 0;
   }
 
+  /**
+   * Removes all key-value-pairs from the map and frees any allocated memory.
+   */
+  void clear_and_shrink()
+  {
+std::destroy_at(this);
+new (this) Map(NoExceptConstructor{});
+  }
+
   /**
* Get the number of collisions that the probing strategy has to go through 
to find the key or
* determine that it is not in the map.
diff --git a/source/blender/blenlib/BLI_multi_value_map.hh 
b/source/blender/blenlib/BLI_multi_value_map.hh
index 81b536e7d3c..99fc7dffe3b 100644
--- a/source/blender/blenlib/BLI_multi_value_map.hh
+++ b/source/blender/blenlib/BLI_multi_value_map.hh
@@ -150,6 +150,11 @@ template class MultiValueMap 
{
   {
 map_.clear();
   }
+
+  void clear_and_shrink()
+  {
+map_.clear_and_shrink();
+  }
 };
 
 }  // namespace blender
diff --git a/source/blender/blenlib/BLI_set.hh 
b/source/blender/blenlib/BLI_set.hh
index 548195e48f7..3e5e6fabb42 100644
--- a/source/blender/blenlib/BLI_set.hh
+++ b/source/blender/blenlib/BLI_set.hh
@@ -542,6 +542,15 @@ class Set {
 occupied_and_removed_slots_ = 0;
   }
 
+  /**
+   * Removes all keys from the set and frees any allocated memory.
+   */
+  void clear_and_shrink()
+  {
+std::destroy_at(this);
+new (this) Set(NoExceptConstructor{});
+  }
+
   /**
* Creates a new slot array and reinserts all keys inside of that. This 
method can be used to get
* rid of removed slots. Also this is useful for benchmarking the grow 
function.
diff --git a/source/blender/blenlib/BLI_stack.hh 
b/source/blender/blenlib/BLI_stack.hh
index ed123f43a6b..a9db671e7ac 100644
--- a/source/blender/blenlib/BLI_stack.hh
+++ b/source/blender/blenlib/BLI_stack.hh
@@ -329,6 +329,15 @@ class Stack {
 top_ = top_chunk_->begin;
   }
 
+  /**
+   * Removes all elements from the stack and frees any allocated memory.
+   */
+  void clear_and_shrink()
+  {
+std::destroy_at(this);
+new (this) Stack(NoExceptConstructor{});
+  }
+
   /* This should only be called by unit tests. */
   bool is_invariant_maintained() const
   {
diff --git a/source/blender/blenlib/BLI_vector.hh 
b/source/blender/blenlib/BLI_vector.hh
index 6bc785c322a..be594377eb3 100644
--- a/source/blender/blenlib/BLI_vector.hh
+++ b/source/blender/blenlib/BLI_vector.hh
@@ -410,7 +410,7 @@ class Vector {
* Afterwards the vector has 0 elements and any allocated memory
* will be freed.
*/
-  void clear_and_make_inline()
+  void clear_and_shrink()
   {
 destruct_n(begin_, this->size());
 if (!this->is_inline()) {
diff --git a/source/blender/blenlib/BLI_vector_set.hh 
b/source/blender/blenlib/BLI_vector_set.hh
index 9805e8a7d59..1be21ccb5d1 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vecto

[Bf-blender-cvs] [a55c356a1c1] master: BLO: shrink old-new-map when it is cleared

2022-12-09 Thread Jacques Lucke
Commit: a55c356a1c169dff3095ef92682ce8a7583729a3
Author: Jacques Lucke
Date:   Fri Dec 9 12:07:40 2022 +0100
Branches: master
https://developer.blender.org/rBa55c356a1c169dff3095ef92682ce8a7583729a3

BLO: shrink old-new-map when it is cleared

This was accidentally changed in {rB57613630c7faa41aa20ae9}.
Not shrinking the map can degrade performance.

===

M   source/blender/blenloader/intern/readfile.cc

===

diff --git a/source/blender/blenloader/intern/readfile.cc 
b/source/blender/blenloader/intern/readfile.cc
index d5ba6730369..d7db103a460 100644
--- a/source/blender/blenloader/intern/readfile.cc
+++ b/source/blender/blenloader/intern/readfile.cc
@@ -301,7 +301,7 @@ static void oldnewmap_clear(OldNewMap *onm)
   MEM_freeN(new_addr.newp);
 }
   }
-  onm->map.clear();
+  onm->map.clear_and_shrink();
 }
 
 static void oldnewmap_free(OldNewMap *onm)

___
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] [122d6d67e6a] master: Fix: Points to Volume node crashes with too small radius

2022-12-09 Thread Jacques Lucke
Commit: 122d6d67e6a0b9036be46f871765d7789921579e
Author: Jacques Lucke
Date:   Fri Dec 9 11:42:10 2022 +0100
Branches: master
https://developer.blender.org/rB122d6d67e6a0b9036be46f871765d7789921579e

Fix: Points to Volume node crashes with too small radius

OpenVDB likes to crash even in release builds when volumes become too small.
To fix this I used the same function that we use in other places already to
determine if the resulting volume will be too small.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc 
b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
index c6801cf15aa..8e5e84fd94a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
@@ -209,9 +209,14 @@ static void 
initialize_volume_component_from_points(GeoNodeExecParams ¶ms,
 }
   }
 
+  if (positions.is_empty()) {
+return;
+  }
+
   const float max_radius = *std::max_element(radii.begin(), radii.end());
   const float voxel_size = compute_voxel_size(params, positions, max_radius);
-  if (voxel_size == 0.0f || positions.is_empty()) {
+  const double determinant = std::pow(voxel_size, 3.0);
+  if (!BKE_volume_grid_determinant_valid(determinant)) {
 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] [f06a1368bbd] master: Cleanup: sanatize namespaces in image engine.

2022-12-09 Thread Jeroen Bakker
Commit: f06a1368bbdbbf6e7b41ddcb124c68d27879cde1
Author: Jeroen Bakker
Date:   Fri Dec 9 10:29:34 2022 +0100
Branches: master
https://developer.blender.org/rBf06a1368bbdbbf6e7b41ddcb124c68d27879cde1

Cleanup: sanatize namespaces in image engine.

Some files were missing namespaces and sometimes the closing comment of
namespaces were incorrectly placed. No functional changes.

===

M   source/blender/draw/engines/image/image_batches.hh
M   source/blender/draw/engines/image/image_buffer_cache.hh
M   source/blender/draw/engines/image/image_engine.cc
M   source/blender/draw/engines/image/image_instance_data.hh
M   source/blender/draw/engines/image/image_shader_params.hh
M   source/blender/draw/engines/image/image_space.hh
M   source/blender/draw/engines/image/image_texture_info.hh
M   source/blender/draw/engines/image/image_usage.hh

===

diff --git a/source/blender/draw/engines/image/image_batches.hh 
b/source/blender/draw/engines/image/image_batches.hh
index 356e3f0db6b..34dca043ccc 100644
--- a/source/blender/draw/engines/image/image_batches.hh
+++ b/source/blender/draw/engines/image/image_batches.hh
@@ -9,6 +9,8 @@
 
 #include "image_texture_info.hh"
 
+namespace blender::draw::image_engine {
+
 /** \brief Create GPUBatch for a IMAGE_ScreenSpaceTextureInfo. */
 class BatchUpdater {
   TextureInfo &info;
@@ -89,3 +91,5 @@ class BatchUpdater {
 }
   }
 };
+
+}  // namespace blender::draw::image_engine
diff --git a/source/blender/draw/engines/image/image_buffer_cache.hh 
b/source/blender/draw/engines/image/image_buffer_cache.hh
index 6c1be27f9f7..5c6b01d8add 100644
--- a/source/blender/draw/engines/image/image_buffer_cache.hh
+++ b/source/blender/draw/engines/image/image_buffer_cache.hh
@@ -13,6 +13,8 @@
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
+namespace blender::draw::image_engine {
+
 struct FloatImageBuffer {
   ImBuf *source_buffer = nullptr;
   ImBuf *float_buffer = nullptr;
@@ -62,7 +64,7 @@ struct FloatImageBuffer {
  */
 struct FloatBufferCache {
  private:
-  blender::Vector cache_;
+  Vector cache_;
 
  public:
   ImBuf *cached_float_buffer(ImBuf *image_buffer)
@@ -130,3 +132,5 @@ struct FloatBufferCache {
 cache_.clear();
   }
 };
+
+}  // namespace blender::draw::image_engine
diff --git a/source/blender/draw/engines/image/image_engine.cc 
b/source/blender/draw/engines/image/image_engine.cc
index 0151c6925bf..1284231d5e9 100644
--- a/source/blender/draw/engines/image/image_engine.cc
+++ b/source/blender/draw/engines/image/image_engine.cc
@@ -128,7 +128,7 @@ class ImageEngine {
   {
 drawing_mode.draw_scene(vedata);
   }
-};  // namespace blender::draw::image_engine
+};
 
 /*  */
 /** \name Engine Callbacks
diff --git a/source/blender/draw/engines/image/image_instance_data.hh 
b/source/blender/draw/engines/image/image_instance_data.hh
index c8de4d0ac83..b027b732aeb 100644
--- a/source/blender/draw/engines/image/image_instance_data.hh
+++ b/source/blender/draw/engines/image/image_instance_data.hh
@@ -19,6 +19,8 @@
 
 #include "DRW_render.h"
 
+namespace blender::draw::image_engine {
+
 /**
  * \brief max allowed textures to use by the ScreenSpaceDrawingMode.
  *
@@ -124,3 +126,5 @@ struct IMAGE_InstanceData {
 }
   }
 };
+
+}  // namespace blender::draw::image_engine
diff --git a/source/blender/draw/engines/image/image_shader_params.hh 
b/source/blender/draw/engines/image/image_shader_params.hh
index 4bc121a49a4..41159d85e05 100644
--- a/source/blender/draw/engines/image/image_shader_params.hh
+++ b/source/blender/draw/engines/image/image_shader_params.hh
@@ -19,6 +19,8 @@
 
 #include "image_space.hh"
 
+namespace blender::draw::image_engine {
+
 struct ShaderParameters {
   int flags = 0;
   float shuffle[4];
@@ -40,3 +42,5 @@ struct ShaderParameters {
 space->get_shader_parameters(*this, image_buffer);
   }
 };
+
+}  // namespace blender::draw::image_engine
diff --git a/source/blender/draw/engines/image/image_space.hh 
b/source/blender/draw/engines/image/image_space.hh
index 03973d892df..fa9c68efb05 100644
--- a/source/blender/draw/engines/image/image_space.hh
+++ b/source/blender/draw/engines/image/image_space.hh
@@ -7,6 +7,8 @@
 
 #pragma once
 
+namespace blender::draw::image_engine {
+
 struct ShaderParameters;
 
 /**
@@ -79,5 +81,6 @@ class AbstractSpaceAccessor {
   virtual void init_ss_to_texture_matrix(const ARegion *region,
  const float image_resolution[2],
  float r_uv_to_texture[4][4]) const = 
0;
+};
 
-};  // namespace blender::draw::image_engine
+}  // namespace blender::draw::image_engine
diff --git a/source/blender/draw/engines/image/image_texture_info.hh 
b/source/blender/draw/engines/image/image_texture_info.hh
index b2ceabfc2c4..acab434a76d 

[Bf-blender-cvs] [6fb4ca1eec7] master: Image Engine: Add assert to check for correct float colorspace.

2022-12-09 Thread Jeroen Bakker
Commit: 6fb4ca1eec7e38e9755b330deb813f1059582352
Author: Jeroen Bakker
Date:   Fri Dec 9 10:08:51 2022 +0100
Branches: master
https://developer.blender.org/rB6fb4ca1eec7e38e9755b330deb813f1059582352

Image Engine: Add assert to check for correct float colorspace.

Float images loaded in Blender are converted to scene linear and don't
require additional conversion. Image engine can reuse the rect_float of
those images. An assert statement is added tp make this more clear and
to test on missing code paths or future developments.

===

M   source/blender/draw/engines/image/image_buffer_cache.hh

===

diff --git a/source/blender/draw/engines/image/image_buffer_cache.hh 
b/source/blender/draw/engines/image/image_buffer_cache.hh
index ebd08273dca..6c1be27f9f7 100644
--- a/source/blender/draw/engines/image/image_buffer_cache.hh
+++ b/source/blender/draw/engines/image/image_buffer_cache.hh
@@ -9,6 +9,7 @@
 
 #include "BLI_vector.hh"
 
+#include "IMB_colormanagement.h"
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
@@ -68,6 +69,11 @@ struct FloatBufferCache {
   {
 /* Check if we can use the float buffer of the given image_buffer. */
 if (image_buffer->rect_float != nullptr) {
+  BLI_assert_msg(
+  IMB_colormanagement_space_name_is_scene_linear(
+  IMB_colormanagement_get_float_colorspace(image_buffer)),
+  "Expected rect_float to be scene_linear - if there are code paths 
where this "
+  "isn't the case we should convert those and add to the 
FloatBufferCache as well.");
   return image_buffer;
 }

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


[Bf-blender-cvs] [9785f84dd20] master: Cleanup remove incorrect TODO in image engine.

2022-12-09 Thread Jeroen Bakker
Commit: 9785f84dd20deec8ab2b199863b701c57f9a40b1
Author: Jeroen Bakker
Date:   Fri Dec 9 09:57:52 2022 +0100
Branches: master
https://developer.blender.org/rB9785f84dd20deec8ab2b199863b701c57f9a40b1

Cleanup remove incorrect TODO in image engine.

Float rect is always in scene linear space, so we can always reuse
rect_float when available.

===

M   source/blender/draw/engines/image/image_buffer_cache.hh

===

diff --git a/source/blender/draw/engines/image/image_buffer_cache.hh 
b/source/blender/draw/engines/image/image_buffer_cache.hh
index 266476cf8aa..ebd08273dca 100644
--- a/source/blender/draw/engines/image/image_buffer_cache.hh
+++ b/source/blender/draw/engines/image/image_buffer_cache.hh
@@ -58,10 +58,6 @@ struct FloatImageBuffer {
  *
  * For this reason we store the float buffer in separate image buffers. The 
FloatBufferCache keep
  * track of the cached buffers and if they are still used.
- *
- * TODO: When an image buffer has a float buffer but not stored in scene 
linear, it currently
- * doesn't apply color management. In this case we still need to create 
another float buffer, but
- * with the buffer converted to scene linear.
  */
 struct FloatBufferCache {
  private:

___
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