[Bf-blender-cvs] [e07c5a14c99] master: Cleanup: sort cmake file lists

2022-12-16 Thread Campbell Barton
Commit: e07c5a14c9948bbbfd87d69805d770c080eb8891
Author: Campbell Barton
Date:   Sat Dec 17 16:00:40 2022 +1100
Branches: master
https://developer.blender.org/rBe07c5a14c9948bbbfd87d69805d770c080eb8891

Cleanup: sort cmake file lists

===

M   source/blender/editors/space_node/CMakeLists.txt
M   source/blender/gpu/CMakeLists.txt
M   source/blender/nodes/CMakeLists.txt

===

diff --git a/source/blender/editors/space_node/CMakeLists.txt 
b/source/blender/editors/space_node/CMakeLists.txt
index f8289b42463..3236082c0d2 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -29,8 +29,8 @@ set(INC
 
 
 set(SRC
-  add_node_search.cc
   add_menu_assets.cc
+  add_node_search.cc
   drawnode.cc
   link_drag_search.cc
   node_add.cc
diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 9f9d216064a..02793fa74be 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -12,9 +12,9 @@ endif()
 set(INC
   .
   intern
-  vulkan
   metal
   opengl
+  vulkan
   ../blenkernel
   ../blenlib
   ../bmesh
@@ -579,15 +579,15 @@ set(SRC_SHADER_CREATE_INFOS
   ../draw/engines/workbench/shaders/infos/workbench_transparent_resolve_info.hh
   ../draw/engines/workbench/shaders/infos/workbench_volume_info.hh
 
-  ../draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
   ../draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh
-  ../draw/engines/eevee/shaders/infos/eevee_legacy_lightprobe_info.hh
-  ../draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
+  ../draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
   ../draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh
-  ../draw/engines/eevee/shaders/infos/eevee_legacy_volume_info.hh
-  ../draw/engines/eevee/shaders/infos/eevee_legacy_shadow_info.hh
+  ../draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
+  ../draw/engines/eevee/shaders/infos/eevee_legacy_lightprobe_info.hh
   ../draw/engines/eevee/shaders/infos/eevee_legacy_material_info.hh
   ../draw/engines/eevee/shaders/infos/eevee_legacy_motion_blur_info.hh
+  ../draw/engines/eevee/shaders/infos/eevee_legacy_shadow_info.hh
+  ../draw/engines/eevee/shaders/infos/eevee_legacy_volume_info.hh
 
   ../draw/engines/image/shaders/infos/engine_image_info.hh
   ../draw/intern/shaders/draw_debug_info.hh
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index c520f804093..27da5f6cf8e 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -64,8 +64,8 @@ set(SRC
   NOD_math_functions.hh
   NOD_multi_function.hh
   NOD_node_declaration.hh
-  NOD_shader.h
   NOD_register.hh
+  NOD_shader.h
   NOD_socket.h
   NOD_socket_declarations.hh
   NOD_socket_declarations_geometry.hh

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


[Bf-blender-cvs] [0cc573c8c42] master: Cleanup: white space around comment blocks

2022-12-16 Thread Campbell Barton
Commit: 0cc573c8c42ab96ed8cab23606fa22d3b959da08
Author: Campbell Barton
Date:   Sat Dec 17 15:58:30 2022 +1100
Branches: master
https://developer.blender.org/rB0cc573c8c42ab96ed8cab23606fa22d3b959da08

Cleanup: white space around comment blocks

===

M   intern/cycles/kernel/integrator/shade_volume.h
M   source/blender/blenkernel/BKE_key.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/BKE_pointcache.h
M   source/blender/blenkernel/intern/curves.cc
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenkernel/intern/idprop.c
M   source/blender/blenkernel/intern/key.cc
M   source/blender/blenkernel/intern/multires.cc
M   source/blender/blenkernel/intern/particle.c
M   source/blender/blenkernel/intern/softbody.c
M   source/blender/blenlib/intern/string_utf8.c
M   source/blender/blenlib/tests/BLI_string_utf8_test.cc
M   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_ghost_accumulate.glsl
M   
source/blender/compositor/realtime_compositor/shaders/compositor_glare_ghost_base.glsl
M   source/blender/depsgraph/intern/builder/deg_builder_key.h
M   source/blender/draw/engines/eevee/engine_eevee_shared_defines.h
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
M   source/blender/draw/engines/eevee/shaders/surface_lib.glsl
M   
source/blender/draw/engines/overlay/shaders/overlay_armature_shape_outline_vert_no_geom.glsl
M   
source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_vert_no_geom.glsl
M   
source/blender/draw/engines/workbench/shaders/workbench_shadow_vert_no_geom.glsl
M   source/blender/draw/intern/draw_pbvh.cc
M   source/blender/draw/intern/draw_shader_shared.h
M   source/blender/draw/intern/draw_texture_pool.cc
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/include/ED_anim_api.h
M   source/blender/editors/interface/interface_templates.cc
M   source/blender/editors/sculpt_paint/sculpt.cc
M   source/blender/editors/sculpt_paint/sculpt_automasking.cc
M   source/blender/editors/space_clip/clip_draw.c
M   source/blender/geometry/intern/uv_parametrizer.cc
M   source/blender/gpu/metal/mtl_command_buffer.mm
M   source/blender/gpu/metal/mtl_shader.hh
M   source/blender/gpu/shaders/gpu_shader_3D_polyline_vert_no_geom.glsl
M   source/blender/gpu/vulkan/vk_storage_buffer.cc
M   source/blender/makesrna/intern/rna_nla.c
M   source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
M   source/blender/python/intern/bpy_app_handlers.c
M   source/blender/python/mathutils/mathutils_Matrix.c

===

diff --git a/intern/cycles/kernel/integrator/shade_volume.h 
b/intern/cycles/kernel/integrator/shade_volume.h
index 0323738c09b..456bebe771a 100644
--- a/intern/cycles/kernel/integrator/shade_volume.h
+++ b/intern/cycles/kernel/integrator/shade_volume.h
@@ -1030,7 +1030,7 @@ ccl_device VolumeIntegrateEvent 
volume_integrate(KernelGlobals kg,
   const float3 initial_throughput = INTEGRATOR_STATE(state, path, throughput);
   /* The path throughput used to calculate the throughput for direct light. */
   float3 unlit_throughput = initial_throughput;
-  /* If a new path segment is generated at the direct scatter position.*/
+  /* If a new path segment is generated at the direct scatter position. */
   bool guiding_generated_new_segment = false;
   float rand_phase_guiding = 0.5f;
 #  endif
diff --git a/source/blender/blenkernel/BKE_key.h 
b/source/blender/blenkernel/BKE_key.h
index 813dc9aba34..7fb3e71ad3d 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -157,6 +157,7 @@ void BKE_keyblock_convert_from_vertcos(const struct Object 
*ob,
const float (*vertCos)[3]);
 float (*BKE_keyblock_convert_to_vertcos(const struct Object *ob, const struct 
KeyBlock *kb))[3];
 
+/** RAW coordinates offsets. */
 void BKE_keyblock_update_from_offset(const struct Object *ob,
  struct KeyBlock *kb,
  const float (*ofs)[3]);
diff --git a/source/blender/blenkernel/BKE_particle.h 
b/source/blender/blenkernel/BKE_particle.h
index 05b9aca7544..618e69b5436 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -665,7 +665,7 @@ float psys_get_current_display_percentage(struct 
ParticleSystem *psys, bool use_
 /* psys_reset */
 #define PSYS_RESET_ALL 1
 #define PSYS_RESET_DEPSGRAPH 2
-/* #define PSYS_RESET_CHILDREN  3 */ /*UNUSED*/
+// #define PSYS_RESET_CHILDREN  3 /*UNUSED*/
 #define PSYS_RESET_CACHE_MISS 4
 
 /* index_dmcache */
diff --git a/source/blender/blenkernel/BKE_pbvh.h 

[Bf-blender-cvs] [a0a7db9f704] master: Cleanup: duplicate words in comments

2022-12-16 Thread Campbell Barton
Commit: a0a7db9f704d28673b73e124874d5571adc5eb42
Author: Campbell Barton
Date:   Sat Dec 17 14:11:11 2022 +1100
Branches: master
https://developer.blender.org/rBa0a7db9f704d28673b73e124874d5571adc5eb42

Cleanup: duplicate words in comments

===

M   source/blender/blenkernel/BKE_mesh_runtime.h
M   source/blender/blenkernel/intern/object_update.cc
M   source/blender/blenlib/BLI_span.hh
M   source/blender/depsgraph/DEG_depsgraph_query.h
M   source/blender/depsgraph/intern/builder/deg_builder_key.h
M   source/blender/editors/mesh/editmesh_knife.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h 
b/source/blender/blenkernel/BKE_mesh_runtime.h
index 083f83ef059..e2346f3a74d 100644
--- a/source/blender/blenkernel/BKE_mesh_runtime.h
+++ b/source/blender/blenkernel/BKE_mesh_runtime.h
@@ -28,7 +28,7 @@ struct Scene;
 int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
 
 /**
- * Return mesh triangulation data, calculated lazily when necessary necessary.
+ * Return mesh triangulation data, calculated lazily when necessary.
  * See #MLoopTri for further description of mesh triangulation.
  *
  * \note Prefer #Mesh::looptris() in C++ code.
diff --git a/source/blender/blenkernel/intern/object_update.cc 
b/source/blender/blenkernel/intern/object_update.cc
index 106c9594718..625aa666023 100644
--- a/source/blender/blenkernel/intern/object_update.cc
+++ b/source/blender/blenkernel/intern/object_update.cc
@@ -142,7 +142,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, 
Scene *scene, Object *o
   CustomData_MeshMasks_update(_masks, _MASK_BAREMESH);
   /* Custom attributes should not be removed automatically. They might be 
used by the render
* engine or scripts. They can still be removed explicitly using 
geometry nodes.
-   * Crease can be be used in generic situations with geometry nodes as 
well. */
+   * Crease can be used in generic situations with geometry nodes as well. 
*/
   cddata_masks.vmask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
   cddata_masks.emask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
   cddata_masks.fmask |= CD_MASK_PROP_ALL;
diff --git a/source/blender/blenlib/BLI_span.hh 
b/source/blender/blenlib/BLI_span.hh
index 94464ef5088..84a5c87d423 100644
--- a/source/blender/blenlib/BLI_span.hh
+++ b/source/blender/blenlib/BLI_span.hh
@@ -152,7 +152,7 @@ template class Span {
 
   /**
* Returns a contiguous part of the array. This invokes undefined behavior 
when the start or size
-   * is negative. Clamps the size of the new new span so it fits in the 
current one.
+   * is negative. Clamps the size of the new span so it fits in the current 
one.
*/
   constexpr Span slice_safe(const int64_t start, const int64_t size) const
   {
@@ -608,7 +608,7 @@ template class MutableSpan {
 
   /**
* Returns a contiguous part of the array. This invokes undefined behavior 
when the start or size
-   * is negative. Clamps the size of the new new span so it fits in the 
current one.
+   * is negative. Clamps the size of the new span so it fits in the current 
one.
*/
   constexpr MutableSpan slice_safe(const int64_t start, const int64_t size) 
const
   {
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h 
b/source/blender/depsgraph/DEG_depsgraph_query.h
index 4a9025641f9..94cb9757867 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -162,7 +162,7 @@ typedef struct DEGObjectIterSettings {
 } DEGObjectIterSettings;
 
 /**
- * Flags to to get objects for draw manager and final render.
+ * Flags to get objects for draw manager and final render.
  */
 #define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS \
   DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | 
\
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_key.h 
b/source/blender/depsgraph/intern/builder/deg_builder_key.h
index 4f8b2dc9f8f..519872a3387 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_key.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_key.h
@@ -139,9 +139,9 @@ struct OperationKey {
   int name_tag = -1;
 };
 
-/* Similar to the the OperationKey but does not contain external references, 
which makes it
+/* Similar to the #OperationKey but does not contain external references, 
which makes it
  * suitable to identify operations even after the original database or graph 
was destroyed.
- * The downside of this key over the OperationKey is that it performs string 
allocation upon
+ * The downside of this key over the #OperationKey is that it performs string 
allocation upon
  * the key construction. */
 struct PersistentOperationKey : public OperationKey {
   /* Create the key which identifies the given operation node. */
@@ -155,7 +155,7 @@ struct PersistentOperationKey : public OperationKey {
   

[Bf-blender-cvs] [02c8ce449ec] master: License headers: add missing license identifiers

2022-12-16 Thread Campbell Barton
Commit: 02c8ce449ec0271bb38d47cbeb80caee7349d42d
Author: Campbell Barton
Date:   Sat Dec 17 14:03:57 2022 +1100
Branches: master
https://developer.blender.org/rB02c8ce449ec0271bb38d47cbeb80caee7349d42d

License headers: add missing license identifiers

===

M   build_files/build_environment/darwin/set_rpath.py
M   source/blender/draw/engines/eevee/engine_eevee_shared_defines.h
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
M   source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_lightprobe_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_material_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_motion_blur_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_shadow_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_volume_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/engine_eevee_legacy_shared.h

===

diff --git a/build_files/build_environment/darwin/set_rpath.py 
b/build_files/build_environment/darwin/set_rpath.py
index e53497b84fb..fec1abca1fb 100644
--- a/build_files/build_environment/darwin/set_rpath.py
+++ b/build_files/build_environment/darwin/set_rpath.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python3
-# macOS utility to remove all rpaths and add a new one.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# macOS utility to remove all `rpaths` and add a new one.
 
 import os
 import re
diff --git a/source/blender/draw/engines/eevee/engine_eevee_shared_defines.h 
b/source/blender/draw/engines/eevee/engine_eevee_shared_defines.h
index 0f7f10914ad..01e246ac4b1 100644
--- a/source/blender/draw/engines/eevee/engine_eevee_shared_defines.h
+++ b/source/blender/draw/engines/eevee/engine_eevee_shared_defines.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #ifndef GPU_SHADER_EEVEE_LEGACY_DEFINES
 #define GPU_SHADER_EEVEE_LEGACY_DEFINES
@@ -27,4 +28,4 @@
 #define DOF_DILATE_RING_COUNT 3
 #define DOF_FAST_GATHER_COC_ERROR 0.05
 
-#endif
\ No newline at end of file
+#endif
diff --git 
a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh 
b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh
index 60b8d255cea..b917d27e8fc 100644
--- a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh
+++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_bloom_info.hh
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "gpu_shader_create_info.hh"
 
@@ -53,4 +54,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve)
 GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve_hq)
 .define("HIGH_QUALITY")
 .additional_info("eevee_legacy_bloom_resolve")
-.do_static_compilation(true);
\ No newline at end of file
+.do_static_compilation(true);
diff --git 
a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh 
b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
index 45ecd339f5f..a9c7687e5cd 100644
--- 
a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
+++ 
b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_common_info.hh
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "gpu_shader_create_info.hh"
 
diff --git 
a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh 
b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh
index 4350eb61f76..56bc957dd42 100644
--- a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh
+++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_dof_info.hh
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
 #include "gpu_shader_create_info.hh"
 
 /* DOF Lib */
@@ -286,4 +288,4 @@ 
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_HQ_BOKEH)
 GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_LQ_BOKEH)
 .additional_info("eevee_legacy_depth_of_field_resolve_LQ")
 .additional_info("eevee_legacy_depth_of_field_resolve_bokeh")
-.do_static_compilation(true);
\ No newline at end of file
+.do_static_compilation(true);
diff --git 
a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh 
b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
index 51a87ae7b98..1afe84be417 100644
--- 
a/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
+++ 
b/source/blender/draw/engines/eevee/shaders/infos/eevee_legacy_effects_info.hh
@@ -1,3 +1,5 

[Bf-blender-cvs] [68ba311c5cb] master: Cleanup: use SPDX license headers

2022-12-16 Thread Campbell Barton
Commit: 68ba311c5cb148ddd55763c788706f945f48b9d1
Author: Campbell Barton
Date:   Sat Dec 17 13:59:20 2022 +1100
Branches: master
https://developer.blender.org/rB68ba311c5cb148ddd55763c788706f945f48b9d1

Cleanup: use SPDX license headers

===

M   build_files/build_environment/cmake/shaderc.cmake
M   build_files/build_environment/cmake/shaderc_deps.cmake
M   build_files/build_environment/cmake/vulkan.cmake

===

diff --git a/build_files/build_environment/cmake/shaderc.cmake 
b/build_files/build_environment/cmake/shaderc.cmake
index 669750913f0..9831f533ab3 100644
--- a/build_files/build_environment/cmake/shaderc.cmake
+++ b/build_files/build_environment/cmake/shaderc.cmake
@@ -1,20 +1,5 @@
-# * BEGIN GPL LICENSE BLOCK *
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# * END GPL LICENSE BLOCK *
+# SPDX-License-Identifier: GPL-2.0-or-later
+
 set(SHADERC_EXTRA_ARGS
   -DSHADERC_SKIP_TESTS=On
   
-DSHADERC_SPIRV_TOOLS_DIR=${BUILD_DIR}/shaderc_spirv_tools/src/external_shaderc_spirv_tools
@@ -60,5 +45,3 @@ if(WIN32)
 )
   endif()
 endif()
-
-
diff --git a/build_files/build_environment/cmake/shaderc_deps.cmake 
b/build_files/build_environment/cmake/shaderc_deps.cmake
index bfe14a55f5b..5be13fc696d 100644
--- a/build_files/build_environment/cmake/shaderc_deps.cmake
+++ b/build_files/build_environment/cmake/shaderc_deps.cmake
@@ -1,20 +1,4 @@
-# * BEGIN GPL LICENSE BLOCK *
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# * END GPL LICENSE BLOCK *
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 # These are build time requirements for shaderc. We only have to unpack these
 # shaderc will build them.
@@ -48,4 +32,3 @@ ExternalProject_Add(external_shaderc_spirv_tools
   BUILD_COMMAND echo .
   INSTALL_COMMAND echo .
 )
-
diff --git a/build_files/build_environment/cmake/vulkan.cmake 
b/build_files/build_environment/cmake/vulkan.cmake
index 578e02ced3e..6f194fee589 100644
--- a/build_files/build_environment/cmake/vulkan.cmake
+++ b/build_files/build_environment/cmake/vulkan.cmake
@@ -1,20 +1,4 @@
-# * BEGIN GPL LICENSE BLOCK *
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# * END GPL LICENSE BLOCK *
+# SPDX-License-Identifier: GPL-2.0-or-later
 
 set(VULKAN_HEADERS_EXTRA_ARGS)
 
@@ -68,4 +52,3 @@ elseif(WIN32)
 )
   endif()
 endif()
-

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


[Bf-blender-cvs] [dc8355cfe22] master: Correct GCC version in message

2022-12-16 Thread Campbell Barton
Commit: dc8355cfe2207c4aa47a7e463c176fa38a055726
Author: Campbell Barton
Date:   Sat Dec 17 13:56:01 2022 +1100
Branches: master
https://developer.blender.org/rBdc8355cfe2207c4aa47a7e463c176fa38a055726

Correct GCC version in message

Missed last commit.

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 428207f0231..a6683ce40b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,7 +118,7 @@ enable_testing()
 
 if(CMAKE_COMPILER_IS_GNUCC)
   if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
-message(FATAL_ERROR "The minimum supported version of GCC is 9.3.1")
+message(FATAL_ERROR "The minimum supported version of GCC is 11.0.0")
   endif()
 elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
   if(CMAKE_COMPILER_IS_GNUCC AND ("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 
"8.0"))

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


[Bf-blender-cvs] [025570c44e4] master: Build: bump minimum GCC version from 9.3.1 to 11.0.0

2022-12-16 Thread Campbell Barton
Commit: 025570c44e4e7c83331266876a7ef1969466ed23
Author: Campbell Barton
Date:   Sat Dec 17 13:53:30 2022 +1100
Branches: master
https://developer.blender.org/rB025570c44e4e7c83331266876a7ef1969466ed23

Build: bump minimum GCC version from 9.3.1 to 11.0.0

Increase the minimum version as part of the VFX platform 2023.

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62e03a003b2..428207f0231 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,7 +117,7 @@ enable_testing()
 # Keep in sync with: https://wiki.blender.org/wiki/Building_Blender
 
 if(CMAKE_COMPILER_IS_GNUCC)
-  if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "9.3.1")
+  if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
 message(FATAL_ERROR "The minimum supported version of GCC is 9.3.1")
   endif()
 elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")

___
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] [2ac6e26c258] master: Cleanup: cmake formatting

2022-12-16 Thread Campbell Barton
Commit: 2ac6e26c258faec43e60ccfbe3fa1f904f2c6a89
Author: Campbell Barton
Date:   Sat Dec 17 13:30:07 2022 +1100
Branches: master
https://developer.blender.org/rB2ac6e26c258faec43e60ccfbe3fa1f904f2c6a89

Cleanup: cmake formatting

===

M   CMakeLists.txt
M   build_files/build_environment/cmake/cve_check.cmake
M   build_files/build_environment/cmake/download.cmake
M   build_files/build_environment/cmake/embree.cmake
M   build_files/build_environment/cmake/gmp.cmake
M   build_files/build_environment/cmake/opencollada.cmake
M   build_files/build_environment/cmake/usd.cmake
M   build_files/buildbot/config/blender_linux.cmake
M   build_files/cmake/Modules/FindOpenEXR.cmake
M   build_files/cmake/have_features.cmake
M   build_files/cmake/macros.cmake
M   build_files/cmake/platform/platform_old_libs_update.cmake
M   build_files/cmake/platform/platform_unix.cmake
M   build_files/cmake/platform/platform_win32.cmake
M   intern/cycles/CMakeLists.txt
M   intern/cycles/cmake/macros.cmake
M   intern/cycles/device/CMakeLists.txt
M   intern/cycles/doc/license/CMakeLists.txt
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/osl/shaders/CMakeLists.txt
M   intern/ghost/CMakeLists.txt
M   intern/locale/CMakeLists.txt
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/creator/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9e0de18913..62e03a003b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -576,8 +576,8 @@ endif()
 
 # OpenGL
 
-option(WITH_OPENGL  "When off limits visibility of the opengl 
headers to just bf_gpu and gawain (temporary option for development purposes)" 
ON)
-option(WITH_GPU_BUILDTIME_SHADER_BUILDER  "Shader builder is a developer 
option enabling linting on GLSL during compilation" 
 OFF)
+option(WITH_OPENGL "When off limits visibility of the opengl headers to just 
bf_gpu and gawain (temporary option for development purposes)" ON)
+option(WITH_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option 
enabling linting on GLSL during compilation" OFF)
 
 mark_as_advanced(
   WITH_OPENGL
@@ -2011,7 +2011,7 @@ set(LIBDIR_STALE)
 
 if(UNIX AND NOT APPLE)
   # Only search for the path if it's found on the system.
-  if (EXISTS "../lib/linux_centos7_x86_64")
+  if(EXISTS "../lib/linux_centos7_x86_64")
 set(LIBDIR_STALE "/lib/linux_centos7_x86_64/")
   endif()
 endif()
diff --git a/build_files/build_environment/cmake/cve_check.cmake 
b/build_files/build_environment/cmake/cve_check.cmake
index 941b6b0cae9..979b5d2a794 100644
--- a/build_files/build_environment/cmake/cve_check.cmake
+++ b/build_files/build_environment/cmake/cve_check.cmake
@@ -24,7 +24,7 @@
 
 set(SBOMCONTENTS)
 get_cmake_property(_variableNames VARIABLES)
-foreach (_variableName ${_variableNames})
+foreach(_variableName ${_variableNames})
   if(_variableName MATCHES "CPE$")
 string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
 string(REPLACE "_CPE" "_ID" CPE_DEPNAME ${_variableName})
diff --git a/build_files/build_environment/cmake/download.cmake 
b/build_files/build_environment/cmake/download.cmake
index 4f8ecc7d0ce..dab4417109a 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -10,22 +10,22 @@ function(download_source dep)
   if(PACKAGE_USE_UPSTREAM_SOURCES)
 set(TARGET_URI  ${${dep}_URI})
   elseif(BLENDER_VERSION)
-set(TARGET_URI  
https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
+set(TARGET_URI 
https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
   else()
-set(TARGET_URI  
https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
+set(TARGET_URI 
https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
   endif()
   # Validate all required variables are set and give an explicit error message
   # rather than CMake erroring out later on with a more ambigious error.
-  if (NOT DEFINED TARGET_FILE)
+  if(NOT DEFINED TARGET_FILE)
 message(FATAL_ERROR "${dep}_FILE variable not set")
   endif()
-  if (NOT DEFINED TARGET_HASH)
+  if(NOT DEFINED TARGET_HASH)
 message(FATAL_ERROR "${dep}_HASH variable not set")
   endif()
-  if (NOT DEFINED TARGET_HASH_TYPE)
+  if(NOT DEFINED TARGET_HASH_TYPE)
 message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
   endif()
-  if (NOT DEFINED TARGET_URI)
+  if(NOT DEFINED TARGET_URI)
 message(FATAL_ERROR "${dep}_URI variable not set")
   endif()
   set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
@@ -43,11 +43,11 @@ function(download_source dep)
   if(EXISTS ${TARGET_FILE})
 # Sometimes the download fails, 

[Bf-blender-cvs] [067fe443d83] master: Cleanup: consistent naming for normals

2022-12-16 Thread Campbell Barton
Commit: 067fe443d8358d62dc570fde3327ca1d557a824c
Author: Campbell Barton
Date:   Sat Dec 17 12:47:43 2022 +1100
Branches: master
https://developer.blender.org/rB067fe443d8358d62dc570fde3327ca1d557a824c

Cleanup: consistent naming for normals

Use consistent naming for {vert/poly/loop/face}_normals.

===

M   source/blender/blenkernel/BKE_key.h
M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_mesh_tangent.h
M   source/blender/blenkernel/BKE_shrinkwrap.h
M   source/blender/blenkernel/intern/key.cc
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_iterators.cc
M   source/blender/blenkernel/intern/mesh_legacy_convert.cc
M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/blenkernel/intern/mesh_tangent.cc
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/shrinkwrap.cc
M   source/blender/draw/engines/overlay/overlay_edit_mesh.cc
M   source/blender/draw/intern/draw_cache_impl.h
M   source/blender/draw/intern/draw_cache_impl_mesh.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M   source/blender/editors/armature/meshlaplacian.c
M   source/blender/editors/mesh/editmesh_tools.c
M   source/blender/io/alembic/intern/abc_reader_mesh.cc
M   source/blender/makesrna/intern/rna_mesh_api.c
M   source/blender/modifiers/intern/MOD_normal_edit.cc
M   source/blender/modifiers/intern/MOD_weighted_normal.cc

===

diff --git a/source/blender/blenkernel/BKE_key.h 
b/source/blender/blenkernel/BKE_key.h
index 6cae56b775f..813dc9aba34 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -139,15 +139,15 @@ void BKE_keyblock_convert_to_mesh(const struct KeyBlock 
*kb, struct MVert *mvert
  *
  * \param kb: the KeyBlock to use to compute normals.
  * \param mesh: the Mesh to apply key-block to.
- * \param r_vertnors: if non-NULL, an array of vectors, same length as number 
of vertices.
- * \param r_polynors: if non-NULL, an array of vectors, same length as number 
of polygons.
- * \param r_loopnors: if non-NULL, an array of vectors, same length as number 
of loops.
+ * \param r_vert_normals: if non-NULL, an array of vectors, same length as 
number of vertices.
+ * \param r_poly_normals: if non-NULL, an array of vectors, same length as 
number of polygons.
+ * \param r_loop_normals: if non-NULL, an array of vectors, same length as 
number of loops.
  */
 void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb,
 const struct Mesh *mesh,
-float (*r_vertnors)[3],
-float (*r_polynors)[3],
-float (*r_loopnors)[3]);
+float (*r_vert_normals)[3],
+float (*r_poly_normals)[3],
+float (*r_loop_normals)[3]);
 
 void BKE_keyblock_update_from_vertcos(const struct Object *ob,
   struct KeyBlock *kb,
diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 472c82c3a81..066d302fdd1 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -481,7 +481,7 @@ void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
 const struct MLoop *mloops,
 int numLoops,
 const struct MPoly *mpolys,
-const float (*polynors)[3],
+const float (*poly_normals)[3],
 int numPolys,
 float split_angle);
 
@@ -603,10 +603,10 @@ void BKE_mesh_normals_loop_split(const struct MVert 
*mverts,
  const struct MEdge *medges,
  int numEdges,
  const struct MLoop *mloops,
- float (*r_loopnors)[3],
+ float (*r_loop_normals)[3],
  int numLoops,
  const struct MPoly *mpolys,
- const float (*polynors)[3],
+ const float (*poly_normals)[3],
  int numPolys,
  bool use_split_normals,
  float split_angle,
@@ -620,22 +620,22 @@ void BKE_mesh_normals_loop_custom_set(const struct MVert 
*mverts,
   struct MEdge *medges,
   int numEdges,

[Bf-blender-cvs] [6d3cc9c38a7] master: Cleanup: cmake indentation

2022-12-16 Thread Campbell Barton
Commit: 6d3cc9c38a7a951beb964b20089223df78204033
Author: Campbell Barton
Date:   Sat Dec 17 12:28:10 2022 +1100
Branches: master
https://developer.blender.org/rB6d3cc9c38a7a951beb964b20089223df78204033

Cleanup: cmake indentation

===

M   build_files/build_environment/cmake/harvest.cmake

===

diff --git a/build_files/build_environment/cmake/harvest.cmake 
b/build_files/build_environment/cmake/harvest.cmake
index 252e52361c5..4ea121492e2 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -11,276 +11,301 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
 
 if(WIN32)
 
-if(BUILD_MODE STREQUAL Release)
-  add_custom_target(Harvest_Release_Results
-COMMAND # jpeg rename libfile + copy include
+  if(BUILD_MODE STREQUAL Release)
+add_custom_target(Harvest_Release_Results
+  COMMAND # JPEG rename lib-file + copy include.
   ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib 
${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
   ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ 
${HARVEST_TARGET}/jpeg/include/ &&
-  # png
+  # PNG.
   ${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib 
${HARVEST_TARGET}/png/lib/libpng.lib &&
   ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ 
${HARVEST_TARGET}/png/include/ &&
-  # freeglut-> opengl
+  # FREEGLUT -> OPENGL.
   ${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib 
${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
   ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ 
${HARVEST_TARGET}/opengl/include/ &&
-DEPENDS
-  )
-endif()
-
-else(WIN32)
-
-function(harvest from to)
-  set(pattern "")
-  foreach(f ${ARGN})
-set(pattern ${f})
-  endforeach()
 
-  if(pattern STREQUAL "")
-get_filename_component(dirpath ${to} DIRECTORY)
-get_filename_component(filename ${to} NAME)
-install(
-  FILES ${LIBDIR}/${from}
-  DESTINATION ${HARVEST_TARGET}/${dirpath}
-  RENAME ${filename}
-)
-  else()
-install(
-  DIRECTORY ${LIBDIR}/${from}/
-  DESTINATION ${HARVEST_TARGET}/${to}
-  USE_SOURCE_PERMISSIONS
-  FILES_MATCHING PATTERN ${pattern}
-  PATTERN "pkgconfig" EXCLUDE
-  PATTERN "cmake" EXCLUDE
-  PATTERN "__pycache__" EXCLUDE
-  PATTERN "tests" EXCLUDE
-  PATTERN "meson*" EXCLUDE
+  DEPENDS
 )
   endif()
-endfunction()
 
-# Set rpath on shared libraries to $ORIGIN since all will be installed in the 
same
-# lib folder, and remove any absolute paths.
-#
-# Ideally this would be done as part of the Blender build since it makes 
assumptions
-# about where the files will be installed. However it would add patchelf as a 
new
-# dependency for building.
-#
-# Also removes versioned symlinks, which give errors with macOS notarization.
-if(APPLE)
-  set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py 
@loader_path)
 else()
-  set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
-endif()
 
-function(harvest_rpath_lib from to pattern)
-  harvest(${from} ${to} ${pattern})
+  function(harvest from to)
+set(pattern "")
+foreach(f ${ARGN})
+  set(pattern ${f})
+endforeach()
+
+if(pattern STREQUAL "")
+  get_filename_component(dirpath ${to} DIRECTORY)
+  get_filename_component(filename ${to} NAME)
+  install(
+FILES ${LIBDIR}/${from}
+DESTINATION ${HARVEST_TARGET}/${dirpath}
+RENAME ${filename}
+  )
+else()
+  install(
+DIRECTORY ${LIBDIR}/${from}/
+DESTINATION ${HARVEST_TARGET}/${to}
+USE_SOURCE_PERMISSIONS
+FILES_MATCHING PATTERN ${pattern}
+PATTERN "pkgconfig" EXCLUDE
+PATTERN "cmake" EXCLUDE
+PATTERN "__pycache__" EXCLUDE
+PATTERN "tests" EXCLUDE
+PATTERN "meson*" EXCLUDE
+  )
+endif()
+  endfunction()
 
-  install(CODE "\
-cmake_policy(SET CMP0009 NEW)\n
-file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
-foreach(f \${shared_libs}) \n
-  if(IS_SYMLINK \${f})\n
-if(APPLE)\n
-  file(REMOVE_RECURSE \${f})
+  # Set rpath on shared libraries to $ORIGIN since all will be installed in 
the same
+  # lib folder, and remove any absolute paths.
+  #
+  # Ideally this would be done as part of the Blender build since it makes 
assumptions
+  # about where the files will be installed. However it would add patchelf as 
a new
+  # dependency for building.
+  #
+  # Also removes versioned symlinks, which give errors with macOS notarization.
+  if(APPLE)
+set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py 
@loader_path)
+  else()
+set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
+  endif()
+
+  function(harvest_rpath_lib from to pattern)
+harvest(${from} ${to} ${pattern})

[Bf-blender-cvs] [6797de4e106] master: Cleanup: spelling in comments

2022-12-16 Thread Campbell Barton
Commit: 6797de4e10622a9c30b5e5c72c94e520b6b6c656
Author: Campbell Barton
Date:   Sat Dec 17 13:14:01 2022 +1100
Branches: master
https://developer.blender.org/rB6797de4e10622a9c30b5e5c72c94e520b6b6c656

Cleanup: spelling in comments

===

M   intern/cycles/hydra/field.cpp
M   intern/cycles/kernel/integrator/init_from_bake.h
M   intern/ghost/intern/GHOST_SystemWin32.cpp
M   source/blender/blenkernel/intern/key.cc
M   source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh
M   
source/blender/draw/engines/eevee/shaders/infos/engine_eevee_legacy_shared.h
M   source/blender/editors/asset/intern/asset_indexer.cc
M   source/blender/editors/include/ED_mesh.h

===

diff --git a/intern/cycles/hydra/field.cpp b/intern/cycles/hydra/field.cpp
index 7cdb4c80d79..e72d86c216c 100644
--- a/intern/cycles/hydra/field.cpp
+++ b/intern/cycles/hydra/field.cpp
@@ -26,8 +26,7 @@ class HdCyclesVolumeLoader : public VDBImageLoader {
   HdCyclesVolumeLoader(const std::string , const std::string 
)
   : VDBImageLoader(gridName)
   {
-/* Disably delay loading and file copying, this has poor performance
- * on network drivers. */
+/* Disable delay loading and file copying, this has poor performance on 
network drivers. */
 const bool delay_load = false;
 openvdb::io::File file(filePath);
 file.setCopyMaxBytes(0);
diff --git a/intern/cycles/kernel/integrator/init_from_bake.h 
b/intern/cycles/kernel/integrator/init_from_bake.h
index 2a5bda50fb3..308f708380f 100644
--- a/intern/cycles/kernel/integrator/init_from_bake.h
+++ b/intern/cycles/kernel/integrator/init_from_bake.h
@@ -18,7 +18,7 @@ CCL_NAMESPACE_BEGIN
 
 /* In order to perform anti-aliasing during baking, we jitter the input 
barycentric coordinates
  * (which are for the center of the texel) within the texel.
- * However, the baking code corrently doesn't support going to neighboring 
triangle, so if the
+ * However, the baking code currently doesn't support going to neighboring 
triangle, so if the
  * jittered location falls outside of the input triangle, we need to bring it 
back in somehow.
  * Clamping is a bad choice here since it can produce noticeable artifacts at 
triangle edges,
  * but properly uniformly sampling the intersection of triangle and texel 
would be very
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 8cb007a756a..d1e0d138918 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1063,7 +1063,7 @@ GHOST_EventCursor 
*GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
   if (window->getCursorGrabModeIsWarp()) {
 static uint64_t last_warp_time = 0;
 {
-  /* WORKAROUND: Check the mouse event timestamp so we can ignore 
mousemove events that were
+  /* WORKAROUND: Check the mouse event timestamp so we can ignore 
mouse-move events that were
* already in the queue before we changed the cursor position. */
   MOUSEMOVEPOINT mp = {x_screen, y_screen};
   ::GetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), , , 1, 
GMMP_USE_DISPLAY_POINTS);
@@ -1117,7 +1117,7 @@ GHOST_EventCursor 
*GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
 
 window->getCursorGrabAccum(x_accum, y_accum);
 if (x_new != x_screen || y_new != y_screen) {
-  /* WORKAROUND: Store the current time so that we ignore outdated 
mousemove events. */
+  /* WORKAROUND: Store the current time so that we ignore outdated 
mouse-move events. */
   last_warp_time = ::GetTickCount64();
 
   /* For more control over which timestamp to store in the event, we use 
`SendInput` instead of
diff --git a/source/blender/blenkernel/intern/key.cc 
b/source/blender/blenkernel/intern/key.cc
index c283ea828e8..26cec31e177 100644
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@ -890,8 +890,8 @@ static void key_evaluate_relative(const int start,
 end = tot;
   }
 
-  /* in case of beztriple */
-  elemstr[0] = 1; /* nr of ipofloats */
+  /* In case of Bezier-triple. */
+  elemstr[0] = 1; /* Number of IPO-floats. */
   elemstr[1] = IPO_BEZTRIPLE;
   elemstr[2] = 0;
 
@@ -1132,8 +1132,8 @@ static void do_key(const int start,
 }
   }
 
-  /* in case of beztriple */
-  elemstr[0] = 1; /* nr of ipofloats */
+  /* In case of bezier-triples. */
+  elemstr[0] = 1; /* Number of IPO-floats. */
   elemstr[1] = IPO_BEZTRIPLE;
   elemstr[2] = 0;
 
diff --git 
a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh 
b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh
index 64988274e03..a14d2cc71e8 100644
--- a/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh
+++ b/source/blender/draw/engines/basic/shaders/infos/basic_depth_info.hh
@@ -31,7 +31,7 @@ 

[Bf-blender-cvs] [7c85f11c427] master: Cycles: Change bake jittering to avoid issues with skinny triangles

2022-12-16 Thread Lukas Stockner
Commit: 7c85f11c427d0d07444d99c34acae5ece56d987e
Author: Lukas Stockner
Date:   Fri Dec 9 02:27:40 2022 +0100
Branches: master
https://developer.blender.org/rB7c85f11c427d0d07444d99c34acae5ece56d987e

Cycles: Change bake jittering to avoid issues with skinny triangles

Partially addresses T72011.

The problem here is that the previous barycentric clamping did not deal well
with skinny triangles and would end up generating "sub-pixel jittering"
locations that were actually >20 pixels away.

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

===

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

===

diff --git a/intern/cycles/kernel/integrator/init_from_bake.h 
b/intern/cycles/kernel/integrator/init_from_bake.h
index cc3fbe3fe39..2a5bda50fb3 100644
--- a/intern/cycles/kernel/integrator/init_from_bake.h
+++ b/intern/cycles/kernel/integrator/init_from_bake.h
@@ -16,18 +16,40 @@
 
 CCL_NAMESPACE_BEGIN
 
-/* This helps with AA but it's not the real solution as it does not AA the 
geometry
- * but it's better than nothing, thus committed. */
-ccl_device_inline float bake_clamp_mirror_repeat(float u, float max)
+/* In order to perform anti-aliasing during baking, we jitter the input 
barycentric coordinates
+ * (which are for the center of the texel) within the texel.
+ * However, the baking code corrently doesn't support going to neighboring 
triangle, so if the
+ * jittered location falls outside of the input triangle, we need to bring it 
back in somehow.
+ * Clamping is a bad choice here since it can produce noticeable artifacts at 
triangle edges,
+ * but properly uniformly sampling the intersection of triangle and texel 
would be very
+ * performance-heavy, so cheat by just trying different jittering until we end 
up inside the
+ * triangle.
+ * For triangles that are smaller than a texel, this might take too many 
attempts, so eventually
+ * we just give up and don't jitter in that case.
+ * This is not a particularly elegant solution, but it's probably the best we 
can do. */
+ccl_device_inline void bake_jitter_barycentric(float ,
+   float ,
+   float2 rand_filter,
+   const float dudx,
+   const float dudy,
+   const float dvdx,
+   const float dvdy)
 {
-  /* use mirror repeat (like opengl texture) so that if the barycentric
-   * coordinate goes past the end of the triangle it is not always clamped
-   * to the same value, gives ugly patterns */
-  u /= max;
-  float fu = floorf(u);
-  u = u - fu;
-
-  return int)fu) & 1) ? 1.0f - u : u) * max;
+  for (int i = 0; i < 10; i++) {
+/* Offset UV according to differentials. */
+float jitterU = u + (rand_filter.x - 0.5f) * dudx + (rand_filter.y - 0.5f) 
* dudy;
+float jitterV = v + (rand_filter.x - 0.5f) * dvdx + (rand_filter.y - 0.5f) 
* dvdy;
+/* If this location is inside the triangle, return. */
+if (jitterU > 0.0f && jitterV > 0.0f && jitterU + jitterV < 1.0f) {
+  u = jitterU;
+  v = jitterV;
+  return;
+}
+/* Retry with new jitter value. */
+rand_filter = hash_float2_to_float2(rand_filter);
+  }
+  /* Retries exceeded, give up and just use center value. */
+  return;
 }
 
 /* Offset towards center of triangle to avoid ray-tracing precision issues. */
@@ -144,12 +166,7 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg,
   }
 
   /* Sub-pixel offset. */
-  if (sample > 0) {
-u = bake_clamp_mirror_repeat(u + dudx * (rand_filter.x - 0.5f) + dudy * 
(rand_filter.y - 0.5f),
- 1.0f);
-v = bake_clamp_mirror_repeat(v + dvdx * (rand_filter.x - 0.5f) + dvdy * 
(rand_filter.y - 0.5f),
- 1.0f - u);
-  }
+  bake_jitter_barycentric(u, v, rand_filter, dudx, dudy, dvdx, dvdy);
 
   /* Convert from Blender to Cycles/Embree/OptiX barycentric convention. */
   const float tmp = u;

___
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] [347c82be6db] master: Fix T98951: Shadow catcher objects are double-counting data passes

2022-12-16 Thread Lukas Stockner
Commit: 347c82be6dba0e35aca1e9fe2e417b256998786f
Author: Lukas Stockner
Date:   Sun Nov 27 02:40:11 2022 +0100
Branches: master
https://developer.blender.org/rB347c82be6dba0e35aca1e9fe2e417b256998786f

Fix T98951: Shadow catcher objects are double-counting data passes

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

===

M   intern/cycles/kernel/film/data_passes.h
M   intern/cycles/kernel/film/denoising_passes.h

===

diff --git a/intern/cycles/kernel/film/data_passes.h 
b/intern/cycles/kernel/film/data_passes.h
index 3c538a74978..0ed5828ff30 100644
--- a/intern/cycles/kernel/film/data_passes.h
+++ b/intern/cycles/kernel/film/data_passes.h
@@ -33,6 +33,12 @@ ccl_device_inline void film_write_data_passes(KernelGlobals 
kg,
 return;
   }
 
+  /* Don't write data passes for paths that were split off for shadow catchers
+   * to avoid double-counting. */
+  if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
+return;
+  }
+
   const int flag = kernel_data.film.pass_flag;
 
   if (!(flag & PASS_ANY)) {
diff --git a/intern/cycles/kernel/film/denoising_passes.h 
b/intern/cycles/kernel/film/denoising_passes.h
index dfc21d787f2..0a32df19a3e 100644
--- a/intern/cycles/kernel/film/denoising_passes.h
+++ b/intern/cycles/kernel/film/denoising_passes.h
@@ -16,7 +16,8 @@ ccl_device_forceinline void 
film_write_denoising_features_surface(KernelGlobals
   ccl_global 
float *ccl_restrict
   
render_buffer)
 {
-  if (!(INTEGRATOR_STATE(state, path, flag) & PATH_RAY_DENOISING_FEATURES)) {
+  const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
+  if (!(path_flag & PATH_RAY_DENOISING_FEATURES)) {
 return;
   }
 
@@ -25,6 +26,12 @@ ccl_device_forceinline void 
film_write_denoising_features_surface(KernelGlobals
 return;
   }
 
+  /* Don't write denoising passes for paths that were split off for shadow 
catchers
+   * to avoid double-counting. */
+  if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
+return;
+  }
+
   ccl_global float *buffer = film_pass_pixel_render_buffer(kg, state, 
render_buffer);
 
   if (kernel_data.film.pass_denoising_depth != PASS_UNUSED) {

___
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] [a90642816ca] temp-nodes-group-declarations: Some progress

2022-12-16 Thread Hans Goudey
Commit: a90642816ca478fe6acb4c922943b827136d1e7e
Author: Hans Goudey
Date:   Fri Dec 16 16:42:19 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rBa90642816ca478fe6acb4c922943b827136d1e7e

Some progress

===

M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/nodes/NOD_common.h
M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/NOD_socket.h
M   source/blender/nodes/geometry/nodes/node_geo_common.cc
M   source/blender/nodes/intern/node_common.cc
M   source/blender/nodes/intern/node_declaration.cc
M   source/blender/nodes/intern/node_socket.cc

===

diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 845b5a5566d..8a747844f97 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -122,7 +122,7 @@ using CPPTypeHandle = blender::CPPType;
 using NodeMultiFunctionBuildFunction = void 
(*)(blender::nodes::NodeMultiFunctionBuilder );
 using NodeGeometryExecFunction = void (*)(blender::nodes::GeoNodeExecParams 
params);
 using NodeDeclareFunction = void (*)(blender::nodes::NodeDeclarationBuilder 
);
-using NodeDeclareDynamicFunction = bool (*)(const bNodeTree ,
+using NodeDeclareDynamicFunction = void (*)(const bNodeTree ,
 const bNode ,
 blender::nodes::NodeDeclaration 
_declaration);
 using SocketGetCPPValueFunction = void (*)(const struct bNodeSocket , 
void *r_value);
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc 
b/source/blender/blenkernel/intern/node_tree_update.cc
index b1cae45ba45..f43d3f0d1d2 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -22,6 +22,7 @@
 #include "MOD_nodes.h"
 
 #include "NOD_node_declaration.hh"
+#include "NOD_socket.h"
 #include "NOD_texture.h"
 
 #include "DEG_depsgraph_query.h"
@@ -535,7 +536,6 @@ class NodeTreeMainUpdater {
 
   void update_individual_nodes(bNodeTree )
   {
-Vector group_inout_nodes;
 for (bNode *node : ntree.all_nodes()) {
   nodeDeclarationEnsure(, node);
   if (this->should_update_individual_node(ntree, *node)) {
@@ -546,28 +546,14 @@ class NodeTreeMainUpdater {
 if (ntype.updatefunc) {
   ntype.updatefunc(, node);
 }
-// if (ntype.declare_dynamic) {
-//   if (!node->runtime->declaration) {
-// node->runtime->declaration = new 
blender::nodes::NodeDeclaration();
-//   }
-//   build_node_declaration_dynamic(ntree, *node, 
*node->runtime->declaration);
-// }
-  }
-  if (ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT)) {
-group_inout_nodes.append(node);
-  }
-}
-/* The update function of group input/output nodes may add new interface 
sockets. When that
- * happens, all the input/output nodes have to be updated again. In the 
future it would be
- * better to move this functionality out of the node update function into 
the operator that's
- * supposed to create the new interface socket. */
-if (ntree.runtime->changed_flag & NTREE_CHANGED_INTERFACE) {
-  for (bNode *node : group_inout_nodes) {
-if (node->typeinfo->declare_dynamic) {
+if (ntype.declare_dynamic) {
   if (!node->runtime->declaration) {
 node->runtime->declaration = new blender::nodes::NodeDeclaration();
   }
   build_node_declaration_dynamic(ntree, *node, 
*node->runtime->declaration);
+  /* TODO: Move this to blenkernel or something. */
+  nodes::refresh_node_sockets_from_declaration(
+  ntree, *node, *node->runtime->declaration, true);
 }
   }
 }
diff --git a/source/blender/nodes/NOD_common.h 
b/source/blender/nodes/NOD_common.h
index d860e60864c..7b6244042f8 100644
--- a/source/blender/nodes/NOD_common.h
+++ b/source/blender/nodes/NOD_common.h
@@ -31,9 +31,9 @@ void node_internal_links_create(struct bNodeTree *ntree, 
struct bNode *node);
 
 namespace blender::nodes {
 
-bool node_group_declare_dynamic(const bNodeTree _tree,
-   const bNode ,
-   NodeDeclaration _declaration);
+void node_group_declare_dynamic(const bNodeTree _tree,
+const bNode ,
+NodeDeclaration _declaration);
 
 }  // namespace blender::nodes
 
diff --git a/source/blender/nodes/NOD_node_declaration.hh 
b/source/blender/nodes/NOD_node_declaration.hh
index f67806a4cd4..f2523823e5e 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -311,6 +311,8 @@ class 

[Bf-blender-cvs] [8a27da7b3b3] temp-nodes-group-declarations: Merge branch 'master' into temp-nodes-group-declarations

2022-12-16 Thread Hans Goudey
Commit: 8a27da7b3b3bba4572ce1d640ae69cb83e6204f7
Author: Hans Goudey
Date:   Fri Dec 16 14:50:08 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB8a27da7b3b3bba4572ce1d640ae69cb83e6204f7

Merge branch 'master' into temp-nodes-group-declarations

===



===



___
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] [4254810e502] master: Cleanup: Slightly refactor cancelling link drag operator

2022-12-16 Thread Hans Goudey
Commit: 4254810e5028c6ebd745bb53c4cfa8c97483af8b
Author: Hans Goudey
Date:   Fri Dec 16 14:03:49 2022 -0600
Branches: master
https://developer.blender.org/rB4254810e5028c6ebd745bb53c4cfa8c97483af8b

Cleanup: Slightly refactor cancelling link drag operator

Clarify that the dragged links aren't stored in the tree, use a
separate function for cancelling vs. applying the links to the tree.

===

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

===

diff --git a/source/blender/editors/space_node/node_relationships.cc 
b/source/blender/editors/space_node/node_relationships.cc
index c4c3924ec6a..360f713e1a7 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -894,42 +894,41 @@ static void node_remove_extra_links(SpaceNode , 
bNodeLink )
   }
 }
 
-static void node_link_exit(bContext , wmOperator , const bool apply_links)
+static void add_dragged_links_to_tree(bContext , bNodeLinkDrag )
 {
   Main *bmain = CTX_data_main();
   ARegion  = *CTX_wm_region();
   SpaceNode  = *CTX_wm_space_node();
   bNodeTree  = *snode.edittree;
-  bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op.customdata;
-
-  for (bNodeLink *link : nldrag->links) {
-if (apply_links && link->tosock && link->fromsock) {
-  /* before actually adding the link,
-   * let nodes perform special link insertion handling
-   */
-  if (link->fromnode->typeinfo->insert_link) {
-link->fromnode->typeinfo->insert_link(, link->fromnode, link);
-  }
-  if (link->tonode->typeinfo->insert_link) {
-link->tonode->typeinfo->insert_link(, link->tonode, link);
-  }
 
-  /* add link to the node tree */
-  BLI_addtail(, link);
-  BKE_ntree_update_tag_link_added(, link);
+  for (bNodeLink *link : nldrag.links) {
+if (!link->tosock || !link->fromsock) {
+  MEM_freeN(link);
+  continue;
+}
 
-  /* we might need to remove a link */
-  node_remove_extra_links(snode, *link);
+/* before actually adding the link,
+ * let nodes perform special link insertion handling
+ */
+if (link->fromnode->typeinfo->insert_link) {
+  link->fromnode->typeinfo->insert_link(, link->fromnode, link);
 }
-else {
-  nodeRemLink(, link);
+if (link->tonode->typeinfo->insert_link) {
+  link->tonode->typeinfo->insert_link(, link->tonode, link);
 }
+
+/* add link to the node tree */
+BLI_addtail(, link);
+BKE_ntree_update_tag_link_added(, link);
+
+/* we might need to remove a link */
+node_remove_extra_links(snode, *link);
   }
 
   ED_node_tree_propagate_change(, bmain, );
 
   /* Ensure drag-link tool-tip is disabled. */
-  draw_draglink_tooltip_deactivate(*CTX_wm_region(), *nldrag);
+  draw_draglink_tooltip_deactivate(region, nldrag);
 
   ED_workspace_status_text(, nullptr);
   ED_region_tag_redraw();
@@ -938,6 +937,19 @@ static void node_link_exit(bContext , wmOperator , 
const bool apply_links)
   snode.runtime->linkdrag.reset();
 }
 
+static void node_link_cancel(bContext *C, wmOperator *op)
+{
+  SpaceNode *snode = CTX_wm_space_node(C);
+  bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata;
+  draw_draglink_tooltip_deactivate(*CTX_wm_region(C), *nldrag);
+  UI_view2d_edge_pan_cancel(C, >pan_data);
+  for (bNodeLink *link : nldrag->links) {
+MEM_freeN(link);
+  }
+  snode->runtime->linkdrag.reset();
+  clear_picking_highlight(>edittree->links);
+}
+
 static void node_link_find_socket(bContext , wmOperator , const float2 
)
 {
   SpaceNode  = *CTX_wm_space_node();
@@ -1061,22 +1073,21 @@ static int node_link_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   }
 }
 
-/* Finish link. */
-node_link_exit(*C, *op, true);
+add_dragged_links_to_tree(*C, *nldrag);
 return OPERATOR_FINISHED;
   }
   break;
 case RIGHTMOUSE:
 case MIDDLEMOUSE: {
   if (event->val == KM_RELEASE) {
-node_link_exit(*C, *op, true);
-return OPERATOR_FINISHED;
+node_link_cancel(C, op);
+return OPERATOR_CANCELLED;
   }
   break;
 }
 case EVT_ESCKEY: {
-  node_link_exit(*C, *op, true);
-  return OPERATOR_FINISHED;
+  node_link_cancel(C, op);
+  return OPERATOR_CANCELLED;
 }
   }
 
@@ -1201,18 +1212,6 @@ static int node_link_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   return OPERATOR_RUNNING_MODAL;
 }
 
-static void node_link_cancel(bContext *C, wmOperator *op)
-{
-  SpaceNode *snode = CTX_wm_space_node(C);
-  bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata;
-
-  UI_view2d_edge_pan_cancel(C, >pan_data);
-
-  snode->runtime->linkdrag.reset();
-
-  clear_picking_highlight(>edittree->links);
-}
-
 void NODE_OT_link(wmOperatorType *ot)
 {
   /* identifiers */


[Bf-blender-cvs] [4352ac0558a] master: Cleanup: Return early in node link operator, remove useless comments

2022-12-16 Thread Hans Goudey
Commit: 4352ac0558ab2f8594c06cffc48e3b1ee41b47da
Author: Hans Goudey
Date:   Fri Dec 16 13:22:34 2022 -0600
Branches: master
https://developer.blender.org/rB4352ac0558ab2f8594c06cffc48e3b1ee41b47da

Cleanup: Return early in node link operator, remove useless comments

===

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

===

diff --git a/source/blender/editors/space_node/node_relationships.cc 
b/source/blender/editors/space_node/node_relationships.cc
index 5f42f75e1d2..c4c3924ec6a 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -94,8 +94,10 @@ static bNodeLink *create_drag_link(bNode , bNodeSocket 
)
   return oplink;
 }
 
-static void pick_link(
-wmOperator , bNodeLinkDrag , SpaceNode , bNode *node, 
bNodeLink _to_pick)
+static void pick_link(bNodeLinkDrag ,
+  SpaceNode ,
+  bNode *node,
+  bNodeLink _to_pick)
 {
   clear_picking_highlight(>links);
 
@@ -163,7 +165,7 @@ static void pick_input_link_by_link_intersect(const 
bContext ,
 ED_area_tag_redraw(CTX_wm_area());
 
 if (!node_find_indicated_socket(*snode, , , cursor, SOCK_IN)) {
-  pick_link(op, nldrag, *snode, node, *link_to_pick);
+  pick_link(nldrag, *snode, node, *link_to_pick);
 }
   }
 }
@@ -1014,8 +1016,6 @@ static void node_link_find_socket(bContext , wmOperator 
, const float2 
   }
 }
 
-/* Loop that adds a node-link, called by function below. */
-/* in_out = starting socket */
 static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
   bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata;
@@ -1084,7 +1084,7 @@ static int node_link_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 }
 
 static std::unique_ptr node_link_init(SpaceNode ,
- float2 cursor,
+ const float2 cursor,
  const bool detach)
 {
   /* output indicated? */
@@ -1115,7 +1115,6 @@ static std::unique_ptr 
node_link_init(SpaceNode ,
 else {
   /* dragged links are fixed on output side */
   nldrag->in_out = SOCK_OUT;
-  /* create a new link */
   nldrag->links.append(create_drag_link(*node, *sock));
 }
 return nldrag;
@@ -1158,7 +1157,6 @@ static std::unique_ptr 
node_link_init(SpaceNode ,
 else {
   /* dragged links are fixed on input side */
   nldrag->in_out = SOCK_IN;
-  /* create a new link */
   nldrag->links.append(create_drag_link(*node, *sock));
 }
 return nldrag;
@@ -1185,23 +1183,22 @@ static int node_link_invoke(bContext *C, wmOperator 
*op, const wmEvent *event)
   ED_preview_kill_jobs(CTX_wm_manager(C), );
 
   std::unique_ptr nldrag = node_link_init(snode, cursor, 
detach);
+  if (!nldrag) {
+return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  }
 
-  if (nldrag) {
-UI_view2d_edge_pan_operator_init(C, >pan_data, op);
+  UI_view2d_edge_pan_operator_init(C, >pan_data, op);
 
-/* Add "+" icon when the link is dragged in empty space. */
-if (should_create_drag_link_search_menu(*snode.edittree, *nldrag)) {
-  draw_draglink_tooltip_activate(*CTX_wm_region(C), *nldrag);
-}
-snode.runtime->linkdrag = std::move(nldrag);
-op->customdata = snode.runtime->linkdrag.get();
+  /* Add "+" icon when the link is dragged in empty space. */
+  if (should_create_drag_link_search_menu(*snode.edittree, *nldrag)) {
+draw_draglink_tooltip_activate(*CTX_wm_region(C), *nldrag);
+  }
+  snode.runtime->linkdrag = std::move(nldrag);
+  op->customdata = snode.runtime->linkdrag.get();
 
-/* add modal handler */
-WM_event_add_modal_handler(C, op);
+  WM_event_add_modal_handler(C, op);
 
-return OPERATOR_RUNNING_MODAL;
-  }
-  return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
+  return OPERATOR_RUNNING_MODAL;
 }
 
 static void node_link_cancel(bContext *C, wmOperator *op)
@@ -1233,8 +1230,6 @@ void NODE_OT_link(wmOperatorType *ot)
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
-  PropertyRNA *prop;
-
   RNA_def_boolean(ot->srna, "detach", false, "Detach", "Detach and redirect 
existing links");
   RNA_def_float_array(ot->srna,
   "drag_start",
@@ -1246,8 +1241,6 @@ void NODE_OT_link(wmOperatorType *ot)
   "The position of the mouse cursor at the start of the 
operation",
   -UI_PRECISION_FLOAT_MAX,
   UI_PRECISION_FLOAT_MAX);
-  RNA_def_property_flag(prop, PROP_HIDDEN);
-  RNA_def_property_flag(prop, PROP_HIDDEN);
 
   UI_view2d_edge_pan_operator_properties_ex(ot,
 NODE_EDGE_PAN_INSIDE_PAD,

___

[Bf-blender-cvs] [c9288ab41f4] master: Cleanup: Remove redundant information from node link drag struct

2022-12-16 Thread Hans Goudey
Commit: c9288ab41f491eba463812c99c1237adca5cf210
Author: Hans Goudey
Date:   Fri Dec 16 12:57:15 2022 -0600
Branches: master
https://developer.blender.org/rBc9288ab41f491eba463812c99c1237adca5cf210

Cleanup: Remove redundant information from node link drag struct

===

M   source/blender/editors/space_node/node_intern.hh
M   source/blender/editors/space_node/node_relationships.cc

===

diff --git a/source/blender/editors/space_node/node_intern.hh 
b/source/blender/editors/space_node/node_intern.hh
index 1a6859a3078..a4eb0c12713 100644
--- a/source/blender/editors/space_node/node_intern.hh
+++ b/source/blender/editors/space_node/node_intern.hh
@@ -44,7 +44,6 @@ struct AssetItemTree;
 struct bNodeLinkDrag {
   /** Links dragged by the operator. */
   Vector links;
-  bool from_multi_input_socket;
   eNodeSocketInOut in_out;
 
   /** Draw handler for the "+" icon when dragging a link in empty space. */
diff --git a/source/blender/editors/space_node/node_relationships.cc 
b/source/blender/editors/space_node/node_relationships.cc
index ea6502dbf00..5f42f75e1d2 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -98,7 +98,6 @@ static void pick_link(
 wmOperator , bNodeLinkDrag , SpaceNode , bNode *node, 
bNodeLink _to_pick)
 {
   clear_picking_highlight(>links);
-  RNA_boolean_set(op.ptr, "has_link_picked", true);
 
   bNodeLink *link = create_drag_link(*link_to_pick.fromnode, 
*link_to_pick.fromsock);
 
@@ -1032,7 +1031,7 @@ static int node_link_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 
   switch (event->type) {
 case MOUSEMOVE:
-  if (nldrag->from_multi_input_socket && !RNA_boolean_get(op->ptr, 
"has_link_picked")) {
+  if (nldrag->start_socket->is_multi_input() && nldrag->links.is_empty()) {
 pick_input_link_by_link_intersect(*C, *op, *nldrag, cursor);
   }
   else {
@@ -1137,14 +1136,11 @@ static std::unique_ptr 
node_link_init(SpaceNode ,
   bNodeLink *link_to_pick;
   LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, >links) {
 if (link->tosock == sock) {
-  if (sock->flag & SOCK_MULTI_INPUT) {
-nldrag->from_multi_input_socket = true;
-  }
   link_to_pick = link;
 }
   }
 
-  if (link_to_pick != nullptr && !nldrag->from_multi_input_socket) {
+  if (link_to_pick != nullptr && !nldrag->start_socket->is_multi_input()) {
 bNodeLink *oplink = MEM_cnew("drag link op link");
 *oplink = *link_to_pick;
 oplink->next = oplink->prev = nullptr;
@@ -1185,7 +1181,6 @@ static int node_link_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   float2 cursor;
   UI_view2d_region_to_view(, mval[0], mval[1], [0], 
[1]);
   RNA_float_set_array(op->ptr, "drag_start", cursor);
-  RNA_boolean_set(op->ptr, "has_link_picked", false);
 
   ED_preview_kill_jobs(CTX_wm_manager(C), );
 
@@ -1241,14 +1236,6 @@ void NODE_OT_link(wmOperatorType *ot)
   PropertyRNA *prop;
 
   RNA_def_boolean(ot->srna, "detach", false, "Detach", "Detach and redirect 
existing links");
-  prop = RNA_def_boolean(
-  ot->srna,
-  "has_link_picked",
-  false,
-  "Has Link Picked",
-  "The operation has placed a link. Only used for multi-input sockets, 
where the "
-  "link is picked later");
-  RNA_def_property_flag(prop, PROP_HIDDEN);
   RNA_def_float_array(ot->srna,
   "drag_start",
   2,

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


[Bf-blender-cvs] [a43e4988788] master: Cleanup: Remove unnecessary node link flag

2022-12-16 Thread Hans Goudey
Commit: a43e4988788a0dcea92da2367d6f8bc71ea8b2c6
Author: Hans Goudey
Date:   Fri Dec 16 12:00:30 2022 -0600
Branches: master
https://developer.blender.org/rBa43e4988788a0dcea92da2367d6f8bc71ea8b2c6

Cleanup: Remove unnecessary node link flag

Links that are currently being dragged are now stored outside
of the node tree, so we don't need a flag to distinguish them
from "proper" links.

===

M   source/blender/editors/space_node/drawnode.cc
M   source/blender/editors/space_node/node_relationships.cc
M   source/blender/makesdna/DNA_node_types.h

===

diff --git a/source/blender/editors/space_node/drawnode.cc 
b/source/blender/editors/space_node/drawnode.cc
index 708efc0c7a6..16771ef7347 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -2199,7 +2199,7 @@ void node_draw_link(const bContext ,
   }
 
   /* Links from field to non-field sockets are not allowed. */
-  if (snode.edittree->type == NTREE_GEOMETRY && !(link.flag & 
NODE_LINK_DRAGGED)) {
+  if (snode.edittree->type == NTREE_GEOMETRY) {
 if ((link.fromsock && link.fromsock->display_shape == 
SOCK_DISPLAY_SHAPE_DIAMOND) &&
 (link.tosock && link.tosock->display_shape == 
SOCK_DISPLAY_SHAPE_CIRCLE)) {
   th_col1 = th_col2 = th_col3 = TH_REDALERT;
diff --git a/source/blender/editors/space_node/node_relationships.cc 
b/source/blender/editors/space_node/node_relationships.cc
index 450d3bff286..ea6502dbf00 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -91,7 +91,6 @@ static bNodeLink *create_drag_link(bNode , bNodeSocket 
)
 oplink->tosock = 
   }
   oplink->flag |= NODE_LINK_VALID;
-  oplink->flag |= NODE_LINK_DRAGGED;
   return oplink;
 }
 
@@ -903,8 +902,6 @@ static void node_link_exit(bContext , wmOperator , 
const bool apply_links)
   bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op.customdata;
 
   for (bNodeLink *link : nldrag->links) {
-link->flag &= ~NODE_LINK_DRAGGED;
-
 if (apply_links && link->tosock && link->fromsock) {
   /* before actually adding the link,
* let nodes perform special link insertion handling
@@ -1110,7 +1107,6 @@ static std::unique_ptr 
node_link_init(SpaceNode ,
   *oplink = *link;
   oplink->next = oplink->prev = nullptr;
   oplink->flag |= NODE_LINK_VALID;
-  oplink->flag |= NODE_LINK_DRAGGED;
 
   nldrag->links.append(oplink);
   nodeRemLink(snode.edittree, link);
@@ -1153,7 +1149,6 @@ static std::unique_ptr 
node_link_init(SpaceNode ,
 *oplink = *link_to_pick;
 oplink->next = oplink->prev = nullptr;
 oplink->flag |= NODE_LINK_VALID;
-oplink->flag |= NODE_LINK_DRAGGED;
 
 nldrag->links.append(oplink);
 nodeRemLink(snode.edittree, link_to_pick);
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 6acb2208962..97505fdf5fe 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -499,7 +499,6 @@ typedef struct bNodeLink {
 #define NODE_LINK_TEST (1 << 2)   /* free test flag, undefined */
 #define NODE_LINK_TEMP_HIGHLIGHT (1 << 3) /* Link is highlighted for picking. 
*/
 #define NODE_LINK_MUTED (1 << 4)  /* Link is muted. */
-#define NODE_LINK_DRAGGED (1 << 5)/* Node link is being dragged by the 
user. */
 
 /* tree->edit_quality/tree->render_quality */
 #define NTREE_QUALITY_HIGH 0

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


[Bf-blender-cvs] [5ffcd8779eb] master: Fix: socket tooltip not showing when there was no type conversion

2022-12-16 Thread Jacques Lucke
Commit: 5ffcd8779eb27145cbc8de0450be0e2c7b03a915
Author: Jacques Lucke
Date:   Fri Dec 16 19:39:14 2022 +0100
Branches: master
https://developer.blender.org/rB5ffcd8779eb27145cbc8de0450be0e2c7b03a915

Fix: socket tooltip not showing when there was no type conversion

===

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 2790e8de6a8..4d551557bac 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -833,10 +833,13 @@ static void 
create_inspection_string_for_generic_value(const bNodeSocket 
 
   const CPPType _type = *socket.typeinfo->base_cpp_type;
   const bke::DataTypeConversions  = 
bke::get_implicit_type_conversions();
-  if (!convert.is_convertible(value_type, socket_type)) {
-return;
+  if (value_type != socket_type) {
+if (!convert.is_convertible(value_type, socket_type)) {
+  return;
+}
   }
   BUFFER_FOR_CPP_TYPE_VALUE(socket_type, socket_value);
+  /* This will just copy the value if the types are equal. */
   convert.convert_to_uninitialized(value_type, socket_type, buffer, 
socket_value);
   BLI_SCOPED_DEFER([&]() { socket_type.destruct(socket_value); });

___
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] [c1741843857] temp-nodes-group-declarations: Merge branch 'master' into temp-nodes-group-declarations

2022-12-16 Thread Hans Goudey
Commit: c17418438570590cc5ed8f092d6c0c6bf1e6a55f
Author: Hans Goudey
Date:   Fri Dec 16 11:32:09 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rBc17418438570590cc5ed8f092d6c0c6bf1e6a55f

Merge branch 'master' into temp-nodes-group-declarations

===



===



___
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] [3aca0bc66a4] master: Geometry Nodes: simplify handling of invalid group interface sockets

2022-12-16 Thread Jacques Lucke
Commit: 3aca0bc66a479e1cca9b688e8140da3ee06e8397
Author: Jacques Lucke
Date:   Fri Dec 16 18:30:47 2022 +0100
Branches: master
https://developer.blender.org/rB3aca0bc66a479e1cca9b688e8140da3ee06e8397

Geometry Nodes: simplify handling of invalid group interface sockets

Previously, the code tried to keep node groups working even if some of
their input/output sockets had undefined type. This caused some
complexity with no benefit because not all places outside of this file
would handle the case correctly. Now node groups with undefined
interface sockets are disabled and have to be fixed manually before
they work again.

Undefined interface sockets are mostly caused by invalid Python
API usage and incomplete forward compatibility (e.g. when newer
versions introduce new socket types that the older version does
not know).

===

M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/blenkernel/intern/node_runtime.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/blenkernel/BKE_node_runtime.hh 
b/source/blender/blenkernel/BKE_node_runtime.hh
index 6a00e70cb5b..b4b9df32663 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -141,6 +141,8 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
   bool has_undefined_nodes_or_sockets = false;
   bNode *group_output_node = nullptr;
   Vector root_frames;
+  Vector interface_inputs;
+  Vector interface_outputs;
 };
 
 /**
@@ -426,6 +428,18 @@ inline blender::Span 
bNodeTree::group_input_nodes() const
   return this->nodes_by_type("NodeGroupInput");
 }
 
+inline blender::Span bNodeTree::interface_inputs() const
+{
+  
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
+  return this->runtime->interface_inputs;
+}
+
+inline blender::Span bNodeTree::interface_outputs() const
+{
+  
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
+  return this->runtime->interface_outputs;
+}
+
 inline blender::Span bNodeTree::all_input_sockets() const
 {
   
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
diff --git a/source/blender/blenkernel/intern/node_runtime.cc 
b/source/blender/blenkernel/intern/node_runtime.cc
index 4bdc8f6f9b8..0f0b04f920e 100644
--- a/source/blender/blenkernel/intern/node_runtime.cc
+++ b/source/blender/blenkernel/intern/node_runtime.cc
@@ -42,6 +42,13 @@ static void 
double_checked_lock_with_task_isolation(std::mutex ,
   double_checked_lock(mutex, data_is_dirty, [&]() { 
threading::isolate_task(fn); });
 }
 
+static void update_interface_sockets(const bNodeTree )
+{
+  bNodeTreeRuntime _runtime = *ntree.runtime;
+  tree_runtime.interface_inputs = ntree.inputs;
+  tree_runtime.interface_outputs = ntree.outputs;
+}
+
 static void update_node_vector(const bNodeTree )
 {
   bNodeTreeRuntime _runtime = *ntree.runtime;
@@ -429,6 +436,7 @@ static void ensure_topology_cache(const bNodeTree )
   bNodeTreeRuntime _runtime = *ntree.runtime;
   double_checked_lock_with_task_isolation(
   tree_runtime.topology_cache_mutex, tree_runtime.topology_cache_is_dirty, 
[&]() {
+update_interface_sockets(ntree);
 update_node_vector(ntree);
 update_link_vector(ntree);
 update_socket_vectors_and_owner_node(ntree);
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index eddc26fe867..6acb2208962 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -636,6 +636,9 @@ typedef struct bNodeTree {
   const bNode *group_output_node() const;
   /** Get all input nodes of the node group. */
   blender::Span group_input_nodes() const;
+  /** Inputs and outputs of the entire node group. */
+  blender::Span interface_inputs() const;
+  blender::Span interface_outputs() const;
 #endif
 } bNodeTree;
 
diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc 
b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 8d11089f253..9ded1827ccc 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -746,20 +746,9 @@ struct GeometryNodesLazyFunctionGraphBuilder {
 
   /**
* All group input nodes are combined into one dummy node in the 
lazy-function graph.
-   * If some input has an invalid type, it is ignored in the new graph. In 
this case null and -1 is
-   * used in the vectors below.
*/
-  Vector group_input_types_;
-  Vector group_input_indices_;
   lf::DummyNode *group_input_lf_node_;
 
-  /**
-   * The output types or null if an output is invalid. Each group output node 
gets a separate
-   * corresponding dummy node in the new graph.
-   */
-  

[Bf-blender-cvs] [6ced6c9545e] master: Fix std::optional value() build error on older macOS SDK

2022-12-16 Thread Hans Goudey
Commit: 6ced6c9545e54d3e27ec6d233b31e902d6624924
Author: Hans Goudey
Date:   Fri Dec 16 11:02:43 2022 -0600
Branches: master
https://developer.blender.org/rB6ced6c9545e54d3e27ec6d233b31e902d6624924

Fix std::optional value() build error on older macOS SDK

Patch from @dupoxy

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

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc 
b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc
index e219d5bc0a1..ec8c82fc66d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc
@@ -33,7 +33,7 @@ static void 
set_computed_position_and_offset(GeometryComponent ,
 
   if (in_positions.is_same(positions_read_only)) {
 if (const std::optional offset = in_offsets.get_if_single()) {
-  if (math::is_zero(offset.value())) {
+  if (math::is_zero(*offset)) {
 return;
   }
 }

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


[Bf-blender-cvs] [ea731f42db3] master: Fix T103187: Opening node search menu is slow because of assets.

2022-12-16 Thread Julian Eisel
Commit: ea731f42db32bf8bf3bf0f799fb4a6d298922b52
Author: Julian Eisel
Date:   Fri Dec 16 17:01:03 2022 +0100
Branches: master
https://developer.blender.org/rBea731f42db32bf8bf3bf0f799fb4a6d298922b52

Fix T103187: Opening node search menu is slow because of assets.

Avoid utility function call that would query the file system, this was a
bottleneck. The path joining was also problematic. See patch for more
details.

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

Reviewed by: Jacques Lucke

===

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 bf0f9c865a8..c40ba5d016b 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -323,7 +323,6 @@ static void filelist_readjob_main_assets(FileListReadJob 
*job_params,
 
 /* helper, could probably go in BKE actually? */
 static int groupname_to_code(const char *group);
-static uint64_t groupname_to_filter_id(const char *group);
 
 static void filelist_cache_clear(FileListEntryCache *cache, size_t new_size);
 static bool filelist_intern_entry_is_main_file(const FileListInternEntry 
*intern_entry);
@@ -751,7 +750,7 @@ static bool is_filtered_file(FileListInternEntry *file,
 }
 
 static bool is_filtered_id_file_type(const FileListInternEntry *file,
- const char *id_group,
+ const short id_code,
  const char *name,
  const FileListFilter *filter)
 {
@@ -761,12 +760,12 @@ static bool is_filtered_id_file_type(const 
FileListInternEntry *file,
 
   /* We only check for types if some type are enabled in filtering. */
   if ((filter->filter || filter->filter_id) && (filter->flags & 
FLF_DO_FILTER)) {
-if (id_group) {
+if (id_code) {
   if (!name && (filter->flags & FLF_HIDE_LIB_DIR)) {
 return false;
   }
 
-  uint64_t filter_id = groupname_to_filter_id(id_group);
+  const uint64_t filter_id = BKE_idtype_idcode_to_idfilter(id_code);
   if (!(filter_id & filter->filter_id)) {
 return false;
   }
@@ -851,15 +850,11 @@ static bool is_filtered_asset(FileListInternEntry *file, 
FileListFilter *filter)
 }
 
 static bool is_filtered_lib_type(FileListInternEntry *file,
- const char *root,
+ const char * /*root*/,
  FileListFilter *filter)
 {
-  char path[FILE_MAX_LIBEXTRA], dir[FILE_MAX_LIBEXTRA], *group, *name;
-
-  BLI_path_join(path, sizeof(path), root, file->relpath);
-
-  if (BLO_library_path_explode(path, dir, , )) {
-return is_filtered_id_file_type(file, group, name, filter);
+  if (file->typeflag & FILE_TYPE_BLENDERLIB) {
+return is_filtered_id_file_type(file, file->blentype, file->name, filter);
   }
   return is_filtered_file_type(file, filter);
 }
@@ -881,7 +876,7 @@ static bool is_filtered_main_assets(FileListInternEntry 
*file,
 FileListFilter *filter)
 {
   /* "Filtered" means *not* being filtered out... So return true if the file 
should be visible. */
-  return is_filtered_id_file_type(file, file->relpath, file->name, filter) &&
+  return is_filtered_id_file_type(file, file->blentype, file->name, filter) &&
  is_filtered_asset(file, filter);
 }
 
@@ -2882,13 +2877,6 @@ static int groupname_to_code(const char *group)
   return buf[0] ? BKE_idtype_idcode_from_name(buf) : 0;
 }
 
-static uint64_t groupname_to_filter_id(const char *group)
-{
-  int id_code = groupname_to_code(group);
-
-  return BKE_idtype_idcode_to_idfilter(id_code);
-}
-
 /**
  * From here, we are in 'Job Context',
  * i.e. have to be careful about sharing stuff between background working 
thread.

___
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] [d77a6849e66] master: Cleanup: Remove duplicate UV islands header

2022-12-16 Thread Hans Goudey
Commit: d77a6849e664d2506f8a3a0392f7864534870dfd
Author: Hans Goudey
Date:   Fri Dec 16 09:43:39 2022 -0600
Branches: master
https://developer.blender.org/rBd77a6849e664d2506f8a3a0392f7864534870dfd

Cleanup: Remove duplicate UV islands header

This code was duplicated from `pbvh_uv_islands.hh`,
which was the version that was actually used.

===

D   source/blender/blenkernel/BKE_uv_islands.hh
M   source/blender/blenkernel/CMakeLists.txt

===

diff --git a/source/blender/blenkernel/BKE_uv_islands.hh 
b/source/blender/blenkernel/BKE_uv_islands.hh
deleted file mode 100644
index 406ecf39b71..000
--- a/source/blender/blenkernel/BKE_uv_islands.hh
+++ /dev/null
@@ -1,746 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#pragma once
-
-#include 
-#include 
-
-#include "BLI_array.hh"
-#include "BLI_edgehash.h"
-#include "BLI_float3x3.hh"
-#include "BLI_map.hh"
-#include "BLI_math.h"
-#include "BLI_math_vec_types.hh"
-#include "BLI_rect.h"
-#include "BLI_vector.hh"
-#include "BLI_vector_list.hh"
-
-#include "DNA_meshdata_types.h"
-
-namespace blender::bke::uv_islands {
-
-struct MeshEdge;
-struct MeshPrimitive;
-struct UVBorder;
-struct UVEdge;
-struct UVIslands;
-struct UVIslandsMask;
-struct UVPrimitive;
-struct UVPrimitiveEdge;
-struct UVVertex;
-
-struct MeshVertex {
-  int64_t v;
-  Vector edges;
-};
-
-struct MeshUVVert {
-  MeshVertex *vertex;
-  float2 uv;
-  int64_t loop;
-};
-
-struct MeshEdge {
-  MeshVertex *vert1;
-  MeshVertex *vert2;
-  Vector primitives;
-};
-
-/** Represents a triangle in 3d space (MLoopTri) */
-struct MeshPrimitive {
-  int64_t index;
-  int64_t poly;
-  Vector edges;
-  Vector vertices;
-
-  /**
-   * UV island this primitive belongs to. This is used to speed up the initial 
uv island
-   * extraction, but should not be used when extending uv islands.
-   */
-  int64_t uv_island_id;
-
-  MeshUVVert *get_other_uv_vertex(const MeshVertex *v1, const MeshVertex *v2)
-  {
-BLI_assert(vertices[0].vertex == v1 || vertices[1].vertex == v1 || 
vertices[2].vertex == v1);
-BLI_assert(vertices[0].vertex == v2 || vertices[1].vertex == v2 || 
vertices[2].vertex == v2);
-for (MeshUVVert _vertex : vertices) {
-  if (uv_vertex.vertex != v1 && uv_vertex.vertex != v2) {
-return _vertex;
-  }
-}
-return nullptr;
-  }
-
-  rctf uv_bounds() const;
-
-  bool has_shared_uv_edge(const MeshPrimitive *other) const
-  {
-int shared_uv_verts = 0;
-for (const MeshUVVert  : vertices) {
-  for (const MeshUVVert _vert : other->vertices) {
-if (vert.uv == other_vert.uv) {
-  shared_uv_verts += 1;
-}
-  }
-}
-return shared_uv_verts >= 2;
-  }
-};
-
-/**
- * MeshData contains input geometry data converted in a list of primitives, 
edges and vertices for
- * quick access for both local space and uv space.
- */
-struct MeshData {
- public:
-  const MLoopTri *looptri;
-  const int64_t looptri_len;
-  const int64_t vert_len;
-  const MLoop *mloop;
-  const MLoopUV *mloopuv;
-
- public:
-  Vector primitives;
-  Vector edges;
-  Vector vertices;
-  /** Total number of uv islands detected. */
-  int64_t uv_island_len;
-
-  explicit MeshData(const MLoopTri *looptri,
-const int64_t looptri_len,
-const int64_t vert_len,
-const MLoop *mloop,
-const MLoopUV *mloopuv)
-  : looptri(looptri),
-looptri_len(looptri_len),
-vert_len(vert_len),
-mloop(mloop),
-mloopuv(mloopuv)
-  {
-init_vertices();
-init_primitives();
-init_edges();
-init_primitive_uv_island_ids();
-  }
-
-  void init_vertices()
-  {
-vertices.reserve(vert_len);
-for (int64_t i = 0; i < vert_len; i++) {
-  MeshVertex vert;
-  vert.v = i;
-  vertices.append(vert);
-}
-  }
-
-  void init_primitives()
-  {
-primitives.reserve(looptri_len);
-for (int64_t i = 0; i < looptri_len; i++) {
-  const MLoopTri  = looptri[i];
-  MeshPrimitive primitive;
-  primitive.index = i;
-  primitive.poly = tri.poly;
-
-  for (int j = 0; j < 3; j++) {
-MeshUVVert uv_vert;
-uv_vert.loop = tri.tri[j];
-uv_vert.vertex = [mloop[uv_vert.loop].v];
-uv_vert.uv = mloopuv[uv_vert.loop].uv;
-primitive.vertices.append(uv_vert);
-  }
-  primitives.append(primitive);
-}
-  }
-
-  void init_edges()
-  {
-edges.reserve(looptri_len * 2);
-EdgeHash *eh = BLI_edgehash_new_ex(__func__, looptri_len * 3);
-for (int64_t i = 0; i < looptri_len; i++) {
-  const MLoopTri  = looptri[i];
-  MeshPrimitive  = primitives[i];
-  for (int j = 0; j < 3; j++) {
-int v1 = mloop[tri.tri[j]].v;
-int v2 = mloop[tri.tri[(j + 1) % 3]].v;
-/* TODO: Use lookup_ptr to be able to store edge 0. */
-void *v = 

[Bf-blender-cvs] [9e94135f179] master: Fix: Crash after mesh color attribute name commit

2022-12-16 Thread Christophe Hery
Commit: 9e94135f17906c64e8306e893cd76dbef59dda15
Author: Christophe Hery
Date:   Fri Dec 16 09:42:30 2022 -0600
Branches: master
https://developer.blender.org/rB9e94135f17906c64e8306e893cd76dbef59dda15

Fix: Crash after mesh color attribute name commit

6514bb05ea5a138d8971 missed a null check when accessing the active
and default color attribute names, since the CustomData API does not
do that check itself.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc 
b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index a53b0e66924..28bbc0ffae3 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -544,11 +544,15 @@ static void update_active_fdata_layers(Mesh , 
CustomData *fdata, CustomData
   }
 
   if (CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) {
-act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, 
mesh.active_color_attribute);
-CustomData_set_layer_active(fdata, CD_MCOL, act);
+if (mesh.active_color_attribute != NULL) {
+  act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, 
mesh.active_color_attribute);
+  CustomData_set_layer_active(fdata, CD_MCOL, act);
+}
 
-act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, 
mesh.default_color_attribute);
-CustomData_set_layer_render(fdata, CD_MCOL, act);
+if (mesh.default_color_attribute != NULL) {
+  act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, 
mesh.default_color_attribute);
+  CustomData_set_layer_render(fdata, CD_MCOL, act);
+}
 
 act = CustomData_get_clone_layer(ldata, CD_PROP_BYTE_COLOR);
 CustomData_set_layer_clone(fdata, CD_MCOL, act);

___
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] [bea5fe65055] master: Nodes: Add Exclusion color mix mode

2022-12-16 Thread Charlie Jolly
Commit: bea5fe65055e32a0a95232450b014c0d84e21e68
Author: Charlie Jolly
Date:   Fri Nov 18 12:52:14 2022 +
Branches: master
https://developer.blender.org/rBbea5fe65055e32a0a95232450b014c0d84e21e68

Nodes: Add Exclusion color mix mode

Expands Color Mix nodes with new Exclusion mode.

Similar to Difference but produces less contrast.

Requested by Pierre Schiller @3D_director and
@OmarSquircleArt on twitter.

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

===

M   intern/cycles/kernel/osl/shaders/node_color_blend.h
M   intern/cycles/kernel/osl/shaders/node_mix.osl
M   intern/cycles/kernel/osl/shaders/node_mix_color.osl
M   intern/cycles/kernel/svm/color_util.h
M   intern/cycles/kernel/svm/types.h
M   intern/cycles/scene/shader_nodes.cpp
M   source/blender/blenkernel/intern/material.cc
M   source/blender/compositor/nodes/COM_MixNode.cc
M   source/blender/compositor/operations/COM_MixOperation.cc
M   source/blender/compositor/operations/COM_MixOperation.h
M   source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M   source/blender/gpu/shaders/common/gpu_shader_common_mix_rgb.glsl
M   source/blender/gpu/shaders/material/gpu_shader_material_mix_color.glsl
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_material.c
M   source/blender/nodes/composite/nodes/node_composite_mixrgb.cc
M   source/blender/nodes/shader/nodes/node_shader_mix.cc
M   source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc

===

diff --git a/intern/cycles/kernel/osl/shaders/node_color_blend.h 
b/intern/cycles/kernel/osl/shaders/node_color_blend.h
index ab4b4809a97..205784c0cda 100644
--- a/intern/cycles/kernel/osl/shaders/node_color_blend.h
+++ b/intern/cycles/kernel/osl/shaders/node_color_blend.h
@@ -73,6 +73,11 @@ color node_mix_diff(float t, color col1, color col2)
   return mix(col1, abs(col1 - col2), t);
 }
 
+color node_mix_exclusion(float t, color col1, color col2)
+{
+  return max(mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
+}
+
 color node_mix_dark(float t, color col1, color col2)
 {
   return mix(col1, min(col1, col2), t);
diff --git a/intern/cycles/kernel/osl/shaders/node_mix.osl 
b/intern/cycles/kernel/osl/shaders/node_mix.osl
index 1bf3abc7f08..6b6806dd05f 100644
--- a/intern/cycles/kernel/osl/shaders/node_mix.osl
+++ b/intern/cycles/kernel/osl/shaders/node_mix.osl
@@ -76,6 +76,11 @@ color node_mix_diff(float t, color col1, color col2)
   return mix(col1, abs(col1 - col2), t);
 }
 
+color node_mix_exclusion(float t, color col1, color col2)
+{
+  return max(mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
+}
+
 color node_mix_dark(float t, color col1, color col2)
 {
   return mix(col1, min(col1, col2), t);
@@ -291,6 +296,8 @@ shader node_mix(string mix_type = "mix",
 Color = node_mix_div(t, Color1, Color2);
   if (mix_type == "difference")
 Color = node_mix_diff(t, Color1, Color2);
+  if (mix_type == "exclusion")
+Color = node_mix_exclusion(t, Color1, Color2);
   if (mix_type == "darken")
 Color = node_mix_dark(t, Color1, Color2);
   if (mix_type == "lighten")
diff --git a/intern/cycles/kernel/osl/shaders/node_mix_color.osl 
b/intern/cycles/kernel/osl/shaders/node_mix_color.osl
index 3ddd89ed306..30521aa1efd 100644
--- a/intern/cycles/kernel/osl/shaders/node_mix_color.osl
+++ b/intern/cycles/kernel/osl/shaders/node_mix_color.osl
@@ -31,6 +31,8 @@ shader node_mix_color(string blend_type = "mix",
 Result = node_mix_div(t, A, B);
   if (blend_type == "difference")
 Result = node_mix_diff(t, A, B);
+  if (blend_type == "exclusion")
+Result = node_mix_exclusion(t, A, B);
   if (blend_type == "darken")
 Result = node_mix_dark(t, A, B);
   if (blend_type == "lighten")
diff --git a/intern/cycles/kernel/svm/color_util.h 
b/intern/cycles/kernel/svm/color_util.h
index 96adb6fd64c..5e9e9db82af 100644
--- a/intern/cycles/kernel/svm/color_util.h
+++ b/intern/cycles/kernel/svm/color_util.h
@@ -79,6 +79,11 @@ ccl_device float3 svm_mix_diff(float t, float3 col1, float3 
col2)
   return interp(col1, fabs(col1 - col2), t);
 }
 
+ccl_device float3 svm_mix_exclusion(float t, float3 col1, float3 col2)
+{
+  return max(interp(col1, col1 + col2 - 2.0f * col1 * col2, t), zero_float3());
+}
+
 ccl_device float3 svm_mix_dark(float t, float3 col1, float3 col2)
 {
   return interp(col1, min(col1, col2), t);
@@ -266,6 +271,8 @@ ccl_device_noinline_cpu float3 svm_mix(NodeMix type, float 
t, float3 c1, float3
   return svm_mix_div(t, c1, c2);
 case NODE_MIX_DIFF:
   return svm_mix_diff(t, c1, c2);
+case NODE_MIX_EXCLUSION:
+  return svm_mix_exclusion(t, c1, c2);
 case NODE_MIX_DARK:
   return svm_mix_dark(t, c1, c2);
 case NODE_MIX_LIGHT:
diff --git a/intern/cycles/kernel/svm/types.h b/intern/cycles/kernel/svm/types.h
index 

[Bf-blender-cvs] [b87bcd3f8fe] blender-v3.4-release: Fix T102346: Mouse escapes window during walk navigation

2022-12-16 Thread Campbell Barton
Commit: b87bcd3f8fe132b3cb99e5f17e77d8eca7f73d6f
Author: Campbell Barton
Date:   Thu Dec 15 11:57:00 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rBb87bcd3f8fe132b3cb99e5f17e77d8eca7f73d6f

Fix T102346: Mouse escapes window during walk navigation

This is an alternative fix to [0] which kept the cursor centrally
located as part of GHOST cursor grabbing which caused T102792.

Now this is done as part of walk mode as it's the operator that most
often ran into this problem although ideally this would be handled by
GHOST - but that's a much bigger project.

[0]: 9fd6dae7939a65b67045749a0eadeb6864ded183

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_navigate_walk.c 
b/source/blender/editors/space_view3d/view3d_navigate_walk.c
index fcb4f549353..108f986d5cd 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_walk.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_walk.c
@@ -55,6 +55,14 @@
 
 #define USE_TABLET_SUPPORT
 
+/**
+ * Use alternative behavior when cursor warp is supported
+ * to prevent the cursor escaping the window bounds, see: T102346.
+ *
+ * \note this is not needed if cursor positioning is not supported.
+ */
+#define USE_CURSOR_WARP_HACK
+
 /*  */
 /** \name Modal Key-map
  * \{ */
@@ -221,6 +229,10 @@ typedef struct WalkInfo {
   bool need_rotation_keyframe;
   bool need_translation_keyframe;
 
+#ifdef USE_CURSOR_WARP_HACK
+  bool need_modal_cursor_warp_hack;
+#endif
+
   /** Previous 2D mouse values. */
   int prev_mval[2];
   /** Initial mouse location. */
@@ -579,6 +591,10 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, 
wmOperator *op, const int
   walk->need_rotation_keyframe = false;
   walk->need_translation_keyframe = false;
 
+#ifdef USE_CURSOR_WARP_HACK
+  walk->need_modal_cursor_warp_hack = false;
+#endif
+
   walk->time_lastdraw = PIL_check_seconds_timer();
 
   walk->draw_handle_pixel = ED_region_draw_cb_activate(
@@ -594,7 +610,31 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, 
wmOperator *op, const int
   copy_v2_v2_int(walk->init_mval, mval);
   copy_v2_v2_int(walk->prev_mval, mval);
 
-  WM_cursor_grab_enable(win, 0, true, NULL);
+#ifdef USE_CURSOR_WARP_HACK
+  if (WM_capabilities_flag() & WM_CAPABILITY_CURSOR_WARP) {
+int bounds[4];
+const rcti *rect = >region->winrct;
+const int center[2] = {BLI_rcti_cent_x(rect), BLI_rcti_cent_y(rect)};
+const int size[2] = {BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)};
+const int div = 4; /* Where 2 is the region size. */
+
+bounds[0] = center[0] - (size[0] / div); /* X-min. */
+bounds[1] = center[1] + (size[1] / div); /* Y-max. */
+bounds[2] = center[0] + (size[0] / div); /* X-max. */
+bounds[3] = center[1] - (size[1] / div); /* Y-min. */
+
+WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, false, bounds);
+
+/* Important to hide afterwards (not part of grabbing),
+ * since enabling cursor and hiding at the same time ignores bounds. */
+WM_cursor_modal_set(win, WM_CURSOR_NONE);
+walk->need_modal_cursor_warp_hack = true;
+  }
+  else
+#endif /* USE_CURSOR_WARP_HACK */
+  {
+WM_cursor_grab_enable(win, 0, true, NULL);
+  }
 
   return 1;
 }
@@ -643,7 +683,16 @@ static int walkEnd(bContext *C, WalkInfo *walk)
   }
 #endif
 
-  WM_cursor_grab_enable(win, 0, true, NULL);
+  WM_cursor_grab_disable(win, NULL);
+
+#ifdef USE_CURSOR_WARP_HACK
+  if (walk->need_modal_cursor_warp_hack) {
+WM_cursor_warp(win,
+   walk->region->winrct.xmin + walk->init_mval[0],
+   walk->region->winrct.ymin + walk->init_mval[1]);
+WM_cursor_modal_restore(win);
+  }
+#endif
 
   if (walk->state == WALK_CONFIRM) {
 MEM_freeN(walk);

___
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] [a1e7d96801d] blender-v3.4-release: Fix T102213: Invalid font size in the image editor with some scripts

2022-12-16 Thread nutti
Commit: a1e7d96801d8644e9f552b731eeba8ba5f2ccfd6
Author: nutti
Date:   Wed Dec 14 15:40:53 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rBa1e7d96801d8644e9f552b731eeba8ba5f2ccfd6

Fix T102213: Invalid font size in the image editor with some scripts

The size could be left at an unexpected value by scripts, causing
the wrong size to be shown.

Ref D16493

===

M   source/blender/editors/screen/area.c

===

diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index a62e027ba03..af97b37acc1 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -3531,6 +3531,9 @@ void ED_region_info_draw_multiline(ARegion *region,
   /* background box */
   rcti rect = *ED_region_visible_rect(region);
 
+  /* Needed in case scripts leave the font size at an unexpected value, see: 
T102213. */
+  BLF_size(fontid, style->widget.points * U.dpi_fac);
+
   /* Box fill entire width or just around text. */
   if (!full_redraw) {
 const char **text = _array[0];

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


[Bf-blender-cvs] [d4a6108ef29] blender-v3.4-release: Fix T103234: GPencil applying armature does not work

2022-12-16 Thread Antonio Vazquez
Commit: d4a6108ef292ee43aa0d5315fdcfd51c9a5da629
Author: Antonio Vazquez
Date:   Thu Dec 15 10:52:58 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBd4a6108ef292ee43aa0d5315fdcfd51c9a5da629

Fix T103234: GPencil applying armature does not work

The problem was the bake function was using the evaluated
data and must use the original data.

The problem was caused by commit: rBcff6eb65804d: Cleanup: Remove duplicate 
Bake modifier code.

Fix by Philipp Oeser

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index d99d9950efb..5163f4d7020 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -118,14 +118,12 @@ static void bakeModifier(Main *UNUSED(bmain),
  GpencilModifierData *md,
  Object *ob)
 {
-  Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
   ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
-  GpencilModifierData *md_eval = 
BKE_gpencil_modifiers_findby_name(object_eval, md->name);
 
   if (mmd->object == NULL) {
 return;
   }
-  generic_bake_deform_stroke(depsgraph, md_eval, object_eval, true, 
deformStroke);
+  generic_bake_deform_stroke(depsgraph, md, ob, true, deformStroke);
 }
 
 static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))

___
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] [c1537d4134a] blender-v3.4-release: Cleanup: declare GHOST_Window::getCursorGrabBounds as const

2022-12-16 Thread Campbell Barton
Commit: c1537d4134a90d1b83eccd7269c1bab530860d04
Author: Campbell Barton
Date:   Thu Dec 15 15:10:51 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rBc1537d4134a90d1b83eccd7269c1bab530860d04

Cleanup: declare GHOST_Window::getCursorGrabBounds as const

Needed so it the method can be called on a cosnt GHOST_Window.

===

M   intern/ghost/GHOST_IWindow.h
M   intern/ghost/intern/GHOST_Window.cpp
M   intern/ghost/intern/GHOST_Window.h

===

diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index f712d9bd9f0..fbc2fbd0b7d 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -254,7 +254,7 @@ class GHOST_IWindow {
*/
   virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
 
-  virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect ) = 0;
+  virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect ) const = 0;
 
   virtual void getCursorGrabState(GHOST_TGrabCursorMode ,
   GHOST_TAxisFlag _flag,
diff --git a/intern/ghost/intern/GHOST_Window.cpp 
b/intern/ghost/intern/GHOST_Window.cpp
index eaa4cdcffac..e1e49f367d6 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -159,7 +159,7 @@ GHOST_TSuccess 
GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode,
   return GHOST_kFailure;
 }
 
-GHOST_TSuccess GHOST_Window::getCursorGrabBounds(GHOST_Rect )
+GHOST_TSuccess GHOST_Window::getCursorGrabBounds(GHOST_Rect ) const
 {
   if (m_cursorGrab != GHOST_kGrabWrap) {
 return GHOST_kFailure;
diff --git a/intern/ghost/intern/GHOST_Window.h 
b/intern/ghost/intern/GHOST_Window.h
index 396691fa161..efc4c7a17b7 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -152,7 +152,7 @@ class GHOST_Window : public GHOST_IWindow {
* Gets the cursor grab region, if unset the window is used.
* reset when grab is disabled.
*/
-  GHOST_TSuccess getCursorGrabBounds(GHOST_Rect ) override;
+  GHOST_TSuccess getCursorGrabBounds(GHOST_Rect ) const override;
 
   void getCursorGrabState(GHOST_TGrabCursorMode ,
   GHOST_TAxisFlag _flag,

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


[Bf-blender-cvs] [5d73850dd44] blender-v3.4-release: Revert "Fix T102346: Mouse escapes window during walk navigation"

2022-12-16 Thread Campbell Barton
Commit: 5d73850dd448e1f046c9ac44473efd23dd8cf33c
Author: Campbell Barton
Date:   Wed Dec 14 21:02:53 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB5d73850dd448e1f046c9ac44473efd23dd8cf33c

Revert "Fix T102346: Mouse escapes window during walk navigation"

This reverts commits
9fd6dae7939a65b67045749a0eadeb6864ded183,
4cac8025f00798938813f52dcb117be83db97f22 (minor cleanup).

Re-introducing T102346, which will be fixed in isolation.

Unfortunately even when the cursor is hidden & grabbed,
the underlying cursor coordinates are still shown in some cases.

This caused bug where dragging a button in the sculpt-context popup
would draw the brush at unexpected locations because internally
the cursor was warping in the middle of the window, reported as T102792.

Resolving this issue with the paint cursor is possible but tend towards
over-complicated solutions.

Revert this change in favor of a more localized workaround for walk-mode
(as was done prior [0] to fix T99021).

[0]: 4c4e8cc926a672ac60692b3fb8c20249f9cae679

===

M   intern/ghost/intern/GHOST_SystemWin32.cpp
M   intern/ghost/intern/GHOST_SystemX11.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index dc350bb58a1..fe719f0e8af 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1055,46 +1055,17 @@ GHOST_EventCursor 
*GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
 int32_t x_new = x_screen;
 int32_t y_new = y_screen;
 int32_t x_accum, y_accum;
+GHOST_Rect bounds;
 
-/* Warp within bounds. */
-{
-  GHOST_Rect bounds;
-  int32_t bounds_margin = 0;
-  GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
-
-  if (window->getCursorGrabMode() == GHOST_kGrabHide) {
-window->getClientBounds(bounds);
-
-/* WARNING(@campbellbarton): The current warping logic fails to warp 
on every event,
- * so the box needs to small enough not to let the cursor escape the 
window but large
- * enough that the cursor isn't being warped every time.
- * If this was not the case it would be less trouble to simply warp 
the cursor to the
- * center of the screen on every motion, see: D16558 (alternative fix 
for T102346). */
-const int32_t subregion_div = 4; /* One quarter of the region. */
-const int32_t size[2] = {bounds.getWidth(), bounds.getHeight()};
-const int32_t center[2] = {(bounds.m_l + bounds.m_r) / 2, (bounds.m_t 
+ bounds.m_b) / 2};
-/* Shrink the box to prevent the cursor escaping. */
-bounds.m_l = center[0] - (size[0] / (subregion_div * 2));
-bounds.m_r = center[0] + (size[0] / (subregion_div * 2));
-bounds.m_t = center[1] - (size[1] / (subregion_div * 2));
-bounds.m_b = center[1] + (size[1] / (subregion_div * 2));
-bounds_margin = 0;
-bounds_axis = GHOST_TAxisFlag(GHOST_kAxisX | GHOST_kAxisY);
-  }
-  else {
-/* Fallback to window bounds. */
-if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
-  window->getClientBounds(bounds);
-}
-bounds_margin = 2;
-bounds_axis = window->getCursorGrabAxis();
-  }
-
-  /* Could also clamp to screen bounds wrap with a window outside the view 
will
-   * fail at the moment. Use inset in case the window is at screen bounds. 
*/
-  bounds.wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
+/* Fallback to window bounds. */
+if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
+  window->getClientBounds(bounds);
 }
 
+/* Could also clamp to screen bounds wrap with a window outside the view 
will
+ * fail at the moment. Use inset in case the window is at screen bounds. */
+bounds.wrapPoint(x_new, y_new, 2, window->getCursorGrabAxis());
+
 window->getCursorGrabAccum(x_accum, y_accum);
 if (x_new != x_screen || y_new != y_screen) {
   system->setCursorPosition(x_new, y_new); /* wrap */
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 1462433277f..5c89febe97c 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -934,48 +934,17 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
 int32_t x_new = xme.x_root;
 int32_t y_new = xme.y_root;
 int32_t x_accum, y_accum;
+GHOST_Rect bounds;
 
-/* Warp within bounds. */
-{
-  GHOST_Rect bounds;
-  int32_t bounds_margin = 0;
-  GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
-
-  if (window->getCursorGrabMode() == GHOST_kGrabHide) {
-window->getClientBounds(bounds);
-
-/* TODO(@campbellbarton): warp the cursor to 

[Bf-blender-cvs] [08fa18fb6e3] blender-v3.4-release: Fix cursor warping display under Wayland

2022-12-16 Thread Campbell Barton
Commit: 08fa18fb6e3f86854c08fda1c3574ca6166ff42a
Author: Campbell Barton
Date:   Thu Dec 15 15:19:57 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB08fa18fb6e3f86854c08fda1c3574ca6166ff42a

Fix cursor warping display under Wayland

Under Wayland the transform cursor wasn't displaying the warped cursor.

This worked on other platforms because cursor motion is warped where as
Wayland simulates cursor warping, so it's necessary to apply warping
when requesting the cursor location too.

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 285fbbd3b6c..b50c2b386c2 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -5826,8 +5826,36 @@ static GHOST_TSuccess 
getCursorPositionClientRelative_impl(
 int32_t )
 {
   const wl_fixed_t scale = win->scale();
-  x = wl_fixed_to_int(scale * seat_state_pointer->xy[0]);
-  y = wl_fixed_to_int(scale * seat_state_pointer->xy[1]);
+
+  if (win->getCursorGrabModeIsWarp()) {
+/* As the cursor is restored at the warped location,
+ * apply warping when requesting the cursor location. */
+GHOST_Rect wrap_bounds{};
+if (win->getCursorGrabModeIsWarp()) {
+  if (win->getCursorGrabBounds(wrap_bounds) == GHOST_kFailure) {
+win->getClientBounds(wrap_bounds);
+  }
+}
+int xy_wrap[2] = {
+seat_state_pointer->xy[0],
+seat_state_pointer->xy[1],
+};
+
+GHOST_Rect wrap_bounds_scale;
+wrap_bounds_scale.m_l = wl_fixed_from_int(wrap_bounds.m_l) / scale;
+wrap_bounds_scale.m_t = wl_fixed_from_int(wrap_bounds.m_t) / scale;
+wrap_bounds_scale.m_r = wl_fixed_from_int(wrap_bounds.m_r) / scale;
+wrap_bounds_scale.m_b = wl_fixed_from_int(wrap_bounds.m_b) / scale;
+wrap_bounds_scale.wrapPoint(UNPACK2(xy_wrap), 0, win->getCursorGrabAxis());
+
+x = wl_fixed_to_int(scale * xy_wrap[0]);
+y = wl_fixed_to_int(scale * xy_wrap[1]);
+  }
+  else {
+x = wl_fixed_to_int(scale * seat_state_pointer->xy[0]);
+y = wl_fixed_to_int(scale * seat_state_pointer->xy[1]);
+  }
+
   return GHOST_kSuccess;
 }

___
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] [72260deac10] blender-v3.4-release: WM: support checking windowing capabilities

2022-12-16 Thread Campbell Barton
Commit: 72260deac10a5497a072c5da6d1c6738ac2e7e77
Author: Campbell Barton
Date:   Thu Dec 15 11:48:08 2022 +1100
Branches: blender-v3.4-release
https://developer.blender.org/rB72260deac10a5497a072c5da6d1c6738ac2e7e77

WM: support checking windowing capabilities

Historically checks for windowing capabilities used platform
pre-processor checks however that doesn't work when Blender is built
with both X11 & Wayland.

Add a capabilities flag which can be used to check which functionality
is supported. This has the advantage of being more descriptive/readable.

===

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

===

diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index 1f9de8040f6..c18e1dd1fd3 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -126,6 +126,15 @@ void WM_init_opengl(void);
  */
 const char *WM_ghost_backend(void);
 
+typedef enum eWM_CapabilitiesFlag {
+  /** Ability to warp the cursor (set it's location). */
+  WM_CAPABILITY_CURSOR_WARP = (1 << 0),
+  /** Ability to access window positions & move them. */
+  WM_CAPABILITY_WINDOW_POSITION = (1 << 1),
+} eWM_CapabilitiesFlag;
+
+eWM_CapabilitiesFlag WM_capabilities_flag(void);
+
 void WM_check(struct bContext *C);
 void WM_reinit_gizmomap_all(struct Main *bmain);
 
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index 265aa08a6b1..c444c2194b4 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1643,6 +1643,23 @@ GHOST_TDrawingContextType 
wm_ghost_drawing_context_type(const eGPUBackendType gp
   return GHOST_kDrawingContextTypeNone;
 }
 
+eWM_CapabilitiesFlag WM_capabilities_flag(void)
+{
+  static eWM_CapabilitiesFlag flag = -1;
+  if (flag != -1) {
+return flag;
+  }
+
+  flag = 0;
+  if (GHOST_SupportsCursorWarp()) {
+flag |= WM_CAPABILITY_CURSOR_WARP;
+  }
+  if (GHOST_SupportsWindowPosition()) {
+flag |= WM_CAPABILITY_WINDOW_POSITION;
+  }
+  return flag;
+}
+
 /** \} */
 
 /*  */

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


[Bf-blender-cvs] [5be12da1890] microfacet_hair: Merge branch 'master' into microfacet_hair

2022-12-16 Thread Weizhen Huang
Commit: 5be12da189015387223716193eb247dfe352e35e
Author: Weizhen Huang
Date:   Fri Dec 16 15:43:44 2022 +0100
Branches: microfacet_hair
https://developer.blender.org/rB5be12da189015387223716193eb247dfe352e35e

Merge branch 'master' into microfacet_hair

===



===



___
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] [a8530d31c29] master: Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error

2022-12-16 Thread Patrick Mours
Commit: a8530d31c2971756df7f2b440a0de3d6fcfc3061
Author: Patrick Mours
Date:   Fri Dec 16 15:41:21 2022 +0100
Branches: master
https://developer.blender.org/rBa8530d31c2971756df7f2b440a0de3d6fcfc3061

Fix T103258: Deleting a shader with OptiX OSL results in an illegal address 
error

Materials without connections to the output node would crash with OSL
in OptiX, since the Cycles `OSLCompiler` generates an empty shader
group reference for them, which resulted in the OptiX device
implementation setting an empty SBT entry for the corresponding direct
callables, which then crashed when calling those direct callables was
attempted in `osl_eval_nodes`. This fixes that by setting the SBT entries
for empty shader groups to a dummy direct callable that does nothing.

===

M   intern/cycles/device/optix/device_impl.cpp

===

diff --git a/intern/cycles/device/optix/device_impl.cpp 
b/intern/cycles/device/optix/device_impl.cpp
index 601e1193e26..23e7bbfa7bb 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -866,6 +866,11 @@ bool OptiXDevice::load_osl_kernels()
   optix_assert(optixSbtRecordPackHeader(osl_groups[i], 
_data[NUM_PROGRAM_GROUPS + i]));
   optix_assert(optixProgramGroupGetStackSize(osl_groups[i], 
_stack_size[i]));
 }
+else {
+  /* Default to "__direct_callable__dummy_services", so that OSL 
evaluation for empty
+   * materials has direct callables to call and does not crash. */
+  optix_assert(optixSbtRecordPackHeader(osl_groups.back(), 
_data[NUM_PROGRAM_GROUPS + i]));
+}
   }
   sbt_data.copy_to_device(); /* Upload updated SBT to device. */

___
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] [f2911ecc075] gpencil-new-data-proposal: Add radius in conversion and test in comparison

2022-12-16 Thread Falk David
Commit: f2911ecc07574255a774ea3c0ad2f113b50c1f23
Author: Falk David
Date:   Fri Dec 16 15:23:38 2022 +0100
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBf2911ecc07574255a774ea3c0ad2f113b50c1f23

Add radius in conversion and test in comparison

===

M   source/blender/blenkernel/intern/gpencil_new_proposal.hh
M   source/blender/blenkernel/intern/gpencil_new_proposal_conversion.cc
M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh 
b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
index 526a1783f3b..461de5c8041 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
@@ -165,6 +165,8 @@ typedef struct GreasePencil {
 
 namespace blender::bke {
 
+static const std::string ATTR_RADIUS = "radius";
+
 class GPLayerGroup : ::GPLayerGroup { /* Unused for now. Placeholder class. */
  public:
   GPLayerGroup();
diff --git 
a/source/blender/blenkernel/intern/gpencil_new_proposal_conversion.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_conversion.cc
index 14ce1de9d04..7e155b57f72 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_conversion.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_conversion.cc
@@ -35,7 +35,7 @@ GPData convert_old_to_new_gpencil_data(bGPdata *old_gpd)
 
   MutableSpan new_gps_positions{new_gps.positions_for_write()};
   SpanAttributeWriter radii = 
attributes.lookup_or_add_for_write_only_span(
-  "radius", ATTR_DOMAIN_POINT);
+  ATTR_RADIUS, ATTR_DOMAIN_POINT);
   int stroke_index;
   LISTBASE_FOREACH_INDEX (const bGPDstroke *, old_gps, _gpf->strokes, 
stroke_index) {
 const IndexRange 
point_index_in_curve{new_gps.points_for_curve(stroke_index)};
@@ -82,6 +82,11 @@ bGPdata *convert_new_to_old_gpencil_data(const GPData 
_gpd)
 
   BLI_listbase_clear(_gpf->strokes);
   const CurvesGeometry _gps{new_gpf.strokes_as_curves()};
+  AttributeAccessor attributes = new_gps.attributes();
+
+  Span new_gps_positions = new_gps.positions();
+  VArray new_gps_radii = 
attributes.lookup_or_default(ATTR_RADIUS, ATTR_DOMAIN_POINT, 0);
+
   for (int stroke_index = 0; stroke_index < new_gpf.strokes_num(); 
stroke_index++) {
 bGPDstroke *old_gps = reinterpret_cast(
 MEM_mallocN(sizeof(bGPDstroke), __func__));
@@ -94,12 +99,11 @@ bGPdata *convert_new_to_old_gpencil_data(const GPData 
_gpd)
 old_gps->editcurve = nullptr;
 old_gps->dvert = nullptr;
 
-Span new_gps_positions = new_gps.positions();
-
 int point_index{0};
 for (int new_gps_point_index : new_gps.points_for_curve(stroke_index)) 
{
   bGPDspoint *pt = _gps->points[point_index];
   copy_v3_v3(>x, new_gps_positions[new_gps_point_index]);
+  pt->pressure = new_gps_radii[new_gps_point_index];
   ++point_index;
 }
 
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index 6c5e1802e0e..ce35caecf8b 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -158,43 +158,56 @@ static void insert_new_stroke_new_gpencil_data(GPFrame 
,
   int stroke_index{gpf.strokes_num()};
   gpf.add_new_stroke(point_num);
   CurvesGeometry  = gpf.strokes_as_curves();
+  MutableAttributeAccessor attributes = curves.attributes_for_write();
 
   int point_index{0};
   MutableSpan pos = curves.positions_for_write();
+  SpanAttributeWriter radii = 
attributes.lookup_or_add_for_write_only_span(
+  ATTR_RADIUS, ATTR_DOMAIN_POINT);
   for (int point_index_in_curve : curves.points_for_curve(stroke_index)) {
 pos[point_index_in_curve].x = position[3 * point_index];
 pos[point_index_in_curve].y = position[3 * point_index + 1];
 pos[point_index_in_curve].z = position[3 * point_index + 2];
+radii.span[point_index_in_curve] = pressure[point_index];
 ++point_index;
   }
+
+  radii.finish();
 }
 
 static void compare_gpencil_stroke_data(const CurvesGeometry ,
 int curve_index,
-const bGPDstroke *stk)
+const bGPDstroke *gps)
 {
   // Stroke/Curve length
   int curve_point_num{curves.points_num_for_curve(curve_index)};
-  EXPECT_EQ(curve_point_num, stk->totpoints);
-  if (curve_point_num != stk->totpoints) {
+  EXPECT_EQ(curve_point_num, gps->totpoints);
+  if (curve_point_num != gps->totpoints) {
 return;
   }
 
+  AttributeAccessor attributes = curves.attributes();
+
   // Get curve attributes
   Span curve_positions{curves.positions()};
+  

[Bf-blender-cvs] [6bc65ecfa68] gpencil-new-data-proposal: Remove uses of `GPStroke`

2022-12-16 Thread Falk David
Commit: 6bc65ecfa688c7f66a21da954e35811ce013a8ad
Author: Falk David
Date:   Fri Dec 16 15:20:23 2022 +0100
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB6bc65ecfa688c7f66a21da954e35811ce013a8ad

Remove uses of `GPStroke`

Use an `IndexRange` as a return value for `GPFrame::add_new_stroke`.

===

M   source/blender/blenkernel/intern/gpencil_new_proposal.cc
M   source/blender/blenkernel/intern/gpencil_new_proposal.hh
M   source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

===

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
index 92be1059619..c3d6ada6071 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
@@ -50,6 +50,7 @@ IndexMask GPLayerGroup::layers_index_mask()
 }
 
 /* GPStroke */
+#if 0
 Span GPStroke::points_positions() const
 {
   return {geometry_->positions().begin() + offset_, points_num_};
@@ -69,6 +70,7 @@ void GPStroke::transform(float4x4 matrix)
 }
   });
 }
+#endif
 
 /* GPFrame */
 GPFrame::GPFrame(int layer_index)
@@ -197,18 +199,7 @@ int GPFrame::points_num() const
   return this->strokes->point_num;
 }
 
-Vector GPFrame::strokes_for_write()
-{
-  Vector strokes;
-  for (const int i : 
this->strokes_as_curves().offsets().drop_back(1).index_range()) {
-int offset = this->strokes_as_curves().offsets()[i];
-int length = this->strokes_as_curves().offsets()[i + 1] - offset;
-strokes.append({reinterpret_cast(this->strokes), length, 
offset});
-  }
-  return strokes;
-}
-
-GPStroke GPFrame::add_new_stroke(int new_points_num)
+IndexRange GPFrame::add_new_stroke(int new_points_num)
 {
   CurvesGeometry  = this->strokes_as_curves();
   int orig_last_offset = strokes.offsets().last();
@@ -220,7 +211,7 @@ GPStroke GPFrame::add_new_stroke(int new_points_num)
   strokes.curve_types_for_write().last() = CURVE_TYPE_POLY;
 
   strokes.tag_topology_changed();
-  return {reinterpret_cast(this->strokes), new_points_num, 
orig_last_offset};
+  return {orig_last_offset, new_points_num};
 }
 
 /* GPLayer */
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh 
b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
index 6c485b897e1..526a1783f3b 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
@@ -196,6 +196,7 @@ class GPDataRuntime {
  * of where to find the stroke in the frame and it's size.
  * This class is only meant to facilitate the handling of individual strokes.
  */
+#if 0
 class GPStroke {
  public:
   GPStroke(CurvesGeometry *geometry, int num_points, int offset)
@@ -225,6 +226,7 @@ class GPStroke {
   int points_num_ = 0;
   int offset_;
 };
+#endif
 
 class GPFrame : public ::GPFrame {
 
@@ -261,8 +263,7 @@ class GPFrame : public ::GPFrame {
   int strokes_num() const;
   int points_num() const;
 
-  Vector strokes_for_write();
-  GPStroke add_new_stroke(int new_points_num);
+  IndexRange add_new_stroke(int new_points_num);
 
   constexpr GPFrameKey get_frame_key() const
   {
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc 
b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index befd94eacd0..6c5e1802e0e 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -399,11 +399,12 @@ TEST(gpencil_proposal, AddSingleStroke)
 
   const int frame_index = data.add_frame_on_layer(layer1_index, 0);
   EXPECT_NE(frame_index, -1);
-  GPStroke stroke = data.frames_for_write(frame_index).add_new_stroke(100);
+
+  IndexRange point_indices = 
data.frames_for_write(frame_index).add_new_stroke(100);
 
   EXPECT_EQ(data.strokes_num(), 1);
   EXPECT_EQ(data.frames(frame_index).strokes_num(), 1);
-  EXPECT_EQ(stroke.points_num(), 100);
+  EXPECT_EQ(point_indices.size(), 100);
 }
 
 TEST(gpencil_proposal, ChangeStrokePoints)

___
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] [c9eb5834607] master: Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL results in an error

2022-12-16 Thread Patrick Mours
Commit: c9eb5834607804eec1ead46289bb66a968ff2a1c
Author: Patrick Mours
Date:   Fri Dec 16 14:01:51 2022 +0100
Branches: master
https://developer.blender.org/rBc9eb5834607804eec1ead46289bb66a968ff2a1c

Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL 
results in an error

Switching viewport denoising causes kernels to be reloaded with a new
feature mask, which would destroy the existing OptiX pipelines. But OSL
kernels were not reloaded as well, leaving the shading pipeline
uninitialized and therefore causing an error when it is later attempted to
execute it. This fixes that by ensuring OSL kernels are always reloaded
when the normal kernels are too.

===

M   intern/cycles/device/optix/device_impl.cpp

===

diff --git a/intern/cycles/device/optix/device_impl.cpp 
b/intern/cycles/device/optix/device_impl.cpp
index f4d1969f3f3..601e1193e26 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -579,7 +579,11 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
   link_options.maxTraceDepth = 1;
   link_options.debugLevel = module_options.debugLevel;
 
-  if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE) 
&& !use_osl) {
+  if (use_osl) {
+/* Re-create OSL pipeline in case kernels are reloaded after it has been 
created before. */
+load_osl_kernels();
+  }
+  else if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | 
KERNEL_FEATURE_MNEE)) {
 /* Create shader raytracing and MNEE pipeline. */
 vector pipeline_groups;
 pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
@@ -743,6 +747,11 @@ bool OptiXDevice::load_osl_kernels()
 }
   }
 
+  if (osl_kernels.empty()) {
+/* No OSL shader groups, so no need to create a pipeline. */
+return true;
+  }
+
   OptixProgramGroupOptions group_options = {}; /* There are no options 
currently. */
   OptixModuleCompileOptions module_options = {};
   module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;

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


[Bf-blender-cvs] [599c0db3fff] master: Cleanup: indentation in CMake files

2022-12-16 Thread Campbell Barton
Commit: 599c0db3fff0a66f4c46f6378daa1ac7e656c13b
Author: Campbell Barton
Date:   Fri Dec 16 23:47:35 2022 +1100
Branches: master
https://developer.blender.org/rB599c0db3fff0a66f4c46f6378daa1ac7e656c13b

Cleanup: indentation in CMake files

===

M   build_files/cmake/macros.cmake
M   build_files/cmake/platform/platform_unix.cmake
M   source/creator/CMakeLists.txt

===

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index dc07be70f84..178a63fba7c 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1371,13 +1371,13 @@ macro(windows_generate_shared_manifest)
 NAME "blender.shared"
   )
   install(
-  FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
-  DESTINATION "./blender.shared"
-  CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
+FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
+DESTINATION "./blender.shared"
+CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
   )
   install(
-  FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
-  DESTINATION "./blender.shared"
-  CONFIGURATIONS Debug
+FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
+DESTINATION "./blender.shared"
+CONFIGURATIONS Debug
   )
 endmacro()
diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index 2b68fa60f15..cf9226433a3 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -351,9 +351,9 @@ endif()
 if(WITH_USD)
   find_package_wrapper(USD)
   set_and_warn_library_found("USD" USD_FOUND WITH_USD)
- if(WITH_USD)
+  if(WITH_USD)
 add_bundled_libraries(usd/lib)
- endif()
+  endif()
 endif()
 
 if(WITH_MATERIALX)
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 3ecea7c5929..47efd9a67b6 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -953,30 +953,30 @@ elseif(WIN32)
   endif()
 
   if(WITH_OPENVDB)
-  windows_install_shared_manifest(
-FILES ${LIBDIR}/openvdb/bin/openvdb.dll
-RELEASE
+windows_install_shared_manifest(
+  FILES ${LIBDIR}/openvdb/bin/openvdb.dll
+  RELEASE
+)
+windows_install_shared_manifest(
+  FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll
+  DEBUG
+)
+
+# This will not exist for 3.4 and earlier lib folders
+# to ease the transition, support both 3.4 and 3.5 lib
+# folders.
+if(EXISTS ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd)
+  install(
+FILES ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd
+DESTINATION ${TARGETDIR_VER}/python/lib/site-packages
+CONFIGURATIONS Debug
   )
-  windows_install_shared_manifest(
-FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll
-DEBUG
+  install(
+FILES ${LIBDIR}/openvdb/python/pyopenvdb.pyd
+DESTINATION ${TARGETDIR_VER}/python/lib/site-packages
+CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
   )
-
-  # This will not exist for 3.4 and earlier lib folders
-  # to ease the transition, support both 3.4 and 3.5 lib
-  # folders.
-  if(EXISTS ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd)
-install(
-  FILES ${LIBDIR}/openvdb/python/pyopenvdb_d.pyd
-  DESTINATION ${TARGETDIR_VER}/python/lib/site-packages
-  CONFIGURATIONS Debug
-)
-install(
-  FILES ${LIBDIR}/openvdb/python/pyopenvdb.pyd
-  DESTINATION ${TARGETDIR_VER}/python/lib/site-packages
-  CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
-)
-  endif()
+endif()
   endif()
 
   if(WITH_MATERIALX)
@@ -1137,22 +1137,22 @@ elseif(WIN32)
 # MaterialX python bindings
 
 install(
-DIRECTORY ${LIBDIR}/materialx/python/Release/MaterialX
-DESTINATION ${TARGETDIR_VER}/python/lib/site-packages/
-CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
-PATTERN ".svn" EXCLUDE
-PATTERN "__pycache__" EXCLUDE   # * any cache *
-PATTERN "*.pyc" EXCLUDE # * any cache *
-PATTERN "*.pyo" EXCLUDE # * any cache *
+  DIRECTORY ${LIBDIR}/materialx/python/Release/MaterialX
+  DESTINATION ${TARGETDIR_VER}/python/lib/site-packages/
+  CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
+  PATTERN ".svn" EXCLUDE
+  PATTERN "__pycache__" EXCLUDE   # * any cache *
+  PATTERN "*.pyc" EXCLUDE # * any cache *
+  PATTERN "*.pyo" EXCLUDE # * any cache *
 )
 install(
-DIRECTORY ${LIBDIR}/materialx/python/Debug/MaterialX
-DESTINATION ${TARGETDIR_VER}/python/lib/site-packages/
-CONFIGURATIONS Debug
-PATTERN 

[Bf-blender-cvs] [9a25c48f08c] master: Build: resolve failure to copy indirect dependencies for USD on Linux

2022-12-16 Thread Campbell Barton
Commit: 9a25c48f08c8df84062a8c7582379be49ca74655
Author: Campbell Barton
Date:   Fri Dec 16 23:28:28 2022 +1100
Branches: master
https://developer.blender.org/rB9a25c48f08c8df84062a8c7582379be49ca74655

Build: resolve failure to copy indirect dependencies for USD on Linux

Even when building without OpenImageIO and OpenVDB, USD depends on these
libraries.

Ensure these libraries are copied when building with USD.

===

M   build_files/cmake/platform/platform_unix.cmake

===

diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index cfb3ecc564b..2b68fa60f15 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -1013,6 +1013,18 @@ endfunction()
 
 configure_atomic_lib_if_needed()
 
+# Handle library inter-dependencies.
+# FIXME: find a better place to handle inter-library dependencies.
+# This is done near the end of the file to ensure bundled libraries are not 
added multiple times.
+if(WITH_USD)
+  if(NOT WITH_OPENIMAGEIO)
+add_bundled_libraries(openimageio/lib)
+  endif()
+  if(NOT WITH_OPENVDB)
+add_bundled_libraries(openvdb/lib)
+  endif()
+endif()
+
 if(PLATFORM_BUNDLED_LIBRARIES)
   # For the installed Python module and installed Blender executable, we set 
the
   # rpath to the relative path where the install step will copy the shared 
libraries.

___
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] [3334ff0e323] master: CMake: warn Linux references old linux_centos7_x86_64 paths

2022-12-16 Thread Campbell Barton
Commit: 3334ff0e32354fe45a2cc4f45aa653f21b39f6c5
Author: Campbell Barton
Date:   Fri Dec 16 23:00:52 2022 +1100
Branches: master
https://developer.blender.org/rB3334ff0e32354fe45a2cc4f45aa653f21b39f6c5

CMake: warn Linux references old linux_centos7_x86_64 paths

When the centos7 library dir is found, warn when the values of cached
variables reference it, listing the variables and their values.

===

M   CMakeLists.txt
M   build_files/cmake/macros.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74bfb23a3a4..c9e0de18913 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2007,6 +2007,24 @@ if(0)
   print_all_vars()
 endif()
 
+set(LIBDIR_STALE)
+
+if(UNIX AND NOT APPLE)
+  # Only search for the path if it's found on the system.
+  if (EXISTS "../lib/linux_centos7_x86_64")
+set(LIBDIR_STALE "/lib/linux_centos7_x86_64/")
+  endif()
+endif()
+
+if(LIBDIR_STALE)
+  print_cached_vars_containing_value(
+"${LIBDIR_STALE}"
+"\nWARNING: found cached references to old library paths!\n"
+"\nIt is *strongly* recommended to reference updated library paths!\n"
+  )
+endif()
+unset(LIBDIR_STALE)
+
 # Should be the last step of configuration.
 if(POSTCONFIGURE_SCRIPT)
   include(${POSTCONFIGURE_SCRIPT})
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 7064ca93e8b..dc07be70f84 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1209,6 +1209,43 @@ function(print_all_vars)
   endforeach()
 endfunction()
 
+# Print a list of all cached variables with values containing `contents`.
+function(print_cached_vars_containing_value
+  contents
+  msg_header
+  msg_footer
+  )
+  set(_list_info)
+  set(_found)
+  get_cmake_property(_vars VARIABLES)
+  foreach(_var ${_vars})
+if (DEFINED CACHE{${_var}})
+  # Skip "_" prefixed variables, these are used for internal book-keeping,
+  # not under user control.
+  string(FIND "${_var}" "_" _found)
+  if(NOT (_found EQUAL 0))
+string(FIND "${${_var}}" "${contents}" _found)
+if(NOT (_found EQUAL -1))
+  if(_found)
+list(APPEND _list_info "${_var}=${${_var}}")
+  endif()
+endif()
+  endif()
+endif()
+  endforeach()
+  unset(_var)
+  unset(_vars)
+  unset(_found)
+  if(_list_info)
+message(${msg_header})
+foreach(_var ${_list_info})
+  message(" * ${_var}")
+endforeach()
+message(${msg_footer})
+  endif()
+  unset(_list_info)
+endfunction()
+
 macro(openmp_delayload
   projectname
   )

___
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] [c37e07bc01a] master: Geometry Nodes: improve dot graph export of lazy function graph

2022-12-16 Thread Jacques Lucke
Commit: c37e07bc01a413ffb0ed65ccdf8f10e26795c7c8
Author: Jacques Lucke
Date:   Fri Dec 16 12:18:49 2022 +0100
Branches: master
https://developer.blender.org/rBc37e07bc01a413ffb0ed65ccdf8f10e26795c7c8

Geometry Nodes: improve dot graph export of lazy function graph

* Dim default input values.
* Print default input values instead of type name.
* Add node/socket names to group input/output nodes.

===

M   source/blender/functions/FN_field_cpp_type_make.hh
M   source/blender/functions/FN_lazy_function_graph.hh
M   source/blender/functions/intern/lazy_function_graph.cc
M   source/blender/nodes/NOD_geometry_nodes_lazy_function.hh
M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/functions/FN_field_cpp_type_make.hh 
b/source/blender/functions/FN_field_cpp_type_make.hh
index 79e46faa9e7..7a4112b432b 100644
--- a/source/blender/functions/FN_field_cpp_type_make.hh
+++ b/source/blender/functions/FN_field_cpp_type_make.hh
@@ -38,7 +38,7 @@ inline 
ValueOrFieldCPPType::ValueOrFieldCPPType(TypeTag /*value_type*
  * Create a new #ValueOrFieldCPPType that can be accessed through 
`ValueOrFieldCPPType::get()`.
  */
 #define FN_FIELD_CPP_TYPE_MAKE(VALUE_TYPE) \
-  BLI_CPP_TYPE_MAKE(blender::fn::ValueOrField, CPPTypeFlags::None) 
\
+  BLI_CPP_TYPE_MAKE(blender::fn::ValueOrField, 
CPPTypeFlags::Printable) \
   template<> \
   const blender::fn::ValueOrFieldCPPType & \
   blender::fn::ValueOrFieldCPPType::get_impl() \
diff --git a/source/blender/functions/FN_lazy_function_graph.hh 
b/source/blender/functions/FN_lazy_function_graph.hh
index 4ede28c4f26..7352004b7fe 100644
--- a/source/blender/functions/FN_lazy_function_graph.hh
+++ b/source/blender/functions/FN_lazy_function_graph.hh
@@ -167,15 +167,25 @@ class FunctionNode : public Node {
   const LazyFunction () const;
 };
 
+class DummyDebugInfo {
+ public:
+  virtual ~DummyDebugInfo() = default;
+  virtual std::string node_name() const;
+  virtual std::string input_name(const int i) const;
+  virtual std::string output_name(const int i) const;
+};
+
 /**
  * A #Node that does *not* correspond to a #LazyFunction. Instead it can be 
used to indicate inputs
  * and outputs of the entire graph. It can have an arbitrary number of inputs 
and outputs.
  */
 class DummyNode : public Node {
  private:
-  std::string name_;
+  const DummyDebugInfo *debug_info_ = nullptr;
 
   friend Node;
+  friend Socket;
+  friend Graph;
 };
 
 /**
@@ -208,7 +218,9 @@ class Graph : NonCopyable, NonMovable {
   /**
* Add a new dummy node with the given socket types.
*/
-  DummyNode _dummy(Span input_types, Span output_types);
+  DummyNode _dummy(Span input_types,
+   Span output_types,
+   const DummyDebugInfo *debug_info = nullptr);
 
   /**
* Add a link between the two given sockets.
diff --git a/source/blender/functions/intern/lazy_function_graph.cc 
b/source/blender/functions/intern/lazy_function_graph.cc
index cc55b70d166..60605a4e64c 100644
--- a/source/blender/functions/intern/lazy_function_graph.cc
+++ b/source/blender/functions/intern/lazy_function_graph.cc
@@ -48,13 +48,16 @@ FunctionNode ::add_function(const LazyFunction )
   return node;
 }
 
-DummyNode ::add_dummy(Span input_types, Span output_types)
+DummyNode ::add_dummy(Span input_types,
+Span output_types,
+const DummyDebugInfo *debug_info)
 {
   DummyNode  = *allocator_.construct().release();
   node.fn_ = nullptr;
   node.inputs_ = 
allocator_.construct_elements_and_pointer_array(input_types.size());
   node.outputs_ = 
allocator_.construct_elements_and_pointer_array(
   output_types.size());
+  node.debug_info_ = debug_info;
 
   for (const int i : input_types.index_range()) {
 InputSocket  = *node.inputs_[i];
@@ -100,6 +103,8 @@ bool Graph::node_indices_are_valid() const
   return true;
 }
 
+static const char *fallback_name = "No Name";
+
 std::string Socket::name() const
 {
   if (node_->is_function()) {
@@ -110,15 +115,41 @@ std::string Socket::name() const
 }
 return fn.output_name(index_in_node_);
   }
-  return "Unnamed";
+  const DummyNode _node = *static_cast(node_);
+  if (dummy_node.debug_info_) {
+if (is_input_) {
+  return dummy_node.debug_info_->input_name(index_in_node_);
+}
+return dummy_node.debug_info_->output_name(index_in_node_);
+  }
+  return fallback_name;
 }
 
 std::string Node::name() const
 {
-  if (fn_ == nullptr) {
-return static_cast(this)->name_;
+  if (this->is_function()) {
+return fn_->name();
   }
-  return fn_->name();
+  const DummyNode _node = *static_cast(this);
+  if (dummy_node.debug_info_) {
+return dummy_node.debug_info_->node_name();
+  }
+  return fallback_name;
+}
+
+std::string DummyDebugInfo::node_name() const
+{
+  return fallback_name;