[Bf-blender-cvs] [e5f139e99d1] master: Fix T101889: Curves editmode points are drawn from evaluated curves

2022-12-14 Thread Philipp Oeser
Commit: e5f139e99d1a89988c5d3383989ac4d2b308ac1f
Author: Philipp Oeser
Date:   Tue Dec 6 14:49:44 2022 +0100
Branches: master
https://developer.blender.org/rBe5f139e99d1a89988c5d3383989ac4d2b308ac1f

Fix T101889: Curves editmode points are drawn from evaluated curves

Editmode should display the original (non-evaluated) points unless there
is something like an "On Cage" option of a modifier [which none of the
curves modifiers have].

This was not the case since the introduction in rBe15320568a29.

So we now draw the editpoints from the original curves. This also means
that original and evaluated curves might not have the same number of
points, so we have to get independent of `proc_point_buf` since that
would possibly create vertexbuffers of different sizes (compared to the
original curves) which is not allowed for a single batch.

- remove the "pos" alias from the vertex buffer format of proc_point_buf
- instead, create a new "edit_points_pos" vertex buffer
- fill that with the original (un-evaluated) curves positions
- dont request `proc_point_buf` anymore
- rename the editpoints flags buffer to be more consistent

And since original and evaluated points might also be in completely
different positions, we also need to draw connecting lines between those
editpoints to not have them float in thin air. For drawing these in
editmode, a simple polyline was chosen (instead of drawing lines in a
resolution that is take from the old particle system -- which is not
depending on points even but has a hardcoded resolution that can only be
upped by the hair_subdiv scene render setting)

- create appropriate batch and indexbuffer for this
- positions vertex buffer can be reused
- reuse particle edit shader (instead of curve edi shader) to get
segment highlighting

{F14055436}

NOTE: this also removes the broken depth handling and instead makes it
work (also XRay is properly taken into account) by binding the correct
overlay framebuffer.

NOTE: to further clarify the distinction between curves drawing (that is
based on the old partice system drawing) and drawing in editmode, the
corresponding vertexbuffers have been moved out of CurvesEvalCache into
CurvesBatchCache directly.

NOTE: drawing the lines in editmode could be improved (taking the "real"
resolution of splines into account, but since this should happen on the
GPU in a compute shader, this is for later)

Potentionally fixes T101889.

Maniphest Tasks: T101889

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

===

M   source/blender/draw/engines/overlay/overlay_edit_curves.cc
M   source/blender/draw/engines/overlay/overlay_private.hh
M   source/blender/draw/intern/draw_cache_impl.h
M   source/blender/draw/intern/draw_cache_impl_curves.cc
M   source/blender/draw/intern/draw_curves_private.h

===

diff --git a/source/blender/draw/engines/overlay/overlay_edit_curves.cc 
b/source/blender/draw/engines/overlay/overlay_edit_curves.cc
index dab44c655a5..c2b7e3ee92f 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_curves.cc
+++ b/source/blender/draw/engines/overlay/overlay_edit_curves.cc
@@ -22,12 +22,11 @@ void OVERLAY_edit_curves_init(OVERLAY_Data *vedata)
 
   /* Create view with depth offset. */
   DRWView *default_view = (DRWView *)DRW_view_default_get();
-  pd->view_edit_curves_points = default_view;
+  pd->view_edit_curves = DRW_view_create_with_zoffset(default_view, 
draw_ctx->rv3d, 1.0f);
 }
 
 void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
 {
-  OVERLAY_TextureList *txl = vedata->txl;
   OVERLAY_PassList *psl = vedata->psl;
   OVERLAY_PrivateData *pd = vedata->stl->pd;
 
@@ -35,33 +34,35 @@ void OVERLAY_edit_curves_cache_init(OVERLAY_Data *vedata)
   DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | 
DRW_STATE_BLEND_ALPHA |
 DRW_STATE_WRITE_DEPTH);
 
-  /* Common boilerplate for shading groups. */
-  DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
-  const DRWContextState *draw_ctx = DRW_context_state_get();
-  const View3D *v3d = draw_ctx->v3d;
-  GPUTexture **depth_tex = (pd->edit_curves.do_zbufclip) ? >depth : 
>dummy_depth_tx;
-  const float backwire_opacity = (pd->edit_curves.do_zbufclip) ? 
v3d->overlay.backwire_opacity :
- 1.0f;
+  GPUShader *sh;
+  DRWShadingGroup *grp;
 
   /* Run Twice for in-front passes. */
   for (int i = 0; i < 2; i++) {
 DRW_PASS_CREATE(psl->edit_curves_points_ps[i], (state | 
pd->clipping_state));
+sh = OVERLAY_shader_edit_particle_point();
+grp = pd->edit_curves_points_grp[i] = DRW_shgroup_create(sh, 
psl->edit_curves_points_ps[i]);
+DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
 
-GPUShader *sh = OVERLAY_shader_edit_curve_point();
-DRWShadingGroup *grp = pd->edit_curves_points_grp[i] = 

[Bf-blender-cvs] [140a2b22c17] temp-linux-35x-libs: Temp down-grade GCC

2022-12-14 Thread Campbell Barton
Commit: 140a2b22c171f2e755a09c6be4ebf67a56827204
Author: Campbell Barton
Date:   Thu Dec 15 18:41:41 2022 +1100
Branches: temp-linux-35x-libs
https://developer.blender.org/rB140a2b22c171f2e755a09c6be4ebf67a56827204

Temp down-grade GCC

===

M   build_files/config/pipeline_config.yaml

===

diff --git a/build_files/config/pipeline_config.yaml 
b/build_files/config/pipeline_config.yaml
index f70e605ca83..653c5eeb3b2 100644
--- a/build_files/config/pipeline_config.yaml
+++ b/build_files/config/pipeline_config.yaml
@@ -49,7 +49,7 @@ update-code:
 #
 buildbot:
 gcc:
-version: '11.2.1'
+version: '9.0.0'
 cuda10:
 version: '10.1.243'
 cuda11:

___
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] [da7bf6ed223] temp-linux-35x-libs: Test building with new 3.5x libraries on Linux

2022-12-14 Thread Campbell Barton
Commit: da7bf6ed2235f2591c34fcae889b8233cfcd1d32
Author: Campbell Barton
Date:   Thu Dec 15 18:09:40 2022 +1100
Branches: temp-linux-35x-libs
https://developer.blender.org/rBda7bf6ed2235f2591c34fcae889b8233cfcd1d32

Test building with new 3.5x libraries on Linux

===

M   build_files/buildbot/config/blender_linux.cmake
M   build_files/config/pipeline_config.yaml

===

diff --git a/build_files/buildbot/config/blender_linux.cmake 
b/build_files/buildbot/config/blender_linux.cmake
index 3f3695ed481..078ad425124 100644
--- a/build_files/buildbot/config/blender_linux.cmake
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -4,9 +4,9 @@
 
 include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
 
-message(STATUS "Building in CentOS 7 64bit environment")
+message(STATUS "Building in Rocky 8 Linux 64bit environment")
 
-set(LIBDIR_NAME "linux_centos7_x86_64")
+set(LIBDIR_NAME "linux_x86_64_glibc_228")
 set(WITH_CXX11_ABI   OFF CACHE BOOL "" FORCE)
 
 #  Linux-specific build options 
diff --git a/build_files/config/pipeline_config.yaml 
b/build_files/config/pipeline_config.yaml
index d344b88f255..f70e605ca83 100644
--- a/build_files/config/pipeline_config.yaml
+++ b/build_files/config/pipeline_config.yaml
@@ -30,7 +30,7 @@ update-code:
 linux-x86_64:
 branch: trunk
 commit_id: HEAD
-path: lib/linux_centos7_x86_64
+path: lib/linux_x86_64_glibc_228
 windows-amd64:
 branch: trunk
 commit_id: HEAD
@@ -49,7 +49,7 @@ update-code:
 #
 buildbot:
 gcc:
-version: '9.0.0'
+version: '11.2.1'
 cuda10:
 version: '10.1.243'
 cuda11:

___
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] [9e47db4f43a] master: Correct build error with MSVC

2022-12-14 Thread Campbell Barton
Commit: 9e47db4f43a2b882d0a7d9f14560e90e1487b4c5
Author: Campbell Barton
Date:   Thu Dec 15 18:03:09 2022 +1100
Branches: master
https://developer.blender.org/rB9e47db4f43a2b882d0a7d9f14560e90e1487b4c5

Correct build error with MSVC

===

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 3d113c408eb..5606527a5fd 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_walk.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_walk.c
@@ -617,11 +617,12 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, 
wmOperator *op, const int
 const int size[2] = {BLI_rcti_size_x(winrct), BLI_rcti_size_y(winrct)};
 const int div = 4; /* Where 2 is the region size. */
 
-rcti wrap_region = {};
-wrap_region.xmin = center[0] - (size[0] / div);
-wrap_region.xmax = center[0] + (size[0] / div);
-wrap_region.ymin = center[1] - (size[1] / div);
-wrap_region.ymax = center[1] + (size[1] / div);
+const rcti wrap_region = {
+.xmin = center[0] - (size[0] / div),
+.xmax = center[0] + (size[0] / div),
+.ymin = center[1] - (size[1] / div),
+.ymax = center[1] + (size[1] / div),
+};
 
 WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, _region, false);

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


[Bf-blender-cvs] [7571222a690] master: Cleanup: add trailing commas for multi-line collections

2022-12-14 Thread Campbell Barton
Commit: 7571222a690372bc907cf42c5fd9faa7f78abc74
Author: Campbell Barton
Date:   Thu Dec 15 17:24:23 2022 +1100
Branches: master
https://developer.blender.org/rB7571222a690372bc907cf42c5fd9faa7f78abc74

Cleanup: add trailing commas for multi-line collections

Avoid accidentally missing commas between strings, see: T101020.
Also use single quotes for enum identifiers.

===

M   intern/cycles/blender/addon/presets.py
M   release/scripts/modules/bpy_extras/anim_utils.py
M   release/scripts/modules/bpy_extras/io_utils.py
M   release/scripts/startup/bl_operators/clip.py
M   release/scripts/startup/bl_operators/object.py
M   release/scripts/startup/bl_operators/object_quick_effects.py
M   release/scripts/startup/bl_operators/presets.py
M   release/scripts/startup/bl_operators/screen_play_rendered_anim.py
M   release/scripts/startup/bl_operators/userpref.py
M   release/scripts/startup/bl_operators/view3d.py
M   release/scripts/startup/bl_operators/wm.py
M   release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M   release/scripts/startup/bl_ui/properties_output.py
M   release/scripts/startup/bl_ui/properties_paint_common.py
M   release/scripts/startup/bl_ui/properties_physics_cloth.py
M   release/scripts/startup/bl_ui/properties_physics_common.py
M   release/scripts/startup/bl_ui/space_clip.py
M   release/scripts/startup/bl_ui/space_filebrowser.py
M   release/scripts/startup/bl_ui/space_image.py
M   release/scripts/startup/bl_ui/space_node.py
M   release/scripts/startup/bl_ui/space_sequencer.py
M   release/scripts/startup/bl_ui/space_text.py
M   release/scripts/startup/bl_ui/space_toolsystem_common.py
M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M   release/scripts/startup/bl_ui/space_userpref.py
M   release/scripts/startup/bl_ui/space_view3d.py
M   release/scripts/startup/nodeitems_builtins.py
M   tests/python/bl_pyapi_idprop.py

===

diff --git a/intern/cycles/blender/addon/presets.py 
b/intern/cycles/blender/addon/presets.py
index 6ad22d765aa..643f54a2bc3 100644
--- a/intern/cycles/blender/addon/presets.py
+++ b/intern/cycles/blender/addon/presets.py
@@ -92,7 +92,7 @@ class AddPresetPerformance(AddPresetBase, Operator):
 
 preset_defines = [
 "render = bpy.context.scene.render",
-"cycles = bpy.context.scene.cycles"
+"cycles = bpy.context.scene.cycles",
 ]
 
 preset_values = [
diff --git a/release/scripts/modules/bpy_extras/anim_utils.py 
b/release/scripts/modules/bpy_extras/anim_utils.py
index 3586401dd7a..3b90b18359e 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -159,7 +159,7 @@ def bake_action_iter(
 "bbone_curveinz", "bbone_curveoutz",
 "bbone_rollin", "bbone_rollout",
 "bbone_scalein", "bbone_scaleout",
-"bbone_easein", "bbone_easeout"
+"bbone_easein", "bbone_easeout",
 ]
 BBONE_PROPS_LENGTHS = {
 "bbone_curveinx": 1,
diff --git a/release/scripts/modules/bpy_extras/io_utils.py 
b/release/scripts/modules/bpy_extras/io_utils.py
index 4dbe0d6f05b..04b536fce40 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -12,7 +12,7 @@ __all__ = (
 "path_reference",
 "path_reference_copy",
 "path_reference_mode",
-"unique_name"
+"unique_name",
 )
 
 import bpy
diff --git a/release/scripts/startup/bl_operators/clip.py 
b/release/scripts/startup/bl_operators/clip.py
index 73c0b4cfd8f..4e018ffc457 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -1028,7 +1028,7 @@ class CLIP_OT_track_settings_to_track(Operator):
 "use_red_channel",
 "use_green_channel",
 "use_blue_channel",
-"weight"
+"weight",
 )
 
 _attrs_marker = (
diff --git a/release/scripts/startup/bl_operators/object.py 
b/release/scripts/startup/bl_operators/object.py
index e3685b6ad78..6a130edbb38 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -776,7 +776,7 @@ class TransformsToDeltasAnim(Operator):
 "rotation_euler": "delta_rotation_euler",
 "rotation_quaternion": "delta_rotation_quaternion",
 # "rotation_axis_angle" : "delta_rotation_axis_angle",
-"scale": "delta_scale"
+"scale": "delta_scale",
 }
 DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()
 
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py 
b/release/scripts/startup/bl_operators/object_quick_effects.py
index e48bd2c8987..d8b0e85be0e 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ 

[Bf-blender-cvs] [657a5f205ac] master: Cleanup: remove redundant property lookups in RNA API use

2022-12-14 Thread Campbell Barton
Commit: 657a5f205acc70fce542d075e68e7f7dba707233
Author: Campbell Barton
Date:   Thu Dec 15 16:30:42 2022 +1100
Branches: master
https://developer.blender.org/rB657a5f205acc70fce542d075e68e7f7dba707233

Cleanup: remove redundant property lookups in RNA API use

===

M   source/blender/editors/geometry/geometry_attributes.cc

===

diff --git a/source/blender/editors/geometry/geometry_attributes.cc 
b/source/blender/editors/geometry/geometry_attributes.cc
index 4e53349707d..d4850f5c124 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -572,11 +572,11 @@ static int geometry_attribute_convert_invoke(bContext *C,
 
   PropertyRNA *prop = RNA_struct_find_property(op->ptr, "domain");
   if (!RNA_property_is_set(op->ptr, prop)) {
-RNA_enum_set(op->ptr, "domain", meta_data.domain);
+RNA_property_enum_set(op->ptr, prop, meta_data.domain);
   }
   prop = RNA_struct_find_property(op->ptr, "data_type");
   if (!RNA_property_is_set(op->ptr, prop)) {
-RNA_enum_set(op->ptr, "data_type", meta_data.data_type);
+RNA_property_enum_set(op->ptr, prop, meta_data.data_type);
   }
 
   return WM_operator_props_dialog_popup(C, op, 300);
@@ -642,11 +642,11 @@ static int 
geometry_color_attribute_convert_invoke(bContext *C,
 
   PropertyRNA *prop = RNA_struct_find_property(op->ptr, "domain");
   if (!RNA_property_is_set(op->ptr, prop)) {
-RNA_enum_set(op->ptr, "domain", meta_data.domain);
+RNA_property_enum_set(op->ptr, prop, meta_data.domain);
   }
   prop = RNA_struct_find_property(op->ptr, "data_type");
   if (!RNA_property_is_set(op->ptr, prop)) {
-RNA_enum_set(op->ptr, "data_type", meta_data.data_type);
+RNA_property_enum_set(op->ptr, prop, meta_data.data_type);
   }
 
   return WM_operator_props_dialog_popup(C, op, 300);

___
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] [18cc1b11084] master: Fix cursor warping display under Wayland

2022-12-14 Thread Campbell Barton
Commit: 18cc1b11084098d2d709a6eb904257ab327568b2
Author: Campbell Barton
Date:   Thu Dec 15 15:19:57 2022 +1100
Branches: master
https://developer.blender.org/rB18cc1b11084098d2d709a6eb904257ab327568b2

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 6bc07fed10c..efcbc79d5c2 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -5830,8 +5830,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] [d715573aea9] master: Cleanup: declare GHOST_Window::getCursorGrabBounds as const

2022-12-14 Thread Campbell Barton
Commit: d715573aea95b91143e6e181d0100e69c6dab93c
Author: Campbell Barton
Date:   Thu Dec 15 15:10:51 2022 +1100
Branches: master
https://developer.blender.org/rBd715573aea95b91143e6e181d0100e69c6dab93c

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 33b9d160f0f..403f9e388cc 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -274,7 +274,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 144bfeab373..202f803f710 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -175,7 +175,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 741ce786859..04ce9fed950 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] [b147af2b7ee] master: Cleanup: remove duplicate doc-strings

2022-12-14 Thread Campbell Barton
Commit: b147af2b7ee4a995a9a444f864bcbb2ad03f9c4f
Author: Campbell Barton
Date:   Thu Dec 15 14:56:58 2022 +1100
Branches: master
https://developer.blender.org/rBb147af2b7ee4a995a9a444f864bcbb2ad03f9c4f

Cleanup: remove duplicate doc-strings

===

M   intern/ghost/intern/GHOST_SystemX11.cpp
M   intern/ghost/intern/GHOST_WindowWayland.cpp
M   intern/ghost/intern/GHOST_WindowX11.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 4baa3ff598f..72f34dac52e 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -275,10 +275,6 @@ uint8_t GHOST_SystemX11::getNumDisplays() const
   return uint8_t(1);
 }
 
-/**
- * Returns the dimensions of the main display on this system.
- * \return The dimension of the main display.
- */
 void GHOST_SystemX11::getMainDisplayDimensions(uint32_t , uint32_t 
) const
 {
   if (m_display) {
@@ -289,10 +285,6 @@ void GHOST_SystemX11::getMainDisplayDimensions(uint32_t 
, uint32_t 
   }
 }
 
-/**
- * Returns the dimensions of the main display on this system.
- * \return The dimension of the main display.
- */
 void GHOST_SystemX11::getAllDisplayDimensions(uint32_t , uint32_t 
) const
 {
   if (m_display) {
@@ -301,22 +293,6 @@ void GHOST_SystemX11::getAllDisplayDimensions(uint32_t 
, uint32_t )
   }
 }
 
-/**
- * Create a new window.
- * The new window is added to the list of windows managed.
- * Never explicitly delete the window, use #disposeWindow() instead.
- * \param title: The name of the window
- * (displayed in the title bar of the window if the OS supports it).
- * \param left: The coordinate of the left edge of the window.
- * \param top: The coordinate of the top edge of the window.
- * \param width: The width the window.
- * \param height: The height the window.
- * \param state: The state of the window when opened.
- * \param glSettings: Misc OpenGL settings.
- * \param exclusive: Use to show the window on top and ignore others (used 
full-screen).
- * \param parentWindow: Parent window.
- * \return The new window (or 0 if creation failed).
- */
 GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
  int32_t left,
  int32_t top,
@@ -417,11 +393,7 @@ static GHOST_Context *create_glx_context(Display *display,
 
   return nullptr;
 }
-/**
- * Create a new off-screen context.
- * Never explicitly delete the context, use #disposeContext() instead.
- * \return The new context (or 0 if creation failed).
- */
+
 GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings 
glSettings)
 {
   /* During development:
@@ -479,11 +451,6 @@ GHOST_IContext 
*GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
   return nullptr;
 }
 
-/**
- * Dispose of a context.
- * \param context: Pointer to the context to be disposed.
- * \return Indication of success.
- */
 GHOST_TSuccess GHOST_SystemX11::disposeContext(GHOST_IContext *context)
 {
   delete context;
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp 
b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 239693e0e5b..ffbb8370c46 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -1203,10 +1203,6 @@ void GHOST_WindowWayland::setOpaque() const
 }
 #endif
 
-/**
- * \param type: The type of rendering context create.
- * \return Indication of success.
- */
 GHOST_Context 
*GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType type)
 {
   GHOST_Context *context;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp 
b/intern/ghost/intern/GHOST_WindowX11.cpp
index 9f77bdc4dd0..00b0230888e 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1112,11 +1112,6 @@ void GHOST_WindowX11::validate()
   m_invalid_window = false;
 }
 
-/**
- * Destructor.
- * Closes the window and disposes resources allocated.
- */
-
 GHOST_WindowX11::~GHOST_WindowX11()
 {
   std::map::iterator it = m_standard_cursors.begin();

___
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] [5da11e22de6] master: Cleanup: improve docs for grab functions & use rcti for the wrap region

2022-12-14 Thread Campbell Barton
Commit: 5da11e22de6ea84751b19718f5fab95db12749d2
Author: Campbell Barton
Date:   Thu Dec 15 13:50:49 2022 +1100
Branches: master
https://developer.blender.org/rB5da11e22de6ea84751b19718f5fab95db12749d2

Cleanup: improve docs for grab functions & use rcti for the wrap region

- Use typed enum for the wrap axis.
- Rename `bounds` to `wrap_region`.
- Take a `rcti` argument instead of an `int[4]`.
- Pair wrap & wrap_region arguments together.

===

M   source/blender/editors/interface/interface_handlers.cc
M   source/blender/editors/space_view3d/view3d_navigate_walk.c
M   source/blender/makesdna/DNA_windowmanager_types.h
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
M   source/blender/windowmanager/intern/wm_cursors.c
M   source/blender/windowmanager/intern/wm_event_system.cc
M   source/blender/windowmanager/intern/wm_operator_type.c
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/source/blender/editors/interface/interface_handlers.cc 
b/source/blender/editors/interface/interface_handlers.cc
index 2d90b6f0d22..0144126f802 100644
--- a/source/blender/editors/interface/interface_handlers.cc
+++ b/source/blender/editors/interface/interface_handlers.cc
@@ -8306,7 +8306,7 @@ static void button_activate_state(bContext *C, uiBut 
*but, uiHandleButtonState s
   /* number editing */
   if (state == BUTTON_STATE_NUM_EDITING) {
 if (ui_but_is_cursor_warp(but)) {
-  WM_cursor_grab_enable(CTX_wm_window(C), WM_CURSOR_WRAP_XY, true, 
nullptr);
+  WM_cursor_grab_enable(CTX_wm_window(C), WM_CURSOR_WRAP_XY, nullptr, 
true);
 }
 ui_numedit_begin(but, data);
   }
diff --git a/source/blender/editors/space_view3d/view3d_navigate_walk.c 
b/source/blender/editors/space_view3d/view3d_navigate_walk.c
index a1d293dc53f..3d113c408eb 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_walk.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_walk.c
@@ -612,18 +612,18 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, 
wmOperator *op, const int
 
 #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 rcti *winrct = >region->winrct;
+const int center[2] = {BLI_rcti_cent_x(winrct), BLI_rcti_cent_y(winrct)};
+const int size[2] = {BLI_rcti_size_x(winrct), BLI_rcti_size_y(winrct)};
 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. */
+rcti wrap_region = {};
+wrap_region.xmin = center[0] - (size[0] / div);
+wrap_region.xmax = center[0] + (size[0] / div);
+wrap_region.ymin = center[1] - (size[1] / div);
+wrap_region.ymax = center[1] + (size[1] / div);
 
-WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, false, bounds);
+WM_cursor_grab_enable(win, WM_CURSOR_WRAP_XY, _region, false);
 
 /* Important to hide afterwards (not part of grabbing),
  * since enabling cursor and hiding at the same time ignores bounds. */
@@ -633,7 +633,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, 
wmOperator *op, const int
   else
 #endif /* USE_CURSOR_WARP_HACK */
   {
-WM_cursor_grab_enable(win, 0, true, NULL);
+WM_cursor_grab_enable(win, WM_CURSOR_WRAP_NONE, NULL, true);
   }
 
   return 1;
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h 
b/source/blender/makesdna/DNA_windowmanager_types.h
index 7231a995f10..af0bb721f60 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -277,7 +277,7 @@ typedef struct wmWindow {
   short lastcursor;
   /** The current modal cursor. */
   short modalcursor;
-  /** Cursor grab mode. */
+  /** Cursor grab mode #GHOST_TGrabCursorMode (run-time only) */
   short grabcursor;
   /** Internal: tag this for extra mouse-move event,
* makes cursors/buttons active on UI switching. */
diff --git a/source/blender/windowmanager/WM_api.h 
b/source/blender/windowmanager/WM_api.h
index df5659845fe..37dce4db61d 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -321,9 +321,22 @@ void WM_cursor_modal_restore(struct wmWindow *win);
  */
 void WM_cursor_wait(bool val);
 /**
- * \param bounds: can be NULL
+ * Enable cursor grabbing, optionally hiding the cursor and wrapping 
cursor-motion
+ * within a sub-region of the window.
+ *
+ * \param 

[Bf-blender-cvs] [0240b895994] master: Fix T102346: Mouse escapes window during walk navigation

2022-12-14 Thread Campbell Barton
Commit: 0240b895994aa58258db6897ae0d6478da7fce5f
Author: Campbell Barton
Date:   Thu Dec 15 11:57:00 2022 +1100
Branches: master
https://developer.blender.org/rB0240b895994aa58258db6897ae0d6478da7fce5f

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 2a426bfd480..a1d293dc53f 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] [230744d6fd9] master: Revert "Fix T102346: Mouse escapes window during walk navigation"

2022-12-14 Thread Campbell Barton
Commit: 230744d6fd96dcf5afe66a8f9b9f6f8bbe1f41bb
Author: Campbell Barton
Date:   Wed Dec 14 21:02:53 2022 +1100
Branches: master
https://developer.blender.org/rB230744d6fd96dcf5afe66a8f9b9f6f8bbe1f41bb

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 8cb007a756a..d005eec3036 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1075,46 +1075,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) {
   /* WORKAROUND: Store the current time so that we ignore outdated 
mousemove events. */
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 4a723435806..4baa3ff598f 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -950,48 +950,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 

[Bf-blender-cvs] [b13a92a238d] master: Cleanup: wrap long lines in CMake

2022-12-14 Thread Campbell Barton
Commit: b13a92a238d4fac149d7743554203b0a759be056
Author: Campbell Barton
Date:   Thu Dec 15 10:54:13 2022 +1100
Branches: master
https://developer.blender.org/rBb13a92a238d4fac149d7743554203b0a759be056

Cleanup: wrap long lines in CMake

Also remove `mingw_LIBDIR` from PKG_CONFIG_PATH since it's not a
package-file path.

===

M   build_files/build_environment/cmake/harfbuzz.cmake
M   build_files/build_environment/cmake/sndfile.cmake

===

diff --git a/build_files/build_environment/cmake/harfbuzz.cmake 
b/build_files/build_environment/cmake/harfbuzz.cmake
index d34d312c9d8..5f57ab6c0ff 100644
--- a/build_files/build_environment/cmake/harfbuzz.cmake
+++ b/build_files/build_environment/cmake/harfbuzz.cmake
@@ -5,7 +5,12 @@ if(WIN32)
   set(HARFBUZZ_PKG_ENV FREETYPE_DIR=${LIBDIR}/freetype)
 else()
   set(HARFBUZZ_CONFIGURE_ENV ${CONFIGURE_ENV})
-  set(HARFBUZZ_PKG_ENV 
PKG_CONFIG_PATH=${LIBDIR}/freetype/lib/pkgconfig:${LIBDIR}/brotli/lib/pkgconfig:${LIBDIR}/lib/python3.10/pkgconfig:$PKG_CONFIG_PATH)
+  set(HARFBUZZ_PKG_ENV "PKG_CONFIG_PATH=\
+${LIBDIR}/freetype/lib/pkgconfig:\
+${LIBDIR}/brotli/lib/pkgconfig:\
+${LIBDIR}/lib/python3.10/pkgconfig:\
+$PKG_CONFIG_PATH"
+  )
 endif()
 
 set(HARFBUZZ_EXTRA_OPTIONS
@@ -23,8 +28,16 @@ ExternalProject_Add(external_harfbuzz
   URL_HASH ${HARFBUZZ_HASH_TYPE}=${HARFBUZZ_HASH}
   DOWNLOAD_DIR ${DOWNLOAD_DIR}
   PREFIX ${BUILD_DIR}/harfbuzz
+
   CONFIGURE_COMMAND ${HARFBUZZ_CONFIGURE_ENV} &&
-${CMAKE_COMMAND} -E env ${HARFBUZZ_PKG_ENV} ${MESON} setup --prefix 
${LIBDIR}/harfbuzz ${HARFBUZZ_EXTRA_OPTIONS} --default-library static --libdir 
lib ${BUILD_DIR}/harfbuzz/src/external_harfbuzz-build 
${BUILD_DIR}/harfbuzz/src/external_harfbuzz
+  ${CMAKE_COMMAND} -E env ${HARFBUZZ_PKG_ENV}
+  ${MESON} setup
+  --prefix ${LIBDIR}/harfbuzz ${HARFBUZZ_EXTRA_OPTIONS}
+  --default-library static
+  --libdir lib
+  ${BUILD_DIR}/harfbuzz/src/external_harfbuzz-build
+  ${BUILD_DIR}/harfbuzz/src/external_harfbuzz
+
   BUILD_COMMAND ninja
   INSTALL_COMMAND ninja install
   INSTALL_DIR ${LIBDIR}/harfbuzz
@@ -46,4 +59,3 @@ if(BUILD_MODE STREQUAL Release AND WIN32)
 DEPENDEES install
   )
 endif()
-
diff --git a/build_files/build_environment/cmake/sndfile.cmake 
b/build_files/build_environment/cmake/sndfile.cmake
index ff57ffe7c28..3ea4c776e56 100644
--- a/build_files/build_environment/cmake/sndfile.cmake
+++ b/build_files/build_environment/cmake/sndfile.cmake
@@ -4,7 +4,12 @@ set(SNDFILE_EXTRA_ARGS)
 set(SNDFILE_ENV)
 
 if(WIN32)
-  set(SNDFILE_ENV 
PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR})
+  set(SNDFILE_ENV "PKG_CONFIG_PATH=\
+${mingw_LIBDIR}/ogg/lib/pkgconfig:\
+${mingw_LIBDIR}/vorbis/lib/pkgconfig:\
+${mingw_LIBDIR}/flac/lib/pkgconfig:\
+${mingw_LIBDIR}/opus/lib/pkgconfig"
+)
   set(SNDFILE_ENV set ${SNDFILE_ENV} &&)
   # Shared for windows because static libs will drag in a libgcc dependency.
   set(SNDFILE_OPTIONS --disable-static --enable-shared )
@@ -19,7 +24,10 @@ if(UNIX AND NOT APPLE)
   #
   # Replace: Cflags: -I${includedir}/opus
   # With:Cflags: -I${includedir}
-  set(SNDFILE_ENV sed -i s/{includedir}\\/opus/{includedir}/g 
${LIBDIR}/opus/lib/pkgconfig/opus.pc && ${SNDFILE_ENV})
+  set(SNDFILE_ENV
+sed -i s/{includedir}\\/opus/{includedir}/g 
${LIBDIR}/opus/lib/pkgconfig/opus.pc &&
+${SNDFILE_ENV}
+  )
 endif()
 
 ExternalProject_Add(external_sndfile

___
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] [c969a533f9c] master: WM: support checking windowing capabilities

2022-12-14 Thread Campbell Barton
Commit: c969a533f9c1b0e93d066331993286f8ee309d9c
Author: Campbell Barton
Date:   Thu Dec 15 11:48:08 2022 +1100
Branches: master
https://developer.blender.org/rBc969a533f9c1b0e93d066331993286f8ee309d9c

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 264b76472f7..df5659845fe 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 f5dc18bb16e..7ee074660b0 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1646,6 +1646,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] [530b2323099] master: Cleanup: use more descriptive name for function in BMesh doc generation

2022-12-14 Thread Campbell Barton
Commit: 530b23230990d8eb521d70b29f83b4da2c611966
Author: Campbell Barton
Date:   Thu Dec 15 10:51:06 2022 +1100
Branches: master
https://developer.blender.org/rB530b23230990d8eb521d70b29f83b4da2c611966

Cleanup: use more descriptive name for function in BMesh doc generation

Avoid the term "print" as the function doesn't print.

===

M   doc/python_api/rst_from_bmesh_opdefines.py

===

diff --git a/doc/python_api/rst_from_bmesh_opdefines.py 
b/doc/python_api/rst_from_bmesh_opdefines.py
index 3b7093f0156..1285938feb1 100644
--- a/doc/python_api/rst_from_bmesh_opdefines.py
+++ b/doc/python_api/rst_from_bmesh_opdefines.py
@@ -370,7 +370,7 @@ def main():
 
 args_in_wash = get_args_wash(args_in, args_in_index, False)
 
-fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", 
".join([print_arg_in(arg) for arg in args_in_wash])))
+fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", 
".join([arg_name_with_default(arg) for arg in args_in_wash])))
 
 # -- wash the comment
 comment_washed = []
@@ -423,8 +423,8 @@ def main():
 print(OUT_RST)
 
 
-def print_arg_in(arg):
-(name, default_value, _, _) = arg
+def arg_name_with_default(arg):
+name, default_value, _, _ = arg
 if default_value is None:
 return name
 return name + '=' + default_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] [59b1eb145d0] temp-nodes-group-declarations: Start of refactoring to use declaration for group nodes

2022-12-14 Thread Hans Goudey
Commit: 59b1eb145d0aa7c1b9a13750ce5c5f941ad27638
Author: Hans Goudey
Date:   Wed Dec 14 18:42:04 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB59b1eb145d0aa7c1b9a13750ce5c5f941ad27638

Start of refactoring to use declaration for group nodes

===

M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/node_tree_field_inferencing.cc
M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/editors/space_node/link_drag_search.cc
M   source/blender/editors/space_node/node_group.cc
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/NOD_common.h
M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/NOD_socket_declarations.hh
M   source/blender/nodes/composite/nodes/node_composite_common.cc
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
M   source/blender/nodes/intern/node_socket_declarations.cc
M   source/blender/nodes/intern/socket_search_link.cc
M   source/blender/nodes/shader/nodes/node_shader_common.cc
M   source/blender/nodes/texture/nodes/node_texture_common.cc

===

diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 5a1198791fb..845b5a5566d 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -104,6 +104,7 @@ namespace nodes {
 class DNode;
 class NodeMultiFunctionBuilder;
 class GeoNodeExecParams;
+class NodeDeclaration;
 class NodeDeclarationBuilder;
 class GatherLinkSearchOpParams;
 }  // namespace nodes
@@ -121,6 +122,9 @@ 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 ,
+const bNode ,
+blender::nodes::NodeDeclaration 
_declaration);
 using SocketGetCPPValueFunction = void (*)(const struct bNodeSocket , 
void *r_value);
 using SocketGetGeometryNodesCPPValueFunction = void (*)(const struct 
bNodeSocket ,
 void *r_value);
@@ -140,6 +144,7 @@ typedef void *NodeGetCompositorShaderNodeFunction;
 typedef void *NodeMultiFunctionBuildFunction;
 typedef void *NodeGeometryExecFunction;
 typedef void *NodeDeclareFunction;
+typedef void *NodeDeclareDynamicFunction;
 typedef void *NodeGatherSocketLinkOperationsFunction;
 typedef void *SocketGetCPPTypeFunction;
 typedef void *SocketGetGeometryNodesCPPTypeFunction;
@@ -176,11 +181,6 @@ typedef struct bNodeSocketType {
 struct bNode *node,
 struct bNodeSocket *sock,
 const char *data_path);
-  void (*interface_verify_socket)(struct bNodeTree *ntree,
-  const struct bNodeSocket *interface_socket,
-  struct bNode *node,
-  struct bNodeSocket *sock,
-  const char *data_path);
   void (*interface_from_socket)(struct bNodeTree *ntree,
 struct bNodeSocket *interface_socket,
 struct bNode *node,
@@ -345,8 +345,12 @@ typedef struct bNodeType {
 
   /* Declares which sockets the node has. */
   NodeDeclareFunction declare;
-  /* Different nodes of this type can have different declarations. */
-  bool declaration_is_dynamic;
+  /**
+   * Declare which sockets the node has, but isn't static per node type. In 
orther words,
+   * different nodes of this type can have different declarations and 
different sockets.
+   */
+  NodeDeclareDynamicFunction declare_dynamic;
+
   /* Declaration to be used when it is not dynamic. */
   NodeDeclarationHandle *fixed_declaration;
 
diff --git a/source/blender/blenkernel/BKE_node_runtime.hh 
b/source/blender/blenkernel/BKE_node_runtime.hh
index 6a00e70cb5b..7f0e7f66936 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -324,7 +324,7 @@ inline bool topology_cache_is_available(const bNodeSocket 
)
 
 namespace node_field_inferencing {
 bool update_field_inferencing(const bNodeTree );
-}
+}  // namespace node_field_inferencing
 
 }  // namespace blender::bke
 
diff --git 

[Bf-blender-cvs] [7766a20b8ff] master: Build: clarify some comments in the rocky8 setup script

2022-12-14 Thread Ray Molenkamp
Commit: 7766a20b8ffada607ec0e155e3f8be73f5afd6b9
Author: Ray Molenkamp
Date:   Wed Dec 14 17:26:40 2022 -0700
Branches: master
https://developer.blender.org/rB7766a20b8ffada607ec0e155e3f8be73f5afd6b9

Build: clarify some comments in the rocky8 setup script

also moved the install of the config manager to before it is needed.

===

M   build_files/build_environment/linux/linux_rocky8_setup.sh

===

diff --git a/build_files/build_environment/linux/linux_rocky8_setup.sh 
b/build_files/build_environment/linux/linux_rocky8_setup.sh
index 2f4efe0be97..48b49f80149 100644
--- a/build_files/build_environment/linux/linux_rocky8_setup.sh
+++ b/build_files/build_environment/linux/linux_rocky8_setup.sh
@@ -11,13 +11,14 @@ if [ `id -u` -ne 0 ]; then
exit 1
 fi
 
+# Required by: config manager command below to enable powertools.
+dnf install 'dnf-command(config-manager)'
+
 # Packages `ninja-build` and `meson` are not available unless CBR or 
PowerTools repositories are enabled.
 # See: https://wiki.rockylinux.org/rocky/repo/#notes-on-unlisted-repositories
 dnf config-manager --set-enabled powertools
 
-# Required by: TODO.
-dnf install 'dnf-command(config-manager)'
-# Required by: TODO.
+# Required by: epel-release has the patchelf and rubygem-asciidoctor packages
 dnf install epel-release
 
 # `yum-config-manager` does not come in the default minimal install,

___
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] [36ca1312c4b] master: Cleanup: use doxy sections and comments in DNA_scene_types.h

2022-12-14 Thread Campbell Barton
Commit: 36ca1312c4b2c9cd860f167e3e2fbd12337e9718
Author: Campbell Barton
Date:   Thu Dec 15 10:31:18 2022 +1100
Branches: master
https://developer.blender.org/rB36ca1312c4b2c9cd860f167e3e2fbd12337e9718

Cleanup: use doxy sections and comments in DNA_scene_types.h

===

M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 8832e044f5e..5f68b2d0c78 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -47,11 +47,9 @@ struct World;
 struct bGPdata;
 struct bNodeTree;
 
-/* * */
-/* Scene Data */
-
-/* * */
-/* Output Format Data */
+/*  */
+/** \name FFMPEG
+ * \{ */
 
 typedef struct AviCodecData {
   /** Save format. */
@@ -100,17 +98,18 @@ typedef enum eFFMpegPreset {
 
   /* Used by WEBM/VP9 and h.264 to control encoding speed vs. file size.
* WEBM/VP9 use these values directly, whereas h.264 map those to
-   * respectively the MEDIUM, SLOWER, and SUPERFAST presets.
-   */
-  /** the default and recommended for most applications */
+   * respectively the MEDIUM, SLOWER, and SUPERFAST presets. */
+
+  /** The default and recommended for most applications. */
   FFM_PRESET_GOOD = 10,
-  /** recommended if you have lots of time and want the best compression 
efficiency */
+  /** Recommended if you have lots of time and want the best compression 
efficiency. */
   FFM_PRESET_BEST = 11,
-  /** recommended for live / fast encoding */
+  /** Recommended for live / fast encoding. */
   FFM_PRESET_REALTIME = 12,
 } eFFMpegPreset;
 
-/* Mapping from easily-understandable descriptions to CRF values.
+/**
+ * Mapping from easily-understandable descriptions to CRF values.
  * Assumes we output 8-bit video. Needs to be remapped if 10-bit
  * is output.
  * We use a slightly wider than "subjectively sane range" according
@@ -160,12 +159,15 @@ typedef struct FFMpegCodecData {
   void *_pad1;
 } FFMpegCodecData;
 
-/* * */
-/* Audio */
+/** \} */
+
+/*  */
+/** \name Audio
+ * \{ */
 
 typedef struct AudioData {
-  int mixrate; /* 2.5: now in FFMpegCodecData: audio_mixrate */
-  float main;  /* 2.5: now in FFMpegCodecData: audio_volume */
+  int mixrate; /* 2.5: now in FFMpegCodecData: audio_mixrate. */
+  float main;  /* 2.5: now in FFMpegCodecData: audio_volume. */
   float speed_of_sound;
   float doppler_factor;
   int distance_model;
@@ -175,8 +177,9 @@ typedef struct AudioData {
   char _pad2[4];
 } AudioData;
 
-/* *** */
-/* Render Layers */
+/*  */
+/** \name Render Layers
+ * \{ */
 
 /** Render Layer. */
 typedef struct SceneRenderLayer {
@@ -196,7 +199,7 @@ typedef struct SceneRenderLayer {
   /** Converted to ViewLayer layflag and flag. */
   int layflag DNA_DEPRECATED;
 
-  /* pass_xor has to be after passflag */
+  /* Pass_xor has to be after passflag. */
   /** Pass_xor has to be after passflag. */
   int passflag DNA_DEPRECATED;
   /** Converted to ViewLayer passflag and flag. */
@@ -227,6 +230,7 @@ typedef struct SceneRenderLayer {
 #define SCE_LAY_MOTION_BLUR (1 << 9)
 
 /* Flags between (1 << 9) and (1 << 15) are set to 1 already, for future 
options. */
+
 #define SCE_LAY_FLAG_DEFAULT ((1 << 15) - 1)
 
 #define SCE_LAY_UNUSED_4 (1 << 15)
@@ -310,7 +314,13 @@ typedef enum eScenePassType {
 #define RE_PASSNAME_CRYPTOMATTE_ASSET "CryptoAsset"
 #define RE_PASSNAME_CRYPTOMATTE_MATERIAL "CryptoMaterial"
 
-/** View - MultiView. */
+/** \} */
+
+/*  */
+/** \name Multi-View
+ * \{ */
+
+/** View (Multi-view). */
 typedef struct SceneRenderView {
   struct SceneRenderView *next, *prev;
 
@@ -333,7 +343,7 @@ enum {
   SCE_VIEWS_FORMAT_MULTIVIEW = 1,
 };
 
-/** #ImageFormatData.views_format (also used for #Sequence.views_format) */
+/** #ImageFormatData.views_format (also used for #Sequence.views_format). */
 enum {
   R_IMF_VIEWS_INDIVIDUAL = 0,
   R_IMF_VIEWS_STEREO_3D = 1,
@@ -381,10 +391,15 @@ typedef enum eStereo3dInterlaceType {
   S3D_INTERLACE_CHECKERBOARD = 2,
 } eStereo3dInterlaceType;
 
-/* *** */
+/** \} */
+
+/*  */
+/** \name Image Format Data
+ * \{ */
 
-/* Generic image format settings,
- * this is used for NodeImageFile and IMAGE_OT_save_as operator too.
+/**
+ * Generic image 

[Bf-blender-cvs] [e0fbeb6e7ba] master: Fix T103225: Line Art modifier skips loose edges

2022-12-14 Thread Hans Goudey
Commit: e0fbeb6e7ba7467f297f24d618d16b73ddb3f4b5
Author: Hans Goudey
Date:   Wed Dec 14 17:07:44 2022 -0600
Branches: master
https://developer.blender.org/rBe0fbeb6e7ba7467f297f24d618d16b73ddb3f4b5

Fix T103225: Line Art modifier skips loose edges

1ea169d90e39647eac72 neglected to increase the loose edge count.

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
index dc65ffd60a4..c7a83efefdc 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.cc
@@ -2109,11 +2109,11 @@ static void 
lineart_geometry_object_load(LineartObjectInfo *ob_info,
 loose_data.loose_array = static_cast(
 MEM_malloc_arrayN(loose_edges.count, sizeof(int), __func__));
 if (loose_edges.count > 0) {
-  int loose_i = 0;
+  loose_data.loose_count = 0;
   for (const int64_t edge_i : IndexRange(me->totedge)) {
 if (loose_edges.is_loose_bits[edge_i]) {
-  loose_data.loose_array[loose_i] = int(edge_i);
-  loose_i++;
+  loose_data.loose_array[loose_data.loose_count] = int(edge_i);
+  loose_data.loose_count++;
 }
   }
 }

___
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] [2dd27d5f06b] master: Cleanup: remove function for accessing supported add-ons

2022-12-14 Thread Campbell Barton
Commit: 2dd27d5f06bd4bc01ce3db66a731468b3004552c
Author: Campbell Barton
Date:   Thu Dec 15 09:39:23 2022 +1100
Branches: master
https://developer.blender.org/rB2dd27d5f06bd4bc01ce3db66a731468b3004552c

Cleanup: remove function for accessing supported add-ons

This was only called once in a situation where such functions
are typically used as a dynamic enum callbacks.

Prefer keeping the items close to the EnumProperty definition &
avoid the need to note why this is a special case that doesn't follow
the common pattern for enum callbacks.

===

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

===

diff --git a/release/scripts/startup/bl_ui/__init__.py 
b/release/scripts/startup/bl_ui/__init__.py
index 592eaf57a97..01ae0730fab 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -95,18 +95,6 @@ _modules_loaded = [_namespace[name] for name in _modules]
 del _namespace
 
 
-def _addon_support_items():
-"""Return the addon support levels suitable for this Blender build."""
-
-items = [
-('OFFICIAL', "Official", "Officially supported"),
-('COMMUNITY', "Community", "Maintained by community developers"),
-]
-if bpy.app.version_cycle == 'alpha':
-items.append(('TESTING', "Testing", "Newly contributed scripts 
(excluded from release builds)"))
-return items
-
-
 def register():
 from bpy.utils import register_class
 for mod in _modules_loaded:
@@ -152,13 +140,23 @@ def register():
 description="Filter add-ons by category",
 )
 
+# These items are static but depend on the version cycle.
+items = [
+('OFFICIAL', "Official", "Officially supported"),
+('COMMUNITY', "Community", "Maintained by community developers"),
+]
+if bpy.app.version_cycle == "alpha":
+items.append(('TESTING', "Testing", "Newly contributed scripts 
(excluded from release builds)"))
+
 WindowManager.addon_support = EnumProperty(
-items=_addon_support_items(),
+items=items,
 name="Support",
 description="Display support level",
 default={'OFFICIAL', 'COMMUNITY'},
 options={'ENUM_FLAG'},
 )
+del items
+
 # done...

___
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] [50a2c77c4eb] geometry-nodes-simulation: Add initial dynamic declarations

2022-12-14 Thread Hans Goudey
Commit: 50a2c77c4ebe0edd048715c94bde5bbe6f106617
Author: Hans Goudey
Date:   Wed Dec 14 16:02:43 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB50a2c77c4ebe0edd048715c94bde5bbe6f106617

Add initial dynamic declarations

===

M   source/blender/blenkernel/intern/node.cc
M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
M   source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
M   source/blender/nodes/intern/node_declaration.cc

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index d55e57bb000..e52f8fe2f1e 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -3620,7 +3620,7 @@ bool nodeDeclarationEnsureOnOutdatedNode(bNodeTree * 
/*ntree*/, bNode *node)
   }
   if (node->typeinfo->declaration_is_dynamic) {
 node->runtime->declaration = new blender::nodes::NodeDeclaration();
-blender::nodes::build_node_declaration(*node->typeinfo, 
*node->runtime->declaration);
+blender::nodes::build_node_declaration_dynamic(*node, 
*node->runtime->declaration);
   }
   else {
 /* Declaration should have been created in #nodeRegisterType. */
diff --git a/source/blender/nodes/NOD_node_declaration.hh 
b/source/blender/nodes/NOD_node_declaration.hh
index 975cc96131c..9c5362a64bc 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -325,11 +325,19 @@ class NodeDeclaration {
 class NodeDeclarationBuilder {
  private:
   NodeDeclaration _;
+  const bNode *node_;
   Vector> builders_;
   bool is_function_node_ = false;
 
  public:
   NodeDeclarationBuilder(NodeDeclaration );
+  NodeDeclarationBuilder(const bNode , NodeDeclaration );
+
+  /** Only valid for nodes with dynamic declarations. */
+  const bNode ()
+  {
+return *node_;
+  }
 
   /**
* All inputs support fields, and all outputs are fields if any of the 
inputs is a field.
@@ -361,6 +369,7 @@ void index(const bNode , void *r_value);
 void id_or_index(const bNode , void *r_value);
 }  // namespace implicit_field_inputs
 
+void build_node_declaration_dynamic(const bNode , NodeDeclaration 
_declaration);
 void build_node_declaration(const bNodeType , NodeDeclaration 
_declaration);
 
 /*  */
@@ -516,6 +525,12 @@ inline 
NodeDeclarationBuilder::NodeDeclarationBuilder(NodeDeclaration 
 {
 }
 
+inline NodeDeclarationBuilder::NodeDeclarationBuilder(const bNode ,
+  NodeDeclaration 
)
+: node_(), declaration_(declaration)
+{
+}
+
 template
 inline typename DeclType::Builder ::add_input(StringRef 
name,
  StringRef 
identifier)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
index 5c2ef821c8a..aa543be2f40 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -17,23 +17,56 @@ NODE_STORAGE_FUNCS(NodeGeometrySimulationInput);
 
 static void node_declare(NodeDeclarationBuilder )
 {
-  b.add_input(N_("Geometry"));
-  b.add_input("", N_("__extend__"));
-
   b.add_output(N_("Delta Time"));
-  b.add_output(N_("Geometry"));
-  b.add_output("", N_("__extend__"));
-}
 
-static void node_layout(uiLayout * /*layout*/, bContext * /*C*/, PointerRNA * 
/*ptr*/)
-{
-  // const NodeGeometrySimulationInput  = node_storage(
-  // *static_cast(ptr->data));
-  // const bNodeTree _tree = *reinterpret_cast(ptr->owner_id);
-  // const bNode *sim_output = node_tree.node_by_id(storage.output_node_id);
-  // if (sim_output) {
-  //   uiItemL(layout, sim_output->name, ICON_PHYSICS);
-  // }
+  const bNode  = b.node();
+  const NodeGeometrySimulationInput  = node_storage(node);
+  const int32_t sim_output_node_id = storage.output_node_id;
+  const bNode *sim_output_node = 
node.owner_tree().node_by_id(sim_output_node_id);
+  if (!sim_output_node) {
+return;
+  }
+  const NodeGeometrySimulationOutput _storage =
+  *static_cast(sim_output_node->storage);
+  const Span items(output_storage.state_items,
+output_storage.state_items_num);
+
+  for (const int i : items.index_range()) {
+const SimulationStateItem  = items[i];
+switch (item.data_type) {
+  case SOCK_FLOAT:
+b.add_input(item.name).supports_field();
+b.add_output(item.name).dependent_field({i});
+break;
+  case SOCK_VECTOR:
+b.add_input(item.name).supports_field();
+b.add_output(item.name).dependent_field({i});
+break;
+ 

[Bf-blender-cvs] [468f43c7a6e] geometry-nodes-simulation: Fix simulation

2022-12-14 Thread Hans Goudey
Commit: 468f43c7a6e96ba55d72564a8f11d60fc8984d33
Author: Hans Goudey
Date:   Wed Dec 14 16:42:48 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB468f43c7a6e96ba55d72564a8f11d60fc8984d33

Fix simulation

===

M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/NOD_node_declaration.hh
M   source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
M   source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index e52f8fe2f1e..3e350fbb80a 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -1124,12 +1124,12 @@ static void node_init(const bContext *C, bNodeTree 
*ntree, bNode *node)
   BLI_strncpy(node->name, DATA_(ntype->ui_name), NODE_MAXSTR);
   nodeUniqueName(ntree, node);
 
-  node_add_sockets_from_type(ntree, node, ntype);
-
   if (ntype->initfunc != nullptr) {
 ntype->initfunc(ntree, node);
   }
 
+  node_add_sockets_from_type(ntree, node, ntype);
+
   if (ntree->typeinfo && ntree->typeinfo->node_add_init) {
 ntree->typeinfo->node_add_init(ntree, node);
   }
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index ba2d63644ef..eaf0ea9e6ba 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1594,7 +1594,7 @@ typedef struct NodeGeometrySimulationOutput {
   int state_items_num;
 
   int8_t use_persistent_cache;
-  int _pad[3];
+  char _pad[3];
 } NodeGeometrySimulationOutput;
 
 typedef struct NodeGeometryDistributePointsInVolume {
diff --git a/source/blender/nodes/NOD_node_declaration.hh 
b/source/blender/nodes/NOD_node_declaration.hh
index 9c5362a64bc..c28f7525245 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -527,7 +527,7 @@ inline 
NodeDeclarationBuilder::NodeDeclarationBuilder(NodeDeclaration 
 
 inline NodeDeclarationBuilder::NodeDeclarationBuilder(const bNode ,
   NodeDeclaration 
)
-: node_(), declaration_(declaration)
+: declaration_(declaration), node_()
 {
 }
 
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
index aa543be2f40..4a785d9fae8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -22,6 +22,8 @@ static void node_declare(NodeDeclarationBuilder )
   const bNode  = b.node();
   const NodeGeometrySimulationInput  = node_storage(node);
   const int32_t sim_output_node_id = storage.output_node_id;
+  /* TODO: Add node tree and ndoe as arguments to new dynamic declaration 
function. */
+  node.owner_tree().ensure_topology_cache();
   const bNode *sim_output_node = 
node.owner_tree().node_by_id(sim_output_node_id);
   if (!sim_output_node) {
 return;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
index 83db79cdcf3..ab330ee65c4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -58,28 +58,35 @@ static void node_declare(NodeDeclarationBuilder )
 
 static void node_init(bNodeTree * /*tree*/, bNode *node)
 {
-  NodeGeometrySimulationOutput *data = 
MEM_cnew(__func__);
-  data->state_items = MEM_cnew_array(1, __func__);
-  data->state_items[0].name = BLI_strdup(DATA_("Geometry"));
-  data->state_items[0].data_type = SOCK_GEOMETRY;
-  data->state_items_num = 1;
-  data->use_persistent_cache = false;
-  node->storage = data;
+  NodeGeometrySimulationOutput *storage = 
MEM_cnew(__func__);
+  storage->state_items = MEM_cnew_array(1, __func__);
+  storage->state_items[0].name = BLI_strdup(DATA_("Geometry"));
+  storage->state_items[0].data_type = SOCK_GEOMETRY;
+  storage->state_items_num = 1;
+  storage->use_persistent_cache = false;
+  node->storage = storage;
 }
 
 static void node_free_storage(bNode *node)
 {
   NodeGeometrySimulationOutput  = node_storage(*node);
+  for (SimulationStateItem  : MutableSpan(storage.state_items, 
storage.state_items_num)) {
+MEM_SAFE_FREE(item.name);
+  }
   MEM_SAFE_FREE(storage.state_items);
 }
 
-void node_copy_storage(bNodeTree * /*dest_ntree*/, bNode *dst_node, const 
bNode *src_node)
+static void node_copy_storage(bNodeTree * /*dest_ntree*/, bNode *dst_node, 
const bNode *src_node)
 {
   const NodeGeometrySimulationOutput  = node_storage(*src_node);
-  NodeGeometrySimulationOutput  = node_storage(*dst_node);
-  

[Bf-blender-cvs] [e476afff412] master: Cleanup: format

2022-12-14 Thread Campbell Barton
Commit: e476afff41249826dd51862af7b009571b3ca0ae
Author: Campbell Barton
Date:   Thu Dec 15 09:34:22 2022 +1100
Branches: master
https://developer.blender.org/rBe476afff41249826dd51862af7b009571b3ca0ae

Cleanup: format

===

M   build_files/build_environment/darwin/set_rpath.py
M   release/scripts/startup/bl_ui/__init__.py
M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/intern/blendfile_link_append.c
M   source/blender/draw/engines/image/image_private.hh
M   
source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_vert_no_geom.glsl
M   source/blender/editors/transform/transform.h
M   source/blender/gpu/metal/mtl_context.mm
M   source/blender/makesrna/intern/rna_gpencil_modifier.c
M   source/blender/makesrna/intern/rna_layer.c
M   source/blender/makesrna/intern/rna_object.c
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/build_files/build_environment/darwin/set_rpath.py 
b/build_files/build_environment/darwin/set_rpath.py
index 6ca58875ac1..e53497b84fb 100644
--- a/build_files/build_environment/darwin/set_rpath.py
+++ b/build_files/build_environment/darwin/set_rpath.py
@@ -6,6 +6,7 @@ import re
 import subprocess
 import sys
 
+
 # Strip version numbers from dependenciesm macOS notarizatiom fails
 # with version symlinks.
 def strip_lib_version(name):
@@ -14,6 +15,7 @@ def strip_lib_version(name):
 name = re.sub(r'(\.[0-9]+)+.cpython', '.cpython', name)
 return name
 
+
 rpath = sys.argv[1]
 file = sys.argv[2]
 
diff --git a/release/scripts/startup/bl_ui/__init__.py 
b/release/scripts/startup/bl_ui/__init__.py
index 4822370c9ea..592eaf57a97 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -94,6 +94,7 @@ _namespace = globals()
 _modules_loaded = [_namespace[name] for name in _modules]
 del _namespace
 
+
 def _addon_support_items():
 """Return the addon support levels suitable for this Blender build."""
 
@@ -105,6 +106,7 @@ def _addon_support_items():
 items.append(('TESTING', "Testing", "Newly contributed scripts 
(excluded from release builds)"))
 return items
 
+
 def register():
 from bpy.utils import register_class
 for mod in _modules_loaded:
diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index 4acaa7b05e1..5c878486c68 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -520,7 +520,7 @@ typedef struct SculptAttribute {
* This will be true if simple_array is requested in
* SculptAttributeParams, or the PBVH type is PBVH_GRIDS or PBVH_BMESH.
*/
-  bool simple_array; 
+  bool simple_array;
   /* Data stored per BMesh element. */
   int bmesh_cd_offset;
 
diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c 
b/source/blender/blenkernel/intern/blendfile_link_append.c
index ea68e939e5a..409ae39f6be 100644
--- a/source/blender/blenkernel/intern/blendfile_link_append.c
+++ b/source/blender/blenkernel/intern/blendfile_link_append.c
@@ -996,14 +996,13 @@ static void blendfile_link_append_proxies_convert(Main 
*bmain, ReportList *repor
 
   if (bf_reports.count.proxies_to_lib_overrides_success != 0 ||
   bf_reports.count.proxies_to_lib_overrides_failures != 0) {
-BKE_reportf(
-bf_reports.reports,
-RPT_WARNING,
-"Proxies have been removed from Blender (%d proxies were automatically 
converted "
-"to library overrides, %d proxies could not be converted and were 
cleared). "
-"Consider re-saving any library .blend file with the newest Blender 
version",
-bf_reports.count.proxies_to_lib_overrides_success,
-bf_reports.count.proxies_to_lib_overrides_failures);
+BKE_reportf(bf_reports.reports,
+RPT_WARNING,
+"Proxies have been removed from Blender (%d proxies were 
automatically converted "
+"to library overrides, %d proxies could not be converted and 
were cleared). "
+"Consider re-saving any library .blend file with the newest 
Blender version",
+bf_reports.count.proxies_to_lib_overrides_success,
+bf_reports.count.proxies_to_lib_overrides_failures);
   }
 }
 
diff --git a/source/blender/draw/engines/image/image_private.hh 
b/source/blender/draw/engines/image/image_private.hh
index 7fa58f43d06..8241b7e288e 100644
--- a/source/blender/draw/engines/image/image_private.hh
+++ b/source/blender/draw/engines/image/image_private.hh
@@ -34,7 +34,6 @@ struct IMAGE_Data {
   IMAGE_InstanceData *instance_data;
 };
 
-
 /**
  * Abstract class for a drawing mode of the image engine.
  *
diff --git 

[Bf-blender-cvs] [d173a52f56b] master: Cleanup: doc-strings and minor changes to anim_utils.py

2022-12-14 Thread Campbell Barton
Commit: d173a52f56be3dd0f1dea6a9628bad52d2fcd0f7
Author: Campbell Barton
Date:   Thu Dec 15 09:26:40 2022 +1100
Branches: master
https://developer.blender.org/rBd173a52f56be3dd0f1dea6a9628bad52d2fcd0f7

Cleanup: doc-strings and minor changes to anim_utils.py

- Follow sphinx conventions for doc-strings.
- Use __slots__ for KeyframesCo as dynamically assigning new members
  isn't needed.
- Import from bpy.types instead of assigning.
- Split typing imports across multiple lines as they tend to become
  quite large.

===

M   release/scripts/modules/bpy_extras/anim_utils.py

===

diff --git a/release/scripts/modules/bpy_extras/anim_utils.py 
b/release/scripts/modules/bpy_extras/anim_utils.py
index 43973307ce6..3586401dd7a 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -9,13 +9,24 @@ __all__ = (
 )
 
 import bpy
-from typing import Mapping, List, Tuple, Sequence
+from bpy.types import Action
 
-# (fcurve.data_path, fcurve.array_index)
-FCurveKey = Tuple[str, int]
-# [frame0, value0, frame1, value1, ...]
+from typing import (
+List,
+Mapping,
+Sequence,
+Tuple,
+)
+
+FCurveKey = Tuple[
+# `fcurve.data_path`.
+str,
+# `fcurve.array_index`.
+int,
+]
+
+# List of `[frame0, value0, frame1, value1, ...]` pairs.
 ListKeyframes = List[float]
-Action = bpy.types.Action
 
 
 def bake_action(
@@ -144,11 +155,11 @@ def bake_action_iter(
 
 # Note: BBONE_PROPS is a list so we can preserve the ordering
 BBONE_PROPS = [
-'bbone_curveinx', 'bbone_curveoutx',
-'bbone_curveinz', 'bbone_curveoutz',
-'bbone_rollin', 'bbone_rollout',
-'bbone_scalein', 'bbone_scaleout',
-'bbone_easein', 'bbone_easeout'
+"bbone_curveinx", "bbone_curveoutx",
+"bbone_curveinz", "bbone_curveoutz",
+"bbone_rollin", "bbone_rollout",
+"bbone_scalein", "bbone_scaleout",
+"bbone_easein", "bbone_easeout"
 ]
 BBONE_PROPS_LENGTHS = {
 "bbone_curveinx": 1,
@@ -433,14 +444,18 @@ def bake_action_iter(
 
 
 class KeyframesCo:
-"""A buffer for keyframe Co unpacked values per FCurveKey. FCurveKeys are 
added using
-add_paths(), Co values stored using extend_co_values(), then finally use
-insert_keyframes_into_*_action() for efficiently inserting keys into the 
fcurves.
+"""
+A buffer for keyframe Co unpacked values per ``FCurveKey``. ``FCurveKeys`` 
are added using
+``add_paths()``, Co values stored using extend_co_values(), then finally 
use
+``insert_keyframes_into_*_action()`` for efficiently inserting keys into 
the F-curves.
 
 Users are limited to one Action Group per instance.
 """
+__slots__ = (
+"keyframes_from_fcurve",
+)
 
-# keyframes[(rna_path, array_index)] = list(time0,value0, time1,value1,...)
+# `keyframes[(rna_path, array_index)] = list(time0,value0, 
time1,value1,...)`.
 keyframes_from_fcurve: Mapping[FCurveKey, ListKeyframes]
 
 def __init__(self):
@@ -480,11 +495,12 @@ class KeyframesCo:
 action: Action,
 action_group_name: str,
 ) -> None:
-"""Assumes the action is new, that it has no fcurves. Otherwise, the 
only difference between versions is
+"""
+Assumes the action is new, that it has no F-curves. Otherwise, the 
only difference between versions is
 performance and implementation simplicity.
 
-Args:
-action_group_name (str): Name of Action Group that fcurves are 
added to.
+:arg action_group_name: Name of Action Group that F-curves are added 
to.
+:type action_group_name: str
 """
 linear_enum_values = [
 
bpy.types.Keyframe.bl_rna.properties["interpolation"].enum_items["LINEAR"].value
@@ -513,14 +529,15 @@ class KeyframesCo:
 action: Action,
 action_group_name: str,
 ) -> None:
-"""Assumes the action already exists, that it might already have 
fcurves. Otherwise, the
+"""
+Assumes the action already exists, that it might already have 
F-curves. Otherwise, the
 only difference between versions is performance and implementation 
simplicity.
 
-Args:
-lookup_fcurves (Mapping[FCurveKey, bpy.types.FCurve]): This is 
only used for efficiency.
-It's a substitute for action.fcurves.find() which is a potentially 
expensive linear
-search.
-action_group_name (str): Name of Action Group that fcurves are 
added to.
+:arg lookup_fcurves: : This is only used for efficiency.
+   It's a substitute for ``action.fcurves.find()`` which is a 
potentially expensive linear search.
+:type lookup_fcurves: ``Mapping[FCurveKey, bpy.types.FCurve]``
+:arg action_group_name: Name of Action Group that F-curves are 

[Bf-blender-cvs] [2d21fc3f5d4] master: Cleanup: avoid multiplying lists multiple times

2022-12-14 Thread Campbell Barton
Commit: 2d21fc3f5d4bb8f9c5d7e5312a79b5c98a850399
Author: Campbell Barton
Date:   Thu Dec 15 09:12:17 2022 +1100
Branches: master
https://developer.blender.org/rB2d21fc3f5d4bb8f9c5d7e5312a79b5c98a850399

Cleanup: avoid multiplying lists multiple times

Parenthesis are important in this case to avoid creating a list with
multiplication, then multiplying it again.

Oversight in 58c8c4fde35c158407ca2ba0c0bc099d1455f691.

===

M   release/scripts/modules/bpy_extras/anim_utils.py

===

diff --git a/release/scripts/modules/bpy_extras/anim_utils.py 
b/release/scripts/modules/bpy_extras/anim_utils.py
index cfa7c2aa134..43973307ce6 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -539,7 +539,7 @@ class KeyframesCo:
 
 keyframe_points = fcurve.keyframe_points
 
-co_buffer = [0] * 2 * len(keyframe_points)
+co_buffer = [0] * (2 * len(keyframe_points))
 keyframe_points.foreach_get("co", co_buffer)
 co_buffer.extend(key_values)

___
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] [918df11a1a1] master: Build: prefer underscores for script naming

2022-12-14 Thread Campbell Barton
Commit: 918df11a1a1f753e2274550b724a001116dfdf8d
Author: Campbell Barton
Date:   Thu Dec 15 08:55:30 2022 +1100
Branches: master
https://developer.blender.org/rB918df11a1a1f753e2274550b724a001116dfdf8d

Build: prefer underscores for script naming

Matches convention for most existing scripts.

===

R100build_files/build_environment/linux/linux-rocky8-setup.sh   
build_files/build_environment/linux/linux_rocky8_setup.sh

===

diff --git a/build_files/build_environment/linux/linux-rocky8-setup.sh 
b/build_files/build_environment/linux/linux_rocky8_setup.sh
similarity index 100%
rename from build_files/build_environment/linux/linux-rocky8-setup.sh
rename to build_files/build_environment/linux/linux_rocky8_setup.sh

___
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] [f167e366da9] master: Build: add missing packages for the rocky8 setup script

2022-12-14 Thread Campbell Barton
Commit: f167e366da9aa0c1f48f36909da492de61e967ed
Author: Campbell Barton
Date:   Thu Dec 15 08:58:30 2022 +1100
Branches: master
https://developer.blender.org/rBf167e366da9aa0c1f48f36909da492de61e967ed

Build: add missing packages for the rocky8 setup script

===

M   build_files/build_environment/linux/linux_rocky8_setup.sh

===

diff --git a/build_files/build_environment/linux/linux_rocky8_setup.sh 
b/build_files/build_environment/linux/linux_rocky8_setup.sh
index 7be07b40a3e..2f4efe0be97 100644
--- a/build_files/build_environment/linux/linux_rocky8_setup.sh
+++ b/build_files/build_environment/linux/linux_rocky8_setup.sh
@@ -15,7 +15,12 @@ fi
 # See: https://wiki.rockylinux.org/rocky/repo/#notes-on-unlisted-repositories
 dnf config-manager --set-enabled powertools
 
-# yum-config-manager does not come in the default minimal install,
+# Required by: TODO.
+dnf install 'dnf-command(config-manager)'
+# Required by: TODO.
+dnf install epel-release
+
+# `yum-config-manager` does not come in the default minimal install,
 # so make sure it is installed and available.
 yum -y update
 yum -y install yum-utils
@@ -82,8 +87,10 @@ PACKAGES_FOR_LIBS=(
 # This is used for the `python3-mako` package for e.g.
 # So use the "default" system Python since it means it's most compatible 
with other packages.
 python3
+# Required by: `external_mesa`.
+python3-mako
 
-# Required by: `mesa`.
+# Required by: `external_mesa`.
 expat-devel
 
 # Required by: `external_igc` & `external_osl` as a build-time dependency.
@@ -114,7 +121,7 @@ PACKAGES_FOR_BLENDER=(
 
 yum -y install -y ${PACKAGES_FOR_LIBS[@]} ${PACKAGES_FOR_BLENDER[@]}
 
-# Dependencies for pip (needed for buildbot-worker), uses Python3.6.
+# Dependencies for pip (needed for `buildbot-worker`), uses Python3.6.
 yum -y install python3 python3-pip python3-devel
 
 # Dependencies for asound.

___
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] [7e5cb947483] blender-v3.4-release: Fix T103119: Allow Win32 Diacritical Composition

2022-12-14 Thread Harley Acheson
Commit: 7e5cb9474837ea25cbdb8ae36c67faacb74ed317
Author: Harley Acheson
Date:   Tue Dec 13 18:30:20 2022 -0800
Branches: blender-v3.4-release
https://developer.blender.org/rB7e5cb9474837ea25cbdb8ae36c67faacb74ed317

Fix T103119: Allow Win32 Diacritical Composition

Allow keyboard layouts which include "dead keys" to enter diacritics
by calling MapVirtualKeyW even when not key_down.

See D16770 for more details.

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

Reviewed by Campbell Barton

===

M   intern/ghost/intern/GHOST_SystemWin32.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 4d016373fc6..dc350bb58a1 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1195,16 +1195,16 @@ GHOST_EventKey 
*GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
 const bool ctrl_pressed = has_state && state[VK_CONTROL] & 0x80;
 const bool alt_pressed = has_state && state[VK_MENU] & 0x80;
 
-if (!key_down) {
-  /* Pass. */
-}
+/* We can be here with !key_down if processing dead keys (diacritics). See 
T103119. */
+
 /* No text with control key pressed (Alt can be used to insert special 
characters though!). */
-else if (ctrl_pressed && !alt_pressed) {
+if (ctrl_pressed && !alt_pressed) {
   /* Pass. */
 }
 /* Don't call #ToUnicodeEx on dead keys as it clears the buffer and so 
won't allow diacritical
- * composition. */
-else if (MapVirtualKeyW(vk, 2) != 0) {
+ * composition. XXX: we are not checking return of MapVirtualKeyW for high 
bit set, which is
+ * what is supposed to indicate dead keys. But this is working now so 
approach cautiously. */
+else if (MapVirtualKeyW(vk, MAPVK_VK_TO_CHAR) != 0) {
   wchar_t utf16[3] = {0};
   int r;
   /* TODO: #ToUnicodeEx can respond with up to 4 utf16 chars (only 2 here).
@@ -1219,6 +1219,10 @@ GHOST_EventKey 
*GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
   utf8_char[0] = '\0';
 }
   }
+  if (!key_down) {
+/* Clear or wm_event_add_ghostevent will warn of unexpected data on 
key up. */
+utf8_char[0] = '\0';
+  }
 }
 
 #ifdef WITH_INPUT_IME

___
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] [6325174a753] blender-v3.4-release: Fix T103101: random Cycles animation rendering freezing up the application

2022-12-14 Thread Brecht Van Lommel
Commit: 6325174a753fc19effb1039f1872287383fbd787
Author: Brecht Van Lommel
Date:   Wed Dec 14 19:47:21 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB6325174a753fc19effb1039f1872287383fbd787

Fix T103101: random Cycles animation rendering freezing up the application

===

M   source/blender/render/intern/engine.cc

===

diff --git a/source/blender/render/intern/engine.cc 
b/source/blender/render/intern/engine.cc
index acca657f7dc..f8fa20387fe 100644
--- a/source/blender/render/intern/engine.cc
+++ b/source/blender/render/intern/engine.cc
@@ -1044,14 +1044,19 @@ bool RE_engine_render(Render *re, bool do_all)
 re->engine = engine;
   }
 
-  /* create render result */
+  /* Create render result. Do this before acquiring lock, to avoid lock
+   * inversion as this calls python to get the render passes, while python UI
+   * code can also hold a lock on the render result. */
+  const bool create_new_result = (re->result == nullptr || !(re->r.scemode & 
R_BUTS_PREVIEW));
+  RenderResult *new_result = engine_render_create_result(re);
+
   BLI_rw_mutex_lock(>resultmutex, THREAD_LOCK_WRITE);
-  if (re->result == nullptr || !(re->r.scemode & R_BUTS_PREVIEW)) {
+  if (create_new_result) {
 if (re->result) {
   render_result_free(re->result);
 }
 
-re->result = engine_render_create_result(re);
+re->result = new_result;
   }
   BLI_rw_mutex_unlock(>resultmutex);

___
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] [0b706237b09] blender-v3.4-release: Fix T103066: Cycles missing full constant foler for mix float and mix vector

2022-12-14 Thread Brecht Van Lommel
Commit: 0b706237b09006f59a1a3b619d69d49d3c80b482
Author: Brecht Van Lommel
Date:   Mon Dec 12 17:28:59 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB0b706237b09006f59a1a3b619d69d49d3c80b482

Fix T103066: Cycles missing full constant foler for mix float and mix vector

===

M   intern/cycles/scene/constant_fold.cpp
M   intern/cycles/scene/constant_fold.h
M   intern/cycles/scene/shader_nodes.cpp

===

diff --git a/intern/cycles/scene/constant_fold.cpp 
b/intern/cycles/scene/constant_fold.cpp
index 1aa4515a087..224c8774cc6 100644
--- a/intern/cycles/scene/constant_fold.cpp
+++ b/intern/cycles/scene/constant_fold.cpp
@@ -386,6 +386,46 @@ void ConstantFolder::fold_mix_color(NodeMix type, bool 
clamp_factor, bool clamp)
   }
 }
 
+void ConstantFolder::fold_mix_float(bool clamp_factor, bool clamp) const
+{
+  ShaderInput *fac_in = node->input("Factor");
+  ShaderInput *float1_in = node->input("A");
+  ShaderInput *float2_in = node->input("B");
+
+  float fac = clamp_factor ? saturatef(node->get_float(fac_in->socket_type)) :
+ node->get_float(fac_in->socket_type);
+  bool fac_is_zero = !fac_in->link && fac == 0.0f;
+  bool fac_is_one = !fac_in->link && fac == 1.0f;
+
+  /* remove no-op node when factor is 0.0 */
+  if (fac_is_zero) {
+if (try_bypass_or_make_constant(float1_in, clamp)) {
+  return;
+}
+  }
+
+  /* remove useless mix floats nodes */
+  if (float1_in->link && float2_in->link) {
+if (float1_in->link == float2_in->link) {
+  try_bypass_or_make_constant(float1_in, clamp);
+  return;
+}
+  }
+  else if (!float1_in->link && !float2_in->link) {
+float value1 = node->get_float(float1_in->socket_type);
+float value2 = node->get_float(float2_in->socket_type);
+if (value1 == value2) {
+  try_bypass_or_make_constant(float1_in, clamp);
+  return;
+}
+  }
+  /* remove no-op mix float node when factor is 1.0 */
+  if (fac_is_one) {
+try_bypass_or_make_constant(float2_in, clamp);
+return;
+  }
+}
+
 void ConstantFolder::fold_math(NodeMathType type) const
 {
   ShaderInput *value1_in = node->input("Value1");
diff --git a/intern/cycles/scene/constant_fold.h 
b/intern/cycles/scene/constant_fold.h
index 246ff2d31ee..14097e1a0e4 100644
--- a/intern/cycles/scene/constant_fold.h
+++ b/intern/cycles/scene/constant_fold.h
@@ -52,6 +52,7 @@ class ConstantFolder {
   /* Specific nodes. */
   void fold_mix(NodeMix type, bool clamp) const;
   void fold_mix_color(NodeMix type, bool clamp_factor, bool clamp) const;
+  void fold_mix_float(bool clamp_factor, bool clamp) const;
   void fold_math(NodeMathType type) const;
   void fold_vector_math(NodeVectorMathType type) const;
   void fold_mapping(NodeMappingType type) const;
diff --git a/intern/cycles/scene/shader_nodes.cpp 
b/intern/cycles/scene/shader_nodes.cpp
index c1189e3795c..7d0a1117806 100644
--- a/intern/cycles/scene/shader_nodes.cpp
+++ b/intern/cycles/scene/shader_nodes.cpp
@@ -5132,6 +5132,9 @@ void MixFloatNode::constant_fold(const ConstantFolder 
)
 }
 folder.make_constant(a * (1 - fac) + b * fac);
   }
+  else {
+folder.fold_mix_float(use_clamp, false);
+  }
 }
 
 /* Mix Vector */
@@ -5185,6 +5188,9 @@ void MixVectorNode::constant_fold(const ConstantFolder 
)
 }
 folder.make_constant(a * (one_float3() - fac) + b * fac);
   }
+  else {
+folder.fold_mix_color(NODE_MIX_BLEND, use_clamp, false);
+  }
 }
 
 /* Mix Vector Non Uniform */

___
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] [9992096c497] blender-v3.4-release: Fix T103208: unavailable socket linked to multi-input socket crashes

2022-12-14 Thread Iliya Katueshenock
Commit: 9992096c497255f173a79a69eb8ad7af50d9d17d
Author: Iliya Katueshenock
Date:   Wed Dec 14 18:28:07 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB9992096c497255f173a79a69eb8ad7af50d9d17d

Fix T103208: unavailable socket linked to multi-input socket crashes

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

===

M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc 
b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 96c369f2f6b..367c66f99b6 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -160,9 +160,11 @@ class LazyFunctionForMultiInput : public LazyFunction {
 BLI_assert(socket.is_multi_input());
 const bNodeTree  = socket.owner_tree();
 for (const bNodeLink *link : socket.directly_linked_links()) {
-  if (!(link->is_muted() || nodeIsDanglingReroute(, 
link->fromnode))) {
-inputs_.append({"Input", *base_type_});
+  if (link->is_muted() || !link->fromsock->is_available() ||
+  nodeIsDanglingReroute(, link->fromnode)) {
+continue;
   }
+  inputs_.append({"Input", *base_type_});
 }
 const CPPType *vector_type = get_vector_type(*base_type_);
 BLI_assert(vector_type != nullptr);

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


[Bf-blender-cvs] [28e6a8414a7] blender-v3.4-release: Revert "Fix T102571: Can't stop audio playback when using multiple windows"

2022-12-14 Thread Richard Antalik
Commit: 28e6a8414a74c9723e8aaf154e05c2ec5c9f2746
Author: Richard Antalik
Date:   Wed Dec 14 18:24:50 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB28e6a8414a74c9723e8aaf154e05c2ec5c9f2746

Revert "Fix T102571: Can't stop audio playback when using multiple windows"

This reverts commit 42b51bf6a91acd055d34e31c06c9dff46b0aac1b.

Commit caused crash when playback is stopped, see T103008.

===

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

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index a4e98aa639a..9c0963d0fb1 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4812,28 +4812,19 @@ bScreen *ED_screen_animation_no_scrub(const 
wmWindowManager *wm)
 int ED_screen_animation_play(bContext *C, int sync, int mode)
 {
   bScreen *screen = CTX_wm_screen(C);
+  Scene *scene = CTX_data_scene(C);
+  Scene *scene_eval = 
DEG_get_evaluated_scene(CTX_data_ensure_evaluated_depsgraph(C));
 
   if (ED_screen_animation_playing(CTX_wm_manager(C))) {
 /* stop playback now */
 ED_screen_animation_timer(C, 0, 0, 0);
-Main *bmain = CTX_data_main(C);
-LISTBASE_FOREACH (Scene *, scene, >scenes) {
-  LISTBASE_FOREACH (ViewLayer *, view_layer, >view_layers) {
-Depsgraph *graph = BKE_scene_get_depsgraph(scene, view_layer);
-if (graph) {
-  Scene *scene_eval = DEG_get_evaluated_scene(graph);
-  /* The audio handles are preserved throughout the dependency graph 
evaluation.
-   * Checking for scene->playback_handle even for non-evaluated scene 
should be okay. */
-  BKE_sound_stop_scene(scene_eval);
-  WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
-}
-  }
-}
+BKE_sound_stop_scene(scene_eval);
+
+WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
   }
   else {
 /* these settings are currently only available from a menu in the TimeLine 
*/
 if (mode == 1) { /* XXX only play audio forwards!? */
-  Scene *scene_eval = 
DEG_get_evaluated_scene(CTX_data_ensure_evaluated_depsgraph(C));
   BKE_sound_play_scene(scene_eval);
 }

___
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] [d6e75e2c237] blender-v3.4-release: Fix T103143: Cycles can lose default color attribute

2022-12-14 Thread Hans Goudey
Commit: d6e75e2c2374d66a42ea3b3d694f095ad5c5f1cb
Author: Hans Goudey
Date:   Wed Dec 14 11:11:37 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBd6e75e2c2374d66a42ea3b3d694f095ad5c5f1cb

Fix T103143: Cycles can lose default color attribute

The `render_color_index` skips attributes with different types
and domains in order to give the proper order for the UI list.
That is a different than an index in the group of all attributes.

The most solid solution I could think of is exposing the name of
the default color attribute. It's "solid" because we always address
attributes by name internally. Doing something different is bound
to create problems. It's also aligned with the design in T98366 and
D15169.

Another option would be to change the way the "attribute index"
is incremented in Cycles. That would be a valid solution, but would
be more complex and annoying.

For consistency, I also exposed the name of the active color attribute
the same way, though it isn't necessary to fix this particular bug.

The properties aren't editable, that can come in 3.5 as part of D15169.

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

===

M   intern/cycles/blender/mesh.cpp
M   source/blender/makesrna/intern/rna_attribute.c

===

diff --git a/intern/cycles/blender/mesh.cpp b/intern/cycles/blender/mesh.cpp
index 1887440bc67..736b80bacd6 100644
--- a/intern/cycles/blender/mesh.cpp
+++ b/intern/cycles/blender/mesh.cpp
@@ -367,13 +367,11 @@ static void attr_create_generic(Scene *scene,
 {
   AttributeSet  = (subdivision) ? mesh->subd_attributes : 
mesh->attributes;
   static const ustring u_velocity("velocity");
-
-  int attribute_index = 0;
-  int render_color_index = b_mesh.attributes.render_color_index();
+  const ustring 
default_color_name{b_mesh.attributes.default_color_name().c_str()};
 
   for (BL::Attribute _attribute : b_mesh.attributes) {
 const ustring name{b_attribute.name().c_str()};
-const bool is_render_color = (attribute_index++ == render_color_index);
+const bool is_render_color = name == default_color_name;
 
 if (need_motion && name == u_velocity) {
   attr_create_motion(mesh, b_attribute, motion_scale);
diff --git a/source/blender/makesrna/intern/rna_attribute.c 
b/source/blender/makesrna/intern/rna_attribute.c
index 116eb1059b7..2e973bc7d40 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -651,6 +651,49 @@ static void rna_AttributeGroup_render_color_index_range(
   *softmin = *min;
   *softmax = *max;
 }
+
+static void rna_AttributeGroup_default_color_name_get(PointerRNA *ptr, char 
*value)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_render_color_get(id);
+  if (!layer) {
+value[0] = '\0';
+return;
+  }
+  BLI_strncpy(value, layer->name, MAX_CUSTOMDATA_LAYER_NAME);
+}
+
+static int rna_AttributeGroup_default_color_name_length(PointerRNA *ptr)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_render_color_get(id);
+  if (!layer) {
+return 0;
+  }
+  return strlen(layer->name);
+}
+
+static void rna_AttributeGroup_active_color_name_get(PointerRNA *ptr, char 
*value)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
+  if (!layer) {
+value[0] = '\0';
+return;
+  }
+  BLI_strncpy(value, layer->name, MAX_CUSTOMDATA_LAYER_NAME);
+}
+
+static int rna_AttributeGroup_active_color_name_length(PointerRNA *ptr)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
+  if (!layer) {
+return 0;
+  }
+  return strlen(layer->name);
+}
+
 #else
 
 static void rna_def_attribute_float(BlenderRNA *brna)
@@ -1110,6 +1153,29 @@ static void rna_def_attribute_group(BlenderRNA *brna)
  "rna_AttributeGroup_render_color_index_set",
  "rna_AttributeGroup_render_color_index_range");
   RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
+
+  prop = RNA_def_property(srna, "default_color_name", PROP_STRING, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
+  RNA_def_property_string_funcs(prop,
+"rna_AttributeGroup_default_color_name_get",
+"rna_AttributeGroup_default_color_name_length",
+NULL);
+  RNA_def_property_ui_text(
+  prop,
+  "Default Color Attribute",
+  "The name of the default color attribute used as a fallback for 
rendering");
+
+  prop = RNA_def_property(srna, "active_color_name", PROP_STRING, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  

[Bf-blender-cvs] [ef40604b87f] blender-v3.4-release: Fix T103051: Changed behavior when removing a material slot

2022-12-14 Thread Hans Goudey
Commit: ef40604b87fa4d1b8231a9813363392026001540
Author: Hans Goudey
Date:   Tue Dec 13 13:36:48 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBef40604b87fa4d1b8231a9813363392026001540

Fix T103051: Changed behavior when removing a material slot

Before f1c0249f34c4171ec311 the material was assigned to the previous
slot rather than the next. Though the behavior is arbitrary, there
is no reason to change it.

===

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

===

diff --git a/source/blender/blenkernel/intern/mesh.cc 
b/source/blender/blenkernel/intern/mesh.cc
index 0018c217964..f89e87f2991 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1364,7 +1364,7 @@ void BKE_mesh_material_index_remove(Mesh *me, short index)
   }
   MutableVArraySpan indices_span(material_indices.varray);
   for (const int i : indices_span.index_range()) {
-if (indices_span[i] > 0 && indices_span[i] > index) {
+if (indices_span[i] > 0 && indices_span[i] >= index) {
   indices_span[i]--;
 }
   }

___
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] [d666c64f5d6] blender-v3.4-release: Fix T103195: Initialize face sets from bevel weights broken

2022-12-14 Thread Hans Goudey
Commit: d666c64f5d6939fec81bc51b8aed140e1c17ddf5
Author: Hans Goudey
Date:   Tue Dec 13 14:26:46 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBd666c64f5d6939fec81bc51b8aed140e1c17ddf5

Fix T103195: Initialize face sets from bevel weights broken

The conversion from char to float (divide by 255) wasn't removed in
291c313f80b48fcc. Also fix a crash when the edge crease layer
didn't exist.

===

M   source/blender/editors/sculpt_paint/sculpt_face_set.cc

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc 
b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
index d0c8a19434b..7253a41f97f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
@@ -692,7 +692,7 @@ static int sculpt_face_set_init_exec(bContext *C, 
wmOperator *op)
   CustomData_get_layer(>edata, CD_CREASE));
   sculpt_face_sets_init_flood_fill(
   ob, [&](const int /*from_face*/, const int edge, const int 
/*to_face*/) -> bool {
-return creases[edge] < threshold;
+return creases ? creases[edge] < threshold : true;
   });
   break;
 }
@@ -709,7 +709,7 @@ static int sculpt_face_set_init_exec(bContext *C, 
wmOperator *op)
   CustomData_get_layer(>edata, CD_BWEIGHT));
   sculpt_face_sets_init_flood_fill(
   ob, [&](const int /*from_face*/, const int edge, const int 
/*to_face*/) -> bool {
-return bevel_weights ? bevel_weights[edge] / 255.0f < threshold : 
true;
+return bevel_weights ? bevel_weights[edge] < threshold : true;
   });
   break;
 }

___
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] [e22f49c8019] blender-v3.4-release: Fix T103052: Box trim does not create face sets attribute

2022-12-14 Thread Hans Goudey
Commit: e22f49c80192a7d3b3661ac132d7026d16b9d2e1
Author: Hans Goudey
Date:   Tue Dec 13 14:11:06 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBe22f49c80192a7d3b3661ac132d7026d16b9d2e1

Fix T103052: Box trim does not create face sets attribute

Previously the sculpt box trim operator always created face sets,
but after face sets became optional it only modified them if they
already existed. Absent a better way to turn the behavior on and off,
the fix is to just always create face sets.

===

M   source/blender/editors/sculpt_paint/paint_mask.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c 
b/source/blender/editors/sculpt_paint/paint_mask.c
index eb24d15dad5..ad9ae6b4349 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1345,6 +1345,11 @@ static void 
sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
 
 static void sculpt_gesture_trim_begin(bContext *C, SculptGestureContext 
*sgcontext)
 {
+  Object *object = sgcontext->vc.obact;
+  SculptSession *ss = object->sculpt;
+  Mesh *mesh = (Mesh *)object->data;
+  ss->face_sets = BKE_sculpt_face_sets_ensure(mesh);
+
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   sculpt_gesture_trim_calculate_depth(sgcontext);
   sculpt_gesture_trim_geometry_generate(sgcontext);
@@ -1369,9 +1374,9 @@ static void sculpt_gesture_trim_end(bContext *UNUSED(C), 
SculptGestureContext *s
 {
   Object *object = sgcontext->vc.obact;
   SculptSession *ss = object->sculpt;
+  Mesh *mesh = (Mesh *)object->data;
 
-  ss->face_sets = CustomData_get_layer_named(
-  &((Mesh *)object->data)->pdata, CD_PROP_INT32, ".sculpt_face_set");
+  ss->face_sets = CustomData_get_layer_named(>pdata, CD_PROP_INT32, 
".sculpt_face_set");
   if (ss->face_sets) {
 /* Assign a new Face Set ID to the new faces created by the trim 
operation. */
 const int next_face_set_id = 
ED_sculpt_face_sets_find_next_available_id(object->data);

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


[Bf-blender-cvs] [94e7e83cd99] blender-v3.4-release: Fix T103061: GPencil export to SVG wrong line thickness

2022-12-14 Thread Antonio Vazquez
Commit: 94e7e83cd997170d42ddb1155814b8eda127a104
Author: Antonio Vazquez
Date:   Tue Dec 13 11:39:13 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB94e7e83cd997170d42ddb1155814b8eda127a104

Fix T103061: GPencil export to SVG wrong line thickness

When the line was very thin the precision of the thickness
calculation was not precise enough.

The algorithm has been improved. This affects SVG and PDF.

===

M   source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
M   source/blender/io/gpencil/intern/gpencil_io_export_svg.cc

===

diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc 
b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
index c042ca597c8..23fea9b6460 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.cc
@@ -177,7 +177,8 @@ void GpencilExporterPDF::export_gpencil_layers()
 /* Apply layer thickness change. */
 gps_duplicate->thickness += gpl->line_change;
 /* Apply object scale to thickness. */
-gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
+const float scalef = mat4_to_scale(ob->object_to_world);
+gps_duplicate->thickness = ceilf((float)gps_duplicate->thickness * 
scalef);
 CLAMP_MIN(gps_duplicate->thickness, 1.0f);
 /* Fill. */
 if ((is_fill) && (params_.flag & GP_EXPORT_FILL)) {
@@ -236,7 +237,9 @@ void 
GpencilExporterPDF::export_stroke_to_polyline(bGPDlayer *gpl,
 
   if (is_stroke && !do_fill) {
 HPDF_Page_SetLineJoin(page_, HPDF_ROUND_JOIN);
-HPDF_Page_SetLineWidth(page_, MAX2((radius * 2.0f) - gpl->line_change, 
1.0f));
+const float width = MAX2(
+MAX2(gps->thickness + gpl->line_change, (radius * 2.0f) + 
gpl->line_change), 1.0f);
+HPDF_Page_SetLineWidth(page_, width);
   }
 
   /* Loop all points. */
diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc 
b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
index b85fd33e116..2c4c09ce1a0 100644
--- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
+++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc
@@ -198,7 +198,8 @@ void GpencilExporterSVG::export_gpencil_layers()
 /* Apply layer thickness change. */
 gps_duplicate->thickness += gpl->line_change;
 /* Apply object scale to thickness. */
-gps_duplicate->thickness *= mat4_to_scale(ob->object_to_world);
+const float scalef = mat4_to_scale(ob->object_to_world);
+gps_duplicate->thickness = ceilf((float)gps_duplicate->thickness * 
scalef);
 CLAMP_MIN(gps_duplicate->thickness, 1.0f);
 
 const bool is_normalized = ((params_.flag & GP_EXPORT_NORM_THICKNESS) 
!= 0) ||
@@ -308,7 +309,9 @@ void 
GpencilExporterSVG::export_stroke_to_polyline(bGPDlayer *gpl,
   color_string_set(gpl, gps, node_gps, do_fill);
 
   if (is_stroke && !do_fill) {
-node_gps.append_attribute("stroke-width").set_value((radius * 2.0f) - 
gpl->line_change);
+const float width = MAX2(
+MAX2(gps->thickness + gpl->line_change, (radius * 2.0f) + 
gpl->line_change), 1.0f);
+node_gps.append_attribute("stroke-width").set_value(width);
   }
 
   std::string txt;

___
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] [389b0869292] blender-v3.4-release: Fix T103067: Regression: Workbench render crash in 3.4

2022-12-14 Thread Lukas Stockner
Commit: 389b0869292915166e0dfb38aa0c846b8b0b66f5
Author: Lukas Stockner
Date:   Tue Dec 13 01:45:52 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB389b0869292915166e0dfb38aa0c846b8b0b66f5

Fix T103067: Regression: Workbench render crash in 3.4

The workbench engine assumes that the Z pass exists, but didn't register it 
before.
Since rB3411a96e7493, this is mandatory.

===

M   source/blender/draw/engines/workbench/workbench_render.c

===

diff --git a/source/blender/draw/engines/workbench/workbench_render.c 
b/source/blender/draw/engines/workbench/workbench_render.c
index 931f6a2dc92..6f4ddbdb10e 100644
--- a/source/blender/draw/engines/workbench/workbench_render.c
+++ b/source/blender/draw/engines/workbench/workbench_render.c
@@ -214,4 +214,7 @@ void workbench_render(void *ved, RenderEngine *engine, 
RenderLayer *render_layer
 void workbench_render_update_passes(RenderEngine *engine, Scene *scene, 
ViewLayer *view_layer)
 {
   RE_engine_register_pass(engine, scene, view_layer, RE_PASSNAME_COMBINED, 4, 
"RGBA", SOCK_RGBA);
+  if ((view_layer->passflag & SCE_PASS_Z) != 0) {
+RE_engine_register_pass(engine, scene, view_layer, RE_PASSNAME_Z, 1, "Z", 
SOCK_FLOAT);
+  }
 }

___
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] [c4251110a97] blender-v3.4-release: Fix T102992: GPencil Array doesn't respect restriction in Offset

2022-12-14 Thread frogstomp
Commit: c4251110a973b5458ef7bf13ca88927ab1391ff9
Author: frogstomp
Date:   Fri Dec 9 16:27:52 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBc4251110a973b5458ef7bf13ca88927ab1391ff9

Fix T102992: GPencil Array doesn't respect restriction in Offset

The problem was the bounding box was calculated using
all strokes, but if a filter is added, the bounding box must
include only selected strokes.

Fix by @frogstomp

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index e51fe8832f0..37e28268829 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -113,7 +113,45 @@ static void 
BKE_gpencil_instance_modifier_instance_tfm(Object *ob,
 zero_v3(r_mat[3]);
   }
 }
+static bool gpencil_data_selected_minmax(ArrayGpencilModifierData *mmd,
+ Object *ob,
+ float r_min[3],
+ float r_max[3])
+{
+  bGPdata *gpd = (bGPdata *)ob->data;
+  bool changed = false;
+
+  INIT_MINMAX(r_min, r_max);
+
+  if (gpd == NULL) {
+return changed;
+  }
+
+  LISTBASE_FOREACH (bGPDlayer *, gpl, >layers) {
+bGPDframe *gpf = gpl->actframe;
+
+if (gpf != NULL) {
+  LISTBASE_FOREACH (bGPDstroke *, gps, >strokes) {
+if (is_stroke_affected_by_modifier(ob,
+   mmd->layername,
+   mmd->material,
+   mmd->pass_index,
+   mmd->layer_pass,
+   1,
+   gpl,
+   gps,
+   mmd->flag & GP_ARRAY_INVERT_LAYER,
+   mmd->flag & GP_ARRAY_INVERT_PASS,
+   mmd->flag & 
GP_ARRAY_INVERT_LAYERPASS,
+   mmd->flag & 
GP_ARRAY_INVERT_MATERIAL)) {
+  changed |= BKE_gpencil_stroke_minmax(gps, false, r_min, r_max);
+}
+  }
+}
+  }
 
+  return changed;
+}
 /* array modifier - generate geometry callback (for viewport/rendering) */
 static void generate_geometry(GpencilModifierData *md,
   Depsgraph *depsgraph,
@@ -131,7 +169,7 @@ static void generate_geometry(GpencilModifierData *md,
   if (mmd->flag & GP_ARRAY_USE_RELATIVE) {
 float min[3];
 float max[3];
-if (BKE_gpencil_data_minmax(gpd, min, max)) {
+if (gpencil_data_selected_minmax(mmd, ob, min, max)) {
   sub_v3_v3v3(size, max, min);
   /* Need a minimum size (for flat drawings). */
   CLAMP3_MIN(size, 0.01f);

___
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] [a47d1ad9d58] blender-v3.4-release: Fix T103031: ViewLayer: Crash in indirect_only_get due to missing null check

2022-12-14 Thread Aras Pranckevicius
Commit: a47d1ad9d58b5596f942b28c03f07b4bded25ea6
Author: Aras Pranckevicius
Date:   Fri Dec 9 20:20:11 2022 +0200
Branches: blender-v3.4-release
https://developer.blender.org/rBa47d1ad9d58b5596f942b28c03f07b4bded25ea6

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

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

===

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

===

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

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


[Bf-blender-cvs] [08d687e8cda] blender-v3.4-release: Fix: UI: broken texpaintslot/color attributes/attributes name filtering

2022-12-14 Thread Philipp Oeser
Commit: 08d687e8cdaf15a087bfab42ae9b731742d1ce72
Author: Philipp Oeser
Date:   Fri Dec 2 12:50:00 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB08d687e8cdaf15a087bfab42ae9b731742d1ce72

Fix: UI: broken texpaintslot/color attributes/attributes name filtering

rB8b7cd1ed2a17 broke this for the paint slots
rB4669178fc378 broke this for regular attributes

Name filtering in UI Lists works when:
- [one] the items to be filtered have a name property
-- see how `uilist_filter_items_default` gets the `namebuf`
- [two] custom python filter functions (`filter_items`) implement it
themselves
-- if you use `filter_items` and dont do name filtering there, the default
name filtering wont be used

So, two problems with rB8b7cd1ed2a17:
- [1] items to be listed changed from `texture_paint_images` to
`texture_paint_slots`
-- the former has name_property defined, the later lacks this
- [2] the new `ColorAttributesListBase` defined a `filter_items` function,
but did not implement name filtering

And the problem with rB4669178fc378:
- it added `filter_items` functions, but did not implement name filtering.

These are all corrected now.

Fixes T102878

Maniphest Tasks: T102878

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

===

M   release/scripts/startup/bl_ui/properties_data_curves.py
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   release/scripts/startup/bl_ui/properties_data_pointcloud.py
M   source/blender/makesrna/intern/rna_material.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_curves.py 
b/release/scripts/startup/bl_ui/properties_data_curves.py
index f71296e98f9..1a353d8d9d5 100644
--- a/release/scripts/startup/bl_ui/properties_data_curves.py
+++ b/release/scripts/startup/bl_ui/properties_data_curves.py
@@ -88,8 +88,16 @@ class CURVES_UL_attributes(UIList):
 flags = []
 indices = [i for i in range(len(attributes))]
 
-for item in attributes:
-flags.append(0 if item.is_internal else self.bitflag_filter_item)
+# Filtering by name
+if self.filter_name:
+flags = bpy.types.UI_UL_list.filter_items_by_name(
+self.filter_name, self.bitflag_filter_item, attributes, 
"name", reverse=self.use_filter_invert)
+if not flags:
+flags = [self.bitflag_filter_item] * len(attributes)
+
+# Filtering internal attributes
+for idx, item in enumerate(attributes):
+flags[idx] = 0 if item.is_internal else flags[idx]
 
 return flags, indices
 
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index ee10203908f..0eb9557b989 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -535,8 +535,16 @@ class MESH_UL_attributes(UIList):
 flags = []
 indices = [i for i in range(len(attributes))]
 
-for item in attributes:
-flags.append(0 if item.is_internal else self.bitflag_filter_item)
+# Filtering by name
+if self.filter_name:
+flags = bpy.types.UI_UL_list.filter_items_by_name(
+self.filter_name, self.bitflag_filter_item, attributes, 
"name", reverse=self.use_filter_invert)
+if not flags:
+flags = [self.bitflag_filter_item] * len(attributes)
+
+# Filtering internal attributes
+for idx, item in enumerate(attributes):
+flags[idx] = 0 if item.is_internal else flags[idx]
 
 return flags, indices
 
@@ -624,20 +632,26 @@ class ColorAttributesListBase():
 }
 
 def filter_items(self, _context, data, property):
-attrs = getattr(data, property)
-ret = []
-idxs = []
+attributes = getattr(data, property)
+flags = []
+indices = [i for i in range(len(attributes))]
+
+# Filtering by name
+if self.filter_name:
+flags = bpy.types.UI_UL_list.filter_items_by_name(
+self.filter_name, self.bitflag_filter_item, attributes, 
"name", reverse=self.use_filter_invert)
+if not flags:
+flags = [self.bitflag_filter_item] * len(attributes)
 
-for idx, item in enumerate(attrs):
+for idx, item in enumerate(attributes):
 skip = (
 (item.domain not in {"POINT", "CORNER"}) or
 (item.data_type not in {"FLOAT_COLOR", "BYTE_COLOR"}) or
 item.is_internal
 )
-ret.append(0 if skip else self.bitflag_filter_item)
-idxs.append(idx)
+flags[idx] = 0 if skip else flags[idx]
 
-return ret, idxs
+return flags, indices
 
 
 class MESH_UL_color_attributes(UIList, ColorAttributesListBase):
diff --git 

[Bf-blender-cvs] [fa5164a8b2e] blender-v3.4-release: Sculpt: Fix T101914: Wpaint gradient tool doesn't work with vertex mask

2022-12-14 Thread Edward
Commit: fa5164a8b2e4b1285597ad5c1d3a4bdad0d4bf01
Author: Edward
Date:   Thu Nov 10 11:02:15 2022 -0800
Branches: blender-v3.4-release
https://developer.blender.org/rBfa5164a8b2e4b1285597ad5c1d3a4bdad0d4bf01

Sculpt: Fix T101914: Wpaint gradient tool doesn't work with vertex mask

Reviewed by: Julian Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D16293
Ref D16293

===

M   source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c 
b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index fca25ee2e4b..816e779cd06 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -587,6 +587,7 @@ typedef struct WPGradient_userData {
   Scene *scene;
   Mesh *me;
   MDeformVert *dvert;
+  const bool *select_vert;
   Brush *brush;
   const float *sco_start; /* [2] */
   const float *sco_end;   /* [2] */
@@ -683,7 +684,7 @@ static void gradientVertInit__mapFunc(void *userData,
   WPGradient_userData *grad_data = userData;
   WPGradient_vertStore *vs = _data->vert_cache->elem[index];
 
-  if (grad_data->use_select && !(grad_data->dvert[index].flag & SELECT)) {
+  if (grad_data->use_select && (grad_data->select_vert && 
!grad_data->select_vert[index])) {
 copy_v2_fl(vs->sco, FLT_MAX);
 return;
   }
@@ -811,6 +812,8 @@ static int paint_weight_gradient_exec(bContext *C, 
wmOperator *op)
   data.scene = scene;
   data.me = ob->data;
   data.dvert = dverts;
+  data.select_vert = (const bool *)CustomData_get_layer_named(
+  >vdata, CD_PROP_BOOL, ".select_vert");
   data.sco_start = sco_start;
   data.sco_end = sco_end;
   data.sco_line_div = 1.0f / len_v2v2(sco_start, sco_end);

___
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] [fd70f9dfda0] blender-v3.4-release: Fix T102276: Hotkey conflict Alt D in Node Editor with Duplicate Linked and Detach

2022-12-14 Thread Dalai Felinto
Commit: fd70f9dfda0c93410c1ada5b5d119bb13736826b
Author: Dalai Felinto
Date:   Tue Dec 6 09:45:20 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBfd70f9dfda0c93410c1ada5b5d119bb13736826b

Fix T102276: Hotkey conflict Alt D in Node Editor with Duplicate Linked and 
Detach

This unassign the Alt+D shortcut from the detach operator. Right now the
operator has to be accessed via the menu.

Alt+D is left for duplicate link, following the other editors.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 39905a9ef5d..9208bdf72f0 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2137,9 +2137,6 @@ def km_node_editor(params):
 )),
 ("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
 ("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
-("node.move_detach_links",
- {"type": 'D', "value": 'PRESS', "alt": True},
- {"properties": [("TRANSFORM_OT_translate", [("view2d_edge_pan", 
True)])]}),
 ("node.move_detach_links_release",
  {"type": params.action_mouse, "value": 'CLICK_DRAG', "alt": True},
  {"properties": [("NODE_OT_translate_attach", 
[("TRANSFORM_OT_translate", [("view2d_edge_pan", True)])])]}),

___
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] [18ecaaf9cb5] blender-v3.4-release: GPU: Fix using FLOAT_2D_ARRAY and FLOAT_3D textures via Python.

2022-12-14 Thread Jeroen Bakker
Commit: 18ecaaf9cb5a14ed522cd7d5cbfeb8eabe0a40c9
Author: Jeroen Bakker
Date:   Tue Dec 6 20:16:39 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB18ecaaf9cb5a14ed522cd7d5cbfeb8eabe0a40c9

GPU: Fix using FLOAT_2D_ARRAY and FLOAT_3D textures via Python.

Translation from python enum values were incorrect and textures created
in python using those types would result in faulty textures. In
renderdoc those textures would not bind.

===

M   source/blender/python/gpu/gpu_py_shader_create_info.cc

===

diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc 
b/source/blender/python/gpu/gpu_py_shader_create_info.cc
index 6b1be057752..deb8653eb18 100644
--- a/source/blender/python/gpu/gpu_py_shader_create_info.cc
+++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc
@@ -115,8 +115,8 @@ static const struct PyC_StringEnumItems 
pygpu_imagetype_items[] = {
 {int(ImageType::FLOAT_1D), "FLOAT_1D"},
 {int(ImageType::FLOAT_1D_ARRAY), "FLOAT_1D_ARRAY"},
 {int(ImageType::FLOAT_2D), "FLOAT_2D"},
-{int(ImageType::FLOAT_2D_ARRAY), "FLOAT"},
-{int(ImageType::FLOAT_3D), "FLOAT_2D_ARRAY"},
+{int(ImageType::FLOAT_2D_ARRAY), "FLOAT_2D_ARRAY"},
+{int(ImageType::FLOAT_3D), "FLOAT_3D"},
 {int(ImageType::FLOAT_CUBE), "FLOAT_CUBE"},
 {int(ImageType::FLOAT_CUBE_ARRAY), "FLOAT_CUBE_ARRAY"},
 {int(ImageType::INT_BUFFER), "INT_BUFFER"},

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


[Bf-blender-cvs] [28235df7096] blender-v3.4-release: Version bump for Blender 3.4.1, rc.

2022-12-14 Thread Thomas Dinges
Commit: 28235df70969f6d27a4fb73e0007a0028e27d70a
Author: Thomas Dinges
Date:   Wed Dec 14 21:27:52 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB28235df70969f6d27a4fb73e0007a0028e27d70a

Version bump for Blender 3.4.1, rc.

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 3ad2631ca2b..f1c57f3c910 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -19,9 +19,9 @@ extern "C" {
 /* Blender major and minor version. */
 #define BLENDER_VERSION 304
 /* Blender patch version for bugfix releases. */
-#define BLENDER_VERSION_PATCH 0
+#define BLENDER_VERSION_PATCH 1
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE release
+#define BLENDER_VERSION_CYCLE rc
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION

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


[Bf-blender-cvs] [c82b1aa1c02] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-14 Thread Hans Goudey
Commit: c82b1aa1c025bf267e162d92cda4a7642ca10a5e
Author: Hans Goudey
Date:   Wed Dec 14 14:41:42 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBc82b1aa1c025bf267e162d92cda4a7642ca10a5e

Merge branch 'master' into geometry-nodes-simulation

===



===



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


[Bf-blender-cvs] [c725a53e896] master: Cleanup: Use standard node function names and namespace

2022-12-14 Thread Hans Goudey
Commit: c725a53e8961ce3488c5ac2f0ddc2bb786d0d331
Author: Hans Goudey
Date:   Wed Dec 14 14:40:02 2022 -0600
Branches: master
https://developer.blender.org/rBc725a53e8961ce3488c5ac2f0ddc2bb786d0d331

Cleanup: Use standard node function names and namespace

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc 
b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
index f2e66e03d26..b0c46c94396 100644
--- 
a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
+++ 
b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_in_volume.cc
@@ -19,11 +19,11 @@
 
 #include "node_geometry_util.hh"
 
-namespace blender::nodes {
+namespace blender::nodes::node_geo_distribute_points_in_volume_cc {
 
 NODE_STORAGE_FUNCS(NodeGeometryDistributePointsInVolume)
 
-static void 
geo_node_distribute_points_in_volume_declare(NodeDeclarationBuilder )
+static void node_declare(NodeDeclarationBuilder )
 {
   
b.add_input(N_("Volume")).supported_type(GEO_COMPONENT_TYPE_VOLUME);
   b.add_input(N_("Density"))
@@ -49,14 +49,12 @@ static void 
geo_node_distribute_points_in_volume_declare(NodeDeclarationBuilder
   b.add_output(N_("Points"));
 }
 
-static void geo_node_distribute_points_in_volume_layout(uiLayout *layout,
-bContext * /*C*/,
-PointerRNA *ptr)
+static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
 {
   uiItemR(layout, ptr, "mode", 0, "", ICON_NONE);
 }
 
-static void node_distribute_points_in_volume_init(bNodeTree * /*tree*/, bNode 
*node)
+static void node_init(bNodeTree * /*tree*/, bNode *node)
 {
   NodeGeometryDistributePointsInVolume *data = 
MEM_cnew(
   __func__);
@@ -64,7 +62,7 @@ static void node_distribute_points_in_volume_init(bNodeTree * 
/*tree*/, bNode *n
   node->storage = data;
 }
 
-static void node_distribute_points_in_volume_update(bNodeTree *ntree, bNode 
*node)
+static void node_update(bNodeTree *ntree, bNode *node)
 {
   const NodeGeometryDistributePointsInVolume  = node_storage(*node);
   GeometryNodeDistributePointsInVolumeMode mode = 
GeometryNodeDistributePointsInVolumeMode(
@@ -181,7 +179,7 @@ static void point_scatter_density_grid(const 
openvdb::FloatGrid ,
 
 #endif /* WITH_OPENVDB */
 
-static void geo_node_distribute_points_in_volume_exec(GeoNodeExecParams params)
+static void node_geo_exec(GeoNodeExecParams params)
 {
 #ifdef WITH_OPENVDB
   GeometrySet geometry_set = params.extract_input("Volume");
@@ -265,10 +263,12 @@ static void 
geo_node_distribute_points_in_volume_exec(GeoNodeExecParams params)
TIP_("Disabled, Blender was compiled without 
OpenVDB"));
 #endif
 }
-}  // namespace blender::nodes
+}  // namespace blender::nodes::node_geo_distribute_points_in_volume_cc
 
 void register_node_type_geo_distribute_points_in_volume()
 {
+  namespace file_ns = blender::nodes::node_geo_distribute_points_in_volume_cc;
+
   static bNodeType ntype;
   geo_node_type_base(,
  GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME,
@@ -278,11 +278,11 @@ void register_node_type_geo_distribute_points_in_volume()
 "NodeGeometryDistributePointsInVolume",
 node_free_standard_storage,
 node_copy_standard_storage);
-  ntype.initfunc = blender::nodes::node_distribute_points_in_volume_init;
-  ntype.updatefunc = blender::nodes::node_distribute_points_in_volume_update;
+  ntype.initfunc = file_ns::node_init;
+  ntype.updatefunc = file_ns::node_update;
   node_type_size(, 170, 100, 320);
-  ntype.declare = blender::nodes::geo_node_distribute_points_in_volume_declare;
-  ntype.geometry_node_execute = 
blender::nodes::geo_node_distribute_points_in_volume_exec;
-  ntype.draw_buttons = 
blender::nodes::geo_node_distribute_points_in_volume_layout;
+  ntype.declare = file_ns::node_declare;
+  ntype.geometry_node_execute = file_ns::node_geo_exec;
+  ntype.draw_buttons = file_ns::node_layout;
   nodeRegisterType();
 }

___
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] [3f1027567d3] geometry-nodes-simulation: Add initial simulation state items array to output node

2022-12-14 Thread Hans Goudey
Commit: 3f1027567d3442b831ec165a07b5c3d15936b893
Author: Hans Goudey
Date:   Wed Dec 14 14:34:20 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB3f1027567d3442b831ec165a07b5c3d15936b893

Add initial simulation state items array to output node

===

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

===

diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 866f8f23279..ba2d63644ef 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1577,12 +1577,24 @@ typedef struct NodeGeometryUVUnwrap {
   uint8_t method;
 } NodeGeometryUVUnwrap;
 
+typedef struct SimulationStateItem {
+  char *name;
+  /* TODO: Use a different enum instead to support Byte colors, geometry, etc. 
*/
+  /* eNodeSocketDatatype */
+  int8_t data_type;
+  char _pad[7];
+} SimulationStateItem;
+
 typedef struct NodeGeometrySimulationInput {
   int32_t output_node_id;
 } NodeGeometrySimulationInput;
 
 typedef struct NodeGeometrySimulationOutput {
+  SimulationStateItem *state_items;
+  int state_items_num;
+
   int8_t use_persistent_cache;
+  int _pad[3];
 } NodeGeometrySimulationOutput;
 
 typedef struct NodeGeometryDistributePointsInVolume {
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index ee232ecd45d..be36cdcd6ad 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9695,8 +9695,18 @@ static void def_geo_set_curve_normal(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
-static void def_geo_simulation_input(StructRNA *srna)
+static void rna_def_simulation_state_item(BlenderRNA *brna)
 {
+  StructRNA *srna = RNA_def_struct(brna, "SimulationStateItem", NULL);
+  RNA_def_struct_ui_text(srna, "Simulation Sate Item", "");
+  RNA_def_struct_sdna(srna, "SimulationStateItem");
+
+  PropertyRNA *prop;
+
+  // prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+  // RNA_def_property_ui_text(prop, "Name", "");
+  // RNA_def_struct_name_property(srna, prop);
+  // RNA_def_property_update(prop, NC_NODE | NA_EDITED, 
"rna_NodeSocket_update");
 }
 
 static void def_geo_simulation_output(StructRNA *srna)
@@ -9708,6 +9718,11 @@ static void def_geo_simulation_output(StructRNA *srna)
   prop = RNA_def_property(srna, "use_persistent_cache", PROP_BOOLEAN, 
PROP_NONE);
   RNA_def_property_ui_text(prop, "Persistent Cache", "");
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+  prop = RNA_def_property(srna, "state_items", PROP_COLLECTION, PROP_NONE);
+  RNA_def_property_collection_sdna(prop, NULL, "state_items", 
"state_items_num");
+  RNA_def_property_struct_type(prop, "SimulationStateItem");
+  RNA_def_property_ui_text(prop, "Inputs", "");
 }
 
 static void def_geo_curve_handle_type_selection(StructRNA *srna)
@@ -12983,6 +12998,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
   rna_def_shader_node(brna);
   rna_def_compositor_node(brna);
   rna_def_texture_node(brna);
+  rna_def_simulation_state_item(brna);
   rna_def_geometry_node(brna);
   rna_def_function_node(brna);
 
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index f10f366f3a3..015642de392 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -412,7 +412,7 @@ DefNode(GeometryNode, GEO_NODE_SET_POSITION, 0, 
"SET_POSITION", SetPosition, "Se
 DefNode(GeometryNode, GEO_NODE_SET_SHADE_SMOOTH, 0, "SET_SHADE_SMOOTH", 
SetShadeSmooth, "Set Shade Smooth", "Control the smoothness of mesh normals 
around each face by changing the \"shade smooth\" attribute")
 DefNode(GeometryNode, GEO_NODE_SET_SPLINE_CYCLIC, 0, "SET_SPLINE_CYCLIC", 
SetSplineCyclic, "Set Spline Cyclic", "Control whether each spline loops back 
on itself by changing the \"cyclic\" attribute")
 DefNode(GeometryNode, GEO_NODE_SET_SPLINE_RESOLUTION, 0, 
"SET_SPLINE_RESOLUTION", SetSplineResolution, "Set Spline Resolution", "Control 
how many evaluated points should be generated on every curve segment")
-DefNode(GeometryNode, GEO_NODE_SIMULATION_INPUT, def_geo_simulation_input, 
"SIMULATION_INPUT", SimulationInput, "Simulation Input", "")
+DefNode(GeometryNode, GEO_NODE_SIMULATION_INPUT, 0, "SIMULATION_INPUT", 
SimulationInput, "Simulation Input", "")
 DefNode(GeometryNode, GEO_NODE_SIMULATION_OUTPUT, def_geo_simulation_output, 
"SIMULATION_OUTPUT", SimulationOutput, "Simulation Output", "")
 DefNode(GeometryNode, GEO_NODE_SPLIT_EDGES, 0, "SPLIT_EDGES", SplitEdges, 
"Split Edges", "Duplicate mesh edges and break 

[Bf-blender-cvs] [ab8d77359b8] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-14 Thread Hans Goudey
Commit: ab8d77359b87660e878a0c0a4191f5c8e56fe5f0
Author: Hans Goudey
Date:   Wed Dec 14 14:02:15 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBab8d77359b87660e878a0c0a4191f5c8e56fe5f0

Merge branch 'master' into geometry-nodes-simulation

===



===



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


[Bf-blender-cvs] [a3a9459050a] master: Fix erratic mouse wrapping movement on Windows (2)

2022-12-14 Thread Germano Cavalcante
Commit: a3a9459050a96e75138b3441c069898f211f179c
Author: Germano Cavalcante
Date:   Wed Dec 14 15:37:49 2022 -0300
Branches: master
https://developer.blender.org/rBa3a9459050a96e75138b3441c069898f211f179c

Fix erratic mouse wrapping movement on Windows (2)

This is a solution in response to the issues mentioned in comments on
rBe4f1d719080a and T103088.

Apparently the workaround of checking if the mouse is already inside
the area on the next event doesn't work for some tablets.

Perhaps the order of events or some very small jitter is causing this
issue on tablets. (Couldn't confirm).

Whatever the cause, the solution of checking the timestamp of the event
and thus ignoring the outdated ones is theoretically safer.

It is the same solution seen in MacOS.

Also calling `SendInput` 3 times every warp ensures that at least one
event is dispatched.

===

M   intern/ghost/intern/GHOST_SystemWin32.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 75a4cc8389a..8cb007a756a 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1061,11 +1061,16 @@ GHOST_EventCursor 
*GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
 
   int32_t x_screen = screen_co[0], y_screen = screen_co[1];
   if (window->getCursorGrabModeIsWarp()) {
-/* WORKAROUND:
- * Sometimes Windows ignores `SetCursorPos()` or `SendInput()` calls or 
the mouse event is
- * outdated. Identify these cases by checking if the cursor is not yet 
within bounds. */
-static bool is_warping_x = false;
-static bool is_warping_y = false;
+static uint64_t last_warp_time = 0;
+{
+  /* WORKAROUND: Check the mouse event timestamp so we can ignore 
mousemove 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);
+  if (mp.time <= last_warp_time) {
+return NULL;
+  }
+}
 
 int32_t x_new = x_screen;
 int32_t y_new = y_screen;
@@ -1112,31 +1117,35 @@ GHOST_EventCursor 
*GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
 
 window->getCursorGrabAccum(x_accum, y_accum);
 if (x_new != x_screen || y_new != y_screen) {
-  system->setCursorPosition(x_new, y_new); /* wrap */
-
-  /* Do not update the accum values if we are an outdated or failed 
pos-warp event. */
-  if (!is_warping_x) {
-is_warping_x = x_new != x_screen;
-if (is_warping_x) {
-  x_accum += (x_screen - x_new);
-}
-  }
-
-  if (!is_warping_y) {
-is_warping_y = y_new != y_screen;
-if (is_warping_y) {
-  y_accum += (y_screen - y_new);
-}
-  }
+  /* WORKAROUND: Store the current time so that we ignore outdated 
mousemove events. */
+  last_warp_time = ::GetTickCount64();
+
+  /* For more control over which timestamp to store in the event, we use 
`SendInput` instead of
+   * `SetCursorPos` here.
+   * It is quite unlikely to happen, but still possible that some event 
between
+   * `last_warp_time` and `GHOST_SystemWin32::setCursorPosition` is sent. 
*/
+  INPUT input[3] = {0};
+  input[0].type = INPUT_MOUSE;
+  input[0].mi.dx = (LONG)(x_new * (65535.0f / 
GetSystemMetrics(SM_CXSCREEN)));
+  input[0].mi.dy = (LONG)(y_new * (65535.0f / 
GetSystemMetrics(SM_CYSCREEN)));
+  input[0].mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
+  input[0].mi.time = last_warp_time;
+
+  /* Send 3 events with a jitter to make sure Windows does not 
occasionally and
+   * inexplicably ignore `SetCursorPos` or `SendInput`. */
+  input[2] = input[1] = input[0];
+  input[1].mi.dx += 1;
+  ::SendInput(3, input, sizeof(INPUT));
+
+  x_accum += (x_screen - x_new);
+  y_accum += (y_screen - y_new);
   window->setCursorGrabAccum(x_accum, y_accum);
 
-  /* When wrapping we don't need to add an event because the 
setCursorPosition call will cause
-   * a new event after. */
+  /* When wrapping we don't need to add an event because the `SendInput` 
call will cause new
+   * events after. */
   return NULL;
 }
 
-is_warping_x = false;
-is_warping_y = false;
 x_screen += x_accum;
 y_screen += y_accum;
   }

___
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] [56237f33a16] master: Fix T103101: random Cycles animation rendering freezing up the application

2022-12-14 Thread Brecht Van Lommel
Commit: 56237f33a16b9ec4c6f271b09b66eeabc5306e44
Author: Brecht Van Lommel
Date:   Wed Dec 14 19:47:21 2022 +0100
Branches: master
https://developer.blender.org/rB56237f33a16b9ec4c6f271b09b66eeabc5306e44

Fix T103101: random Cycles animation rendering freezing up the application

===

M   source/blender/render/intern/engine.cc

===

diff --git a/source/blender/render/intern/engine.cc 
b/source/blender/render/intern/engine.cc
index b9672246c5f..7d78f957e31 100644
--- a/source/blender/render/intern/engine.cc
+++ b/source/blender/render/intern/engine.cc
@@ -1046,14 +1046,19 @@ bool RE_engine_render(Render *re, bool do_all)
 re->engine = engine;
   }
 
-  /* create render result */
+  /* Create render result. Do this before acquiring lock, to avoid lock
+   * inversion as this calls python to get the render passes, while python UI
+   * code can also hold a lock on the render result. */
+  const bool create_new_result = (re->result == nullptr || !(re->r.scemode & 
R_BUTS_PREVIEW));
+  RenderResult *new_result = engine_render_create_result(re);
+
   BLI_rw_mutex_lock(>resultmutex, THREAD_LOCK_WRITE);
-  if (re->result == nullptr || !(re->r.scemode & R_BUTS_PREVIEW)) {
+  if (create_new_result) {
 if (re->result) {
   render_result_free(re->result);
 }
 
-re->result = engine_render_create_result(re);
+re->result = new_result;
   }
   BLI_rw_mutex_unlock(>resultmutex);

___
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] [4121e32edd9] master: Fix T102740: don't allow inserting group into itself

2022-12-14 Thread Iliya Katueshenock
Commit: 4121e32edd9135fc364426f4b3a1763aa32989f1
Author: Iliya Katueshenock
Date:   Wed Dec 14 19:35:43 2022 +0100
Branches: master
https://developer.blender.org/rB4121e32edd9135fc364426f4b3a1763aa32989f1

Fix T102740: don't allow inserting group into itself

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

===

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

===

diff --git a/source/blender/editors/space_node/node_group.cc 
b/source/blender/editors/space_node/node_group.cc
index be9a6c69601..2c28a8fae34 100644
--- a/source/blender/editors/space_node/node_group.cc
+++ b/source/blender/editors/space_node/node_group.cc
@@ -1114,6 +1114,24 @@ void NODE_OT_group_make(wmOperatorType *ot)
 /** \name Group Insert Operator
  * \{ */
 
+static bool node_tree_contains_tree_recursive(const bNodeTree 
_to_search_in,
+  const bNodeTree 
_to_search_for)
+{
+  if (_to_search_in == _to_search_for) {
+return true;
+  }
+  ntree_to_search_in.ensure_topology_cache();
+  for (const bNode *node : ntree_to_search_in.group_nodes()) {
+if (node->id) {
+  if (node_tree_contains_tree_recursive(*reinterpret_cast(node->id),
+ntree_to_search_for)) {
+return true;
+  }
+}
+  }
+  return false;
+}
+
 static int node_group_insert_exec(bContext *C, wmOperator *op)
 {
   SpaceNode *snode = CTX_wm_space_node(C);
@@ -1128,8 +1146,21 @@ static int node_group_insert_exec(bContext *C, 
wmOperator *op)
 return OPERATOR_CANCELLED;
   }
 
-  bNodeTree *ngroup = (bNodeTree *)gnode->id;
+  bNodeTree *ngroup = reinterpret_cast(gnode->id);
   VectorSet nodes_to_group = get_nodes_to_group(*ntree, gnode);
+
+  /* Make sure that there won't be a node group containing itself afterwards. 
*/
+  for (const bNode *group : nodes_to_group) {
+if (!group->is_group() || group->id == nullptr) {
+  continue;
+}
+if (node_tree_contains_tree_recursive(*reinterpret_cast(group->id), *ngroup)) {
+  BKE_reportf(
+  op->reports, RPT_WARNING, "Can not insert group '%s' in '%s'", 
group->name, gnode->name);
+  return OPERATOR_CANCELLED;
+}
+  }
+
   if (!node_group_make_test_selected(*ntree, nodes_to_group, ngroup->idname, 
*op->reports)) {
 return OPERATOR_CANCELLED;
   }

___
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] [a501a2dbff7] master: Images: add mirror extension type

2022-12-14 Thread Hallam Roberts
Commit: a501a2dbff797829b61f21c5aeb9d19dba3e3874
Author: Hallam Roberts
Date:   Wed Dec 14 19:19:52 2022 +0100
Branches: master
https://developer.blender.org/rBa501a2dbff797829b61f21c5aeb9d19dba3e3874

Images: add mirror extension type

This adds a new mirror image extension type for shaders and
geometry nodes (next to the existing repeat, extend and clip
options).

See D16432 for a more detailed explanation of `wrap_mirror`.

This also adds a new sampler flag `GPU_SAMPLER_MIRROR_REPEAT`.
It acts as a modifier to `GPU_SAMPLER_REPEAT`, so any `REPEAT`
flag must be set for the `MIRROR` flag to have an effect.

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

===

M   intern/cycles/device/cuda/device_impl.cpp
M   intern/cycles/device/hip/device_impl.cpp
M   intern/cycles/device/metal/device_impl.mm
M   intern/cycles/kernel/device/cpu/image.h
M   intern/cycles/kernel/device/metal/compat.h
M   intern/cycles/kernel/device/metal/context_begin.h
M   intern/cycles/kernel/device/oneapi/image.h
M   intern/cycles/scene/shader_nodes.cpp
M   intern/cycles/util/texture.h
M   source/blender/draw/engines/workbench/workbench_materials.cc
M   source/blender/gpu/GPU_texture.h
M   source/blender/gpu/metal/mtl_context.mm
M   source/blender/gpu/opengl/gl_texture.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
M   source/blender/nodes/shader/nodes/node_shader_tex_image.cc

===

diff --git a/intern/cycles/device/cuda/device_impl.cpp 
b/intern/cycles/device/cuda/device_impl.cpp
index c9764d1c21b..f354ba6aee1 100644
--- a/intern/cycles/device/cuda/device_impl.cpp
+++ b/intern/cycles/device/cuda/device_impl.cpp
@@ -952,6 +952,9 @@ void CUDADevice::tex_alloc(device_texture )
 case EXTENSION_CLIP:
   address_mode = CU_TR_ADDRESS_MODE_BORDER;
   break;
+case EXTENSION_MIRROR:
+  address_mode = CU_TR_ADDRESS_MODE_MIRROR;
+  break;
 default:
   assert(0);
   break;
diff --git a/intern/cycles/device/hip/device_impl.cpp 
b/intern/cycles/device/hip/device_impl.cpp
index a84f1edd70e..04de8619697 100644
--- a/intern/cycles/device/hip/device_impl.cpp
+++ b/intern/cycles/device/hip/device_impl.cpp
@@ -909,6 +909,9 @@ void HIPDevice::tex_alloc(device_texture )
* because it's unsupported in HIP. */
   address_mode = hipAddressModeClamp;
   break;
+case EXTENSION_MIRROR:
+  address_mode = hipAddressModeMirror;
+  break;
 default:
   assert(0);
   break;
diff --git a/intern/cycles/device/metal/device_impl.mm 
b/intern/cycles/device/metal/device_impl.mm
index 24836e88755..95935ce2a3a 100644
--- a/intern/cycles/device/metal/device_impl.mm
+++ b/intern/cycles/device/metal/device_impl.mm
@@ -856,7 +856,7 @@ void MetalDevice::tex_alloc(device_texture )
   /* sampler_index maps into the GPU's constant 'metal_samplers' array */
   uint64_t sampler_index = mem.info.extension;
   if (mem.info.interpolation != INTERPOLATION_CLOSEST) {
-sampler_index += 3;
+sampler_index += 4;
   }
 
   /* Image Texture Storage */
diff --git a/intern/cycles/kernel/device/cpu/image.h 
b/intern/cycles/kernel/device/cpu/image.h
index 320e6309128..eb50ac8217f 100644
--- a/intern/cycles/kernel/device/cpu/image.h
+++ b/intern/cycles/kernel/device/cpu/image.h
@@ -202,6 +202,14 @@ template struct 
TextureInterpolator {
 return clamp(x, 0, width - 1);
   }
 
+  static ccl_always_inline int wrap_mirror(int x, int width)
+  {
+const int m = abs(x + (x < 0)) % (2 * width);
+if (m >= width)
+  return 2 * width - m - 1;
+return m;
+  }
+
   /*   2D interpolation  */
 
   static ccl_always_inline OutT interp_closest(const TextureInfo , float 
x, float y)
@@ -226,6 +234,10 @@ template struct 
TextureInterpolator {
 ix = wrap_clamp(ix, width);
 iy = wrap_clamp(iy, height);
 break;
+  case EXTENSION_MIRROR:
+ix = wrap_mirror(ix, width);
+iy = wrap_mirror(iy, height);
+break;
   default:
 kernel_assert(0);
 return zero();
@@ -268,6 +280,12 @@ template struct 
TextureInterpolator {
 niy = wrap_clamp(iy + 1, height);
 iy = wrap_clamp(iy, height);
 break;
+  case EXTENSION_MIRROR:
+nix = wrap_mirror(ix + 1, width);
+ix = wrap_mirror(ix, width);
+niy = wrap_mirror(iy + 1, height);
+iy = wrap_mirror(iy, height);
+break;
   default:
 kernel_assert(0);
 return zero();
@@ -331,6 +349,17 @@ template struct 
TextureInterpolator {
 nniy = wrap_clamp(iy + 2, height);
 iy = wrap_clamp(iy, height);
 break;
+  case EXTENSION_MIRROR:
+pix = wrap_mirror(ix - 1, width);
+nix = 

[Bf-blender-cvs] [8c14992db23] master: Fix syntax errors in Cycles float8 test

2022-12-14 Thread Brecht Van Lommel
Commit: 8c14992db235964b04074fcdb94518d19debf124
Author: Brecht Van Lommel
Date:   Wed Dec 14 19:01:42 2022 +0100
Branches: master
https://developer.blender.org/rB8c14992db235964b04074fcdb94518d19debf124

Fix syntax errors in Cycles float8 test

===

M   intern/cycles/test/util_float8_test.h

===

diff --git a/intern/cycles/test/util_float8_test.h 
b/intern/cycles/test/util_float8_test.h
index bcceeada12c..4da96dfb7b0 100644
--- a/intern/cycles/test/util_float8_test.h
+++ b/intern/cycles/test/util_float8_test.h
@@ -26,7 +26,7 @@ static bool validate_cpu_capabilities()
  * constructor until we know the instructions are supported. */
 static vfloat8 float8_a()
 {
-  return make_vfloat8(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f)
+  return make_vfloat8(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
 }
 
 static vfloat8 float8_b()
@@ -80,7 +80,7 @@ TEST(TEST_CATEGORY_NAME, float8_add_vv){
 basic_test_vf(float8_a(), float_b, *)} TEST(TEST_CATEGORY_NAME, 
float8_div_vf){
 basic_test_vf(float8_a(), float_b, /)}
 
-TEST(TEST_CATEGORY_NAME, float8_c() tor)
+TEST(TEST_CATEGORY_NAME, float8_ctor)
 {
   INIT_FLOAT8_TEST
   compare_vector_scalar(make_vfloat8(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 
7.0f),

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


[Bf-blender-cvs] [7efba6c59a2] master: Geometry Nodes: show correct type in socket tooltip

2022-12-14 Thread Iliya Katueshenock
Commit: 7efba6c59a225fbb478b1f554848f1086c190db0
Author: Iliya Katueshenock
Date:   Wed Dec 14 18:48:13 2022 +0100
Branches: master
https://developer.blender.org/rB7efba6c59a225fbb478b1f554848f1086c190db0

Geometry Nodes: show correct type in socket tooltip

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

===

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 3bb10404302..2790e8de6a8 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -39,6 +39,7 @@
 #include "BKE_node_runtime.hh"
 #include "BKE_node_tree_update.h"
 #include "BKE_object.h"
+#include "BKE_type_conversions.hh"
 
 #include "DEG_depsgraph.h"
 
@@ -794,56 +795,76 @@ struct SocketTooltipData {
   const bNodeSocket *socket;
 };
 
-static void create_inspection_string_for_generic_value(const GPointer value, 
std::stringstream )
+static void create_inspection_string_for_generic_value(const bNodeSocket 
,
+   const GPointer value,
+   std::stringstream )
 {
   auto id_to_inspection_string = [&](const ID *id, const short idcode) {
 ss << (id ? id->name + 2 : TIP_("None")) << " (" << 
TIP_(BKE_idtype_idcode_to_name(idcode))
<< ")";
   };
 
-  const CPPType  = *value.type();
+  const CPPType _type = *value.type();
   const void *buffer = value.get();
-  if (type.is()) {
+  if (value_type.is()) {
 id_to_inspection_string(*static_cast(buffer), ID_OB);
+return;
   }
-  else if (type.is()) {
+  else if (value_type.is()) {
 id_to_inspection_string(*static_cast(buffer), ID_MA);
+return;
   }
-  else if (type.is()) {
+  else if (value_type.is()) {
 id_to_inspection_string(*static_cast(buffer), ID_TE);
+return;
   }
-  else if (type.is()) {
+  else if (value_type.is()) {
 id_to_inspection_string(*static_cast(buffer), ID_IM);
+return;
   }
-  else if (type.is()) {
+  else if (value_type.is()) {
 id_to_inspection_string(*static_cast(buffer), ID_GR);
+return;
+  }
+  else if (value_type.is()) {
+ss << *static_cast(buffer) << TIP_(" (String)");
+return;
+  }
+
+  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;
   }
-  else if (type.is()) {
-ss << *(int *)buffer << TIP_(" (Integer)");
+  BUFFER_FOR_CPP_TYPE_VALUE(socket_type, socket_value);
+  convert.convert_to_uninitialized(value_type, socket_type, buffer, 
socket_value);
+  BLI_SCOPED_DEFER([&]() { socket_type.destruct(socket_value); });
+
+  if (socket_type.is()) {
+ss << *static_cast(socket_value) << TIP_(" (Integer)");
   }
-  else if (type.is()) {
-ss << *(float *)buffer << TIP_(" (Float)");
+  else if (socket_type.is()) {
+ss << *static_cast(socket_value) << TIP_(" (Float)");
   }
-  else if (type.is()) {
-ss << *(blender::float3 *)buffer << TIP_(" (Vector)");
+  else if (socket_type.is()) {
+ss << *static_cast(socket_value) << TIP_(" (Vector)");
   }
-  else if (type.is()) {
-const blender::ColorGeometry4f  = *(blender::ColorGeometry4f 
*)buffer;
+  else if (socket_type.is()) {
+const blender::ColorGeometry4f  = 
*static_cast(socket_value);
 ss << "(" << color.r << ", " << color.g << ", " << color.b << ", " << 
color.a << ")"
<< TIP_(" (Color)");
   }
-  else if (type.is()) {
-ss << ((*(bool *)buffer) ? TIP_("True") : TIP_("False")) << TIP_(" 
(Boolean)");
-  }
-  else if (type.is()) {
-ss << *(std::string *)buffer << TIP_(" (String)");
+  else if (socket_type.is()) {
+ss << ((*static_cast(socket_value)) ? TIP_("True") : TIP_("False"))
+   << TIP_(" (Boolean)");
   }
 }
 
-static void create_inspection_string_for_field_info(const 
geo_log::FieldInfoLog _log,
+static void create_inspection_string_for_field_info(const bNodeSocket ,
+const 
geo_log::FieldInfoLog _log,
 std::stringstream )
 {
-  const CPPType  = value_log.type;
+  const CPPType _type = *socket.typeinfo->base_cpp_type;
   const Span input_tooltips = value_log.input_tooltips;
 
   if (input_tooltips.is_empty()) {
@@ -852,22 +873,22 @@ static void create_inspection_string_for_field_info(const 
geo_log::FieldInfoLog
 ss << "Value has not been logged";
   }
   else {
-if (type.is()) {
+if (socket_type.is()) {
   ss << TIP_("Integer field");
 }
-else if (type.is()) {
+else if (socket_type.is()) {
   ss << TIP_("Float field");
 }
-else if (type.is()) {
+else if (socket_type.is()) {
   ss << TIP_("Vector 

[Bf-blender-cvs] [d33758755b0] master: Revert "Fix T102571: Can't stop audio playback when using multiple windows"

2022-12-14 Thread Richard Antalik
Commit: d33758755b02f3a69631ed4fc671ba400f02b6a5
Author: Richard Antalik
Date:   Wed Dec 14 18:24:50 2022 +0100
Branches: master
https://developer.blender.org/rBd33758755b02f3a69631ed4fc671ba400f02b6a5

Revert "Fix T102571: Can't stop audio playback when using multiple windows"

This reverts commit 42b51bf6a91acd055d34e31c06c9dff46b0aac1b.

Commit caused crash when playback is stopped, see T103008.

===

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

===

diff --git a/source/blender/editors/screen/screen_ops.c 
b/source/blender/editors/screen/screen_ops.c
index a4e98aa639a..9c0963d0fb1 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4812,28 +4812,19 @@ bScreen *ED_screen_animation_no_scrub(const 
wmWindowManager *wm)
 int ED_screen_animation_play(bContext *C, int sync, int mode)
 {
   bScreen *screen = CTX_wm_screen(C);
+  Scene *scene = CTX_data_scene(C);
+  Scene *scene_eval = 
DEG_get_evaluated_scene(CTX_data_ensure_evaluated_depsgraph(C));
 
   if (ED_screen_animation_playing(CTX_wm_manager(C))) {
 /* stop playback now */
 ED_screen_animation_timer(C, 0, 0, 0);
-Main *bmain = CTX_data_main(C);
-LISTBASE_FOREACH (Scene *, scene, >scenes) {
-  LISTBASE_FOREACH (ViewLayer *, view_layer, >view_layers) {
-Depsgraph *graph = BKE_scene_get_depsgraph(scene, view_layer);
-if (graph) {
-  Scene *scene_eval = DEG_get_evaluated_scene(graph);
-  /* The audio handles are preserved throughout the dependency graph 
evaluation.
-   * Checking for scene->playback_handle even for non-evaluated scene 
should be okay. */
-  BKE_sound_stop_scene(scene_eval);
-  WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
-}
-  }
-}
+BKE_sound_stop_scene(scene_eval);
+
+WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
   }
   else {
 /* these settings are currently only available from a menu in the TimeLine 
*/
 if (mode == 1) { /* XXX only play audio forwards!? */
-  Scene *scene_eval = 
DEG_get_evaluated_scene(CTX_data_ensure_evaluated_depsgraph(C));
   BKE_sound_play_scene(scene_eval);
 }

___
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] [77a4ab3ccf2] master: Fix wrong syntax in Cycles float8 test fix

2022-12-14 Thread Brecht Van Lommel
Commit: 77a4ab3ccf2df23f540ebb0a1fc5e5266990281d
Author: Brecht Van Lommel
Date:   Wed Dec 14 18:35:34 2022 +0100
Branches: master
https://developer.blender.org/rB77a4ab3ccf2df23f540ebb0a1fc5e5266990281d

Fix wrong syntax in Cycles float8 test fix

===

M   intern/cycles/test/util_float8_test.h

===

diff --git a/intern/cycles/test/util_float8_test.h 
b/intern/cycles/test/util_float8_test.h
index 8ae95d75f47..bcceeada12c 100644
--- a/intern/cycles/test/util_float8_test.h
+++ b/intern/cycles/test/util_float8_test.h
@@ -24,17 +24,17 @@ static bool validate_cpu_capabilities()
 
 /* These are not just static variables because we don't want to run the
  * constructor until we know the instructions are supported. */
-static vfloat8 float8_a()()
+static vfloat8 float8_a()
 {
   return make_vfloat8(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f)
 }
 
-static vfloat8 float8_b()()
+static vfloat8 float8_b()
 {
   return make_vfloat8(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
 }
 
-static vfloat8 float8_c()()
+static vfloat8 float8_c()
 {
   return make_vfloat8(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f);
 }

___
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] [c5f5046efd0] master: Fix T103208: unavailable socket linked to multi-input socket crashes

2022-12-14 Thread Iliya Katueshenock
Commit: c5f5046efd07a81232904ab6cb6a94f0c755f376
Author: Iliya Katueshenock
Date:   Wed Dec 14 18:28:07 2022 +0100
Branches: master
https://developer.blender.org/rBc5f5046efd07a81232904ab6cb6a94f0c755f376

Fix T103208: unavailable socket linked to multi-input socket crashes

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

===

M   source/blender/nodes/intern/geometry_nodes_lazy_function.cc

===

diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc 
b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index d7d633353bd..cad92cc0d90 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -157,9 +157,11 @@ class LazyFunctionForMultiInput : public LazyFunction {
 BLI_assert(socket.is_multi_input());
 const bNodeTree  = socket.owner_tree();
 for (const bNodeLink *link : socket.directly_linked_links()) {
-  if (!(link->is_muted() || nodeIsDanglingReroute(, 
link->fromnode))) {
-inputs_.append({"Input", *base_type_});
+  if (link->is_muted() || !link->fromsock->is_available() ||
+  nodeIsDanglingReroute(, link->fromnode)) {
+continue;
   }
+  inputs_.append({"Input", *base_type_});
 }
 const CPPType *vector_type = get_vector_type(*base_type_);
 BLI_assert(vector_type != nullptr);

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


[Bf-blender-cvs] [9fd834fbb34] master: Fix T103143: Cycles can lose default color attribute

2022-12-14 Thread Hans Goudey
Commit: 9fd834fbb3468133b807b50808f3ccfbf55cc7f1
Author: Hans Goudey
Date:   Wed Dec 14 11:11:37 2022 -0600
Branches: master
https://developer.blender.org/rB9fd834fbb3468133b807b50808f3ccfbf55cc7f1

Fix T103143: Cycles can lose default color attribute

The `render_color_index` skips attributes with different types
and domains in order to give the proper order for the UI list.
That is a different than an index in the group of all attributes.

The most solid solution I could think of is exposing the name of
the default color attribute. It's "solid" because we always address
attributes by name internally. Doing something different is bound
to create problems. It's also aligned with the design in T98366 and
D15169.

Another option would be to change the way the "attribute index"
is incremented in Cycles. That would be a valid solution, but would
be more complex and annoying.

For consistency, I also exposed the name of the active color attribute
the same way, though it isn't necessary to fix this particular bug.

The properties aren't editable, that can come in 3.5 as part of D15169.

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

===

M   intern/cycles/blender/mesh.cpp
M   source/blender/makesrna/intern/rna_attribute.c

===

diff --git a/intern/cycles/blender/mesh.cpp b/intern/cycles/blender/mesh.cpp
index 1887440bc67..736b80bacd6 100644
--- a/intern/cycles/blender/mesh.cpp
+++ b/intern/cycles/blender/mesh.cpp
@@ -367,13 +367,11 @@ static void attr_create_generic(Scene *scene,
 {
   AttributeSet  = (subdivision) ? mesh->subd_attributes : 
mesh->attributes;
   static const ustring u_velocity("velocity");
-
-  int attribute_index = 0;
-  int render_color_index = b_mesh.attributes.render_color_index();
+  const ustring 
default_color_name{b_mesh.attributes.default_color_name().c_str()};
 
   for (BL::Attribute _attribute : b_mesh.attributes) {
 const ustring name{b_attribute.name().c_str()};
-const bool is_render_color = (attribute_index++ == render_color_index);
+const bool is_render_color = name == default_color_name;
 
 if (need_motion && name == u_velocity) {
   attr_create_motion(mesh, b_attribute, motion_scale);
diff --git a/source/blender/makesrna/intern/rna_attribute.c 
b/source/blender/makesrna/intern/rna_attribute.c
index c5ddc9a0204..d65159af28a 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -651,6 +651,49 @@ static void rna_AttributeGroup_render_color_index_range(
   *softmin = *min;
   *softmax = *max;
 }
+
+static void rna_AttributeGroup_default_color_name_get(PointerRNA *ptr, char 
*value)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_render_color_get(id);
+  if (!layer) {
+value[0] = '\0';
+return;
+  }
+  BLI_strncpy(value, layer->name, MAX_CUSTOMDATA_LAYER_NAME);
+}
+
+static int rna_AttributeGroup_default_color_name_length(PointerRNA *ptr)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_render_color_get(id);
+  if (!layer) {
+return 0;
+  }
+  return strlen(layer->name);
+}
+
+static void rna_AttributeGroup_active_color_name_get(PointerRNA *ptr, char 
*value)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
+  if (!layer) {
+value[0] = '\0';
+return;
+  }
+  BLI_strncpy(value, layer->name, MAX_CUSTOMDATA_LAYER_NAME);
+}
+
+static int rna_AttributeGroup_active_color_name_length(PointerRNA *ptr)
+{
+  const ID *id = ptr->owner_id;
+  const CustomDataLayer *layer = BKE_id_attributes_active_color_get(id);
+  if (!layer) {
+return 0;
+  }
+  return strlen(layer->name);
+}
+
 #else
 
 static void rna_def_attribute_float(BlenderRNA *brna)
@@ -1110,6 +1153,29 @@ static void rna_def_attribute_group(BlenderRNA *brna)
  "rna_AttributeGroup_render_color_index_set",
  "rna_AttributeGroup_render_color_index_range");
   RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
+
+  prop = RNA_def_property(srna, "default_color_name", PROP_STRING, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
+  RNA_def_property_string_funcs(prop,
+"rna_AttributeGroup_default_color_name_get",
+"rna_AttributeGroup_default_color_name_length",
+NULL);
+  RNA_def_property_ui_text(
+  prop,
+  "Default Color Attribute",
+  "The name of the default color attribute used as a fallback for 
rendering");
+
+  prop = RNA_def_property(srna, "active_color_name", PROP_STRING, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  

[Bf-blender-cvs] [eae1be548dd] master: Fix T103186: Missing anonymous attribute reference

2022-12-14 Thread Hans Goudey
Commit: eae1be548dd5d36328121882106dc417ae8e02be
Author: Hans Goudey
Date:   Wed Dec 14 11:08:35 2022 -0600
Branches: master
https://developer.blender.org/rBeae1be548dd5d36328121882106dc417ae8e02be

Fix T103186: Missing anonymous attribute reference

Creating the `WeakAnonymousAttributeID` doesn't
increase the reference count, but destructing it does.

===

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

===

diff --git a/source/blender/geometry/intern/mesh_split_edges.cc 
b/source/blender/geometry/intern/mesh_split_edges.cc
index ba00ba5a8a6..19db9cbfc03 100644
--- a/source/blender/geometry/intern/mesh_split_edges.cc
+++ b/source/blender/geometry/intern/mesh_split_edges.cc
@@ -79,6 +79,7 @@ static void add_new_edges(Mesh ,
 }
 else {
   anonymous_ids.append(bke::WeakAnonymousAttributeID(_id()));
+  BKE_anonymous_attribute_id_increment_weak(_id());
 }
   }
   Vector local_edge_ids;
@@ -98,8 +99,8 @@ static void add_new_edges(Mesh ,
 void *array;
   };
   Vector dst_attributes;
-  for (const bke::AttributeIDRef  : local_edge_ids) {
-bke::GAttributeReader attribute = attributes.lookup(id);
+  for (const bke::AttributeIDRef _id : local_edge_ids) {
+bke::GAttributeReader attribute = attributes.lookup(local_id);
 if (!attribute) {
   continue;
 }
@@ -115,8 +116,8 @@ static void add_new_edges(Mesh ,
 });
 
 /* Free the original attribute as soon as possible to lower peak memory 
usage. */
-attributes.remove(id);
-dst_attributes.append({id, type, new_data});
+attributes.remove(local_id);
+dst_attributes.append({local_id, type, new_data});
   }
 
   int *new_orig_indices = nullptr;

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


[Bf-blender-cvs] [edc59cefb66] universal-scene-description: USD import: fix prim_path_mask storage.

2022-12-14 Thread Michael Kowalski
Commit: edc59cefb66542d2f9cf11496d15ab2cff419b2b
Author: Michael Kowalski
Date:   Wed Dec 14 12:18:08 2022 -0500
Branches: universal-scene-description
https://developer.blender.org/rBedc59cefb66542d2f9cf11496d15ab2cff419b2b

USD import: fix prim_path_mask storage.

Now accessing the prm_path_mask string property as
an allocated string, as the string is of arbitrary
length.

===

M   source/blender/editors/io/io_usd.c
M   source/blender/io/usd/intern/usd_capi_import.cc
M   source/blender/io/usd/usd.h

===

diff --git a/source/blender/editors/io/io_usd.c 
b/source/blender/editors/io/io_usd.c
index 0e26d6e8820..b1b511affa0 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -1119,8 +1119,7 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
 
   const bool create_collection = RNA_boolean_get(op->ptr, "create_collection");
 
-  char prim_path_mask[1024];
-  RNA_string_get(op->ptr, "prim_path_mask", prim_path_mask);
+  char *prim_path_mask = RNA_string_get_alloc(op->ptr, "prim_path_mask", NULL, 
0, NULL);
 
   const bool import_guide = RNA_boolean_get(op->ptr, "import_guide");
   const bool import_proxy = RNA_boolean_get(op->ptr, "import_proxy");
@@ -1198,8 +1197,6 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
.import_shapes = import_shapes,
.import_defined_only = import_defined_only};
 
-  STRNCPY(params.prim_path_mask, prim_path_mask);
-
   const bool ok = USD_import(C, filename, , as_background_job);
 
   return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
diff --git a/source/blender/io/usd/intern/usd_capi_import.cc 
b/source/blender/io/usd/intern/usd_capi_import.cc
index e26e2d36adb..b0913db3d0f 100644
--- a/source/blender/io/usd/intern/usd_capi_import.cc
+++ b/source/blender/io/usd/intern/usd_capi_import.cc
@@ -648,6 +648,8 @@ static void import_endjob(void *customdata)
   break;
   }
 
+  MEM_freeN(data->params.prim_path_mask);
+
   WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene);
   report_job_duration(data);
 }
diff --git a/source/blender/io/usd/usd.h b/source/blender/io/usd/usd.h
index 097740db87a..714fb3069a5 100644
--- a/source/blender/io/usd/usd.h
+++ b/source/blender/io/usd/usd.h
@@ -167,7 +167,7 @@ struct USDImportParams {
   bool import_blendshapes;
   bool import_volumes;
   bool import_skeletons;
-  char prim_path_mask[1024];
+  char *prim_path_mask;
   bool import_subdiv;
   bool import_instance_proxies;
   bool create_collection;

___
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] [f879c20f72d] master: Geometry Nodes: output uv map from primitive nodes as anonymous attributes

2022-12-14 Thread Jacques Lucke
Commit: f879c20f72d9ce58a2e0ed26dc15557116d5961f
Author: Jacques Lucke
Date:   Wed Dec 14 18:05:31 2022 +0100
Branches: master
https://developer.blender.org/rBf879c20f72d9ce58a2e0ed26dc15557116d5961f

Geometry Nodes: output uv map from primitive nodes as anonymous attributes

This is essentially a left-over from the initial transition to fields where 
this was
forgotten. The mesh primitive nodes used to create a named uv map attribute
with a hard-coded name. The standard way to deal with that in geometry nodes
now is to output the attribute as a socket instead. The user can then decide
to store it as a named attribute or not.

The benefits of not always storing the named attribute in the node are:
* Improved performance and lower memory usage when the uv map is not
  used.
* It's more obvious that there actually is a uv map.
* The hard-coded name was inconsistent.

The versioning code inserts a new Store Named Attribute node that
stores the uv map immediatly. In many cases, users can probably just
remove this node without affecting their final result, but we can't
detect that.

There is one behavior change which is that the stored uv map will be
a 3d vector instead of a 2d vector which is what the nodes originally created.
We could store the uv map as 2d vector inthe Store Named Attribute node,
but that has the problem that older Blender versions don't support this
and would crash immediately. Users can just change this to 2d vector
manually if they don't care about forward compatibility.

There is a plan to support 2d vectors more natively in geometry nodes: T92765.

This change breaks forward compatibility in the case when the uv map
was used.

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

===

M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenloader/intern/versioning_300.cc
M   source/blender/nodes/geometry/node_geometry_util.hh
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index abf9d67370b..91a458e347f 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -25,13 +25,13 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 3
+#define BLENDER_FILE_SUBVERSION 4
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the 
file
  * was written with too new a version. */
 #define BLENDER_FILE_MIN_VERSION 305
-#define BLENDER_FILE_MIN_SUBVERSION 3
+#define BLENDER_FILE_MIN_SUBVERSION 4
 
 /** User readable version string. */
 const char *BKE_blender_version_string(void);
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index c98a9f67bbc..9bc42879d78 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -1130,7 +1130,7 @@ static void node_init(const bContext *C, bNodeTree 
*ntree, bNode *node)
 ntype->initfunc(ntree, node);
   }
 
-  if (ntree->typeinfo->node_add_init != nullptr) {
+  if (ntree->typeinfo && ntree->typeinfo->node_add_init) {
 ntree->typeinfo->node_add_init(ntree, node);
   }
 
diff --git a/source/blender/blenloader/intern/versioning_300.cc 
b/source/blender/blenloader/intern/versioning_300.cc
index a90a8cfd753..c22c74ac237 100644
--- a/source/blender/blenloader/intern/versioning_300.cc
+++ b/source/blender/blenloader/intern/versioning_300.cc
@@ -823,6 +823,99 @@ static void 
version_geometry_nodes_replace_transfer_attribute_node(bNodeTree *nt
   }
 }
 
+/**
+ * The mesh primitive nodes created a uv map with a hardcoded name. Now they 
are outputting the uv
+ * map as a socket instead. The versioning just inserts a Store Named 
Attribute node after
+ * primitive nodes.
+ */
+static void version_geometry_nodes_primitive_uv_maps(bNodeTree )
+{
+  blender::Vector new_nodes;
+  LISTBASE_FOREACH_MUTABLE (bNode *, node, ) {
+if (!ELEM(node->type,
+  GEO_NODE_MESH_PRIMITIVE_CONE,
+  GEO_NODE_MESH_PRIMITIVE_CUBE,
+  GEO_NODE_MESH_PRIMITIVE_CYLINDER,
+  GEO_NODE_MESH_PRIMITIVE_GRID,
+  GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE,
+  

[Bf-blender-cvs] [b0cc8e8ddec] master: Cycles: switch from pretabulated 2D PMJ02 to pretabulated 4D Sobol

2022-12-14 Thread Nathan Vegdahl
Commit: b0cc8e8ddec3f1771b69234860b40511be975039
Author: Nathan Vegdahl
Date:   Tue Dec 13 19:14:29 2022 +0100
Branches: master
https://developer.blender.org/rBb0cc8e8ddec3f1771b69234860b40511be975039

Cycles: switch from pretabulated 2D PMJ02 to pretabulated 4D Sobol

The first two dimensions of scrambled, shuffled Sobol and shuffled PMJ02 are
equivalent, so this makes no real difference for the first two dimensions.
But Sobol allows us to naturally extend to more dimensions.

Pretabulated Sobol is now always used, and the sampling pattern settings is now
only available as a debug option.

This in turn allows the following two things (also implemented):

* Use proper 3D samples for combined lens + motion blur sampling. This
  notably reduces the noise on objects that are simultaneously out-of-focus
  and motion blurred.
* Use proper 3D samples for combined light selection + light sampling.
  Cycles was already doing something clever here with 2D samples, but using
  3D samples is more straightforward and avoids overloading one of the
  dimensions.

In the future this will also allow for proper sampling of e.g. volumetric
light sources and other things that may need three or four dimensions.

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

===

M   intern/cycles/blender/addon/properties.py
M   intern/cycles/blender/addon/ui.py
M   intern/cycles/blender/addon/version_update.py
M   intern/cycles/blender/sync.cpp
M   intern/cycles/kernel/CMakeLists.txt
M   intern/cycles/kernel/data_arrays.h
M   intern/cycles/kernel/data_template.h
M   intern/cycles/kernel/integrator/init_from_camera.h
M   intern/cycles/kernel/integrator/path_state.h
M   intern/cycles/kernel/integrator/shade_surface.h
M   intern/cycles/kernel/integrator/shade_volume.h
M   intern/cycles/kernel/light/distribution.h
M   intern/cycles/kernel/light/sample.h
M   intern/cycles/kernel/light/tree.h
D   intern/cycles/kernel/sample/jitter.h
M   intern/cycles/kernel/sample/pattern.h
A   intern/cycles/kernel/sample/tabulated_sobol.h
M   intern/cycles/kernel/types.h
M   intern/cycles/scene/CMakeLists.txt
M   intern/cycles/scene/integrator.cpp
D   intern/cycles/scene/jitter.cpp
D   intern/cycles/scene/jitter.h
A   intern/cycles/scene/tabulated_sobol.cpp
A   intern/cycles/scene/tabulated_sobol.h

===

diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index 2da763b9eb1..eff6384c85e 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -82,8 +82,8 @@ enum_use_layer_samples = (
 )
 
 enum_sampling_pattern = (
-('SOBOL', "Sobol-Burley", "Use Sobol-Burley random sampling pattern", 0),
-('PROGRESSIVE_MULTI_JITTER', "Progressive Multi-Jitter", "Use Progressive 
Multi-Jitter random sampling pattern", 1),
+('SOBOL_BURLEY', "Sobol-Burley", "Use on-the-fly computed Owen-scrambled 
Sobol for random sampling", 0),
+('TABULATED_SOBOL', "Tabulated Sobol", "Use precomputed tables of 
Owen-scrambled Sobol for random sampling", 1),
 )
 
 enum_emission_sampling = (
@@ -412,9 +412,9 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 
 sampling_pattern: EnumProperty(
 name="Sampling Pattern",
-description="Random sampling pattern used by the integrator. When 
adaptive sampling is enabled, Progressive Multi-Jitter is always used instead 
of Sobol-Burley",
+description="Random sampling pattern used by the integrator",
 items=enum_sampling_pattern,
-default='PROGRESSIVE_MULTI_JITTER',
+default='TABULATED_SOBOL',
 )
 
 scrambling_distance: FloatProperty(
diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index c3477ae0284..4746790aae8 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -364,16 +364,13 @@ class 
CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
 row.prop(cscene, "seed")
 row.prop(cscene, "use_animated_seed", text="", icon='TIME')
 
-col = layout.column(align=True)
-col.prop(cscene, "sampling_pattern", text="Pattern")
-
 col = layout.column(align=True)
 col.prop(cscene, "sample_offset")
 
 layout.separator()
 
 heading = layout.column(align=True, heading="Scrambling Distance")
-heading.active = cscene.sampling_pattern != 'SOBOL'
+heading.active = cscene.sampling_pattern != 'TABULATED_SOBOL'
 heading.prop(cscene, "auto_scrambling_distance", text="Automatic")
 heading.prop(cscene, "preview_scrambling_distance", text="Viewport")
 heading.prop(cscene, "scrambling_distance", text="Multiplier")
@@ -396,11 +393,22 @@ class 
CYCLES_RENDER_PT_sampling_lights(CyclesButtonsPanel, 

[Bf-blender-cvs] [d9192aaa6d2] master: Cycles: limit the internal sample index of Sobol-Burley for performance

2022-12-14 Thread Nathan Vegdahl
Commit: d9192aaa6d2a0a17bcfe158bade77314f0679cf7
Author: Nathan Vegdahl
Date:   Wed Dec 14 16:43:12 2022 +0100
Branches: master
https://developer.blender.org/rBd9192aaa6d2a0a17bcfe158bade77314f0679cf7

Cycles: limit the internal sample index of Sobol-Burley for performance

This is done based on the render sample count so that it doesn't impact
sampling quality. It's similar in spirit to the adaptive table size in D16561,
but in this case for performance rather than memory usage.

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

===

M   intern/cycles/kernel/data_template.h
M   intern/cycles/kernel/sample/pattern.h
M   intern/cycles/kernel/sample/sobol_burley.h
M   intern/cycles/scene/integrator.cpp

===

diff --git a/intern/cycles/kernel/data_template.h 
b/intern/cycles/kernel/data_template.h
index af7a6d2ef41..ddc462e02f6 100644
--- a/intern/cycles/kernel/data_template.h
+++ b/intern/cycles/kernel/data_template.h
@@ -180,6 +180,7 @@ KERNEL_STRUCT_MEMBER(integrator, int, use_caustics)
 /* Sampling pattern. */
 KERNEL_STRUCT_MEMBER(integrator, int, sampling_pattern)
 KERNEL_STRUCT_MEMBER(integrator, int, tabulated_sobol_sequence_size)
+KERNEL_STRUCT_MEMBER(integrator, int, sobol_index_mask)
 KERNEL_STRUCT_MEMBER(integrator, float, scrambling_distance)
 /* Volume render. */
 KERNEL_STRUCT_MEMBER(integrator, int, use_volumes)
@@ -204,7 +205,6 @@ KERNEL_STRUCT_MEMBER(integrator, int, 
use_guiding_mis_weights)
 
 /* Padding. */
 KERNEL_STRUCT_MEMBER(integrator, int, pad1)
-KERNEL_STRUCT_MEMBER(integrator, int, pad2)
 KERNEL_STRUCT_END(KernelIntegrator)
 
 /* SVM. For shader specialization. */
diff --git a/intern/cycles/kernel/sample/pattern.h 
b/intern/cycles/kernel/sample/pattern.h
index f6f1de448e0..71018bb1e91 100644
--- a/intern/cycles/kernel/sample/pattern.h
+++ b/intern/cycles/kernel/sample/pattern.h
@@ -3,8 +3,8 @@
 
 #pragma once
 
-#include "kernel/sample/tabulated_sobol.h"
 #include "kernel/sample/sobol_burley.h"
+#include "kernel/sample/tabulated_sobol.h"
 #include "util/hash.h"
 
 CCL_NAMESPACE_BEGIN
@@ -23,7 +23,8 @@ ccl_device_forceinline float path_rng_1D(KernelGlobals kg,
 #endif
 
   if (kernel_data.integrator.sampling_pattern == 
SAMPLING_PATTERN_SOBOL_BURLEY) {
-return sobol_burley_sample_1D(sample, dimension, rng_hash);
+const uint index_mask = kernel_data.integrator.sobol_index_mask;
+return sobol_burley_sample_1D(sample, dimension, rng_hash, index_mask);
   }
   else {
 return tabulated_sobol_sample_1D(kg, sample, rng_hash, dimension);
@@ -40,7 +41,8 @@ ccl_device_forceinline float2 path_rng_2D(KernelGlobals kg,
 #endif
 
   if (kernel_data.integrator.sampling_pattern == 
SAMPLING_PATTERN_SOBOL_BURLEY) {
-return sobol_burley_sample_2D(sample, dimension, rng_hash);
+const uint index_mask = kernel_data.integrator.sobol_index_mask;
+return sobol_burley_sample_2D(sample, dimension, rng_hash, index_mask);
   }
   else {
 return tabulated_sobol_sample_2D(kg, sample, rng_hash, dimension);
@@ -57,7 +59,8 @@ ccl_device_forceinline float3 path_rng_3D(KernelGlobals kg,
 #endif
 
   if (kernel_data.integrator.sampling_pattern == 
SAMPLING_PATTERN_SOBOL_BURLEY) {
-return sobol_burley_sample_3D(sample, dimension, rng_hash);
+const uint index_mask = kernel_data.integrator.sobol_index_mask;
+return sobol_burley_sample_3D(sample, dimension, rng_hash, index_mask);
   }
   else {
 return tabulated_sobol_sample_3D(kg, sample, rng_hash, dimension);
@@ -74,7 +77,8 @@ ccl_device_forceinline float4 path_rng_4D(KernelGlobals kg,
 #endif
 
   if (kernel_data.integrator.sampling_pattern == 
SAMPLING_PATTERN_SOBOL_BURLEY) {
-return sobol_burley_sample_4D(sample, dimension, rng_hash);
+const uint index_mask = kernel_data.integrator.sobol_index_mask;
+return sobol_burley_sample_4D(sample, dimension, rng_hash, index_mask);
   }
   else {
 return tabulated_sobol_sample_4D(kg, sample, rng_hash, dimension);
diff --git a/intern/cycles/kernel/sample/sobol_burley.h 
b/intern/cycles/kernel/sample/sobol_burley.h
index 47796ae7998..f3fcde4ff62 100644
--- a/intern/cycles/kernel/sample/sobol_burley.h
+++ b/intern/cycles/kernel/sample/sobol_burley.h
@@ -64,32 +64,76 @@ ccl_device_forceinline float sobol_burley(uint 
rev_bit_index,
   return uint_to_float_excl(result);
 }
 
+/*
+ * NOTE: the functions below intentionally produce samples that are
+ * uncorrelated between functions.  For example, a 1D sample and 2D
+ * sample produced with the same index, dimension, and seed are
+ * uncorrelated with each other.  This allows more care-free usage
+ * of the functions together, without having to worry about
+ * e.g. 1D and 2D samples being accidentally correlated with each
+ * other.
+ */
+
 /*
  * Computes a 1D Owen-scrambled and shuffled Sobol sample.
+ *
+ * `index` is the index of the sample in the sequence.
+ *
+ 

[Bf-blender-cvs] [ecfcf1b97b7] master: Cycles: disable light tree for existing scenes, enable on new scenes

2022-12-14 Thread Brecht Van Lommel
Commit: ecfcf1b97b707faa7a3076bf4d917cd333c331d8
Author: Brecht Van Lommel
Date:   Tue Dec 13 20:10:39 2022 +0100
Branches: master
https://developer.blender.org/rBecfcf1b97b707faa7a3076bf4d917cd333c331d8

Cycles: disable light tree for existing scenes, enable on new scenes

While it helps on many scenes, it can be disruptive for existing scenes and
for benchmarks the differences in timing can be confusing. So be a bit more
conservative and only it enable it for new scenes.

===

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

===

diff --git a/intern/cycles/blender/addon/version_update.py 
b/intern/cycles/blender/addon/version_update.py
index 8ebb17e614a..7f81ac96309 100644
--- a/intern/cycles/blender/addon/version_update.py
+++ b/intern/cycles/blender/addon/version_update.py
@@ -241,6 +241,12 @@ def do_versions(self):
 layer.samples *= layer.samples
 cscene["use_square_samples"] = False
 
+# Disable light tree for existing scenes.
+if version <= (3, 5, 3):
+cscene = scene.cycles
+if not cscene.is_property_set("use_light_tree"):
+cscene.use_light_tree = False
+
 # Lamps
 for light in bpy.data.lights:
 if light.library not in 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] [d88ebd31d67] master: Cleanup: add comments explaining need for requests dependencies

2022-12-14 Thread Brecht Van Lommel
Commit: d88ebd31d6736b9b184da1c1c11ddb5183ecacbc
Author: Brecht Van Lommel
Date:   Wed Dec 14 16:10:43 2022 +0100
Branches: master
https://developer.blender.org/rBd88ebd31d6736b9b184da1c1c11ddb5183ecacbc

Cleanup: add comments explaining need for requests dependencies

===

M   build_files/build_environment/cmake/versions.cmake

===

diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index b27dcb4fa4e..6b56df4ee99 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -235,11 +235,11 @@ set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
 # 
--
 # Python Modules
 
-# Needed by: TODO.
+# Needed by: `requests` module (so the version doesn't change on rebuild).
 set(IDNA_VERSION 3.3)
-# Needed by: TODO.
+# Needed by: `requests` module (so the version doesn't change on rebuild).
 set(CHARSET_NORMALIZER_VERSION 2.0.10)
-# Needed by: TODO.
+# Needed by: `requests` module (so the version doesn't change on rebuild).
 set(URLLIB3_VERSION 1.26.8)
 set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
 # Needed by: Python's `requests` module (so add-ons can authenticate against 
trusted certificates).

___
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] [2221cfc0442] master: Cleanup: GCC compiler warnings in Cycles float8 test

2022-12-14 Thread Brecht Van Lommel
Commit: 2221cfc044223d3e87013fe43ed5c5a1b28781a3
Author: Brecht Van Lommel
Date:   Wed Dec 14 17:38:25 2022 +0100
Branches: master
https://developer.blender.org/rB2221cfc044223d3e87013fe43ed5c5a1b28781a3

Cleanup: GCC compiler warnings in Cycles float8 test

===

M   intern/cycles/test/util_float8_test.h

===

diff --git a/intern/cycles/test/util_float8_test.h 
b/intern/cycles/test/util_float8_test.h
index 54701afaf8b..8ae95d75f47 100644
--- a/intern/cycles/test/util_float8_test.h
+++ b/intern/cycles/test/util_float8_test.h
@@ -22,13 +22,26 @@ static bool validate_cpu_capabilities()
 #endif
 }
 
+/* These are not just static variables because we don't want to run the
+ * constructor until we know the instructions are supported. */
+static vfloat8 float8_a()()
+{
+  return make_vfloat8(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f)
+}
+
+static vfloat8 float8_b()()
+{
+  return make_vfloat8(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
+}
+
+static vfloat8 float8_c()()
+{
+  return make_vfloat8(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f);
+}
+
 #define INIT_FLOAT8_TEST \
   if (!validate_cpu_capabilities()) \
-return; \
-\
-  const vfloat8 float8_a = make_vfloat8(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 
0.7f, 0.8f); \
-  const vfloat8 float8_b = make_vfloat8(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 
7.0f, 8.0f); \
-  const vfloat8 float8_c = make_vfloat8(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 
7.7f, 8.8f);
+return;
 
 #define compare_vector_scalar(a, b) \
   for (size_t index = 0; index < 8; index++) \
@@ -57,17 +70,17 @@ static bool validate_cpu_capabilities()
 
 static const float float_b = 1.5f;
 
-TEST(TEST_CATEGORY_NAME,
- float8_add_vv){basic_test_vv(float8_a, float8_b, +)} 
TEST(TEST_CATEGORY_NAME, float8_sub_vv){
-basic_test_vv(float8_a, float8_b, -)} TEST(TEST_CATEGORY_NAME, 
float8_mul_vv){
-basic_test_vv(float8_a, float8_b, *)} TEST(TEST_CATEGORY_NAME, 
float8_div_vv){
-basic_test_vv(float8_a, float8_b, /)} TEST(TEST_CATEGORY_NAME, 
float8_add_vf){
-basic_test_vf(float8_a, float_b, +)} TEST(TEST_CATEGORY_NAME, 
float8_sub_vf){
-basic_test_vf(float8_a, float_b, -)} TEST(TEST_CATEGORY_NAME, 
float8_mul_vf){
-basic_test_vf(float8_a, float_b, *)} TEST(TEST_CATEGORY_NAME,
-  
float8_div_vf){basic_test_vf(float8_a, float_b, /)}
-
-TEST(TEST_CATEGORY_NAME, float8_ctor)
+TEST(TEST_CATEGORY_NAME, float8_add_vv){
+basic_test_vv(float8_a(), float8_b(), +)} TEST(TEST_CATEGORY_NAME, 
float8_sub_vv){
+basic_test_vv(float8_a(), float8_b(), -)} TEST(TEST_CATEGORY_NAME, 
float8_mul_vv){
+basic_test_vv(float8_a(), float8_b(), *)} TEST(TEST_CATEGORY_NAME, 
float8_div_vv){
+basic_test_vv(float8_a(), float8_b(), /)} TEST(TEST_CATEGORY_NAME, 
float8_add_vf){
+basic_test_vf(float8_a(), float_b, +)} TEST(TEST_CATEGORY_NAME, 
float8_sub_vf){
+basic_test_vf(float8_a(), float_b, -)} TEST(TEST_CATEGORY_NAME, 
float8_mul_vf){
+basic_test_vf(float8_a(), float_b, *)} TEST(TEST_CATEGORY_NAME, 
float8_div_vf){
+basic_test_vf(float8_a(), float_b, /)}
+
+TEST(TEST_CATEGORY_NAME, float8_c() tor)
 {
   INIT_FLOAT8_TEST
   compare_vector_scalar(make_vfloat8(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 
7.0f),
@@ -85,18 +98,18 @@ TEST(TEST_CATEGORY_NAME, float8_sqrt)
 TEST(TEST_CATEGORY_NAME, float8_min_max)
 {
   INIT_FLOAT8_TEST
-  compare_vector_vector(min(float8_a, float8_b), float8_a);
-  compare_vector_vector(max(float8_a, float8_b), float8_b);
+  compare_vector_vector(min(float8_a(), float8_b()), float8_a());
+  compare_vector_vector(max(float8_a(), float8_b()), float8_b());
 }
 
 TEST(TEST_CATEGORY_NAME, float8_shuffle)
 {
   INIT_FLOAT8_TEST
-  vfloat8 res0 = shuffle<0, 1, 2, 3, 1, 3, 2, 0>(float8_a);
+  vfloat8 res0 = shuffle<0, 1, 2, 3, 1, 3, 2, 0>(float8_a());
   compare_vector_vector(res0, make_vfloat8(0.1f, 0.2f, 0.3f, 0.4f, 0.6f, 0.8f, 
0.7f, 0.5f));
-  vfloat8 res1 = shuffle<3>(float8_a);
+  vfloat8 res1 = shuffle<3>(float8_a());
   compare_vector_vector(res1, make_vfloat8(0.4f, 0.4f, 0.4f, 0.4f, 0.8f, 0.8f, 
0.8f, 0.8f));
-  vfloat8 res2 = shuffle<3, 2, 1, 0>(float8_a, float8_b);
+  vfloat8 res2 = shuffle<3, 2, 1, 0>(float8_a(), float8_b());
   compare_vector_vector(res2, make_vfloat8(0.4f, 0.3f, 2.0f, 1.0f, 0.8f, 0.7f, 
6.0f, 5.0f));
 }

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


[Bf-blender-cvs] [f0dc4d67e56] master: Geometry Nodes: support storing 2d vector attributes

2022-12-14 Thread Jacques Lucke
Commit: f0dc4d67e56dbdd13feb6ae09d584974b8b567ad
Author: Jacques Lucke
Date:   Wed Dec 14 16:43:38 2022 +0100
Branches: master
https://developer.blender.org/rBf0dc4d67e56dbdd13feb6ae09d584974b8b567ad

Geometry Nodes: support storing 2d vector attributes

This allows choosing the 2d vector type in the Store Named Attribute
node. Similar to byte-colors, there is not a special socket type for this
(currently). In geometry nodes itself, vectors are all still 3d.

===

M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc

===

diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 6d827cf757a..4a977f09884 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2175,6 +2175,7 @@ static bool generic_attribute_type_supported(const 
EnumPropertyItem *item)
 {
   return ELEM(item->value,
   CD_PROP_FLOAT,
+  CD_PROP_FLOAT2,
   CD_PROP_FLOAT3,
   CD_PROP_COLOR,
   CD_PROP_BOOL,
@@ -2192,7 +2193,8 @@ static const EnumPropertyItem 
*rna_GeometryNodeAttributeType_type_itemf(bContext
 
 static bool generic_attribute_type_supported_with_socket(const 
EnumPropertyItem *item)
 {
-  return generic_attribute_type_supported(item) && !ELEM(item->value, 
CD_PROP_BYTE_COLOR);
+  return generic_attribute_type_supported(item) &&
+ !ELEM(item->value, CD_PROP_BYTE_COLOR, CD_PROP_FLOAT2);
 }
 static const EnumPropertyItem 
*rna_GeometryNodeAttributeType_type_with_socket_itemf(
 bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), 
bool *r_free)
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc 
b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
index 50f066a647c..4970a926445 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
@@ -59,7 +59,7 @@ static void node_update(bNodeTree *ntree, bNode *node)
   bNodeSocket *socket_boolean = socket_color4f->next;
   bNodeSocket *socket_int32 = socket_boolean->next;
 
-  nodeSetSocketAvailability(ntree, socket_vector, data_type == CD_PROP_FLOAT3);
+  nodeSetSocketAvailability(ntree, socket_vector, ELEM(data_type, 
CD_PROP_FLOAT2, CD_PROP_FLOAT3));
   nodeSetSocketAvailability(ntree, socket_float, data_type == CD_PROP_FLOAT);
   nodeSetSocketAvailability(
   ntree, socket_color4f, ELEM(data_type, CD_PROP_COLOR, 
CD_PROP_BYTE_COLOR));
@@ -113,6 +113,11 @@ static void node_geo_exec(GeoNodeExecParams params)
 case CD_PROP_FLOAT:
   field = params.get_input>("Value_Float");
   break;
+case CD_PROP_FLOAT2: {
+  field = params.get_input>("Value_Vector");
+  field = bke::get_implicit_type_conversions().try_convert(field, 
CPPType::get());
+  break;
+}
 case CD_PROP_FLOAT3:
   field = params.get_input>("Value_Vector");
   break;

___
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] [55e1ef2c232] refactor-mesh-corner-normals-lazy: More progress, reverting unnecessary changes

2022-12-14 Thread Hans Goudey
Commit: 55e1ef2c232f0c1a19ee4b659004f61f80ff0b14
Author: Hans Goudey
Date:   Wed Dec 14 09:40:41 2022 -0600
Branches: refactor-mesh-corner-normals-lazy
https://developer.blender.org/rB55e1ef2c232f0c1a19ee4b659004f61f80ff0b14

More progress, reverting unnecessary changes

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/DerivedMesh.cc
M   source/blender/blenkernel/intern/data_transfer.cc
M   source/blender/blenkernel/intern/mesh.cc
M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/blenkernel/intern/mesh_wrapper.cc
M   source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh.hh
M   source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M   source/blender/modifiers/intern/MOD_displace.cc
M   source/blender/modifiers/intern/MOD_triangulate.cc
M   source/blender/render/intern/multires_bake.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 846250bd098..c75fac7452f 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -410,8 +410,6 @@ float (*BKE_mesh_vertex_normals_for_write(struct Mesh 
*mesh))[3];
  */
 float (*BKE_mesh_poly_normals_for_write(struct Mesh *mesh))[3];
 
-float (*BKE_mesh_corner_normals_for_write(struct Mesh *mesh))[3];
-
 /**
  * Mark the mesh's vertex normals non-dirty, for when they are calculated or 
assigned manually.
  */
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc 
b/source/blender/blenkernel/intern/DerivedMesh.cc
index d13f30b1898..88cdbdce963 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -559,8 +559,6 @@ static void mesh_calc_modifier_final_normals(const Mesh 
*mesh_input,
* which deals with drawing differently. */
   BKE_mesh_ensure_normals_for_display(mesh_final);
 }
-
-
   }
 }
 
diff --git a/source/blender/blenkernel/intern/data_transfer.cc 
b/source/blender/blenkernel/intern/data_transfer.cc
index cc914599005..382736ae502 100644
--- a/source/blender/blenkernel/intern/data_transfer.cc
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2014 Blender Foundation. All rights reserved. */
 
 /** \file
  * \ingroup bke
@@ -269,18 +271,19 @@ static void data_transfer_dtdata_type_preprocess(Mesh 
*me_src,
 const float split_angle_dst = me_dst->smoothresh;
 
 /* This should be ensured by cddata_masks we pass to code 
generating/giving us me_src now. */
-BLI_assert(CustomData_get_layer(_src->ldata, CD_NORMAL) != NULL);
+BLI_assert(CustomData_get_layer(_src->ldata, CD_NORMAL) != nullptr);
 (void)me_src;
 
 float(*loop_nors_dst)[3];
-short(*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, 
CD_CUSTOMLOOPNORMAL);
+short(*custom_nors_dst)[2] = static_cast(
+CustomData_get_layer(ldata_dst, CD_CUSTOMLOOPNORMAL));
 
 /* Cache loop nors into a temp CDLayer. */
-loop_nors_dst = CustomData_get_layer(ldata_dst, CD_NORMAL);
-const bool do_loop_nors_dst = (loop_nors_dst == NULL);
+loop_nors_dst = static_cast(CustomData_get_layer(ldata_dst, 
CD_NORMAL));
+const bool do_loop_nors_dst = (loop_nors_dst == nullptr);
 if (do_loop_nors_dst) {
-  loop_nors_dst = CustomData_add_layer(
-  ldata_dst, CD_NORMAL, CD_SET_DEFAULT, NULL, num_loops_dst);
+  loop_nors_dst = static_cast(
+  CustomData_add_layer(ldata_dst, CD_NORMAL, CD_SET_DEFAULT, nullptr, 
num_loops_dst));
   CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
 }
 if (dirty_nors_dst || do_loop_nors_dst) {
@@ -297,8 +300,8 @@ static void data_transfer_dtdata_type_preprocess(Mesh 
*me_src,
   num_polys_dst,
   use_split_nors_dst,
   split_angle_dst,
-  NULL,
-  NULL,
+  nullptr,
+  nullptr,
   custom_nors_dst);
 }
   }
@@ -328,12 +331,14 @@ static void data_transfer_dtdata_type_postprocess(Object 
*UNUSED(ob_src),
 CustomData *ldata_dst = _dst->ldata;
 
 const float(*poly_nors_dst)[3] = BKE_mesh_poly_normals_ensure(me_dst);
-float(*loop_nors_dst)[3] = CustomData_get_layer(ldata_dst, CD_NORMAL);
-short(*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, 
CD_CUSTOMLOOPNORMAL);
+float(*loop_nors_dst)[3] = static_cast(
+CustomData_get_layer(ldata_dst, CD_NORMAL));
+short(*custom_nors_dst)[2] = static_cast(
+CustomData_get_layer(ldata_dst, CD_CUSTOMLOOPNORMAL));
 
 

[Bf-blender-cvs] [26cc225ed84] refactor-mesh-corner-normals-lazy: Merge branch 'master' into refactor-mesh-corner-normals-lazy

2022-12-14 Thread Hans Goudey
Commit: 26cc225ed844c98cfc738e9bf3c763b4af093f53
Author: Hans Goudey
Date:   Tue Dec 13 18:48:03 2022 -0600
Branches: refactor-mesh-corner-normals-lazy
https://developer.blender.org/rB26cc225ed844c98cfc738e9bf3c763b4af093f53

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

===



===

diff --cc source/blender/blenkernel/intern/data_transfer.cc
index c0a82aac25a,382736ae502..cc914599005
--- a/source/blender/blenkernel/intern/data_transfer.cc
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@@ -1,5 -1,5 +1,3 @@@
--/* SPDX-License-Identifier: GPL-2.0-or-later
-- * Copyright 2014 Blender Foundation. All rights reserved. */
  
  /** \file
   * \ingroup bke
@@@ -330,11 -331,14 +328,12 @@@ static void data_transfer_dtdata_type_p
  CustomData *ldata_dst = _dst->ldata;
  
  const float(*poly_nors_dst)[3] = BKE_mesh_poly_normals_ensure(me_dst);
 -float(*loop_nors_dst)[3] = static_cast(
 -CustomData_get_layer(ldata_dst, CD_NORMAL));
 -short(*custom_nors_dst)[2] = static_cast(
 -CustomData_get_layer(ldata_dst, CD_CUSTOMLOOPNORMAL));
++float(*loop_nors_dst)[3] = CustomData_get_layer(ldata_dst, CD_NORMAL);
 +short(*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, 
CD_CUSTOMLOOPNORMAL);
  
  if (!custom_nors_dst) {
 -  custom_nors_dst = static_cast(CustomData_add_layer(
 -  ldata_dst, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, nullptr, 
num_loops_dst));
 +  custom_nors_dst = CustomData_add_layer(
 +  ldata_dst, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, NULL, 
num_loops_dst);
  }
  
  /* Note loop_nors_dst contains our custom normals as transferred from 
source... */
diff --cc source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index 32409d644ed,181180267db..3b2d70f9d4f
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@@ -173,17 -181,20 +181,14 @@@ int OBJMesh::ith_smooth_group(const in
return poly_smooth_groups_[poly_index];
  }
  
 -void OBJMesh::ensure_mesh_normals() const
 -{
 -  /* Const cast can be removed when calculating face corner normals lazily is 
possible. */
 -  BKE_mesh_calc_normals_split(const_cast(export_mesh_));
 -}
 -
  void OBJMesh::calc_smooth_groups(const bool use_bitflags)
  {
-   const Span edges = export_mesh_eval_->edges();
-   const Span polys = export_mesh_eval_->polys();
-   const Span loops = export_mesh_eval_->loops();
-   poly_smooth_groups_ = BKE_mesh_calc_smoothgroups(edges.data(),
-edges.size(),
-polys.data(),
-polys.size(),
-loops.data(),
-loops.size(),
+   poly_smooth_groups_ = BKE_mesh_calc_smoothgroups(mesh_edges_.data(),
+mesh_edges_.size(),
+mesh_polys_.data(),
+mesh_polys_.size(),
+mesh_loops_.data(),
+mesh_loops_.size(),
 _smooth_groups_,
 use_bitflags);
  }
@@@ -381,13 -382,13 +376,13 @@@ void OBJMesh::store_normal_coords_and_i
int cur_normal_index = 0;
Map normal_to_index;
/* We don't know how many unique normals there will be, but this is a 
guess. */
-   normal_to_index.reserve(export_mesh_eval_->totpoly);
-   loop_to_normal_index_.resize(export_mesh_eval_->totloop);
+   normal_to_index.reserve(export_mesh_->totpoly);
+   loop_to_normal_index_.resize(export_mesh_->totloop);
loop_to_normal_index_.fill(-1);
-   /* TODO: Only get loop normals when they're necessary. */
-   const float(*lnors)[3] = BKE_mesh_corner_normals_ensure(export_mesh_eval_);
+   const float(*lnors)[3] = static_cast(
 -  CustomData_get_layer(_mesh_->ldata, CD_NORMAL));
 -  for (int poly_index = 0; poly_index < export_mesh_->totpoly; ++poly_index) {
 -const MPoly  = mesh_polys_[poly_index];
++  CustomData_get_layer(_mesh_eval_->ldata, CD_NORMAL));
 +  for (int poly_index = 0; poly_index < export_mesh_eval_->totpoly; 
++poly_index) {
 +const MPoly  = polys[poly_index];
  bool need_per_loop_normals = lnors != nullptr || (mpoly.flag & ME_SMOOTH);
  if (need_per_loop_normals) {
for (int loop_of_poly = 0; loop_of_poly < mpoly.totloop; 
++loop_of_poly) {
diff --cc source/blender/modifiers/intern/MOD_displace.cc
index a8d10d6ccb4,527bbeae0e5..fc12a9c2aad
--- a/source/blender/modifiers/intern/MOD_displace.cc
+++ 

[Bf-blender-cvs] [45dbd69296f] master: Fix compiler error on MSVC after a243a9dc79eb

2022-12-14 Thread Julian Eisel
Commit: 45dbd69296f0677481daff0c915dbc02db743e07
Author: Julian Eisel
Date:   Wed Dec 14 16:08:26 2022 +0100
Branches: master
https://developer.blender.org/rB45dbd69296f0677481daff0c915dbc02db743e07

Fix compiler error on MSVC after a243a9dc79eb

===

M   source/blender/editors/asset/intern/asset_ops.cc

===

diff --git a/source/blender/editors/asset/intern/asset_ops.cc 
b/source/blender/editors/asset/intern/asset_ops.cc
index 497b655c7ce..3bbfa2ac0f4 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -14,6 +14,7 @@
 #include "BKE_preferences.h"
 #include "BKE_report.h"
 
+#include "BLI_fileops.h" /* MSVC needs this for `PATH_MAX` */
 #include "BLI_fnmatch.h"
 #include "BLI_path_util.h"
 #include "BLI_set.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] [8daaf71688b] master: deps_builder: add missing freetype dep to harfbuzz

2022-12-14 Thread Ray Molenkamp
Commit: 8daaf71688b849cbbb31b2af7a1260db773b2348
Author: Ray Molenkamp
Date:   Wed Dec 14 08:03:28 2022 -0700
Branches: master
https://developer.blender.org/rB8daaf71688b849cbbb31b2af7a1260db773b2348

deps_builder: add missing freetype dep to harfbuzz

without it harfbuzz could build before freetype which
it needs to build.

===

M   build_files/build_environment/cmake/harfbuzz.cmake

===

diff --git a/build_files/build_environment/cmake/harfbuzz.cmake 
b/build_files/build_environment/cmake/harfbuzz.cmake
index 3eb994f72fe..d34d312c9d8 100644
--- a/build_files/build_environment/cmake/harfbuzz.cmake
+++ b/build_files/build_environment/cmake/harfbuzz.cmake
@@ -33,6 +33,7 @@ ExternalProject_Add(external_harfbuzz
 add_dependencies(
   external_harfbuzz
   external_python
+  external_freetype
   # Needed for `MESON`.
   external_python_site_packages
 )

___
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] [fe3110a2859] master: Fix FallbackCyclesBlitShader compilation error

2022-12-14 Thread Germano Cavalcante
Commit: fe3110a2859d84401dceda06fd41f3b082eae790
Author: Germano Cavalcante
Date:   Wed Dec 14 11:59:11 2022 -0300
Branches: master
https://developer.blender.org/rBfe3110a2859d84401dceda06fd41f3b082eae790

Fix FallbackCyclesBlitShader compilation error

Error: C0204: version directive must be first statement and may not be
repeated

===

M   intern/cycles/blender/display_driver.cpp

===

diff --git a/intern/cycles/blender/display_driver.cpp 
b/intern/cycles/blender/display_driver.cpp
index 3c347145117..60dd5e2c1d2 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -57,7 +57,6 @@ int BlenderDisplayShader::get_tex_coord_attrib_location()
 
 /* TODO move shaders to standalone .glsl file. */
 static const char *FALLBACK_VERTEX_SHADER =
-"#version 330\n"
 "uniform vec2 fullscreen;\n"
 "in vec2 texCoord;\n"
 "in vec2 pos;\n"
@@ -75,7 +74,6 @@ static const char *FALLBACK_VERTEX_SHADER =
 "}\n\0";
 
 static const char *FALLBACK_FRAGMENT_SHADER =
-"#version 330\n"
 "uniform sampler2D image_texture;\n"
 "in vec2 texCoord_interp;\n"
 "out vec4 fragColor;\n"

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


[Bf-blender-cvs] [a243a9dc79e] master: Cleanup: Remove unused headers in asset files

2022-12-14 Thread Julian Eisel
Commit: a243a9dc79ebe6cf4ee473be69a0d28b5b05375c
Author: Julian Eisel
Date:   Tue Dec 13 17:24:24 2022 +0100
Branches: master
https://developer.blender.org/rBa243a9dc79ebe6cf4ee473be69a0d28b5b05375c

Cleanup: Remove unused headers in asset files

===

M   source/blender/asset_system/intern/asset_catalog.cc
M   source/blender/asset_system/intern/asset_library.cc
M   source/blender/asset_system/intern/asset_library_service.cc
M   source/blender/asset_system/intern/asset_representation.cc
M   source/blender/asset_system/tests/asset_catalog_test.cc
M   source/blender/asset_system/tests/asset_catalog_tree_test.cc
M   source/blender/asset_system/tests/asset_library_test.cc
M   source/blender/editors/asset/intern/asset_handle.cc
M   source/blender/editors/asset/intern/asset_indexer.cc
M   source/blender/editors/asset/intern/asset_list.cc
M   source/blender/editors/asset/intern/asset_ops.cc

===

diff --git a/source/blender/asset_system/intern/asset_catalog.cc 
b/source/blender/asset_system/intern/asset_catalog.cc
index 9b47aca1209..c295f2de16e 100644
--- a/source/blender/asset_system/intern/asset_catalog.cc
+++ b/source/blender/asset_system/intern/asset_catalog.cc
@@ -9,7 +9,6 @@
 
 #include "AS_asset_catalog.hh"
 #include "AS_asset_catalog_tree.hh"
-#include "AS_asset_library.h"
 #include "AS_asset_library.hh"
 
 #include "BLI_fileops.hh"
diff --git a/source/blender/asset_system/intern/asset_library.cc 
b/source/blender/asset_system/intern/asset_library.cc
index 73f81a50e46..9a6b73ef501 100644
--- a/source/blender/asset_system/intern/asset_library.cc
+++ b/source/blender/asset_system/intern/asset_library.cc
@@ -17,7 +17,6 @@
 
 #include "BLI_fileops.h"
 #include "BLI_path_util.h"
-#include "BLI_set.hh"
 
 #include "DNA_userdef_types.h"
 
diff --git a/source/blender/asset_system/intern/asset_library_service.cc 
b/source/blender/asset_system/intern/asset_library_service.cc
index 37136968946..79097ac8cd2 100644
--- a/source/blender/asset_system/intern/asset_library_service.cc
+++ b/source/blender/asset_system/intern/asset_library_service.cc
@@ -7,8 +7,6 @@
 #include "BKE_blender.h"
 #include "BKE_preferences.h"
 
-#include "BLI_fileops.h" /* For PATH_MAX (at least on Windows). */
-#include "BLI_path_util.h"
 #include "BLI_string_ref.hh"
 
 #include "DNA_asset_types.h"
diff --git a/source/blender/asset_system/intern/asset_representation.cc 
b/source/blender/asset_system/intern/asset_representation.cc
index c6bc5193570..573358b7df7 100644
--- a/source/blender/asset_system/intern/asset_representation.cc
+++ b/source/blender/asset_system/intern/asset_representation.cc
@@ -13,8 +13,6 @@
 #include "AS_asset_representation.h"
 #include "AS_asset_representation.hh"
 
-#include "BKE_asset.h"
-
 namespace blender::asset_system {
 
 AssetRepresentation::AssetRepresentation(AssetIdentifier &,
diff --git a/source/blender/asset_system/tests/asset_catalog_test.cc 
b/source/blender/asset_system/tests/asset_catalog_test.cc
index 87819f3683b..3e117e3da97 100644
--- a/source/blender/asset_system/tests/asset_catalog_test.cc
+++ b/source/blender/asset_system/tests/asset_catalog_test.cc
@@ -4,7 +4,6 @@
 #include "AS_asset_catalog.hh"
 #include "AS_asset_catalog_tree.hh"
 
-#include "BKE_appdir.h"
 #include "BKE_preferences.h"
 
 #include "BLI_fileops.h"
@@ -13,8 +12,6 @@
 #include "DNA_asset_types.h"
 #include "DNA_userdef_types.h"
 
-#include "CLG_log.h"
-
 #include "testing/testing.h"
 
 #include "asset_library_test_common.hh"
diff --git a/source/blender/asset_system/tests/asset_catalog_tree_test.cc 
b/source/blender/asset_system/tests/asset_catalog_tree_test.cc
index fb1cbde517d..3355423cb48 100644
--- a/source/blender/asset_system/tests/asset_catalog_tree_test.cc
+++ b/source/blender/asset_system/tests/asset_catalog_tree_test.cc
@@ -4,17 +4,8 @@
 #include "AS_asset_catalog.hh"
 #include "AS_asset_catalog_tree.hh"
 
-#include "BKE_appdir.h"
-#include "BKE_preferences.h"
-
-#include "BLI_fileops.h"
 #include "BLI_path_util.h"
 
-#include "DNA_asset_types.h"
-#include "DNA_userdef_types.h"
-
-#include "CLG_log.h"
-
 #include "testing/testing.h"
 
 #include "asset_library_test_common.hh"
diff --git a/source/blender/asset_system/tests/asset_library_test.cc 
b/source/blender/asset_system/tests/asset_library_test.cc
index 059f3d9a46c..1b8d2f8ff0c 100644
--- a/source/blender/asset_system/tests/asset_library_test.cc
+++ b/source/blender/asset_system/tests/asset_library_test.cc
@@ -5,7 +5,6 @@
 #include "AS_asset_library.h"
 #include "AS_asset_library.hh"
 
-#include "BKE_appdir.h"
 #include "BKE_callbacks.h"
 
 #include "asset_library_service.hh"
diff --git a/source/blender/editors/asset/intern/asset_handle.cc 
b/source/blender/editors/asset/intern/asset_handle.cc
index 3528a3824db..26b6f09b231 100644
--- a/source/blender/editors/asset/intern/asset_handle.cc
+++ 

[Bf-blender-cvs] [f4912e7f5b2] master: Fix asset loading indicator in node add menu disappearing too early

2022-12-14 Thread Julian Eisel
Commit: f4912e7f5b250b00e34888d79549f91562817654
Author: Julian Eisel
Date:   Tue Dec 13 17:25:40 2022 +0100
Branches: master
https://developer.blender.org/rBf4912e7f5b250b00e34888d79549f91562817654

Fix asset loading indicator in node add menu disappearing too early

The "Loading Asset Libraries" label in the menu would already disappear
before the asset libraries are done loading. It only queried if the
loading was started, not if it was finished. Especially notable when the
asset library was slow to load, e.g. because it is not yet in the asset
index.

===

M   source/blender/editors/asset/intern/asset_list.cc

===

diff --git a/source/blender/editors/asset/intern/asset_list.cc 
b/source/blender/editors/asset/intern/asset_list.cc
index 5b3d256c70c..caceedbd4a5 100644
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@ -111,6 +111,7 @@ class AssetList : NonCopyable {
   void clear(bContext *C);
 
   bool needsRefetch() const;
+  bool isLoaded() const;
   void iterate(AssetListIterFn fn) const;
   bool listen(const wmNotifier ) const;
   int size() const;
@@ -189,6 +190,11 @@ bool AssetList::needsRefetch() const
   return filelist_needs_force_reset(filelist_) || 
filelist_needs_reading(filelist_);
 }
 
+bool AssetList::isLoaded() const
+{
+  return filelist_is_ready(filelist_);
+}
+
 void AssetList::iterate(AssetListIterFn fn) const
 {
   FileList *files = filelist_;
@@ -422,7 +428,7 @@ bool ED_assetlist_is_loaded(const AssetLibraryReference 
*library_reference)
   if (list->needsRefetch()) {
 return false;
   }
-  return true;
+  return list->isLoaded();
 }
 
 void ED_assetlist_ensure_previews_job(const AssetLibraryReference 
*library_reference,

___
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] [c30fdb9cf52] master: Fix mismatching PTX function declarations for OSL intrinsics with string parameters

2022-12-14 Thread Patrick Mours
Commit: c30fdb9cf52d62dcd25fbc93f29c2983cc90a447
Author: Patrick Mours
Date:   Wed Dec 14 15:21:39 2022 +0100
Branches: master
https://developer.blender.org/rBc30fdb9cf52d62dcd25fbc93f29c2983cc90a447

Fix mismatching PTX function declarations for OSL intrinsics with string 
parameters

The use of a struct for device strings caused the CUDA compiler to
generate byte arrays as the argument type, whereas OSL generated
primitive integer types (for the hash). Fix that by using a typedef
instead so that the CUDA compiler too will use an integer type in the
PTX it generates.

Maniphest Tasks: T101222

===

M   intern/cycles/kernel/osl/services_gpu.h
M   intern/cycles/kernel/osl/types.h

===

diff --git a/intern/cycles/kernel/osl/services_gpu.h 
b/intern/cycles/kernel/osl/services_gpu.h
index 75cf39919a0..744c7103b28 100644
--- a/intern/cycles/kernel/osl/services_gpu.h
+++ b/intern/cycles/kernel/osl/services_gpu.h
@@ -14,111 +14,111 @@
 namespace DeviceStrings {
 
 /* "" */
-ccl_device_constant DeviceString _emptystring_ = {0ull};
+ccl_device_constant DeviceString _emptystring_ = 0ull;
 /* "common" */
-ccl_device_constant DeviceString u_common = {14645198576927606093ull};
+ccl_device_constant DeviceString u_common = 14645198576927606093ull;
 /* "world" */
-ccl_device_constant DeviceString u_world = {16436542438370751598ull};
+ccl_device_constant DeviceString u_world = 16436542438370751598ull;
 /* "shader" */
-ccl_device_constant DeviceString u_shader = {4279676006089868ull};
+ccl_device_constant DeviceString u_shader = 4279676006089868ull;
 /* "object" */
-ccl_device_constant DeviceString u_object = {973692718279674627ull};
+ccl_device_constant DeviceString u_object = 973692718279674627ull;
 /* "NDC" */
-ccl_device_constant DeviceString u_ndc = {5148305047403260775ull};
+ccl_device_constant DeviceString u_ndc = 5148305047403260775ull;
 /* "screen" */
-ccl_device_constant DeviceString u_screen = {14159088609039777114ull};
+ccl_device_constant DeviceString u_screen = 14159088609039777114ull;
 /* "camera" */
-ccl_device_constant DeviceString u_camera = {2159505832145726196ull};
+ccl_device_constant DeviceString u_camera = 2159505832145726196ull;
 /* "raster" */
-ccl_device_constant DeviceString u_raster = {7759263238610201778ull};
+ccl_device_constant DeviceString u_raster = 7759263238610201778ull;
 /* "hsv" */
-ccl_device_constant DeviceString u_hsv = {2177035556331879497ull};
+ccl_device_constant DeviceString u_hsv = 2177035556331879497ull;
 /* "hsl" */
-ccl_device_constant DeviceString u_hsl = {7749766809258288148ull};
+ccl_device_constant DeviceString u_hsl = 7749766809258288148ull;
 /* "XYZ" */
-ccl_device_constant DeviceString u_xyz = {4957977063494975483ull};
+ccl_device_constant DeviceString u_xyz = 4957977063494975483ull;
 /* "xyY" */
-ccl_device_constant DeviceString u_xyy = {5138822319725660255ull};
+ccl_device_constant DeviceString u_xyy = 5138822319725660255ull;
 /* "sRGB" */
-ccl_device_constant DeviceString u_srgb = {15368599878474175032ull};
+ccl_device_constant DeviceString u_srgb = 15368599878474175032ull;
 /* "object:location" */
-ccl_device_constant DeviceString u_object_location = {7846190347358762897ull};
+ccl_device_constant DeviceString u_object_location = 7846190347358762897ull;
 /* "object:color" */
-ccl_device_constant DeviceString u_object_color = {12695623857059169556ull};
+ccl_device_constant DeviceString u_object_color = 12695623857059169556ull;
 /* "object:alpha" */
-ccl_device_constant DeviceString u_object_alpha = {11165053919428293151ull};
+ccl_device_constant DeviceString u_object_alpha = 11165053919428293151ull;
 /* "object:index" */
-ccl_device_constant DeviceString u_object_index = {6588325838217472556ull};
+ccl_device_constant DeviceString u_object_index = 6588325838217472556ull;
 /* "geom:dupli_generated" */
-ccl_device_constant DeviceString u_geom_dupli_generated = 
{6715607178003388908ull};
+ccl_device_constant DeviceString u_geom_dupli_generated = 
6715607178003388908ull;
 /* "geom:dupli_uv" */
-ccl_device_constant DeviceString u_geom_dupli_uv = {1294253317490155849ull};
+ccl_device_constant DeviceString u_geom_dupli_uv = 1294253317490155849ull;
 /* "material:index" */
-ccl_device_constant DeviceString u_material_index = {741770758159634623ull};
+ccl_device_constant DeviceString u_material_index = 741770758159634623ull;
 /* "object:random" */
-ccl_device_constant DeviceString u_object_random = {15789063994977955884ull};
+ccl_device_constant DeviceString u_object_random = 15789063994977955884ull;
 /* "particle:index" */
-ccl_device_constant DeviceString u_particle_index = {9489711748229903784ull};
+ccl_device_constant DeviceString u_particle_index = 9489711748229903784ull;
 /* "particle:random" */
-ccl_device_constant DeviceString u_particle_random = {17993722202766855761ull};
+ccl_device_constant DeviceString u_particle_random = 

[Bf-blender-cvs] [7bd7538b254] microfacet_hair: Revert to original implementation (needs investigation)

2022-12-14 Thread Weizhen Huang
Commit: 7bd7538b2540e01b2885565215f520ea2bfd392a
Author: Weizhen Huang
Date:   Wed Dec 14 15:18:43 2022 +0100
Branches: microfacet_hair
https://developer.blender.org/rB7bd7538b2540e01b2885565215f520ea2bfd392a

Revert to original implementation (needs investigation)

===

M   intern/cycles/kernel/closure/bsdf_hair_microfacet.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h 
b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
index 8cf39366111..b5e88464776 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
@@ -612,16 +612,16 @@ ccl_device Spectrum 
bsdf_microfacet_hair_eval_circular(KernelGlobals kg,
   const float3 R = bsdf_microfacet_hair_eval_r_circular(sc, wi, wo) +
bsdf_microfacet_hair_eval_tt_trt_circular(kg, sc, wi, wo, 
sd->lcg_state);
 
-  /* This choice could be better */
+  /* TODO: better estimation of the pdf */
   *pdf = 1.f;
 
   // original from Huang's EGSR 2022
-  // return rgb_to_spectrum(R / cos_theta(wi));
+  return rgb_to_spectrum(R / cos_theta(wi));
 
   // correction: the extra cos_theta(wo) corresponds to the lack of 
consideration of Zinke's
   // cos_theta_i^2 in the BCSDF; for instance eq[2] in Huang's should include 
an extra cos_theta_i
   // (plus here remember wi and wo meanings are flipped)
-  return rgb_to_spectrum(R / (cos_theta(wi) * cos_theta(wo)));
+  /* return rgb_to_spectrum(R / (cos_theta(wi) * cos_theta(wo))); */
 }
 
 ccl_device int bsdf_microfacet_hair_sample_circular(const KernelGlobals kg,
@@ -814,12 +814,12 @@ ccl_device int bsdf_microfacet_hair_sample_circular(const 
KernelGlobals kg,
   }
 
   // original from Huang's EGSR 2022
-  //*eval *= visibility;
+  *eval *= visibility;
 
   // correction: the extra cos_theta(wo) corresponds to the lack of 
consideration of Zinke's
   // cos_theta_i^2 in the BCSDF; for instance eq[2] in Huang's should include 
an extra cos_theta_i
   // (plus here remember wi and wo meanings are flipped)
-  *eval *= visibility / cos_theta(wo);
+  /* *eval *= visibility / cos_theta(wo); */
 
   *omega_in = wo.x * X + wo.y * Y + wo.z * Z;
 
@@ -1155,8 +1155,8 @@ ccl_device Spectrum 
bsdf_microfacet_hair_eval_elliptic(KernelGlobals kg,
 
   *pdf = 1.f;
 
-  // return rgb_to_spectrum(R / cos_theta(wi)); // original from Huang's EGSR 
2022
-  return rgb_to_spectrum(R / (cos_theta(wi) * cos_theta(wo)));
+  return rgb_to_spectrum(R / cos_theta(wi));  // original from Huang's EGSR 
2022
+  /* return rgb_to_spectrum(R / (cos_theta(wi) * cos_theta(wo))); */
   // correction: the extra cos_theta(wo) corresponds to the lack of 
consideration of Zinke's
   // cos_theta_i^2 in the BCSDF; for instance eq[2] in Huang's should include 
an extra cos_theta_i
   // (plus here remember wi and wo meanings are flipped)
@@ -1373,8 +1373,8 @@ ccl_device int bsdf_microfacet_hair_sample_elliptic(const 
KernelGlobals kg,
 label |= LABEL_TRANSMIT;
   }
 
-  //*eval *= visibility; // original from Huang's EGSR 2022
-  *eval *= visibility / cos_theta(wo);
+  *eval *= visibility;  // original from Huang's EGSR 2022
+  /* *eval *= visibility / cos_theta(wo); */
   // correction: the extra cos_theta(wo) corresponds to the lack of 
consideration of Zinke's
   // cos_theta_i^2 in the BCSDF; for instance eq[2] in Huang's should include 
an extra cos_theta_i
   // (plus here remember wi and wo meanings are flipped)

___
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] [1edaee99266] microfacet_hair: Cleanup: renaming a few functions and variables

2022-12-14 Thread Weizhen Huang
Commit: 1edaee99266d9c0a3db34a12cc5c90bfbbc04900
Author: Weizhen Huang
Date:   Wed Dec 14 15:13:15 2022 +0100
Branches: microfacet_hair
https://developer.blender.org/rB1edaee99266d9c0a3db34a12cc5c90bfbbc04900

Cleanup: renaming a few functions and variables

===

M   intern/cycles/kernel/closure/bsdf_hair_microfacet.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h 
b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
index cf87fa73e2d..8cf39366111 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_microfacet.h
@@ -66,8 +66,8 @@ ccl_device int bsdf_microfacet_hair_setup(ccl_private 
ShaderData *sd,
   bsdf->roughness = clamp(bsdf->roughness, 0.001f, 1.0f);
 
   /* Compute local frame, aligned to curve tangent and ray direction. */
-  float3 X = safe_normalize(sd->dPdu);
-  float3 Y = safe_normalize(cross(X, sd->I));
+  float3 Y = safe_normalize(sd->dPdu);
+  float3 X = safe_normalize(cross(Y, sd->I));
 
   /* h -1..0..1 means the rays goes from grazing the hair, to hitting it at
* the center, to grazing the other edge. This is the sine of the angle
@@ -75,13 +75,13 @@ ccl_device int bsdf_microfacet_hair_setup(ccl_private 
ShaderData *sd,
 
   /* TODO: we convert this value to a cosine later and discard the sign, so
* we could probably save some operations. */
-  float h = (sd->type & PRIMITIVE_CURVE_RIBBON) ? -sd->v : -dot(Y, sd->Ng);
+  float h = (sd->type & PRIMITIVE_CURVE_RIBBON) ? -sd->v : -dot(X, sd->Ng);
 
   kernel_assert(fabsf(h) < 1.0f + 1e-4f);
-  kernel_assert(isfinite_safe(Y));
+  kernel_assert(isfinite_safe(X));
   kernel_assert(isfinite_safe(h));
 
-  bsdf->extra->geom = make_float4(Y.x, Y.y, Y.z, h);
+  bsdf->extra->geom = make_float4(X.x, X.y, X.z, h);
 
   return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_NEEDS_LCG | 
SD_BSDF_HAS_TRANSMISSION;
 }
@@ -216,15 +216,18 @@ ccl_device_inline float3 sample_wh(KernelGlobals kg,
 }
 
 /* Check micronormal/mesonormal direct visiblity from v */
-ccl_device_inline bool smith_g1_(const float3 v, const float3 m, const float3 
h)
+ccl_device_inline bool microfacet_visible(const float3 v, const float3 m, 
const float3 h)
 {
   return (dot(v, h) > 0.f && dot(v, m) > 0.f);
 }
 
 /* Check micronormal/mesonormal direct visiblity from wi and wo */
-ccl_device_inline bool G_(const float3 wi, const float3 wo, const float3 m, 
const float3 h)
+ccl_device_inline bool microfacet_visible(const float3 wi,
+  const float3 wo,
+  const float3 m,
+  const float3 h)
 {
-  return smith_g1_(wi, m, h) && smith_g1_(wo, m, h);
+  return microfacet_visible(wi, m, h) && microfacet_visible(wo, m, h);
 }
 
 /* Check micronormal/mesonormal statistical visiblity from v: Smith's 
separable shadowing/masking
@@ -238,23 +241,8 @@ ccl_device_inline float smith_g1(
   if (dot(v, h) <= 0.f || cos_vm <= 0.f)
 return 0.f;
 
-  const float roughness2 = sqr(roughness);
-
-  float result;
-  if (beckmann) {
-float tmp = fabsf(1.f / (sqr(cos_vm)) - 1.f);
-float a_sqr = 1.f / (roughness2 * tmp);
-float a = sqrtf(a_sqr);
-
-/* Use a fast and accurate (<0.35% rel. error) rational approximation to 
the shadowing-masking
- * function */
-result = (a >= 1.6f) ? 1.f :
-   (3.535f * a + 2.181f * a_sqr) / (1.f + 2.276f * a + 
2.577f * a_sqr);
-  }
-  else {
-result = 2.f / (1.f + sqrtf(roughness2 / sqr(cos_vm) + 1.f - roughness2));
-  }
-  return result;
+  return beckmann ? bsdf_beckmann_G1(roughness, cos_vm) :
+2.f / (1.f + sqrtf(1.0f + sqr(roughness) * (1.0f / 
sqr(cos_vm) - 1.0f)));
 }
 
 /* Smith's separable shadowing-masking approximation */
@@ -326,10 +314,10 @@ ccl_device float fresnel(float cos_theta_i, float eta, 
ccl_private float _th
   return r;
 }
 
-ccl_device_inline float3 refract(const float3 incident,
- const float3 normal,
- const float cos_theta_t,
- const float inv_eta)
+ccl_device_inline float3 refract_angle(const float3 incident,
+   const float3 normal,
+   const float cos_theta_t,
+   const float inv_eta)
 {
   return inv_eta * incident - (inv_eta * dot(normal, incident) + cos_theta_t) 
* normal;
 }
@@ -429,7 +417,7 @@ ccl_device float3 
bsdf_microfacet_hair_eval_r_circular(ccl_private const ShaderC
   const float3 wm = sph_dir(tilt, phi_m);
   const float J = fmaxf(cos(phi_i - phi_m), 0.f);
 
-  if (G_(wi, wo, make_float3(wm.x, 0.f, wm.z), wh)) {
+  if (microfacet_visible(wi, wo, make_float3(wm.x, 0.f, wm.z), wh)) {
 const float weight = (i == 0 

[Bf-blender-cvs] [cdc73cb8404] blender-v2.93-release: Fix T102685: Grease Pencil brush cursors missing on file open

2022-12-14 Thread Philipp Oeser
Commit: cdc73cb8404fc2b72d813a02acbd3e2f53eda5ab
Author: Philipp Oeser
Date:   Thu Nov 24 14:04:16 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rBcdc73cb8404fc2b72d813a02acbd3e2f53eda5ab

Fix T102685: Grease Pencil brush cursors missing on file open

Brush cursors were missing when opening a file saved in sculpt/vertex-/
weightpaint mode.

Since we dont do a full modeswitch on file load in `ED_editors_init` for
grease pencil since rBde994d6b7b1c, we were missing the brush cursor
toggling [`ED_gpencil_toggle_brush_cursor`] normally done in
`ED_gpencil_setup_modes`.

This is now explicitly added for any greasepencil paintmode (in case
object is active).

Maniphest Tasks: T102685

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

===

M   source/blender/editors/util/ed_util.c

===

diff --git a/source/blender/editors/util/ed_util.c 
b/source/blender/editors/util/ed_util.c
index b80782b51be..f4a69c96c13 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -46,6 +46,7 @@
 #include "DEG_depsgraph.h"
 
 #include "ED_armature.h"
+#include "ED_gpencil.h"
 #include "ED_image.h"
 #include "ED_mesh.h"
 #include "ED_object.h"
@@ -117,6 +118,9 @@ void ED_editors_init(bContext *C)
 ob->mode = OB_MODE_OBJECT;
 DEG_id_tag_update(>id, ID_RECALC_COPY_ON_WRITE);
   }
+  else if (mode & OB_MODE_ALL_PAINT_GPENCIL) {
+ED_gpencil_toggle_brush_cursor(C, true, NULL);
+  }
   continue;
 }

___
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] [1f30e7c183c] blender-v2.93-release: Fix: missing greasepencil hook modifier relationship lines

2022-12-14 Thread Philipp Oeser
Commit: 1f30e7c183cd9d5f04579e8c37d236360d0e6c44
Author: Philipp Oeser
Date:   Fri Nov 25 09:43:51 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB1f30e7c183cd9d5f04579e8c37d236360d0e6c44

Fix: missing greasepencil hook modifier relationship lines

Overlay relationship lines were missing between the object having the
modifier and the target object.

To make this consistent with other objects types, now draw relationship
lines for greasepencil and hooks now, too.

Spotted while looking into T102741.

Maniphest Tasks: T102741

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

===

M   source/blender/draw/engines/overlay/overlay_extra.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_extra.c 
b/source/blender/draw/engines/overlay/overlay_extra.c
index 7da94b52faa..a4e851f2406 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -42,6 +42,7 @@
 #include "DNA_constraint_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_fluid_types.h"
+#include "DNA_gpencil_modifier_types.h"
 #include "DNA_lightprobe_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
@@ -1290,6 +1291,17 @@ static void 
OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
   OVERLAY_extra_point(cb, center, relation_color);
 }
   }
+  for (GpencilModifierData *md = ob->greasepencil_modifiers.first; md; md = 
md->next) {
+if (md->type == eGpencilModifierType_Hook) {
+  HookGpencilModifierData *hmd = (HookGpencilModifierData *)md;
+  float center[3];
+  mul_v3_m4v3(center, ob->obmat, hmd->cent);
+  if (hmd->object) {
+OVERLAY_extra_line_dashed(cb, hmd->object->obmat[3], center, 
relation_color);
+  }
+  OVERLAY_extra_point(cb, center, relation_color);
+}
+  }
 
   if (ob->rigidbody_constraint) {
 Object *rbc_ob1 = ob->rigidbody_constraint->ob1;

___
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] [3e3a70a8bb1] blender-v2.93-release: Fix File Browser Move Bookmark malfunction if no item is selected

2022-12-14 Thread Philipp Oeser
Commit: 3e3a70a8bb178caaf1f5975d72c79a1cdcf23c68
Author: Philipp Oeser
Date:   Fri Nov 4 10:28:20 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB3e3a70a8bb178caaf1f5975d72c79a1cdcf23c68

Fix File Browser Move Bookmark malfunction if no item is selected

The operator was acting on non selected items (wasnt checking SpaceFile
bookmarknr for being -1) which could end up removing items even.

Now sanatize this by introducing proper poll (which returns false if
nothing is selected).

Fixes T102014.

Maniphest Tasks: T102014

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

===

M   source/blender/editors/space_file/file_ops.c

===

diff --git a/source/blender/editors/space_file/file_ops.c 
b/source/blender/editors/space_file/file_ops.c
index 856bd5b1bc3..435f8cd274b 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1280,6 +1280,13 @@ static int bookmark_move_exec(bContext *C, wmOperator 
*op)
   return OPERATOR_FINISHED;
 }
 
+static bool file_bookmark_move_poll(bContext *C)
+{
+  SpaceFile *sfile = CTX_wm_space_file(C);
+
+  return sfile->bookmarknr != -1;
+}
+
 void FILE_OT_bookmark_move(wmOperatorType *ot)
 {
   static const EnumPropertyItem slot_move[] = {
@@ -1297,6 +1304,7 @@ void FILE_OT_bookmark_move(wmOperatorType *ot)
   /* api callbacks */
   ot->poll = ED_operator_file_active;
   ot->exec = bookmark_move_exec;
+  ot->poll = file_bookmark_move_poll;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER; /* No undo! */

___
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] [9e0fcd57557] blender-v2.93-release: Fix T102514: wrong scene reported for missing compositing camera

2022-12-14 Thread Philipp Oeser
Commit: 9e0fcd575572e4156be8ad45afef0dbd5130d209
Author: Philipp Oeser
Date:   Wed Nov 16 09:58:41 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB9e0fcd575572e4156be8ad45afef0dbd5130d209

Fix T102514: wrong scene reported for missing compositing camera

If compositing uses renderlayers, and a camera was missing in the
associated scenes, the error message also referred to the scene the comp
tree was in (not the scene of the renderlayer -- which can potentionally
be different).

This was confusing and is now rectified.

Maniphest Tasks: T102514

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

===

M   source/blender/render/intern/pipeline.c

===

diff --git a/source/blender/render/intern/pipeline.c 
b/source/blender/render/intern/pipeline.c
index a39214b609d..d56daafaa9d 100644
--- a/source/blender/render/intern/pipeline.c
+++ b/source/blender/render/intern/pipeline.c
@@ -1497,7 +1497,9 @@ static void do_render_full_pipeline(Render *re)
   }
 }
 
-static bool check_valid_compositing_camera(Scene *scene, Object 
*camera_override)
+static bool check_valid_compositing_camera(Scene *scene,
+   Object *camera_override,
+   ReportList *reports)
 {
   if (scene->r.scemode & R_DOCOMP && scene->use_nodes) {
 bNode *node = scene->nodetree->nodes.first;
@@ -1510,6 +1512,11 @@ static bool check_valid_compositing_camera(Scene *scene, 
Object *camera_override
 }
 if (sce->camera == NULL) {
   /* all render layers nodes need camera */
+  BKE_reportf(reports,
+  RPT_ERROR,
+  "No camera found in scene \"%s\" (used in compositing of 
scene \"%s\")",
+  sce->id.name + 2,
+  scene->id.name + 2);
   return false;
 }
   }
@@ -1519,7 +1526,12 @@ static bool check_valid_compositing_camera(Scene *scene, 
Object *camera_override
 return true;
   }
 
-  return (camera_override != NULL || scene->camera != NULL);
+  const bool ok = (camera_override != NULL || scene->camera != NULL);
+  if (!ok) {
+BKE_reportf(reports, RPT_ERROR, "No camera found in scene \"%s\"", 
scene->id.name + 2);
+  }
+
+  return ok;
 }
 
 static bool check_valid_camera_multiview(Scene *scene, Object *camera, 
ReportList *reports)
@@ -1563,8 +1575,6 @@ static bool check_valid_camera_multiview(Scene *scene, 
Object *camera, ReportLis
 
 static int check_valid_camera(Scene *scene, Object *camera_override, 
ReportList *reports)
 {
-  const char *err_msg = "No camera found in scene \"%s\"";
-
   if (camera_override == NULL && scene->camera == NULL) {
 scene->camera = 
BKE_view_layer_camera_find(BKE_view_layer_default_render(scene));
   }
@@ -1586,8 +1596,7 @@ static int check_valid_camera(Scene *scene, Object 
*camera_override, ReportList
   /* camera could be unneeded due to composite nodes */
   Object *override = (seq->scene == scene) ? camera_override : 
NULL;
 
-  if (!check_valid_compositing_camera(seq->scene, override)) {
-BKE_reportf(reports, RPT_ERROR, err_msg, seq->scene->id.name + 
2);
+  if (!check_valid_compositing_camera(seq->scene, override, 
reports)) {
 return false;
   }
 }
@@ -1601,8 +1610,7 @@ static int check_valid_camera(Scene *scene, Object 
*camera_override, ReportList
   }
 }
   }
-  else if (!check_valid_compositing_camera(scene, camera_override)) {
-BKE_reportf(reports, RPT_ERROR, err_msg, scene->id.name + 2);
+  else if (!check_valid_compositing_camera(scene, camera_override, reports)) {
 return false;
   }

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


[Bf-blender-cvs] [9a537b63a5a] blender-v2.93-release: Fix: greasepencil selection of entire_strokes not working

2022-12-14 Thread Philipp Oeser
Commit: 9a537b63a5ad22da689b6a799a24b4c5ef269301
Author: Philipp Oeser
Date:   Tue Nov 22 13:09:41 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB9a537b63a5ad22da689b6a799a24b4c5ef269301

Fix: greasepencil selection of entire_strokes not working

Caused by rB85f90ed6fd88.

Above commit made sure whole strokes are selected when the
GP_SELECTMODE_STROKE is used in different modes, but ignored the fact
that this can also already be set by the entire_strokes select operator
property.

This is now corrected.

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

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_select.c 
b/source/blender/editors/gpencil/gpencil_select.c
index 55521ac4d15..913dfcbb8f7 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -2219,15 +2219,15 @@ static int gpencil_select_exec(bContext *C, wmOperator 
*op)
 
   /* if select mode is stroke, use whole stroke */
   if ((ob) && (ob->mode == OB_MODE_SCULPT_GPENCIL)) {
-whole = 
(bool)(gpencil_select_mode_from_sculpt(ts->gpencil_selectmode_sculpt) ==
+whole |= 
(bool)(gpencil_select_mode_from_sculpt(ts->gpencil_selectmode_sculpt) ==
GP_SELECTMODE_STROKE);
   }
   else if ((ob) && (ob->mode == OB_MODE_VERTEX_GPENCIL)) {
-whole = 
(bool)(gpencil_select_mode_from_vertex(ts->gpencil_selectmode_sculpt) ==
+whole |= 
(bool)(gpencil_select_mode_from_vertex(ts->gpencil_selectmode_sculpt) ==
GP_SELECTMODE_STROKE);
   }
   else {
-whole = (bool)(ts->gpencil_selectmode_edit == GP_SELECTMODE_STROKE);
+whole |= (bool)(ts->gpencil_selectmode_edit == GP_SELECTMODE_STROKE);
   }
 
   if (is_curve_edit) {

___
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] [34e99240861] blender-v2.93-release: Fix T100926: Show UV outline in texture paint mode

2022-12-14 Thread Chris Blackbourn
Commit: 34e99240861ade6e03511cb7550f88de3271ff05
Author: Chris Blackbourn
Date:   Wed Nov 16 11:13:45 2022 +1300
Branches: blender-v2.93-release
https://developer.blender.org/rB34e99240861ade6e03511cb7550f88de3271ff05

Fix T100926: Show UV outline in texture paint mode

After rB716ea1547989 the UV overlay is no longer displayed in
the UV Editor. It only appears for the Image Editor.

So restore the previous behavior, displaying the "UV shadow"
overlay in the UV editor as well.

Reviewed By: Jeroen Bakker, Germano Cavalcante

Maniphest Tasks: T92614, T100926

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

===

M   source/blender/draw/engines/overlay/overlay_edit_uv.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c 
b/source/blender/draw/engines/overlay/overlay_edit_uv.c
index 9c58a2b574f..db07a5494ec 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_uv.c
+++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c
@@ -145,6 +145,8 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
  ((is_paint_mode && do_tex_paint_shadows &&
((draw_ctx->object_mode &
  (OB_MODE_TEXTURE_PAINT | 
OB_MODE_EDIT)) != 0)) ||
+  (is_uv_editor && do_tex_paint_shadows &&
+   ((draw_ctx->object_mode & 
(OB_MODE_TEXTURE_PAINT)) != 0)) ||
   (is_view_mode && do_tex_paint_shadows &&
((draw_ctx->object_mode & 
(OB_MODE_TEXTURE_PAINT)) != 0)) ||
   (do_uv_overlay && (show_modified_uvs)));

___
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] [ac7b4855bd9] blender-v2.93-release: audaspace: Fix build error with MSVC 17.4+

2022-12-14 Thread Ray Molenkamp
Commit: ac7b4855bd924cfbd6dbabee0810dff03deee060
Author: Ray Molenkamp
Date:   Wed Nov 9 14:39:15 2022 -0700
Branches: blender-v2.93-release
https://developer.blender.org/rBac7b4855bd924cfbd6dbabee0810dff03deee060

audaspace: Fix build error with MSVC 17.4+

`DeviceManager.h` uses `std::string` without explicitly including
the `` header. While older MSVC implicitly included this
header somewhere, the headers for 17.4+ do not leading to a build
error.

===

M   extern/audaspace/include/devices/DeviceManager.h

===

diff --git a/extern/audaspace/include/devices/DeviceManager.h 
b/extern/audaspace/include/devices/DeviceManager.h
index 27a546630e8..fa84025478f 100644
--- a/extern/audaspace/include/devices/DeviceManager.h
+++ b/extern/audaspace/include/devices/DeviceManager.h
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 AUD_NAMESPACE_BEGIN

___
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] [4db3ae2c522] blender-v2.93-release: Fix T102312: anchored brush texture overlay draws in wrong place

2022-12-14 Thread Philipp Oeser
Commit: 4db3ae2c522e85970ed703242eba106067239ae1
Author: Philipp Oeser
Date:   Tue Nov 8 12:27:17 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB4db3ae2c522e85970ed703242eba106067239ae1

Fix T102312: anchored brush texture overlay draws in wrong place

Rotation and scale was done around the wrong center (always around mouse
position) in paint_draw_tex_overlay [on the other hand,
paint_draw_cursor_overlay already got the center right].

Now make the center dependent on UnifiedPaintSettings "draw_anchored".

Maniphest Tasks: T102312

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

===

M   source/blender/editors/sculpt_paint/paint_cursor.c

===

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c 
b/source/blender/editors/sculpt_paint/paint_cursor.c
index 7740fb42c37..920e78c8b36 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -577,31 +577,36 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings 
*ups,
 if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
   GPU_matrix_push();
 
+  float center[2] = {
+  ups->draw_anchored ? ups->anchored_initial_mouse[0] : x,
+  ups->draw_anchored ? ups->anchored_initial_mouse[1] : y,
+  };
+
   /* Brush rotation. */
-  GPU_matrix_translate_2f(x, y);
+  GPU_matrix_translate_2fv(center);
   GPU_matrix_rotate_2d(-RAD2DEGF(primary ? ups->brush_rotation : 
ups->brush_rotation_sec));
-  GPU_matrix_translate_2f(-x, -y);
+  GPU_matrix_translate_2f(-center[0], -center[1]);
 
   /* Scale based on tablet pressure. */
   if (primary && ups->stroke_active && BKE_brush_use_size_pressure(brush)) 
{
 const float scale = ups->size_pressure_value;
-GPU_matrix_translate_2f(x, y);
+GPU_matrix_translate_2fv(center);
 GPU_matrix_scale_2f(scale, scale);
-GPU_matrix_translate_2f(-x, -y);
+GPU_matrix_translate_2f(-center[0], -center[1]);
   }
 
   if (ups->draw_anchored) {
-quad.xmin = ups->anchored_initial_mouse[0] - ups->anchored_size;
-quad.ymin = ups->anchored_initial_mouse[1] - ups->anchored_size;
-quad.xmax = ups->anchored_initial_mouse[0] + ups->anchored_size;
-quad.ymax = ups->anchored_initial_mouse[1] + ups->anchored_size;
+quad.xmin = center[0] - ups->anchored_size;
+quad.ymin = center[1] - ups->anchored_size;
+quad.xmax = center[0] + ups->anchored_size;
+quad.ymax = center[1] + ups->anchored_size;
   }
   else {
 const int radius = BKE_brush_size_get(vc->scene, brush) * zoom;
-quad.xmin = x - radius;
-quad.ymin = y - radius;
-quad.xmax = x + radius;
-quad.ymax = y + radius;
+quad.xmin = center[0] - radius;
+quad.ymin = center[1] - radius;
+quad.xmax = center[0] + radius;
+quad.ymax = center[1] + radius;
   }
 }
 else if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) {

___
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] [6a9b0772fee] blender-v2.93-release: Fix T102187: Add knife tool in mesh panel

2022-12-14 Thread Pratik Borhade
Commit: 6a9b0772fee918e408b6b3fbe7f92ab3de8c9ccb
Author: Pratik Borhade
Date:   Sun Nov 13 22:48:24 2022 +0530
Branches: blender-v2.93-release
https://developer.blender.org/rB6a9b0772fee918e408b6b3fbe7f92ab3de8c9ccb

Fix T102187: Add knife tool in mesh panel

Add knife tool option in mesh panel

Reviewer: campbellbarton, JulienKaspar

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

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index c658e965ab7..8050b55b6c2 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3677,6 +3677,7 @@ class VIEW3D_MT_edit_mesh(Menu):
 
 layout.operator("mesh.bisect")
 layout.operator("mesh.knife_project")
+layout.operator("mesh.knife_tool")
 
 if with_bullet:
 layout.operator("mesh.convex_hull")

___
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] [0e1877b7542] blender-v2.93-release: Fix T85870: ColorRamp Keyframes crash Blender

2022-12-14 Thread Julian Eisel
Commit: 0e1877b7542d9cbe5429577c4b0980a9c8c4590f
Author: Julian Eisel
Date:   Tue Nov 8 12:14:31 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB0e1877b7542d9cbe5429577c4b0980a9c8c4590f

Fix T85870: ColorRamp Keyframes crash Blender

The color-band needs to do some special, rather awkward updating of the
UI state when certain values are changed. As @lichtwerk noted in the
report, this was done to the wrong buttons. Now lookup the proper
buttons, and don't assume that `uiItemR()` only adds a single button
(which often isn't the case).

===

M   source/blender/editors/interface/interface_templates.c

===

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index d455686fdaa..86629768b72 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -3362,13 +3362,9 @@ static void colorband_buttons_layout(uiLayout *layout,
 
   row = uiLayoutRow(split, false);
   uiItemR(row, , "position", 0, IFACE_("Pos"), ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_func_set(bt, colorband_update_cb, bt, coba);
 
   row = uiLayoutRow(layout, false);
   uiItemR(row, , "color", 0, "", ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 }
 else {
   split = uiLayoutSplit(layout, 0.5f, false);
@@ -3393,13 +3389,28 @@ static void colorband_buttons_layout(uiLayout *layout,
 
   row = uiLayoutRow(subsplit, false);
   uiItemR(row, , "position", UI_ITEM_R_SLIDER, IFACE_("Pos"), 
ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_func_set(bt, colorband_update_cb, bt, coba);
 
   row = uiLayoutRow(split, false);
   uiItemR(row, , "color", 0, "", ICON_NONE);
-  bt = block->buttons.last;
-  UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
+}
+
+/* Some special (rather awkward) treatment to update UI state on certain 
property changes. */
+LISTBASE_FOREACH_BACKWARD (uiBut *, but, >buttons) {
+  if (but->rnapoin.data != ptr.data) {
+continue;
+  }
+  if (!but->rnaprop) {
+continue;
+  }
+
+  const char *prop_identifier = RNA_property_identifier(but->rnaprop);
+  if (STREQ(prop_identifier, "position")) {
+UI_but_func_set(but, colorband_update_cb, but, coba);
+  }
+
+  if (STREQ(prop_identifier, "color")) {
+UI_but_funcN_set(but, rna_update_cb, MEM_dupallocN(cb), NULL);
+  }
 }
   }
 }

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


[Bf-blender-cvs] [c184516c37b] blender-v2.93-release: Fix T89350: Emboss color missing from icon buttons without emboss

2022-12-14 Thread Hans Goudey
Commit: c184516c37b3ef81507558daaff4d8268ecc7d2c
Author: Hans Goudey
Date:   Mon Jun 28 10:00:15 2021 -0500
Branches: blender-v2.93-release
https://developer.blender.org/rBc184516c37b3ef81507558daaff4d8268ecc7d2c

Fix T89350: Emboss color missing from icon buttons without emboss

Passing `emboss=False`set `UI_EMBOSS_NONE` in the layout, which
completely disables button background colors for things like animation
state. This commit changes that to `UI_EMBOSS_NONE_OR_STATUS`,
which effectively restores the behavior to what it was prior to the
addition of that flag, with the added option to completely disable
the status emboss with `UI_EMBOSS_NONE`.

===

M   source/blender/editors/interface/interface_layout.c
M   source/blender/makesrna/intern/rna_ui_api.c

===

diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index cabd98902a6..2c2ea70d0d2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1191,7 +1191,7 @@ static uiBut *uiItemFullO_ptr_ex(uiLayout *layout,
 
   const eUIEmbossType prev_emboss = layout->emboss;
   if (flag & UI_ITEM_R_NO_BG) {
-layout->emboss = UI_EMBOSS_NONE;
+layout->emboss = UI_EMBOSS_NONE_OR_STATUS;
   }
 
   /* create the button */
@@ -2122,7 +2122,7 @@ void uiItemFullR(uiLayout *layout,
 
   const eUIEmbossType prev_emboss = layout->emboss;
   if (no_bg) {
-layout->emboss = UI_EMBOSS_NONE;
+layout->emboss = UI_EMBOSS_NONE_OR_STATUS;
   }
 
   uiBut *but = NULL;
diff --git a/source/blender/makesrna/intern/rna_ui_api.c 
b/source/blender/makesrna/intern/rna_ui_api.c
index f128719db19..104d2090978 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -912,7 +912,12 @@ void RNA_api_ui_layout(StructRNA *srna)
   RNA_def_boolean(func, "event", false, "", "Use button to input key events");
   RNA_def_boolean(
   func, "full_event", false, "", "Use button to input full events 
including modifiers");
-  RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just 
the icon/text");
+  RNA_def_boolean(func,
+  "emboss",
+  true,
+  "",
+  "Draw the button itself, not just the icon/text. When false, 
corresponds to the "
+  "'NONE_OR_STATUS' layout emboss type");
   RNA_def_int(func,
   "index",
   /* RNA_NO_INDEX == -1 */

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


[Bf-blender-cvs] [398de297cf5] blender-v2.93-release: Fix T99603: node body colors colormanagement issue

2022-12-14 Thread Philipp Oeser
Commit: 398de297cf52d06cf56e6232a6877e51652424ca
Author: Philipp Oeser
Date:   Tue Oct 25 12:14:39 2022 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB398de297cf52d06cf56e6232a6877e51652424ca

Fix T99603: node body colors colormanagement issue

This led to the color actually looking different on the node body itself
vs. in the panel, also using the colorpicker gave unexpected results.

UI colors should use PROP_COLOR_GAMMA to avoid being affected by scene
color management (clarification by @brecht).

Maniphest Tasks: T99603

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 6da7edb5891..d0d53e08db8 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -10801,7 +10801,7 @@ static void rna_def_node(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the 
node");
   RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
 
-  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+  prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
   RNA_def_property_array(prop, 3);
   RNA_def_property_range(prop, 0.0f, 1.0f);
   RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");

___
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] [18f0caa6c11] blender-v2.93-release: Fix T99997: Calling teleport without waiting for the previous event disables gravity

2022-12-14 Thread Pratik Borhade
Commit: 18f0caa6c1173510f3569bcdd60c2c6796fb26b7
Author: Pratik Borhade
Date:   Wed Oct 19 18:20:47 2022 +0530
Branches: blender-v2.93-release
https://developer.blender.org/rB18f0caa6c1173510f3569bcdd60c2c6796fb26b7

Fix T7: Calling teleport without waiting for the previous event disables 
gravity

During teleport event, gravity is disabled and WalkMethod
is stored in `teleport.navigation_mode` which is used later to reset
the status after execution. Calling teleport events consecutively
will change the initial WalkMethod value. So update it only on the
first call. Also remove `else condition` as it stops the previously running
teleport when the new teleport call fails to find a hit point.

Reviewed by: dfelinto, mano-wii

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

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_walk.c 
b/source/blender/editors/space_view3d/view3d_walk.c
index cbd65e3175d..ee9fc21175e 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -916,11 +916,15 @@ static void walkEvent(bContext *C, WalkInfo *walk, const 
wmEvent *event)
 
 if (ret) {
   WalkTeleport *teleport = >teleport;
+
+  /* Store the current navigation mode if we are not already 
teleporting. */
+  if (teleport->state == WALK_TELEPORT_STATE_OFF) {
+teleport->navigation_mode = walk->navigation_mode;
+  }
   teleport->state = WALK_TELEPORT_STATE_ON;
   teleport->initial_time = PIL_check_seconds_timer();
   teleport->duration = U.walk_navigation.teleport_time;
 
-  teleport->navigation_mode = walk->navigation_mode;
   walk_navigation_mode_set(walk, WALK_MODE_FREE);
 
   copy_v3_v3(teleport->origin, walk->rv3d->viewinv[3]);
@@ -931,9 +935,7 @@ static void walkEvent(bContext *C, WalkInfo *walk, const 
wmEvent *event)
 
   sub_v3_v3v3(teleport->direction, loc, teleport->origin);
 }
-else {
-  walk->teleport.state = WALK_TELEPORT_STATE_OFF;
-}
+
 break;
   }

___
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] [283af786579] blender-v2.93-release: Fix T101591: mathutils.geometry.intersect_line_line 2D vector error

2022-12-14 Thread Campbell Barton
Commit: 283af786579b4d5e094332a15d95a5c888647b13
Author: Campbell Barton
Date:   Thu Oct 6 17:32:11 2022 +1100
Branches: blender-v2.93-release
https://developer.blender.org/rB283af786579b4d5e094332a15d95a5c888647b13

Fix T101591: mathutils.geometry.intersect_line_line 2D vector error

Uninitialized stack memory was used when intersecting 2D vectors.

===

M   source/blender/python/mathutils/mathutils_geometry.c

===

diff --git a/source/blender/python/mathutils/mathutils_geometry.c 
b/source/blender/python/mathutils/mathutils_geometry.c
index 4b09c08f62c..b431c45062f 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -193,6 +193,13 @@ static PyObject *M_Geometry_intersect_line_line(PyObject 
*UNUSED(self), PyObject
 return NULL;
   }
 
+  /* Zero 3rd axis of 2D vectors. */
+  if (len == 2) {
+lines[1][2] = 0.0f;
+lines[2][2] = 0.0f;
+lines[3][2] = 0.0f;
+  }
+
   result = isect_line_line_v3(UNPACK4(lines), i1, i2);
   /* The return-code isn't exposed,
* this way we can check know how close the lines are. */

___
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] [dba7837d449] master: Fix typo in rB2c5a525d6409

2022-12-14 Thread Germano Cavalcante
Commit: dba7837d449c6502600bd5bd907b89c7e860c7f0
Author: Germano Cavalcante
Date:   Wed Dec 14 09:21:49 2022 -0300
Branches: master
https://developer.blender.org/rBdba7837d449c6502600bd5bd907b89c7e860c7f0

Fix typo in rB2c5a525d6409

`MOD_MIR_AXIS_Y` -> `MOD_MIR_AXIS_Z`

This causes mirror-Z clipping to be non-functional.

===

M   source/blender/editors/transform/transform_convert.c

===

diff --git a/source/blender/editors/transform/transform_convert.c 
b/source/blender/editors/transform/transform_convert.c
index b5373b4fd6c..22f42d4ab5c 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -1079,7 +1079,7 @@ void 
transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc)
 continue;
   }
 
-  if ((mmd->flag & (MOD_MIR_AXIS_X | MOD_MIR_AXIS_Y | MOD_MIR_AXIS_Y)) == 
0) {
+  if ((mmd->flag & (MOD_MIR_AXIS_X | MOD_MIR_AXIS_Y | MOD_MIR_AXIS_Z)) == 
0) {
 continue;
   }

___
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] [4234a8017ec] microfacet_hair: Merge branch 'master' into microfacet_hair

2022-12-14 Thread Weizhen Huang
Commit: 4234a8017ec6eb6708496b682aa8c6fcd7b3bd05
Author: Weizhen Huang
Date:   Tue Dec 13 11:47:00 2022 +0100
Branches: microfacet_hair
https://developer.blender.org/rB4234a8017ec6eb6708496b682aa8c6fcd7b3bd05

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