[Bf-blender-cvs] [09ee781a672] master: GPU: Add placeholders for PixelBuffer to vulkan backend.

2022-12-01 Thread Jeroen Bakker
Commit: 09ee781a672a9cbafbd8102b7ee1a094179f
Author: Jeroen Bakker
Date:   Fri Dec 2 08:35:17 2022 +0100
Branches: master
https://developer.blender.org/rB09ee781a672a9cbafbd8102b7ee1a094179f

GPU: Add placeholders for PixelBuffer to vulkan backend.

PixelBuffer was recently introduced. This change adds empty placeholders to the
vulkan backend and other related API tweaks.

===

M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/vulkan/vk_backend.cc
M   source/blender/gpu/vulkan/vk_backend.hh
A   source/blender/gpu/vulkan/vk_fence.cc
A   source/blender/gpu/vulkan/vk_fence.hh
A   source/blender/gpu/vulkan/vk_pixel_buffer.cc
A   source/blender/gpu/vulkan/vk_pixel_buffer.hh
M   source/blender/gpu/vulkan/vk_texture.cc
M   source/blender/gpu/vulkan/vk_texture.hh

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 2708b0fe084..cf485bf476a 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -191,8 +191,10 @@ set(VULKAN_SRC
   vulkan/vk_batch.cc
   vulkan/vk_context.cc
   vulkan/vk_drawlist.cc
+  vulkan/vk_fence.cc
   vulkan/vk_framebuffer.cc
   vulkan/vk_index_buffer.cc
+  vulkan/vk_pixel_buffer.cc
   vulkan/vk_query.cc
   vulkan/vk_shader.cc
   vulkan/vk_storage_buffer.cc
@@ -204,8 +206,10 @@ set(VULKAN_SRC
   vulkan/vk_batch.hh
   vulkan/vk_context.hh
   vulkan/vk_drawlist.hh
+  vulkan/vk_fence.hh
   vulkan/vk_framebuffer.hh
   vulkan/vk_index_buffer.hh
+  vulkan/vk_pixel_buffer.hh
   vulkan/vk_query.hh
   vulkan/vk_shader.hh
   vulkan/vk_storage_buffer.hh
diff --git a/source/blender/gpu/vulkan/vk_backend.cc 
b/source/blender/gpu/vulkan/vk_backend.cc
index 7e8d08f9ca9..b0212012fdf 100644
--- a/source/blender/gpu/vulkan/vk_backend.cc
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -10,8 +10,10 @@
 #include "vk_batch.hh"
 #include "vk_context.hh"
 #include "vk_drawlist.hh"
+#include "vk_fence.hh"
 #include "vk_framebuffer.hh"
 #include "vk_index_buffer.hh"
+#include "vk_pixel_buffer.hh"
 #include "vk_query.hh"
 #include "vk_shader.hh"
 #include "vk_storage_buffer.hh"
@@ -80,6 +82,11 @@ DrawList *VKBackend::drawlist_alloc(int /*list_length*/)
   return new VKDrawList();
 }
 
+Fence *VKBackend::fence_alloc()
+{
+  return new VKFence();
+}
+
 FrameBuffer *VKBackend::framebuffer_alloc(const char *name)
 {
   return new VKFrameBuffer(name);
@@ -90,6 +97,11 @@ IndexBuf *VKBackend::indexbuf_alloc()
   return new VKIndexBuffer();
 }
 
+PixelBuffer *VKBackend::pixelbuf_alloc(uint size)
+{
+  return new VKPixelBuffer(size);
+}
+
 QueryPool *VKBackend::querypool_alloc()
 {
   return new VKQueryPool();
diff --git a/source/blender/gpu/vulkan/vk_backend.hh 
b/source/blender/gpu/vulkan/vk_backend.hh
index 55b528bfa00..c78788298a5 100644
--- a/source/blender/gpu/vulkan/vk_backend.hh
+++ b/source/blender/gpu/vulkan/vk_backend.hh
@@ -33,8 +33,10 @@ class VKBackend : public GPUBackend {
 
   Batch *batch_alloc() override;
   DrawList *drawlist_alloc(int list_length) override;
+  Fence *fence_alloc() override;
   FrameBuffer *framebuffer_alloc(const char *name) override;
   IndexBuf *indexbuf_alloc() override;
+  PixelBuffer *pixelbuf_alloc(uint size) override;
   QueryPool *querypool_alloc() override;
   Shader *shader_alloc(const char *name) override;
   Texture *texture_alloc(const char *name) override;
diff --git a/source/blender/gpu/vulkan/vk_fence.cc 
b/source/blender/gpu/vulkan/vk_fence.cc
new file mode 100644
index 000..3acd94d3050
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_fence.cc
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "vk_fence.hh"
+
+namespace blender::gpu {
+
+void VKFence::signal()
+{
+}
+
+void VKFence::wait()
+{
+}
+
+}  // namespace blender::gpu
\ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_fence.hh 
b/source/blender/gpu/vulkan/vk_fence.hh
new file mode 100644
index 000..ff382ae54e3
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_fence.hh
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#pragma once
+
+#include "gpu_state_private.hh"
+
+namespace blender::gpu {
+
+class VKFence : public Fence {
+ public:
+  void signal() override;
+  void wait() override;
+};
+
+}  // namespace blender::gpu
\ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_pixel_buffer.cc 
b/source/blender/gpu/vulkan/vk_pixel_buffer.cc
new file mode 100644
index 000..65780778d59
--- /dev/null
+++ b/source/blender/gpu/vulkan/vk_pixel_buffer.cc
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+

[Bf-blender-cvs] [7469e194468] geometry-nodes-simulation: Add basic UI support for multiple simulations in a group

2022-12-01 Thread Hans Goudey
Commit: 7469e19446834d5d32ce3a15ecb0543ebc49c75a
Author: Hans Goudey
Date:   Thu Dec 1 19:49:05 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB7469e19446834d5d32ce3a15ecb0543ebc49c75a

Add basic UI support for multiple simulations in a group

Just allows multiple simulation "frames"/regions/contexts to be drawn
in the editor, doesn't include any changes to caching yet.

===

M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/editors/space_node/node_draw.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc

===

diff --git a/source/blender/blenkernel/BKE_node_runtime.hh 
b/source/blender/blenkernel/BKE_node_runtime.hh
index a2241557315..ffcf661b1e0 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -57,6 +57,8 @@ struct NodeIDEquality {
 
 namespace blender::bke {
 
+using NodeIDVectorSet = VectorSet;
+
 class bNodeTreeRuntime : NonCopyable, NonMovable {
  public:
   /**
@@ -82,7 +84,7 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
* allow simpler and more cache friendly iteration. Supports lookup by 
integer or by node.
* Unlike other caches, this is maintained eagerly while changing the tree.
*/
-  VectorSet 
nodes_by_id;
+  NodeIDVectorSet nodes_by_id;
 
   /** Execution data.
*
@@ -341,12 +343,14 @@ inline blender::Span bNodeTree::all_nodes()
 
 inline bNode *bNodeTree::node_by_id(const int32_t identifier)
 {
+  BLI_assert(identifier >= 0);
   bNode *const *node = 
this->runtime->nodes_by_id.lookup_key_ptr_as(identifier);
   return node ? *node : nullptr;
 }
 
 inline const bNode *bNodeTree::node_by_id(const int32_t identifier) const
 {
+  BLI_assert(identifier >= 0);
   const bNode *const *node = 
this->runtime->nodes_by_id.lookup_key_ptr_as(identifier);
   return node ? *node : nullptr;
 }
diff --git a/source/blender/editors/space_node/node_draw.cc 
b/source/blender/editors/space_node/node_draw.cc
index c3154a095d8..7714979a52a 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -3037,13 +3037,16 @@ static void 
node_draw_sub_context_frames(TreeDrawContext _draw_ctx,
 {
   const Span all_simulation_inputs = ntree.nodes_by_type(
   "GeometryNodeSimulationInput");
-  const Span all_simulation_outputs = ntree.nodes_by_type(
-  "GeometryNodeSimulationOutput");
-  if (all_simulation_inputs.is_empty() || all_simulation_outputs.is_empty()) {
+  if (all_simulation_inputs.is_empty()) {
 return;
   }
   Vector sub_contexts;
-  sub_contexts.append({float3(0.0f, 0.0f, 0.0f), all_simulation_inputs, 
all_simulation_outputs});
+  for (const bNode *sim_input : all_simulation_inputs) {
+const auto  = *static_cast(sim_input->storage);
+if (const bNode *sim_output = ntree.node_by_id(storage.output_node_id)) {
+  sub_contexts.append({float3(0.0f, 0.0f, 0.0f), {sim_input}, 
{sim_output}});
+}
+  }
 
   for (SubContext _context : sub_contexts) {
 const Span context_inputs = sub_context.input_nodes;
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 3390bac1385..c0fd4900196 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1551,7 +1551,7 @@ typedef struct NodeGeometryUVUnwrap {
 } NodeGeometryUVUnwrap;
 
 typedef struct NodeGeometrySimulationInput {
-  int8_t dummy;
+  int32_t output_node_id;
 } NodeGeometrySimulationInput;
 
 typedef struct NodeGeometrySimulationOutput {
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 3e1330b44b0..0a199ddf91d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -5,6 +5,9 @@
 
 #include "DEG_depsgraph_query.h"
 
+#include "UI_interface.h"
+#include "UI_resources.h"
+
 #include "node_geometry_util.hh"
 
 namespace blender::nodes::node_geo_simulation_input_cc {
@@ -20,16 +23,49 @@ static void node_declare(NodeDeclarationBuilder )
   b.add_output(N_("Geometry"));
 }
 
-static void node_init(bNodeTree * /*tree*/, bNode *node)
+static void node_layout(uiLayout * /*layout*/, bContext * /*C*/, PointerRNA * 
/*ptr*/)
+{
+  // const NodeGeometrySimulationInput  = node_storage(
+  // *static_cast(ptr->data));
+  // const bNodeTree _tree = *reinterpret_cast(ptr->owner_id);
+  // const bNode *sim_output = node_tree.node_by_id(storage.output_node_id);
+  // if (sim_output) {
+  //   uiItemL(layout, sim_output->name, ICON_PHYSICS);
+  // }
+}
+
+static void node_init(bNodeTree *tree, bNode *node)
 {
   NodeGeometrySimulationInput *data = 
MEM_cnew(__func__);
-  

[Bf-blender-cvs] [0019d6cc8fe] geometry-nodes-simulation: Fix property name for node UI

2022-12-01 Thread Hans Goudey
Commit: 0019d6cc8fe0d5718fca2b57915b9cc25c7342c0
Author: Hans Goudey
Date:   Thu Dec 1 18:11:11 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB0019d6cc8fe0d5718fca2b57915b9cc25c7342c0

Fix property name for node UI

===

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 d8d8940fcb9..1b40c295ed1 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -26,7 +26,7 @@ static void node_declare(NodeDeclarationBuilder )
 
 static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
 {
-  uiItemR(layout, ptr, "use_cache", 0, IFACE_("Persistent Cache"), ICON_NONE);
+  uiItemR(layout, ptr, "use_persistent_cache", 0, IFACE_("Persistent Cache"), 
ICON_NONE);
 }
 
 static void node_init(bNodeTree * /*tree*/, bNode *node)

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

2022-12-01 Thread Hans Goudey
Commit: e9c3e4f14ee3f85d2b755527274a810ecfcf2aa6
Author: Hans Goudey
Date:   Thu Dec 1 17:57:14 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBe9c3e4f14ee3f85d2b755527274a810ecfcf2aa6

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] [587b213fe16] master: Fix: Node sorting broken after node identifier commit

2022-12-01 Thread Hans Goudey
Commit: 587b213fe1684ba631b12c40f1db785ec3406614
Author: Hans Goudey
Date:   Thu Dec 1 17:55:33 2022 -0600
Branches: master
https://developer.blender.org/rB587b213fe1684ba631b12c40f1db785ec3406614

Fix: Node sorting broken after node identifier commit

90ea1b76434fe175 broke the sorting that happens as nodes are selected.
The compare function for stable sort had different requirements than
the previous implementation.

===

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

===

diff --git a/source/blender/editors/space_node/node_draw.cc 
b/source/blender/editors/space_node/node_draw.cc
index be778a75039..31a146ed6a2 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -187,7 +187,8 @@ static void 
node_socket_add_tooltip_in_node_editor(TreeDrawContext * /*tree_draw
const bNodeSocket *sock,
uiLayout *layout);
 
-static bool compare_nodes(const bNode *a, const bNode *b)
+/** Return true when \a a should be behind \a b and false otherwise. */
+static bool compare_node_depth(const bNode *a, const bNode *b)
 {
   /* These tell if either the node or any of the parent nodes is selected.
* A selected parent means an unselected node is also in foreground! */
@@ -200,7 +201,7 @@ static bool compare_nodes(const bNode *a, const bNode *b)
   for (bNode *parent = a->parent; parent; parent = parent->parent) {
 /* If B is an ancestor, it is always behind A. */
 if (parent == b) {
-  return true;
+  return false;
 }
 /* Any selected ancestor moves the node forward. */
 if (parent->flag & NODE_ACTIVE) {
@@ -213,7 +214,7 @@ static bool compare_nodes(const bNode *a, const bNode *b)
   for (bNode *parent = b->parent; parent; parent = parent->parent) {
 /* If A is an ancestor, it is always behind B. */
 if (parent == a) {
-  return false;
+  return true;
 }
 /* Any selected ancestor moves the node forward. */
 if (parent->flag & NODE_ACTIVE) {
@@ -226,17 +227,23 @@ static bool compare_nodes(const bNode *a, const bNode *b)
 
   /* One of the nodes is in the background and the other not. */
   if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND)) {
-return false;
-  }
-  if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND)) {
 return true;
   }
+  if ((b->flag & NODE_BACKGROUND) && !(a->flag & NODE_BACKGROUND)) {
+return false;
+  }
 
   /* One has a higher selection state (active > selected > nothing). */
-  if (!b_active && a_active) {
+  if (a_active && !b_active) {
+return false;
+  }
+  if (b_active && !a_active) {
 return true;
   }
   if (!b_select && (a_active || a_select)) {
+return false;
+  }
+  if (!a_select && (b_active || b_select)) {
 return true;
   }
 
@@ -246,7 +253,7 @@ static bool compare_nodes(const bNode *a, const bNode *b)
 void node_sort(bNodeTree )
 {
   Array sort_nodes = ntree.all_nodes();
-  std::stable_sort(sort_nodes.begin(), sort_nodes.end(), compare_nodes);
+  std::stable_sort(sort_nodes.begin(), sort_nodes.end(), compare_node_depth);
 
   /* If nothing was changed, exit early. Otherwise the node tree's runtime
* node vector needs to be rebuilt, since it cannot be reordered in place. */

___
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] [7d33edcf369] soc-2022-many-lights-sampling: Fix `theta - theta_o - theta_u = theta_e = 0` considered invisible

2022-12-01 Thread RiverIntheSky
Commit: 7d33edcf369ca6136680cfbd4e6415cd66e16c94
Author: RiverIntheSky
Date:   Thu Dec 1 23:58:00 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB7d33edcf369ca6136680cfbd4e6415cd66e16c94

Fix `theta - theta_o - theta_u = theta_e = 0` considered invisible

===

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

===

diff --git a/intern/cycles/kernel/light/tree.h 
b/intern/cycles/kernel/light/tree.h
index eba03e93cb9..95a7fa0ed79 100644
--- a/intern/cycles/kernel/light/tree.h
+++ b/intern/cycles/kernel/light/tree.h
@@ -125,12 +125,12 @@ ccl_device void light_tree_importance(const float3 N_or_D,
   /* minimum angle an emitter’s axis would form with the direction to the 
shading point,
* cos(theta') in the paper */
   float cos_min_outgoing_angle;
-  if ((cos_theta > cos_theta_u) || (cos_theta_minus_theta_u > cos_theta_o)) {
-/* theta - theta_o - theta_u < 0 */
+  if ((cos_theta >= cos_theta_u) || (cos_theta_minus_theta_u >= cos_theta_o)) {
+/* theta - theta_o - theta_u <= 0 */
 kernel_assert((fast_acosf(cos_theta) - bcone.theta_o - 
fast_acosf(cos_theta_u)) < 5e-4f);
 cos_min_outgoing_angle = 1.0f;
   }
-  else if ((cos_theta > cos_theta_u) || (bcone.theta_o + bcone.theta_e > 
M_PI_F) ||
+  else if ((bcone.theta_o + bcone.theta_e > M_PI_F) ||
(cos_theta_minus_theta_u > cos(bcone.theta_o + bcone.theta_e))) {
 /* theta' = theta - theta_o - theta_u < theta_e */
 kernel_assert(

___
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] [18b2ec19633] geometry-nodes-simulation: Rename "Use Cache" to "Persistent Cache"

2022-12-01 Thread Hans Goudey
Commit: 18b2ec19633cdf20a289ac15c9fca62171232ded
Author: Hans Goudey
Date:   Thu Dec 1 16:32:01 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB18b2ec19633cdf20a289ac15c9fca62171232ded

Rename "Use Cache" to "Persistent Cache"

This is a temporary option anyway, the caches will be controlled in a
more unified place at the object or scene level. But for now the name
can be a bit better anyway.

===

M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc

===

diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 055a34dfe93..3390bac1385 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1555,7 +1555,7 @@ typedef struct NodeGeometrySimulationInput {
 } NodeGeometrySimulationInput;
 
 typedef struct NodeGeometrySimulationOutput {
-  int8_t use_cache;
+  int8_t use_persistent_cache;
 } NodeGeometrySimulationOutput;
 
 typedef struct NodeGeometryDistributePointsInVolume {
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 468f13d8817..42100b0dccc 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9696,8 +9696,8 @@ static void def_geo_simulation_output(StructRNA *srna)
 
   RNA_def_struct_sdna_from(srna, "NodeGeometrySimulationOutput", "storage");
 
-  prop = RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_ui_text(prop, "Use Cache", "");
+  prop = RNA_def_property(srna, "use_persistent_cache", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_ui_text(prop, "Persistent Cache", "");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
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 f11100f0eac..e1579061a69 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -26,13 +26,13 @@ static void node_declare(NodeDeclarationBuilder )
 
 static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
 {
-  uiItemR(layout, ptr, "use_cache", 0, nullptr, ICON_NONE);
+  uiItemR(layout, ptr, "use_cache", 0, IFACE_("Persistent Cache"), ICON_NONE);
 }
 
 static void node_init(bNodeTree * /*tree*/, bNode *node)
 {
   NodeGeometrySimulationOutput *data = 
MEM_cnew(__func__);
-  data->use_cache = false;
+  data->use_persistent_cache = false;
   node->storage = data;
 }
 
@@ -95,7 +95,7 @@ static void node_geo_exec(GeoNodeExecParams params)
   GeometrySet geometry_set = params.extract_input("Geometry");
   geometry_set.ensure_owns_direct_data();
   /* TODO: The "Use cache" input should probably become a "Persistent Cache" 
option. */
-  if (storage.use_cache || cache.geometry_per_frame.is_empty()) {
+  if (storage.use_persistent_cache || cache.geometry_per_frame.is_empty()) {
 /* If using the cache or there is no cached data yet, write the input in a 
new cache value. */
 cache.insert(geometry_set, scene_frame, scene_ctime);
   }

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

2022-12-01 Thread Hans Goudey
Commit: 3059f1743ee839ad469ddce07652aabf85b37336
Author: Hans Goudey
Date:   Thu Dec 1 15:45:46 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB3059f1743ee839ad469ddce07652aabf85b37336

Merge branch 'master' into geometry-nodes-simulation

===



===

diff --cc source/blender/blenkernel/BKE_node.h
index 62ddf695f94,74d6f8becd1..583993bd1ad
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -1388,11 -1386,8 +1386,11 @@@ struct TexResult
  /** \name Geometry Nodes
   * \{ */
  
 +#define GEO_NODE_SIMULATION_INPUT 1198
 +#define GEO_NODE_SIMULATION_OUTPUT 1199
 +
  #define GEO_NODE_TRIANGULATE 1000
- #define GEO_NODE_TRANSFORM 1002
+ #define GEO_NODE_TRANSFORM_GEOMETRY 1002
  #define GEO_NODE_MESH_BOOLEAN 1003
  #define GEO_NODE_OBJECT_INFO 1007
  #define GEO_NODE_JOIN_GEOMETRY 1010
diff --cc source/blender/editors/space_node/node_draw.cc
index f30c9b0d563,be778a75039..9bda8e271c8
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@@ -79,8 -77,8 +79,10 @@@
  #include "FN_field.hh"
  #include "FN_field_cpp_type.hh"
  
 +#include "GEO_fillet_curves.hh"
 +
+ #include "../interface/interface_intern.hh" /* TODO: Remove */
+ 
  #include "node_intern.hh" /* own include */
  
  namespace geo_log = blender::nodes::geo_eval_log;
@@@ -88,20 -86,6 +90,14 @@@
  using blender::GPointer;
  using blender::Vector;
  
- extern "C" {
- /* XXX interface.h */
- extern void ui_draw_dropshadow(
- const rctf *rct, float radius, float aspect, float alpha, int select);
- }
- 
 +namespace blender::ed::space_node {
 +struct SubContext {
 +  float3 color;
 +  Vector input_nodes;
 +  Vector output_nodes;
 +};
 +}  // namespace blender::ed::space_node
 +
  /**
   * This is passed to many functions which draw the node editor.
   */

___
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] [bdd71c129c8] geometry-nodes-simulation: Set "Run" input default to true

2022-12-01 Thread Hans Goudey
Commit: bdd71c129c8bee4e23015d571ab203c7cec7f330
Author: Hans Goudey
Date:   Thu Dec 1 16:34:50 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBbdd71c129c8bee4e23015d571ab203c7cec7f330

Set "Run" input default to true

===

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 e1579061a69..d8d8940fcb9 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -16,7 +16,7 @@ NODE_STORAGE_FUNCS(NodeGeometrySimulationOutput);
 
 static void node_declare(NodeDeclarationBuilder )
 {
-  b.add_input(N_("Run"));
+  b.add_input(N_("Run")).default_value(true);
   b.add_input(N_("Geometry"));
   b.add_output(N_("Started"));
   b.add_output(N_("Ended"));

___
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] [97df619be73] geometry-nodes-simulation: Move "Run" input to simulation output node

2022-12-01 Thread Hans Goudey
Commit: 97df619be73478a356ebecf91bb0b391f9cd5064
Author: Hans Goudey
Date:   Thu Dec 1 16:30:46 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB97df619be73478a356ebecf91bb0b391f9cd5064

Move "Run" input to simulation output node

It's the output node that decides whether to requiest the values
from the nodes inside the simulation, so it makes more sense
for it to be there. This is part of a general effort to have less
redundancy in the options.

===

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 2cd240570a7..3e1330b44b0 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -13,7 +13,6 @@ NODE_STORAGE_FUNCS(NodeGeometrySimulationInput);
 
 static void node_declare(NodeDeclarationBuilder )
 {
-  b.add_input(N_("Run"));
   b.add_input(N_("Geometry"));
 
   b.add_output(N_("Delta Time"));
@@ -35,9 +34,6 @@ static void node_geo_exec(GeoNodeExecParams params)
   const float scene_ctime = BKE_scene_ctime_get(scene);
   const int scene_frame = int(scene_ctime);
 
-  /* TODO: Somehow use "Run" input. We also need to pass through the 
simulation state directly to
-   * the output node on the first frame the "Run" input is true. */
-
   const GeoNodesLFUserData _data = *params.user_data();
   bke::ComputeCaches _caches = *lf_data.modifier_data->cache_per_frame;
   const bke::SimulationCache *cache = 
all_caches.lookup_context(lf_data.compute_context->hash());
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 a72d1f31983..f11100f0eac 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -16,7 +16,7 @@ NODE_STORAGE_FUNCS(NodeGeometrySimulationOutput);
 
 static void node_declare(NodeDeclarationBuilder )
 {
-  b.add_input(N_("Stop"));
+  b.add_input(N_("Run"));
   b.add_input(N_("Geometry"));
   b.add_output(N_("Started"));
   b.add_output(N_("Ended"));
@@ -38,7 +38,7 @@ static void node_init(bNodeTree * /*tree*/, bNode *node)
 
 static void node_geo_exec(GeoNodeExecParams params)
 {
-  if (params.lazy_require_input("Stop")) {
+  if (params.lazy_require_input("Run")) {
 return;
   }
 
@@ -51,7 +51,6 @@ static void node_geo_exec(GeoNodeExecParams params)
   bke::ComputeCaches _caches = *lf_data.modifier_data->cache_per_frame;
   bke::SimulationCache  = 
all_caches.ensure_for_context(lf_data.compute_context->hash());
 
-  /* TODO: Retrieve "started" from "run" socket on simulation input node? */
   if (cache.geometry_per_frame.is_empty()) {
 if (params.lazy_output_is_required("Started")) {
   params.set_output("Started", false);
@@ -66,8 +65,13 @@ static void node_geo_exec(GeoNodeExecParams params)
 }
   }
 
-  const bool stop = params.get_input("Stop");
-  if (stop) {
+  const bool run = params.get_input("Run");
+  if (run) {
+if (params.lazy_output_is_required("Ended")) {
+  params.set_output("Ended", false);
+}
+  }
+  else {
 if (params.lazy_output_is_required("Ended")) {
   params.set_output("Ended", true);
 }
@@ -77,11 +81,6 @@ static void node_geo_exec(GeoNodeExecParams params)
   return;
 }
   }
-  else {
-if (params.lazy_output_is_required("Ended")) {
-  params.set_output("Ended", false);
-}
-  }
 
   if (const bke::GeometryCacheValue *data = cache.value_at_time(scene_frame)) {
 params.set_output("Geometry", data->geometry_set);

___
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] [e29c615fb7b] soc-2022-many-lights-sampling: Cycles: remove shadow pass

2022-12-01 Thread Brecht Van Lommel
Commit: e29c615fb7bc3569deeff073bc97c7cf2d5c0137
Author: Brecht Van Lommel
Date:   Thu Dec 1 22:42:50 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBe29c615fb7bc3569deeff073bc97c7cf2d5c0137

Cycles: remove shadow pass

This was not working well in non-trivial scenes before the light tree, and now
it is even harder to make it work well. It would average the shadow with equal
weight for every light object regardless of intensity or distance, and be quite
noisy due to not working with multiple importance sampling.

We may restore this if were enough good use cases for the previous 
implementation,
but let's wait and see what the feedback is.

Some uses cases for this have been replaced by the shadow catcher passes, which
did not exist when this was initially added.

===

M   intern/cycles/blender/addon/engine.py
M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/session.cpp
M   intern/cycles/blender/sync.cpp
M   intern/cycles/kernel/data_template.h
M   intern/cycles/kernel/film/light_passes.h
M   intern/cycles/kernel/integrator/shade_surface.h
M   intern/cycles/kernel/integrator/shade_volume.h
M   intern/cycles/kernel/integrator/shadow_state_template.h
M   intern/cycles/kernel/types.h
M   intern/cycles/scene/film.cpp
M   intern/cycles/scene/pass.cpp

===

diff --git a/intern/cycles/blender/addon/engine.py 
b/intern/cycles/blender/addon/engine.py
index 4ac078ed8a5..5aa17216aa6 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -204,7 +204,6 @@ def list_render_passes(scene, srl):
 if crl.use_pass_volume_indirect:   yield ("VolumeInd", "RGB",  
'COLOR')
 if srl.use_pass_emit:  yield ("Emit",  "RGB",  
'COLOR')
 if srl.use_pass_environment:   yield ("Env",   "RGB",  
'COLOR')
-if srl.use_pass_shadow:yield ("Shadow","RGB",  
'COLOR')
 if srl.use_pass_ambient_occlusion: yield ("AO","RGB",  
'COLOR')
 if crl.use_pass_shadow_catcher:yield ("Shadow Catcher",  
"RGB",  'COLOR')
 # autopep8: on
diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index e6a88f58ce1..2705fe4fc3c 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -155,7 +155,6 @@ enum_view3d_shading_render_pass = (
 ('EMISSION', "Emission", "Show the Emission render pass"),
 ('BACKGROUND', "Background", "Show the Background render pass"),
 ('AO', "Ambient Occlusion", "Show the Ambient Occlusion render pass"),
-('SHADOW', "Shadow", "Show the Shadow render pass"),
 ('SHADOW_CATCHER', "Shadow Catcher", "Show the Shadow Catcher render 
pass"),
 
 ('', "Light", ""),
diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index 344bdccabac..d0d66d09442 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -978,7 +978,6 @@ class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, 
Panel):
 col = layout.column(heading="Other", align=True)
 col.prop(view_layer, "use_pass_emit", text="Emission")
 col.prop(view_layer, "use_pass_environment")
-col.prop(view_layer, "use_pass_shadow")
 col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient 
Occlusion")
 col.prop(cycles_view_layer, "use_pass_shadow_catcher")
 
diff --git a/intern/cycles/blender/session.cpp 
b/intern/cycles/blender/session.cpp
index 6641e2b8ac5..7dfacec8fc9 100644
--- a/intern/cycles/blender/session.cpp
+++ b/intern/cycles/blender/session.cpp
@@ -559,11 +559,6 @@ static bool bake_setup_pass(Scene *scene, const string 
_type_str, const int
  0);
 integrator->set_use_emission((bake_filter & 
BL::BakeSettings::pass_filter_EMIT) != 0);
   }
-  /* Shadow pass. */
-  else if (strcmp(bake_type, "SHADOW") == 0) {
-type = PASS_SHADOW;
-use_direct_light = true;
-  }
   /* Light component passes. */
   else if (strcmp(bake_type, "DIFFUSE") == 0) {
 if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 85a4e47c66b..b3cc4b1170e 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -624,7 +624,6 @@ static bool get_known_pass_type(BL::RenderPass _pass, 
PassType , PassMode
   MAP_PASS("Emit", PASS_EMISSION, false);
   MAP_PASS("Env", PASS_BACKGROUND, false);
   MAP_PASS("AO", PASS_AO, false);
-  MAP_PASS("Shadow", PASS_SHADOW, false);
 
   MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE, false);
   MAP_PASS("BakeDifferential", PASS_BAKE_DIFFERENTIAL, false);
diff --git 

[Bf-blender-cvs] [4fb418d40c8] soc-2022-many-lights-sampling: Cleanup: add back ccl_optional_struct_init

2022-12-01 Thread Brecht Van Lommel
Commit: 4fb418d40c8addbeda6299f763ec5c3fdcbf3759
Author: Brecht Van Lommel
Date:   Thu Dec 1 22:18:35 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB4fb418d40c8addbeda6299f763ec5c3fdcbf3759

Cleanup: add back ccl_optional_struct_init

===

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

===

diff --git a/intern/cycles/kernel/integrator/shade_volume.h 
b/intern/cycles/kernel/integrator/shade_volume.h
index f9ea6dc2cb8..1901f243ff7 100644
--- a/intern/cycles/kernel/integrator/shade_volume.h
+++ b/intern/cycles/kernel/integrator/shade_volume.h
@@ -704,7 +704,7 @@ ccl_device_forceinline bool 
integrate_volume_equiangular_sample_light(
   const uint bounce = INTEGRATOR_STATE(state, path, bounce);
   const float2 rand_light = path_state_rng_2D(kg, rng_state, PRNG_LIGHT);
 
-  LightSample ls;
+  LightSample ls ccl_optional_struct_init;
   if (!light_sample_from_volume_segment(kg,
 rand_light.x,
 rand_light.y,
@@ -761,7 +761,7 @@ ccl_device_forceinline void integrate_volume_direct_light(
* Additionally we could end up behind the light or outside a spot light 
cone, which might
* waste a sample. Though on the other hand it would be possible to prevent 
that with
* equiangular sampling restricted to a smaller sub-segment where the light 
has influence. */
-  LightSample ls;
+  LightSample ls ccl_optional_struct_init;
   {
 const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
 const uint bounce = INTEGRATOR_STATE(state, path, bounce);

___
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] [4d5e8b7caa3] master: Cleanup: Use new node identifiers when copying tree

2022-12-01 Thread Hans Goudey
Commit: 4d5e8b7caa3c7f00390212da7827ec96bd3297b2
Author: Hans Goudey
Date:   Thu Dec 1 15:27:58 2022 -0600
Branches: master
https://developer.blender.org/rB4d5e8b7caa3c7f00390212da7827ec96bd3297b2

Cleanup: Use new node identifiers when copying tree

We can avoid creating a new map and use the node vector set that
must be built anyway when updating pointers in the new tree.

===

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

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 5d6b33e810c..d349f3e87eb 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -139,36 +139,39 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, 
const ID *id_src, cons
   const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
 
   ntree_dst->runtime = MEM_new(__func__);
+  bNodeTreeRuntime _runtime = *ntree_dst->runtime;
 
-  /* in case a running nodetree is copied */
-  ntree_dst->runtime->execdata = nullptr;
-
-  Map node_map;
   Map socket_map;
 
-  ntree_dst->runtime->nodes_by_id.reserve(ntree_src->all_nodes().size());
+  dst_runtime.nodes_by_id.reserve(ntree_src->all_nodes().size());
   BLI_listbase_clear(_dst->nodes);
   LISTBASE_FOREACH (const bNode *, src_node, _src->nodes) {
 /* Don't find a unique name for every node, since they should have valid 
names already. */
 bNode *new_node = blender::bke::node_copy_with_mapping(
 ntree_dst, *src_node, flag_subdata, false, socket_map);
-node_map.add(src_node, new_node);
-ntree_dst->runtime->nodes_by_id.add_new(new_node);
+dst_runtime.nodes_by_id.add_new(new_node);
   }
 
   /* copy links */
   BLI_listbase_clear(_dst->links);
   LISTBASE_FOREACH (const bNodeLink *, src_link, _src->links) {
 bNodeLink *dst_link = (bNodeLink *)MEM_dupallocN(src_link);
-dst_link->fromnode = node_map.lookup(src_link->fromnode);
+dst_link->fromnode = 
dst_runtime.nodes_by_id.lookup_key_as(src_link->fromnode->identifier);
 dst_link->fromsock = socket_map.lookup(src_link->fromsock);
-dst_link->tonode = node_map.lookup(src_link->tonode);
+dst_link->tonode = 
dst_runtime.nodes_by_id.lookup_key_as(src_link->tonode->identifier);
 dst_link->tosock = socket_map.lookup(src_link->tosock);
 BLI_assert(dst_link->tosock);
 dst_link->tosock->link = dst_link;
 BLI_addtail(_dst->links, dst_link);
   }
 
+  /* update node->parent pointers */
+  LISTBASE_FOREACH (bNode *, new_node, _dst->nodes) {
+if (new_node->parent) {
+  new_node->parent = 
dst_runtime.nodes_by_id.lookup_key_as(new_node->parent->identifier);
+}
+  }
+
   /* copy interface sockets */
   BLI_listbase_clear(_dst->inputs);
   LISTBASE_FOREACH (const bNodeSocket *, src_socket, _src->inputs) {
@@ -199,15 +202,8 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, 
const ID *id_src, cons
 ntree_dst->previews = nullptr;
   }
 
-  /* update node->parent pointers */
-  LISTBASE_FOREACH (bNode *, new_node, _dst->nodes) {
-if (new_node->parent) {
-  new_node->parent = node_map.lookup(new_node->parent);
-}
-  }
-
   if (ntree_src->runtime->field_inferencing_interface) {
-ntree_dst->runtime->field_inferencing_interface = 
std::make_unique(
+dst_runtime.field_inferencing_interface = 
std::make_unique(
 *ntree_src->runtime->field_inferencing_interface);
   }

___
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] [b768a2bf2ff] master: Cleanup: Remove unnecessary list clearing in node tree reading

2022-12-01 Thread Hans Goudey
Commit: b768a2bf2ffc27e1af7cb7e1235f33e82e109ee8
Author: Hans Goudey
Date:   Thu Dec 1 15:14:49 2022 -0600
Branches: master
https://developer.blender.org/rBb768a2bf2ffc27e1af7cb7e1235f33e82e109ee8

Cleanup: Remove unnecessary list clearing in node tree reading

The lists were cleared a few lines below already.

===

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

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 957150441ea..5d6b33e810c 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -143,9 +143,6 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, 
const ID *id_src, cons
   /* in case a running nodetree is copied */
   ntree_dst->runtime->execdata = nullptr;
 
-  BLI_listbase_clear(_dst->nodes);
-  BLI_listbase_clear(_dst->links);
-
   Map node_map;
   Map socket_map;

___
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] [e78cd275657] master: Fix T102895: Grammar in apply scale operator

2022-12-01 Thread Hans Goudey
Commit: e78cd275657b54b9df2b75532eec717b0884ff01
Author: Hans Goudey
Date:   Thu Dec 1 15:21:59 2022 -0600
Branches: master
https://developer.blender.org/rBe78cd275657b54b9df2b75532eec717b0884ff01

Fix T102895: Grammar in apply scale operator

"Fonts" are referred to as "Text objects" now.

===

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

===

diff --git a/source/blender/editors/object/object_transform.cc 
b/source/blender/editors/object/object_transform.cc
index 7d0b62db827..ef30d40a980 100644
--- a/source/blender/editors/object/object_transform.cc
+++ b/source/blender/editors/object/object_transform.cc
@@ -746,8 +746,10 @@ static int apply_objects_internal(bContext *C,
 
 if (ob->type == OB_FONT) {
   if (apply_rot || apply_loc) {
-BKE_reportf(
-reports, RPT_ERROR, "Font's can only have scale applied: \"%s\"", 
ob->id.name + 2);
+BKE_reportf(reports,
+RPT_ERROR,
+"Text objects can only have scale applied: \"%s\"",
+ob->id.name + 2);
 changed = false;
   }
 }

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


[Bf-blender-cvs] [8842a8c4c3b] master: Cleanup: format

2022-12-01 Thread Chris Blackbourn
Commit: 8842a8c4c3b1ed175c4987657e6b26683a7f9eef
Author: Chris Blackbourn
Date:   Fri Dec 2 10:14:50 2022 +1300
Branches: master
https://developer.blender.org/rB8842a8c4c3b1ed175c4987657e6b26683a7f9eef

Cleanup: format

===

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

===

diff --git a/source/blender/blenkernel/intern/scene.cc 
b/source/blender/blenkernel/intern/scene.cc
index 830122474e1..f86292c1471 100644
--- a/source/blender/blenkernel/intern/scene.cc
+++ b/source/blender/blenkernel/intern/scene.cc
@@ -761,8 +761,7 @@ static void 
scene_foreach_layer_collection(LibraryForeachIDData *data, ListBase
  (lc->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
 IDWALK_CB_EMBEDDED :
 IDWALK_CB_NOP;
-BKE_LIB_FOREACHID_PROCESS_IDSUPER(
-data, lc->collection, cb_flag | IDWALK_CB_DIRECT_WEAK_LINK);
+BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, lc->collection, cb_flag | 
IDWALK_CB_DIRECT_WEAK_LINK);
 scene_foreach_layer_collection(data, >layer_collections);
   }
 }
@@ -835,11 +834,10 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData 
*data)
 BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, view_layer->mat_override, 
IDWALK_CB_USER);
 BKE_view_layer_synced_ensure(scene, view_layer);
 LISTBASE_FOREACH (Base *, base, 
BKE_view_layer_object_bases_get(view_layer)) {
-  BKE_LIB_FOREACHID_PROCESS_IDSUPER(data,
-base->object,
-IDWALK_CB_NOP |
-
IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE |
-IDWALK_CB_DIRECT_WEAK_LINK);
+  BKE_LIB_FOREACHID_PROCESS_IDSUPER(
+  data,
+  base->object,
+  IDWALK_CB_NOP | IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE | 
IDWALK_CB_DIRECT_WEAK_LINK);
 }
 
 BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(

___
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] [90ea1b76434] master: Nodes: Use persistent integer to identify to nodes

2022-12-01 Thread Hans Goudey
Commit: 90ea1b76434fe175e99d43da8f463f28a108d0ad
Author: Hans Goudey
Date:   Thu Dec 1 14:53:27 2022 -0600
Branches: master
https://developer.blender.org/rB90ea1b76434fe175e99d43da8f463f28a108d0ad

Nodes: Use persistent integer to identify to nodes

This patch adds an integer identifier to nodes that doesn't change when
the node name changes. This identifier can be used by different systems
to reference a node. This may be important to store caches and simulation
states per node, because otherwise those would always be invalidated
when a node name changes.

Additionally, this kind of identifier could make some things more efficient,
because with it an integer is enough to identify a node and one does not
have to store the node name.

I observed a 10% improvement in evaluation time in a file with an extreme
number of simple math nodes, due to reduced logging overhead-- from
0.226s to 0.205s.

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

===

M   source/blender/blenkernel/BKE_compute_contexts.hh
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/blenkernel/intern/compute_contexts.cc
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/node_runtime.cc
M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/blenkernel/intern/viewer_path.cc
M   source/blender/editors/include/ED_viewer_path.hh
M   source/blender/editors/space_node/node_draw.cc
M   source/blender/editors/space_node/node_geometry_attribute_search.cc
M   source/blender/editors/space_node/node_group.cc
M   source/blender/editors/util/ed_viewer_path.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesdna/DNA_viewer_path_types.h
M   source/blender/modifiers/intern/MOD_nodes.cc
M   source/blender/nodes/NOD_geometry_nodes_log.hh
M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc
M   source/blender/nodes/intern/geometry_nodes_log.cc
M   source/blender/nodes/intern/node_geometry_exec.cc
M   source/blender/nodes/shader/node_shader_tree.cc

===

diff --git a/source/blender/blenkernel/BKE_compute_contexts.hh 
b/source/blender/blenkernel/BKE_compute_contexts.hh
index a8f0022f49b..8e4a524 100644
--- a/source/blender/blenkernel/BKE_compute_contexts.hh
+++ b/source/blender/blenkernel/BKE_compute_contexts.hh
@@ -8,6 +8,8 @@
 
 #include "BLI_compute_context.hh"
 
+struct bNode;
+
 namespace blender::bke {
 
 class ModifierComputeContext : public ComputeContext {
@@ -32,12 +34,20 @@ class NodeGroupComputeContext : public ComputeContext {
  private:
   static constexpr const char *s_static_type = "NODE_GROUP";
 
-  std::string node_name_;
+  int32_t node_id_;
+
+#ifdef DEBUG
+  std::string debug_node_name_;
+#endif
 
  public:
-  NodeGroupComputeContext(const ComputeContext *parent, std::string node_name);
+  NodeGroupComputeContext(const ComputeContext *parent, int32_t node_id);
+  NodeGroupComputeContext(const ComputeContext *parent, const bNode );
 
-  StringRefNull node_name() const;
+  int32_t node_id() const
+  {
+return node_id_;
+  }
 
  private:
   void print_current_in_line(std::ostream ) const override;
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 2cd2fa9ac62..74d6f8becd1 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -668,6 +668,7 @@ void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode 
*node);
  * Find the first available, non-duplicate name for a given node.
  */
 void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
+void nodeUniqueID(struct bNodeTree *ntree, struct bNode *node);
 
 /**
  * Delete node, associated animation data and ID user count.
@@ -687,16 +688,17 @@ namespace blender::bke {
 
 /**
  * \note keeps socket list order identical, for copying links.
- * \note `unique_name` should usually be true, unless the \a dst_tree is 
temporary,
- * or the names can already be assumed valid.
+ * \param use_unique: If true, make sure the node's identifier and name are 
unique in the new
+ * tree. Must be *true* if the \a dst_tree had nodes that weren't in the 
source node's tree.
+ * Must be *false* when simply copying a node tree, so that identifiers don't 
change.
  */
 bNode *node_copy_with_mapping(bNodeTree *dst_tree,
   const bNode _src,
   int flag,
-  bool unique_name,
+  bool use_unique,
   Map 
_socket_map);
 
-bNode *node_copy(bNodeTree *dst_tree, const bNode _node, int flag, bool 
unique_name);
+bNode *node_copy(bNodeTree *dst_tree, const bNode _node, int flag, bool 
use_unique);
 
 }  // namespace blender::bke
 

[Bf-blender-cvs] [aaece0279fe] soc-2022-many-lights-sampling: Fix mistake in previous commit (pass randu by value), some code tweaks

2022-12-01 Thread Brecht Van Lommel
Commit: aaece0279feb8da06ab680ab31f0cc350dd94fc5
Author: Brecht Van Lommel
Date:   Thu Dec 1 21:43:55 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBaaece0279feb8da06ab680ab31f0cc350dd94fc5

Fix mistake in previous commit (pass randu by value), some code tweaks

===

M   intern/cycles/kernel/integrator/shade_volume.h
M   intern/cycles/kernel/light/distribution.h
M   intern/cycles/kernel/light/sample.h
M   intern/cycles/kernel/light/tree.h
M   intern/cycles/scene/light.cpp

===

diff --git a/intern/cycles/kernel/integrator/shade_volume.h 
b/intern/cycles/kernel/integrator/shade_volume.h
index dbc28a2de0f..f9ea6dc2cb8 100644
--- a/intern/cycles/kernel/integrator/shade_volume.h
+++ b/intern/cycles/kernel/integrator/shade_volume.h
@@ -1013,7 +1013,6 @@ ccl_device VolumeIntegrateEvent 
volume_integrate(KernelGlobals kg,
 
   /* Sample light ahead of volume stepping, for equiangular sampling. */
   /* TODO: distant lights are ignored now, but could instead use even 
distribution. */
-  LightSample ls ccl_optional_struct_init;
   const bool need_light_sample = !(INTEGRATOR_STATE(state, path, flag) & 
PATH_RAY_TERMINATE);
   float3 equiangular_P = zero_float3();
   const bool have_equiangular_sample = need_light_sample &&
diff --git a/intern/cycles/kernel/light/distribution.h 
b/intern/cycles/kernel/light/distribution.h
index adf01faa68b..8afc15757db 100644
--- a/intern/cycles/kernel/light/distribution.h
+++ b/intern/cycles/kernel/light/distribution.h
@@ -11,7 +11,7 @@ CCL_NAMESPACE_BEGIN
 /* Simple CDF based sampling over all lights in the scene, without taking into
  * account shading position or normal. */
 
-ccl_device int light_distribution_sample(KernelGlobals kg, ccl_private float 
*randu)
+ccl_device int light_distribution_sample(KernelGlobals kg, ccl_private float 
)
 {
   /* This is basically std::upper_bound as used by PBRT, to find a point light 
or
* triangle to emit from, proportional to area. a good improvement would be 
to
@@ -19,7 +19,7 @@ ccl_device int light_distribution_sample(KernelGlobals kg, 
ccl_private float *ra
* arbitrary shaders. */
   int first = 0;
   int len = kernel_data.integrator.num_distribution + 1;
-  float r = *randu;
+  float r = randu;
 
   do {
 int half_len = len >> 1;
@@ -42,33 +42,32 @@ ccl_device int light_distribution_sample(KernelGlobals kg, 
ccl_private float *ra
* each area light be stratified as well. */
   float distr_min = kernel_data_fetch(light_distribution, index).totarea;
   float distr_max = kernel_data_fetch(light_distribution, index + 1).totarea;
-  *randu = (r - distr_min) / (distr_max - distr_min);
+  randu = (r - distr_min) / (distr_max - distr_min);
 
   return index;
 }
 
-template
 ccl_device_noinline bool light_distribution_sample(KernelGlobals kg,
-   float randu,
+   ccl_private float ,
const float randv,
const float time,
const float3 P,
const int bounce,
const uint32_t path_flag,
-   ccl_private int 
*emitter_object,
-   ccl_private int 
*emitter_prim,
-   ccl_private int 
*emitter_shader_flag,
-   ccl_private float 
*emitter_pdf_selection)
+   ccl_private int 
_object,
+   ccl_private int 
_prim,
+   ccl_private int 
_shader_flag,
+   ccl_private float 
_pdf_selection)
 {
   /* Sample light index from distribution. */
-  const int index = light_distribution_sample(kg, );
+  const int index = light_distribution_sample(kg, randu);
   ccl_global const KernelLightDistribution *kdistribution = 
_data_fetch(light_distribution,

index);
 
-  *emitter_object = kdistribution->mesh_light.object_id;
-  *emitter_prim = kdistribution->prim;
-  *emitter_shader_flag = kdistribution->mesh_light.shader_flag;
-  *emitter_pdf_selection = kernel_data.integrator.distribution_pdf_lights;
+  emitter_object = kdistribution->mesh_light.object_id;
+  emitter_prim = kdistribution->prim;
+  emitter_shader_flag = kdistribution->mesh_light.shader_flag;
+  emitter_pdf_selection = kernel_data.integrator.distribution_pdf_lights;
 
   return true;
 }
diff --git 

[Bf-blender-cvs] [4c1b250e172] master: Fix T102893: Assert Opening File Browser (Win32)

2022-12-01 Thread Harley Acheson
Commit: 4c1b250e172a99c44c7da20f20ea38970ec40340
Author: Harley Acheson
Date:   Thu Dec 1 12:25:49 2022 -0800
Branches: master
https://developer.blender.org/rB4c1b250e172a99c44c7da20f20ea38970ec40340

Fix T102893: Assert Opening File Browser (Win32)

Fix debug assert opening File Browser on Windows platform.

See D16672 for more details.

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

Reviewed by Julian Eisel

===

M   source/blender/editors/space_file/filelist.cc

===

diff --git a/source/blender/editors/space_file/filelist.cc 
b/source/blender/editors/space_file/filelist.cc
index 3374da082d8..44bfa7fcbaf 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -2942,7 +2942,7 @@ static char *current_relpath_append(const FileListReadJob 
*job_params, const cha
 return BLI_strdup(filename);
   }
 
-  BLI_assert(relbase[strlen(relbase) - 1] == SEP);
+  BLI_assert(ELEM(relbase[strlen(relbase) - 1], SEP, ALTSEP));
   BLI_assert(BLI_path_is_rel(relbase));
 
   char relpath[FILE_MAX_LIBEXTRA];

___
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] [ce4ab25a57e] soc-2022-many-lights-sampling: Fix CUDA error in wdas_cloud by refactoring code

2022-12-01 Thread Brecht Van Lommel
Commit: ce4ab25a57ee07f6e2a7322247c17ff97d277e4e
Author: Brecht Van Lommel
Date:   Wed Nov 30 22:41:24 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBce4ab25a57ee07f6e2a7322247c17ff97d277e4e

Fix CUDA error in wdas_cloud by refactoring code

This looks like a compiler bug as it does not happen with -O0, and trying to
identify any particular line of code as causing the issue seems impossible.

Instead do some random changes that seems to sidestep the issue:
* Changing inline flags in light tree
* Reduce lifetime of LightSample
* Share emitter sampling between light tree and distribution

===

M   intern/cycles/kernel/integrator/shade_volume.h
M   intern/cycles/kernel/light/distribution.h
M   intern/cycles/kernel/light/sample.h
M   intern/cycles/kernel/light/tree.h
M   intern/cycles/kernel/light/triangle.h
M   intern/cycles/kernel/types.h
M   intern/cycles/scene/light.cpp

===

diff --git a/intern/cycles/kernel/integrator/shade_volume.h 
b/intern/cycles/kernel/integrator/shade_volume.h
index a23efd5738b..dbc28a2de0f 100644
--- a/intern/cycles/kernel/integrator/shade_volume.h
+++ b/intern/cycles/kernel/integrator/shade_volume.h
@@ -685,15 +685,14 @@ ccl_device_forceinline void 
volume_integrate_heterogeneous(
 #  endif /* __DENOISING_FEATURES__ */
 }
 
-/* Path tracing: sample point on light and evaluate light shader, then
- * queue shadow ray to be traced. */
-ccl_device_forceinline bool integrate_volume_sample_light(
+/* Path tracing: sample point on light for equiangular sampling. */
+ccl_device_forceinline bool integrate_volume_equiangular_sample_light(
 KernelGlobals kg,
 IntegratorState state,
 ccl_private const Ray *ccl_restrict ray,
 ccl_private const ShaderData *ccl_restrict sd,
 ccl_private const RNGState *ccl_restrict rng_state,
-ccl_private LightSample *ccl_restrict ls)
+ccl_private float3 *ccl_restrict P)
 {
   /* Test if there is a light or BSDF that needs direct light. */
   if (!kernel_data.integrator.use_direct_light) {
@@ -705,6 +704,7 @@ ccl_device_forceinline bool integrate_volume_sample_light(
   const uint bounce = INTEGRATOR_STATE(state, path, bounce);
   const float2 rand_light = path_state_rng_2D(kg, rng_state, PRNG_LIGHT);
 
+  LightSample ls;
   if (!light_sample_from_volume_segment(kg,
 rand_light.x,
 rand_light.y,
@@ -714,14 +714,20 @@ ccl_device_forceinline bool integrate_volume_sample_light(
 ray->tmax - ray->tmin,
 bounce,
 path_flag,
-ls)) {
+)) {
+return false;
+  }
+
+  if (ls.shader & SHADER_EXCLUDE_SCATTER) {
 return false;
   }
 
-  if (ls->shader & SHADER_EXCLUDE_SCATTER) {
+  if (ls.t == FLT_MAX) {
 return false;
   }
 
+  *P = ls.P;
+
   return true;
 }
 
@@ -737,8 +743,7 @@ ccl_device_forceinline void integrate_volume_direct_light(
 #  ifdef __PATH_GUIDING__
 ccl_private const Spectrum unlit_throughput,
 #  endif
-ccl_private const Spectrum throughput,
-ccl_private LightSample *ccl_restrict ls)
+ccl_private const Spectrum throughput)
 {
   PROFILING_INIT(kg, PROFILING_SHADE_VOLUME_DIRECT_LIGHT);
 
@@ -756,6 +761,7 @@ ccl_device_forceinline void integrate_volume_direct_light(
* Additionally we could end up behind the light or outside a spot light 
cone, which might
* waste a sample. Though on the other hand it would be possible to prevent 
that with
* equiangular sampling restricted to a smaller sub-segment where the light 
has influence. */
+  LightSample ls;
   {
 const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
 const uint bounce = INTEGRATOR_STATE(state, path, bounce);
@@ -771,12 +777,12 @@ ccl_device_forceinline void integrate_volume_direct_light(
 SD_BSDF_HAS_TRANSMISSION,
 bounce,
 path_flag,
-ls)) {
+)) {
   return;
 }
   }
 
-  if (ls->shader & SHADER_EXCLUDE_SCATTER) {
+  if (ls.shader & SHADER_EXCLUDE_SCATTER) {
 return;
   }
 
@@ -788,32 +794,32 @@ ccl_device_forceinline void integrate_volume_direct_light(
* non-constant light sources. */
   ShaderDataTinyStorage emission_sd_storage;
   ccl_private ShaderData *emission_sd = AS_SHADER_DATA(_sd_storage);
-  const Spectrum light_eval = light_sample_shader_eval(kg, state, emission_sd, 
ls, sd->time);
+  const Spectrum light_eval = light_sample_shader_eval(kg, state, emission_sd, 
, sd->time);
   if (is_zero(light_eval)) {
 return;
   }
 
   /* Evaluate BSDF. */
 

[Bf-blender-cvs] [cf9f4952830] refactor-mesh-corner-normals-lazy: fix some compilation errors

2022-12-01 Thread Jacques Lucke
Commit: cf9f4952830b56266b5a772ca22bc8db0b447457
Author: Jacques Lucke
Date:   Thu Dec 1 19:47:15 2022 +0100
Branches: refactor-mesh-corner-normals-lazy
https://developer.blender.org/rBcf9f4952830b56266b5a772ca22bc8db0b447457

fix some compilation errors

===

M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/makesrna/intern/rna_mesh.c

===

diff --git a/source/blender/blenkernel/intern/mesh_normals.cc 
b/source/blender/blenkernel/intern/mesh_normals.cc
index cb1ba9efafd..9364918ddb3 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -525,7 +525,7 @@ const float (*BKE_mesh_poly_normals_ensure(const Mesh 
*mesh))[3]
 const float (*BKE_mesh_corner_normals_ensure(const Mesh *mesh))[3]
 {
   if (!BKE_mesh_corner_normals_are_dirty(mesh)) {
-BLI_assert(mesh->runtime->corner_normals != nullptr || mesh->totcorner == 
0);
+BLI_assert(mesh->runtime->corner_normals != nullptr || mesh->totloop == 0);
 return mesh->runtime->corner_normals;
   }
 
diff --git a/source/blender/makesrna/intern/rna_mesh.c 
b/source/blender/makesrna/intern/rna_mesh.c
index 8d0460d8578..f30beb5736d 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2434,6 +2434,7 @@ static void rna_def_mloop(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Index", "Index of this loop");
 
   prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_array(prop, 3);
   RNA_def_property_range(prop, -1.0f, 1.0f);
   RNA_def_property_float_funcs(prop, "rna_MeshLoop_normal_get", NULL, NULL);

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


[Bf-blender-cvs] [2a1eb0ca175] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal

2022-12-01 Thread Antonio Vazquez
Commit: 2a1eb0ca175cbeefa3f98560d3d9937610eac73a
Author: Antonio Vazquez
Date:   Thu Dec 1 19:38:30 2022 +0100
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB2a1eb0ca175cbeefa3f98560d3d9937610eac73a

Merge branch 'master' into gpencil-new-data-proposal

===



===



___
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] [30502bddc0d] refactor-mesh-corner-normals-lazy: Merge branch 'master' into refactor-mesh-corner-normals-lazy

2022-12-01 Thread Jacques Lucke
Commit: 30502bddc0dca8b790e943e313028792158c231d
Author: Jacques Lucke
Date:   Thu Dec 1 18:46:48 2022 +0100
Branches: refactor-mesh-corner-normals-lazy
https://developer.blender.org/rB30502bddc0dca8b790e943e313028792158c231d

Merge branch 'master' into refactor-mesh-corner-normals-lazy

===



===



___
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] [09098e6539c] tracking_tools: Merge branch 'master' into tracking_tools

2022-12-01 Thread Sergey Sharybin
Commit: 09098e6539c23fad29bd166149233ba25a31c3f4
Author: Sergey Sharybin
Date:   Thu Dec 1 16:40:52 2022 +0100
Branches: tracking_tools
https://developer.blender.org/rB09098e6539c23fad29bd166149233ba25a31c3f4

Merge branch 'master' into tracking_tools

===



===

diff --cc release/scripts/startup/bl_ui/space_clip.py
index 6477d36b845,fd46fe3099e..8d2200f0e25
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@@ -2,9 -2,13 +2,12 @@@
  
  import bpy
  from bpy.types import Panel, Header, Menu, UIList
- from bpy.app.translations import pgettext_iface as iface_
+ from bpy.app.translations import (
+ pgettext_iface as iface_,
+ contexts as i18n_contexts,
+ )
  from bl_ui.utils import PresetPanel
  from bl_ui.properties_grease_pencil_common import (
 -AnnotationDrawingToolsPanel,
  AnnotationDataPanel,
  )
  
@@@ -241,13 -166,14 +244,15 @@@ class CLIP_HT_header(Header)
  
  if sc.view == 'CLIP':
  r = active_object.reconstruction
 -
  if r.is_valid and sc.view == 'CLIP':
- layout.label(text="Solve error: %.2f px" % 
(r.average_error))
+ layout.label(text=iface_("Solve error: %.2f px") %
+  (r.average_error),
+  translate=False)
  
 +object_icon = 'CAMERA_DATA' if active_object.is_camera else 
'OBJECT_DATA'
 +
  row = layout.row()
 -row.prop(sc, "pivot_point", text="", icon_only=True)
 +row.popover(panel='CLIP_PT_objects', text=active_object.name, 
icon=object_icon)
  row = layout.row(align=True)
  icon = 'LOCKED' if sc.lock_selection else 'UNLOCKED'
  row.operator("clip.lock_selection_toggle", icon=icon, 
text="", depress=sc.lock_selection)
diff --cc source/blender/blenloader/intern/versioning_300.cc
index df0dae82474,85078a9902d..bf6a9c30dfc
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@@ -3628,32 -3720,17 +3720,45 @@@ void blo_do_versions_300(FileData *fd, 
{
  /* Keep this block, even when empty. */
  
+ LISTBASE_FOREACH (bNodeTree *, ntree, >nodetrees) {
+   if (ntree->type == NTREE_GEOMETRY) {
+ version_node_socket_name(ntree, GEO_NODE_COLLECTION_INFO, "Geometry", 
"Instances");
+   }
+ }
+ 
+ /* UVSeam fixing distance. */
+ if (!DNA_struct_elem_find(fd->filesdna, "Image", "short", "seam_margin")) 
{
+   LISTBASE_FOREACH (Image *, image, >images) {
+ image->seam_margin = 8;
+   }
+ }
++
 +{
 +  LISTBASE_FOREACH (bScreen *, screen, >screens) {
 +LISTBASE_FOREACH (ScrArea *, area, >areabase) {
 +  LISTBASE_FOREACH (SpaceLink *, sl, >spacedata) {
 +if (sl->spacetype != SPACE_CLIP) {
 +  continue;
 +}
 +
 +SpaceClip *space_clip = (SpaceClip *)sl;
 +ListBase *regionbase = (sl == area->spacedata.first) ? 
>regionbase :
 +   
>regionbase;
 +
 +ARegion *new_tool_header = do_versions_add_region_if_not_found(
 +regionbase, RGN_TYPE_TOOL_HEADER, "tool header", 
RGN_TYPE_HEADER);
 +
 +if (new_tool_header != NULL) {
 +  new_tool_header->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? 
RGN_ALIGN_BOTTOM :
 + 
RGN_ALIGN_TOP;
 +
 +  if (space_clip->view != SC_VIEW_CLIP) {
 +new_tool_header->flag |= RGN_FLAG_HIDDEN;
 +  }
 +}
 +  }
 +}
 +  }
 +}
}
 -}
 +}
diff --cc source/blender/blenloader/intern/versioning_defaults.cc
index 000,3ae4d5479f0..5bf273d782e
mode 00,100644..100644
--- a/source/blender/blenloader/intern/versioning_defaults.cc
+++ b/source/blender/blenloader/intern/versioning_defaults.cc
@@@ -1,0 -1,790 +1,793 @@@
+ /* SPDX-License-Identifier: GPL-2.0-or-later */
+ 
+ /** \file
+  * \ingroup blenloader
+  *
+  * This file handles updating the `startup.blend`, this is used when reading 
old files.
+  *
+  * Unlike regular versioning this makes changes that ensure the startup file
+  * has brushes and other presets setup to take advantage of newer features.
+  *
+  * To update preference defaults see `userdef_default.c`.
+  */
+ 
+ #include "MEM_guardedalloc.h"
+ 
+ #include "BLI_listbase.h"
+ #include "BLI_math.h"
+ #include "BLI_math_vec_types.hh"
+ #include "BLI_string.h"
+ #include "BLI_system.h"
+ #include "BLI_utildefines.h"
+ 
+ #include "DNA_camera_types.h"
+ #include "DNA_curveprofile_types.h"
+ #include "DNA_gpencil_types.h"
+ #include "DNA_light_types.h"
+ #include 

[Bf-blender-cvs] [25501983bb4] master: Cleanup: Spelling mistake in comment

2022-12-01 Thread Sergey Sharybin
Commit: 25501983bb4d032b25e9518d09230c6234c96da9
Author: Sergey Sharybin
Date:   Thu Dec 1 16:29:20 2022 +0100
Branches: master
https://developer.blender.org/rB25501983bb4d032b25e9518d09230c6234c96da9

Cleanup: Spelling mistake in comment

===

M   source/blender/editors/space_clip/tracking_select.c

===

diff --git a/source/blender/editors/space_clip/tracking_select.c 
b/source/blender/editors/space_clip/tracking_select.c
index 3637c2f0028..507f61ad6af 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -454,7 +454,7 @@ bool ed_tracking_plane_track_pick_can_slide(const 
PlaneTrackPick *pick)
 /** \} */
 
 /*  */
-/** \name Point closest to point or plane track.
+/** \name Pick closest point or plane track.
  * \{ */
 
 BLI_INLINE TrackingPick tracking_pick_make_null(void)

___
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] [f95768d1e07] blender-v3.4-release: Update THIRD-PARTY-LICENSES.txt for Blender 3.4.

2022-12-01 Thread Thomas Dinges
Commit: f95768d1e07bf2f25145cacab4c16dcb43a704bf
Author: Thomas Dinges
Date:   Thu Dec 1 15:21:43 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBf95768d1e07bf2f25145cacab4c16dcb43a704bf

Update THIRD-PARTY-LICENSES.txt for Blender 3.4.

===

M   release/license/THIRD-PARTY-LICENSES.txt

===

diff --git a/release/license/THIRD-PARTY-LICENSES.txt 
b/release/license/THIRD-PARTY-LICENSES.txt
index e0ac2bdf226..e574f74e27b 100644
--- a/release/license/THIRD-PARTY-LICENSES.txt
+++ b/release/license/THIRD-PARTY-LICENSES.txt
@@ -23,14 +23,16 @@ PERFORMANCE OF THIS SOFTWARE.
 ** Cuda Wrangler; version cbf465b -- https://github.com/CudaWrangler/cuew
 ** Draco; version 1.3.6 -- https://google.github.io/draco/
 ** Embree; version 3.13.4 -- https://github.com/embree/embree
-** Intel® Open Path Guiding Library; version v0.3.1-beta --
+** Intel(R) oneAPI DPC++ compiler; version 20221019 --
+https://github.com/intel/llvm#oneapi-dpc-compiler
+** Intel® Open Path Guiding Library; version v0.4.1-beta --
 http://www.openpgl.org/
 ** Mantaflow; version 0.13 -- http://mantaflow.com/
 ** oneAPI Threading Building Block; version 2020_U3 --
 https://software.intel.com/en-us/oneapi/onetbb
 ** OpenCL Wrangler; version 27a6867 -- https://github.com/OpenCLWrangler/clew
 ** OpenImageDenoise; version 1.4.3 -- https://www.openimagedenoise.org/
-** OpenSSL; version 1.1.1 -- https://www.openssl.org/
+** OpenSSL; version 1.1.1q -- https://www.openssl.org/
 ** OpenXR SDK; version 1.0.17 -- https://khronos.org/openxr
 ** RangeTree; version 40ebed8aa209 -- https://github.com/ideasman42/rangetree-c
 ** SDL Extension Wrangler; version 15edf8e --
@@ -242,6 +244,8 @@ limitations under the License.
 Copyright 2018 The Draco Authors
 * For Embree see also this required NOTICE:
 Copyright 2009-2020 Intel Corporation
+* For Intel(R) oneAPI DPC++ compiler see also this required NOTICE:
+Copyright (C) 2021 Intel Corporation
 * For Intel® Open Path Guiding Library see also this required NOTICE:
 Copyright 2020 Intel Corporation.
 * For Mantaflow see also this required NOTICE:
@@ -273,7 +277,7 @@ limitations under the License.
 Copyright (c) 2016, Alliance for Open Media. All rights reserved.
 ** NASM; version 2.15.02 -- https://www.nasm.us/
 Contributions since 2008-12-15 are Copyright Intel Corporation.
-** OpenJPEG; version 2.4.0 -- https://github.com/uclouvain/openjpeg
+** OpenJPEG; version 2.5.0 -- https://github.com/uclouvain/openjpeg
 Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
 Copyright (c) 2002-2014, Professor Benoit Macq
 Copyright (c) 2003-2014, Antonin Descampe
@@ -330,7 +334,7 @@ Copyright Intel Corporation
 Copyright (c) 2005-2021, NumPy Developers.
 ** Ogg; version 1.3.5 -- https://www.xiph.org/ogg/
 COPYRIGHT (C) 1994-2019 by the Xiph.Org Foundation https://www.xiph.org/
-** Open Shading Language; version 1.11.17.0 --
+** Open Shading Language; version 1.12.6.2 --
 https://github.com/imageworks/OpenShadingLanguage
 Copyright Contributors to the Open Shading Language project.
 ** OpenColorIO; version 2.1.1 --
@@ -339,7 +343,7 @@ Copyright Contributors to the OpenColorIO Project.
 ** OpenEXR; version 3.1.5 --
 https://github.com/AcademySoftwareFoundation/openexr
 Copyright Contributors to the OpenEXR Project. All rights reserved.
-** OpenImageIO; version 2.3.13.0 -- http://www.openimageio.org
+** OpenImageIO; version 2.3.20.0 -- http://www.openimageio.org
 Copyright (c) 2008-present by Contributors to the OpenImageIO project. All
 Rights Reserved.
 ** Pystring; version 1.1.3 -- https://github.com/imageworks/pystring
@@ -1183,7 +1187,7 @@ Copyright (C) 2003-2021 x264 project
 ** miniLZO; version 2.08 -- http://www.oberhumer.com/opensource/lzo/
 LZO and miniLZO are Copyright (C) 1996-2014 Markus Franz Xaver Oberhumer
 All Rights Reserved.
-** The FreeType Project; version 2.11.1 --
+** The FreeType Project; version 2.12.1 --
 https://sourceforge.net/projects/freetype
 Copyright (C) 1996-2020 by David Turner, Robert Wilhelm, and Werner Lemberg.
 ** X Drag and Drop; version 2000-08-08 --
@@ -2186,8 +2190,10 @@ of this License. But first, please read http://ffmpeg.org/
+** FFmpeg; version 5.1.2 -- http://ffmpeg.org/
 -
+** Libsndfile; version 1.1.0 -- http://libsndfile.github.io/libsndfile/
+Copyright (C) 2011-2016 Erik de Castro Lopo 
 
 GNU LESSER GENERAL PUBLIC LICENSE
 
@@ -2675,171 +2681,6 @@ That's all there is to it!
 
 --
 
-** Libsndfile; version 1.0.28 -- http://www.mega-nerd.com/libsndfile/
-Copyright (C) 2011-2016 Erik de Castro Lopo 
-
-GNU LESSER GENERAL PUBLIC LICENSE
-
-Version 3, 29 June 2007
-
-Copyright (C) 2007 Free Software Foundation, Inc. 
-
-Everyone is permitted to copy and distribute verbatim copies of this license
-document, but changing it is not allowed.
-
-This version of the GNU Lesser General Public License 

[Bf-blender-cvs] [b132e3b3ce1] master: Cycles: use GPU module for viewport display

2022-12-01 Thread Jason Fielder
Commit: b132e3b3ce1c5ecc836d22f4c4cba90e0ed2edcc
Author: Jason Fielder
Date:   Thu Dec 1 15:33:54 2022 +0100
Branches: master
https://developer.blender.org/rBb132e3b3ce1c5ecc836d22f4c4cba90e0ed2edcc

Cycles: use GPU module for viewport display

To make GPU backends other than OpenGL work. Adds required pixel buffer and
fence objects to GPU module.

Authored by Apple: Michael Parkin-White

Ref T96261
Ref T92212

Reviewed By: fclem, brecht

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

===

M   intern/cycles/blender/display_driver.cpp
M   intern/cycles/blender/display_driver.h
M   source/blender/gpu/GPU_shader.h
M   source/blender/gpu/GPU_state.h
M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/intern/gpu_backend.hh
M   source/blender/gpu/intern/gpu_shader.cc
M   source/blender/gpu/intern/gpu_state.cc
M   source/blender/gpu/intern/gpu_state_private.hh
M   source/blender/gpu/intern/gpu_texture.cc
M   source/blender/gpu/intern/gpu_texture_private.hh
M   source/blender/gpu/metal/mtl_backend.hh
M   source/blender/gpu/metal/mtl_backend.mm
M   source/blender/gpu/metal/mtl_command_buffer.mm
M   source/blender/gpu/metal/mtl_context.hh
M   source/blender/gpu/metal/mtl_state.hh
M   source/blender/gpu/metal/mtl_state.mm
M   source/blender/gpu/metal/mtl_texture.hh
M   source/blender/gpu/metal/mtl_texture.mm
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/opengl/gl_state.cc
M   source/blender/gpu/opengl/gl_state.hh
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/gpu/opengl/gl_texture.hh
M   source/blender/render/RE_engine.h
M   source/blender/render/intern/engine.cc

===

diff --git a/intern/cycles/blender/display_driver.cpp 
b/intern/cycles/blender/display_driver.cpp
index e2be4f85a9b..2469046eccf 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -5,9 +5,14 @@
 
 #include "device/device.h"
 #include "util/log.h"
+#include "util/math.h"
 #include "util/opengl.h"
 
-#include "GPU_platform.h"
+#include "GPU_context.h"
+#include "GPU_immediate.h"
+#include "GPU_shader.h"
+#include "GPU_state.h"
+#include "GPU_texture.h"
 
 #include "RE_engine.h"
 
@@ -30,8 +35,9 @@ unique_ptr 
BlenderDisplayShader::create(BL::RenderEngine &
 int BlenderDisplayShader::get_position_attrib_location()
 {
   if (position_attribute_location_ == -1) {
-const uint shader_program = get_shader_program();
-position_attribute_location_ = glGetAttribLocation(shader_program, 
position_attribute_name);
+GPUShader *shader_program = get_shader_program();
+position_attribute_location_ = GPU_shader_get_attribute(shader_program,
+
position_attribute_name);
   }
   return position_attribute_location_;
 }
@@ -39,8 +45,9 @@ int BlenderDisplayShader::get_position_attrib_location()
 int BlenderDisplayShader::get_tex_coord_attrib_location()
 {
   if (tex_coord_attribute_location_ == -1) {
-const uint shader_program = get_shader_program();
-tex_coord_attribute_location_ = glGetAttribLocation(shader_program, 
tex_coord_attribute_name);
+GPUShader *shader_program = get_shader_program();
+tex_coord_attribute_location_ = GPU_shader_get_attribute(shader_program,
+ 
tex_coord_attribute_name);
   }
   return tex_coord_attribute_location_;
 }
@@ -79,100 +86,42 @@ static const char *FALLBACK_FRAGMENT_SHADER =
 "   fragColor = texture(image_texture, texCoord_interp);\n"
 "}\n\0";
 
-static void shader_print_errors(const char *task, const char *log, const char 
*code)
+static GPUShader *compile_fallback_shader(void)
 {
-  LOG(ERROR) << "Shader: " << task << " error:";
-  LOG(ERROR) << "= shader string ";
-
-  stringstream stream(code);
-  string partial;
-
-  int line = 1;
-  while (getline(stream, partial, '\n')) {
-if (line < 10) {
-  LOG(ERROR) << " " << line << " " << partial;
-}
-else {
-  LOG(ERROR) << line << " " << partial;
-}
-line++;
-  }
-  LOG(ERROR) << log;
-}
-
-static int compile_fallback_shader(void)
-{
-  const struct Shader {
-const char *source;
-const GLenum type;
-  } shaders[2] = {{FALLBACK_VERTEX_SHADER, GL_VERTEX_SHADER},
-  {FALLBACK_FRAGMENT_SHADER, GL_FRAGMENT_SHADER}};
-
-  const GLuint program = glCreateProgram();
-
-  for (int i = 0; i < 2; i++) {
-const GLuint shader = glCreateShader(shaders[i].type);
-
-string source_str = shaders[i].source;
-const char *c_str = source_str.c_str();
-
-glShaderSource(shader, 1, _str, NULL);
-glCompileShader(shader);
-
-GLint compile_status;
-glGetShaderiv(shader, GL_COMPILE_STATUS, _status);
-
-if (!compile_status) {
-  

[Bf-blender-cvs] [009f7de619e] master: Cleanup: use better matching integer types for graphics interop handle

2022-12-01 Thread Brecht Van Lommel
Commit: 009f7de619e62b9415fa09f4ee72ecb4b8fbb9b9
Author: Brecht Van Lommel
Date:   Thu Dec 1 15:42:04 2022 +0100
Branches: master
https://developer.blender.org/rB009f7de619e62b9415fa09f4ee72ecb4b8fbb9b9

Cleanup: use better matching integer types for graphics interop handle

Ref D16042

===

M   intern/cycles/blender/display_driver.cpp
M   intern/cycles/device/cuda/graphics_interop.h
M   intern/cycles/device/hip/graphics_interop.h
M   intern/cycles/session/display_driver.h
M   source/blender/gpu/opengl/gl_texture.cc

===

diff --git a/intern/cycles/blender/display_driver.cpp 
b/intern/cycles/blender/display_driver.cpp
index 2469046eccf..883310e13ae 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -679,7 +679,7 @@ BlenderDisplayDriver::GraphicsInterop 
BlenderDisplayDriver::graphics_interop_get
 
   interop_dst.buffer_width = tiles_->current_tile.buffer_object.width;
   interop_dst.buffer_height = tiles_->current_tile.buffer_object.height;
-  interop_dst.opengl_pbo_id = (int)GPU_pixel_buffer_get_native_handle(
+  interop_dst.opengl_pbo_id = GPU_pixel_buffer_get_native_handle(
   tiles_->current_tile.buffer_object.gpu_pixel_buffer);
 
   return interop_dst;
diff --git a/intern/cycles/device/cuda/graphics_interop.h 
b/intern/cycles/device/cuda/graphics_interop.h
index c6b30b1a10c..067ae63d296 100644
--- a/intern/cycles/device/cuda/graphics_interop.h
+++ b/intern/cycles/device/cuda/graphics_interop.h
@@ -38,7 +38,7 @@ class CUDADeviceGraphicsInterop : public 
DeviceGraphicsInterop {
   CUDADevice *device_ = nullptr;
 
   /* OpenGL PBO which is currently registered as the destination for the CUDA 
buffer. */
-  uint opengl_pbo_id_ = 0;
+  int64_t opengl_pbo_id_ = 0;
   /* Buffer area in pixels of the corresponding PBO. */
   int64_t buffer_area_ = 0;
 
diff --git a/intern/cycles/device/hip/graphics_interop.h 
b/intern/cycles/device/hip/graphics_interop.h
index fad258d10a7..06a8c4cdb6e 100644
--- a/intern/cycles/device/hip/graphics_interop.h
+++ b/intern/cycles/device/hip/graphics_interop.h
@@ -36,7 +36,7 @@ class HIPDeviceGraphicsInterop : public DeviceGraphicsInterop 
{
   HIPDevice *device_ = nullptr;
 
   /* OpenGL PBO which is currently registered as the destination for the HIP 
buffer. */
-  uint opengl_pbo_id_ = 0;
+  int64_t opengl_pbo_id_ = 0;
   /* Buffer area in pixels of the corresponding PBO. */
   int64_t buffer_area_ = 0;
 
diff --git a/intern/cycles/session/display_driver.h 
b/intern/cycles/session/display_driver.h
index f1d654e57d1..bc6203e48a2 100644
--- a/intern/cycles/session/display_driver.h
+++ b/intern/cycles/session/display_driver.h
@@ -85,7 +85,7 @@ class DisplayDriver {
 int buffer_height = 0;
 
 /* OpenGL pixel buffer object. */
-int opengl_pbo_id = 0;
+int64_t opengl_pbo_id = 0;
 
 /* Clear the entire buffer before doing partial write to it. */
 bool need_clear = false;
diff --git a/source/blender/gpu/opengl/gl_texture.cc 
b/source/blender/gpu/opengl/gl_texture.cc
index dae5aa45cc9..6db73345d5f 100644
--- a/source/blender/gpu/opengl/gl_texture.cc
+++ b/source/blender/gpu/opengl/gl_texture.cc
@@ -320,7 +320,7 @@ void GLTexture::update_sub(int offset[3],
   GLContext::state_manager_active_get()->texture_bind_temp(this);
 
   /* Bind pixel buffer for source data. */
-  int pix_buf_handle = (int)GPU_pixel_buffer_get_native_handle(pixbuf);
+  GLint pix_buf_handle = (GLint)GPU_pixel_buffer_get_native_handle(pixbuf);
   glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pix_buf_handle);
 
   switch (dimensions) {

___
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] [a179246e1fd] master: Move fcurve cleanup from transform system to BKE

2022-12-01 Thread Philipp Oeser
Commit: a179246e1fdf36c19c0c5d196da1190aa3984c4b
Author: Philipp Oeser
Date:   Thu Dec 1 13:04:31 2022 +0100
Branches: master
https://developer.blender.org/rBa179246e1fdf36c19c0c5d196da1190aa3984c4b

Move fcurve cleanup from transform system to BKE

This exposes the fcurve cleanup from transform system to other callers
in anticipation to use it in the snapping operators.

It has been renamed from `posttrans_fcurve_clean` to
`BKE_fcurve_merge_duplicate_keys` to better describe what it does.
No functional change expected.

Ref. T101996

NOTE: same probably has to be done for greasepencil, but that is for
another commit.

Maniphest Tasks: T101996

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

===

M   source/blender/blenkernel/BKE_fcurve.h
M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/editors/transform/transform_convert.c
M   source/blender/editors/transform/transform_convert.h
M   source/blender/editors/transform/transform_convert_action.c
M   source/blender/editors/transform/transform_convert_graph.c

===

diff --git a/source/blender/blenkernel/BKE_fcurve.h 
b/source/blender/blenkernel/BKE_fcurve.h
index b4de24e3b64..cdade9209b6 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -483,6 +483,18 @@ bool BKE_fcurve_delete_keys_selected(struct FCurve *fcu);
  */
 void BKE_fcurve_delete_keys_all(struct FCurve *fcu);
 
+/**
+ * Called during transform/snapping to make sure selected keyframes replace
+ * any other keyframes which may reside on that frame (that is not selected).
+ *
+ * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine 
selection. Usually `SELECT`,
+ *  but may want to use a different one at times (if caller 
does not operate on
+ *  selection).
+ */
+void BKE_fcurve_merge_duplicate_keys(struct FCurve *fcu,
+ const int sel_flag,
+ const bool use_handle);
+
 /*  Curve Sanity  */
 
 /**
diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 3e772e37177..3c4a068b42a 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1709,6 +1709,133 @@ void BKE_fcurve_delete_keys_all(FCurve *fcu)
   fcurve_bezt_free(fcu);
 }
 
+/* Time + Average value */
+typedef struct tRetainedKeyframe {
+  struct tRetainedKeyframe *next, *prev;
+  float frame; /* frame to cluster around */
+  float val;   /* average value */
+
+  size_t tot_count; /* number of keyframes that have been averaged */
+  size_t del_count; /* number of keyframes of this sort that have been deleted 
so far */
+} tRetainedKeyframe;
+
+void BKE_fcurve_merge_duplicate_keys(FCurve *fcu, const int sel_flag, const 
bool use_handle)
+{
+  /* NOTE: We assume that all keys are sorted */
+  ListBase retained_keys = {NULL, NULL};
+  const bool can_average_points = ((fcu->flag & (FCURVE_INT_VALUES | 
FCURVE_DISCRETE_VALUES)) ==
+   0);
+
+  /* sanity checks */
+  if ((fcu->totvert == 0) || (fcu->bezt == NULL)) {
+return;
+  }
+
+  /* 1) Identify selected keyframes, and average the values on those
+   * in case there are collisions due to multiple keys getting scaled
+   * to all end up on the same frame
+   */
+  for (int i = 0; i < fcu->totvert; i++) {
+BezTriple *bezt = >bezt[i];
+
+if (BEZT_ISSEL_ANY(bezt)) {
+  bool found = false;
+
+  /* If there's another selected frame here, merge it */
+  for (tRetainedKeyframe *rk = retained_keys.last; rk; rk = rk->prev) {
+if (IS_EQT(rk->frame, bezt->vec[1][0], BEZT_BINARYSEARCH_THRESH)) {
+  rk->val += bezt->vec[1][1];
+  rk->tot_count++;
+
+  found = true;
+  break;
+}
+if (rk->frame < bezt->vec[1][0]) {
+  /* Terminate early if have passed the supposed insertion point? */
+  break;
+}
+  }
+
+  /* If nothing found yet, create a new one */
+  if (found == false) {
+tRetainedKeyframe *rk = MEM_callocN(sizeof(tRetainedKeyframe), 
"tRetainedKeyframe");
+
+rk->frame = bezt->vec[1][0];
+rk->val = bezt->vec[1][1];
+rk->tot_count = 1;
+
+BLI_addtail(_keys, rk);
+  }
+}
+  }
+
+  if (BLI_listbase_is_empty(_keys)) {
+/* This may happen if none of the points were selected... */
+if (G.debug & G_DEBUG) {
+  printf("%s: nothing to do for FCurve %p (rna_path = '%s')\n", __func__, 
fcu, fcu->rna_path);
+}
+return;
+  }
+
+  /* Compute the average values for each retained keyframe */
+  LISTBASE_FOREACH (tRetainedKeyframe *, rk, _keys) {
+rk->val = rk->val / (float)rk->tot_count;
+  }
+
+  /* 2) Delete all keyframes duplicating the "retained keys" 

[Bf-blender-cvs] [b5ebc9bb24a] master: Fix T101996: merge fcurve keyframes on the same frame after snapping

2022-12-01 Thread Philipp Oeser
Commit: b5ebc9bb24ae5bb539878a7884154827bce4a7d7
Author: Philipp Oeser
Date:   Thu Dec 1 13:55:47 2022 +0100
Branches: master
https://developer.blender.org/rBb5ebc9bb24ae5bb539878a7884154827bce4a7d7

Fix T101996: merge fcurve keyframes on the same frame after snapping

Use recently introduced BKE_fcurve_merge_duplicate_keys (that was moved
from the transform system to BKE) to merge keyframes on the same frame
after snapping (same as what would happen with the transform system).

This makes behavior consistent and prevents a state after snapping that
cannot be reproduced in any other way.

NOTE: same probably has to be done for greasepencil, but that is for
another commit.

===

M   source/blender/editors/space_action/action_edit.c
M   source/blender/editors/space_graph/graph_edit.c

===

diff --git a/source/blender/editors/space_action/action_edit.c 
b/source/blender/editors/space_action/action_edit.c
index 0803c5dc575..dcbb8bac192 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1791,10 +1791,14 @@ static void snap_action_keys(bAnimContext *ac, short 
mode)
 else if (adt) {
   ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
   ANIM_fcurve_keyframes_loop(, ale->key_data, NULL, edit_cb, 
BKE_fcurve_handles_recalc);
+  BKE_fcurve_merge_duplicate_keys(
+  ale->key_data, SELECT, false); /* only use handles in graph editor */
   ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
 }
 else {
   ANIM_fcurve_keyframes_loop(, ale->key_data, NULL, edit_cb, 
BKE_fcurve_handles_recalc);
+  BKE_fcurve_merge_duplicate_keys(
+  ale->key_data, SELECT, false); /* only use handles in graph editor */
 }
 
 ale->update |= ANIM_UPDATE_DEFAULT;
diff --git a/source/blender/editors/space_graph/graph_edit.c 
b/source/blender/editors/space_graph/graph_edit.c
index cb01b0d9dc8..1ad68eef2f5 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2279,6 +2279,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
   edit_cb = ANIM_editkeyframes_snap(mode);
 
   /* Snap keyframes. */
+  const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
   for (ale = anim_data.first; ale; ale = ale->next) {
 AnimData *adt = ANIM_nla_mapping_get(ac, ale);
 
@@ -2296,10 +2297,12 @@ static void snap_graph_keys(bAnimContext *ac, short 
mode)
 if (adt) {
   ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
   ANIM_fcurve_keyframes_loop(, ale->key_data, NULL, edit_cb, 
BKE_fcurve_handles_recalc);
+  BKE_fcurve_merge_duplicate_keys(ale->key_data, BEZT_FLAG_TEMP_TAG, 
use_handle);
   ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
 }
 else {
   ANIM_fcurve_keyframes_loop(, ale->key_data, NULL, edit_cb, 
BKE_fcurve_handles_recalc);
+  BKE_fcurve_merge_duplicate_keys(ale->key_data, BEZT_FLAG_TEMP_TAG, 
use_handle);
 }
 
 ale->update |= ANIM_UPDATE_DEFAULT;

___
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] [5e4dcb8cf0a] master: Cleanup: use OB_MODE_ALL_PAINT_GPENCIL in more places

2022-12-01 Thread Philipp Oeser
Commit: 5e4dcb8cf0a3baec068183a9a83d50d8390b8810
Author: Philipp Oeser
Date:   Wed Nov 30 12:01:06 2022 +0100
Branches: master
https://developer.blender.org/rB5e4dcb8cf0a3baec068183a9a83d50d8390b8810

Cleanup: use OB_MODE_ALL_PAINT_GPENCIL in more places

This just replaces the combined usage of OB_MODE_PAINT_GPENCIL
OB_MODE_SCULPT_GPENCIL
OB_MODE_WEIGHT_GPENCIL
OB_MODE_VERTEX_GPENCIL.

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

===

M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/interface/interface_icons.cc
M   source/blender/editors/object/object_modes.c
M   source/blender/editors/transform/transform_convert.c
M   source/blender/editors/undo/ed_undo.c

===

diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index 40f33a888aa..61f8111008f 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1664,11 +1664,7 @@ static bool gpencil_check_cursor_region(bContext *C, 
const int mval_i[2])
   ScrArea *area = CTX_wm_area(C);
   Object *ob = CTX_data_active_object(C);
 
-  if ((ob == NULL) || !ELEM(ob->mode,
-OB_MODE_PAINT_GPENCIL,
-OB_MODE_SCULPT_GPENCIL,
-OB_MODE_WEIGHT_GPENCIL,
-OB_MODE_VERTEX_GPENCIL)) {
+  if ((ob == NULL) || ((ob->mode & OB_MODE_ALL_PAINT_GPENCIL) == 0)) {
 return false;
   }
 
diff --git a/source/blender/editors/interface/interface_icons.cc 
b/source/blender/editors/interface/interface_icons.cc
index dab9d923428..e1f9ba897fe 100644
--- a/source/blender/editors/interface/interface_icons.cc
+++ b/source/blender/editors/interface/interface_icons.cc
@@ -2124,10 +2124,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID 
*id)
 }
 
 /* reset the icon */
-if ((ob != NULL) &&
-(ob->mode & (OB_MODE_PAINT_GPENCIL | OB_MODE_VERTEX_GPENCIL | 
OB_MODE_SCULPT_GPENCIL |
- OB_MODE_WEIGHT_GPENCIL)) &&
-(br->gpencil_settings != NULL)) {
+if ((ob != NULL) && (ob->mode & OB_MODE_ALL_PAINT_GPENCIL) && 
(br->gpencil_settings != NULL)) {
   switch (br->gpencil_settings->icon_id) {
 case GP_BRUSH_ICON_PENCIL:
   br->id.icon_id = ICON_GPBRUSH_PENCIL;
diff --git a/source/blender/editors/object/object_modes.c 
b/source/blender/editors/object/object_modes.c
index 6525f2d6027..7e3a9dd7ccb 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -137,8 +137,7 @@ bool ED_object_mode_compat_test(const Object *ob, 
eObjectMode mode)
   }
   break;
 case OB_GPENCIL:
-  if (mode & (OB_MODE_EDIT_GPENCIL | OB_MODE_PAINT_GPENCIL | 
OB_MODE_SCULPT_GPENCIL |
-  OB_MODE_WEIGHT_GPENCIL | OB_MODE_VERTEX_GPENCIL)) {
+  if (mode & (OB_MODE_EDIT_GPENCIL | OB_MODE_ALL_PAINT_GPENCIL)) {
 return true;
   }
   break;
diff --git a/source/blender/editors/transform/transform_convert.c 
b/source/blender/editors/transform/transform_convert.c
index d71a3897cbc..75627370a85 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -1115,11 +1115,7 @@ static TransConvertTypeInfo *convert_type_get(const 
TransInfo *t, Object **r_obj
 }
 return NULL;
   }
-  if (ob && ELEM(ob->mode,
- OB_MODE_PAINT_GPENCIL,
- OB_MODE_SCULPT_GPENCIL,
- OB_MODE_WEIGHT_GPENCIL,
- OB_MODE_VERTEX_GPENCIL)) {
+  if (ob && (ob->mode & OB_MODE_ALL_PAINT_GPENCIL)) {
 /* In grease pencil all transformations must be canceled if not Object or 
Edit. */
 return NULL;
   }
diff --git a/source/blender/editors/undo/ed_undo.c 
b/source/blender/editors/undo/ed_undo.c
index 42563cb8f83..db0eaa36047 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -214,11 +214,7 @@ static void ed_undo_step_post(bContext *C,
 Object *obact = CTX_data_active_object(C);
 if (obact && (obact->type == OB_GPENCIL)) {
   /* set cursor */
-  if (ELEM(obact->mode,
-   OB_MODE_PAINT_GPENCIL,
-   OB_MODE_SCULPT_GPENCIL,
-   OB_MODE_WEIGHT_GPENCIL,
-   OB_MODE_VERTEX_GPENCIL)) {
+  if ((obact->mode & OB_MODE_ALL_PAINT_GPENCIL)) {
 ED_gpencil_toggle_brush_cursor(C, true, NULL);
   }
   else {

___
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] [5c580ff4574] master: Fix asset-only loading optimizatoin not working as intended

2022-12-01 Thread Julian Eisel
Commit: 5c580ff45746fa79057788562a74b25e40ca7ec4
Author: Julian Eisel
Date:   Wed Nov 30 21:05:19 2022 +0100
Branches: master
https://developer.blender.org/rB5c580ff45746fa79057788562a74b25e40ca7ec4

Fix asset-only loading optimizatoin not working as intended

Introduced in fc7beac8d6f4, but I think this never worked because the
`asset_library_ref` of the temporary file-list used for reading in a
background thread is nulled. Now there's a different pointer that we can
use that works properly.

===

M   source/blender/editors/space_file/filelist.cc

===

diff --git a/source/blender/editors/space_file/filelist.cc 
b/source/blender/editors/space_file/filelist.cc
index beb1387b26e..3374da082d8 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -3614,7 +3614,7 @@ static void 
filelist_readjob_recursive_dir_add_items(const bool do_lib,
   }
   /* Only load assets when browsing an asset library. For normal file 
browsing we return all
* entries. `FLF_ASSETS_ONLY` filter can be enabled/disabled by the 
user. */
-  if (filelist->asset_library_ref) {
+  if (filelist->asset_library) {
 list_lib_options |= LIST_LIB_ASSETS_ONLY;
   }
   std::optional lib_entries_num = filelist_readjob_list_lib(

___
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] [1a2e2dcddc5] master: Cleanup: Improve function name for asset identifier creation

2022-12-01 Thread Julian Eisel
Commit: 1a2e2dcddc5d2d798ffb24b9656cfb12ec4ed04d
Author: Julian Eisel
Date:   Thu Dec 1 11:41:04 2022 +0100
Branches: master
https://developer.blender.org/rB1a2e2dcddc5d2d798ffb24b9656cfb12ec4ed04d

Cleanup: Improve function name for asset identifier creation

I find this a bit more explanatory/clear.

===

M   source/blender/asset_system/AS_asset_library.hh
M   source/blender/asset_system/intern/asset_library.cc

===

diff --git a/source/blender/asset_system/AS_asset_library.hh 
b/source/blender/asset_system/AS_asset_library.hh
index 9f9b1b80343..f272ed6ff51 100644
--- a/source/blender/asset_system/AS_asset_library.hh
+++ b/source/blender/asset_system/AS_asset_library.hh
@@ -125,7 +125,7 @@ class AssetLibrary {
* Create an asset identifier from the root path of this asset library and 
the given relative
* asset path (relative to the asset library root directory).
*/
-  AssetIdentifier derive_asset_identifier(StringRef relative_asset_path);
+  AssetIdentifier asset_identifier_from_library(StringRef relative_asset_path);
 
   StringRefNull root_path() const;
 
diff --git a/source/blender/asset_system/intern/asset_library.cc 
b/source/blender/asset_system/intern/asset_library.cc
index 2f3b56d226a..73f81a50e46 100644
--- a/source/blender/asset_system/intern/asset_library.cc
+++ b/source/blender/asset_system/intern/asset_library.cc
@@ -152,13 +152,13 @@ AssetRepresentation 
::add_external_asset(StringRef relative_asset_p
   StringRef name,
   
std::unique_ptr metadata)
 {
-  AssetIdentifier identifier = derive_asset_identifier(relative_asset_path);
+  AssetIdentifier identifier = 
asset_identifier_from_library(relative_asset_path);
   return asset_storage_->add_external_asset(std::move(identifier), name, 
std::move(metadata));
 }
 
 AssetRepresentation ::add_local_id_asset(StringRef 
relative_asset_path, ID )
 {
-  AssetIdentifier identifier = derive_asset_identifier(relative_asset_path);
+  AssetIdentifier identifier = 
asset_identifier_from_library(relative_asset_path);
   return asset_storage_->add_local_id_asset(std::move(identifier), id);
 }
 
@@ -215,7 +215,7 @@ void AssetLibrary::on_blend_save_post(struct Main *main,
   }
 }
 
-AssetIdentifier AssetLibrary::derive_asset_identifier(StringRef 
relative_asset_path)
+AssetIdentifier AssetLibrary::asset_identifier_from_library(StringRef 
relative_asset_path)
 {
   return AssetIdentifier(root_path_, relative_asset_path);
 }

___
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] [9f3b0e41bbc] master: Fix T102887: crash deleting plane track

2022-12-01 Thread Philipp Oeser
Commit: 9f3b0e41bbc5529444e47395e14cded89614c493
Author: Philipp Oeser
Date:   Thu Dec 1 10:10:33 2022 +0100
Branches: master
https://developer.blender.org/rB9f3b0e41bbc5529444e47395e14cded89614c493

Fix T102887: crash deleting plane track

Two things here:
- fix ghash lookup from rB4d497721ecd1
-- this was looking in the wrong map (causing an assert on file load)
- set MovieTrackingObject active_plane_track to NULL upon deletion (same
as for regular tracks)
-- rBfe38715600c introduced a crash because `draw_tracking_tracks` would
still get an active plane track (logic for getting these changed)

Maniphest Tasks: T102887

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

===

M   source/blender/blenkernel/intern/tracking.c
M   source/blender/editors/space_clip/clip_utils.c

===

diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index d71c0cc4bf9..f53e32a70c2 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -275,7 +275,7 @@ static void tracking_object_copy(MovieTrackingObject 
*tracking_object_dst,
   }
   if (tracking_object_src->active_plane_track) {
 tracking_object_dst->active_plane_track = BLI_ghash_lookup(
-ctx.old_to_new_track_map, tracking_object_src->active_plane_track);
+ctx.old_to_new_plane_track_map, 
tracking_object_src->active_plane_track);
 BLI_assert(tracking_object_dst->active_plane_track != NULL);
   }
 
diff --git a/source/blender/editors/space_clip/clip_utils.c 
b/source/blender/editors/space_clip/clip_utils.c
index 53aca35c997..3e621a39dcb 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -362,6 +362,11 @@ void clip_delete_plane_track(bContext *C, MovieClip *clip, 
MovieTrackingPlaneTra
 {
   MovieTracking *tracking = >tracking;
   MovieTrackingObject *tracking_object = 
BKE_tracking_object_get_active(>tracking);
+
+  if (plane_track == tracking_object->active_plane_track) {
+tracking_object->active_plane_track = NULL;
+  }
+
   /* Delete f-curves associated with the track (such as weight, i.e.) */
   /* Escaped object name, escaped track name, rest of the path. */
   char rna_path[MAX_NAME * 4 + 64];

___
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