[Bf-blender-cvs] [e11ba956d21] sculpt-dev: Sculpt: various uv-related fixed

2021-10-06 Thread Joseph Eagar
Commit: e11ba956d21b298d24885af30aad4a40a301d125
Author: Joseph Eagar
Date:   Wed Oct 6 21:54:10 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBe11ba956d21b298d24885af30aad4a40a301d125

Sculpt: various uv-related fixed

* The dyntopo collapse function now
  properly snaps UVs, including at
  island boundaries.
* PBVHTriBufs are now split by UVs
  (and face sets); this turned out
  to be surprising easy.
* Also fixed a few bugs relating to
  hiding/revealing stuff.

===

M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenkernel/intern/dyntopo.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/editors/sculpt_paint/paint_hide.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_displacement.h
M   source/blender/editors/sculpt_paint/sculpt_smooth.c
M   source/blender/gpu/intern/gpu_buffers.c
M   source/blender/windowmanager/intern/wm_init_exit.c

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 229fb7bb7e4..4b92a614cc6 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -505,6 +505,7 @@ void BKE_pbvh_bmesh_update_all_valence(PBVH *pbvh);
 void BKE_pbvh_bmesh_flag_all_disk_sort(PBVH *pbvh);
 bool BKE_pbvh_bmesh_mark_update_valence(PBVH *pbvh, SculptVertRef vertex);
 
+void BKE_pbvh_node_mark_update_triangulation(PBVHNode *node);
 void BKE_pbvh_node_mark_original_update(PBVHNode *node);
 void BKE_pbvh_node_mark_update_tri_area(PBVHNode *node);
 void BKE_pbvh_update_all_tri_areas(PBVH *pbvh);
@@ -642,7 +643,8 @@ typedef struct PBVHVertexIter {
   bool visible;
 } PBVHVertexIter;
 
-#define BKE_PBVH_SCULPTVERT(cd_sculpt_vert, v) ((MSculptVert 
*)BM_ELEM_CD_GET_VOID_P(v, cd_sculpt_vert))
+#define BKE_PBVH_SCULPTVERT(cd_sculpt_vert, v) \
+  ((MSculptVert *)BM_ELEM_CD_GET_VOID_P(v, cd_sculpt_vert))
 
 void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int 
mode);
 
@@ -851,7 +853,7 @@ void BKE_pbvh_set_symmetry(PBVH *pbvh, int symmetry, int 
boundary_symmetry);
 #if 0
 typedef enum {
   SCULPT_TEXTURE_UV = 1 << 0,  // per-uv
-  // SCULPT_TEXTURE_PTEX?
+  SCULPT_TEXTURE_GRIDS = 1<<1
 } SculptTextureType;
 
 typedef int TexLayerRef;
@@ -870,6 +872,8 @@ typedef struct SculptTextureDef {
 
   void (*build_begin)(PBVH *pbvh, PBVHNode *node, TexLayerRef vdm);
 
+  void (*calc_bounds)(PBVH *pbvh, PBVHNode *node, float r_min[3], float 
r_max[3], TexLayerRef vdm);
+
   /*vdms can cache data per node, which is freed to maintain memory limit.
 they store cache in the same structure they return in buildNodeData.*/
   void (*freeCachedData)(PBVH *pbvh, PBVHNode *node, TexLayerRef vdm);
@@ -879,6 +883,8 @@ typedef struct SculptTextureDef {
   void *(*buildNodeData)(PBVH *pbvh, PBVHNode *node);
   bool (*validate)(PBVH *pbvh, TexLayerRef vdm);
 
+  void (*setVertexCos)(PBVH *pbvh, PBVHNode *node, SculptVertRef *verts, int 
totvert, TexLayerRef vdm);
+
   void (*getPointsFromNode)(PBVH *pbvh,
 PBVHNode *node,
 TexLayerRef vdm,
@@ -924,7 +930,7 @@ typedef struct SculptTextureDef {
   PBVH *pbvh, PBVHNode *node, TexLayerRef vdm, TexPointRef *ids, int 
totid);
 
   /*displacement texture stuff*/
-  // can be tangent, object space displacement, whatever
+  // can be tangent, object space displacement
   void (*worldToDelta)(PBVH *pbvh, PBVHNode *node, TexLayerRef vdm, 
TexPointRef *ids, int totid);
   void (*deltaToWorld)(PBVH *pbvh, PBVHNode *node, TexLayerRef vdm, 
TexPointRef *ids, int totid);
 } SculptDisplacementDef;
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index b94b4382fdc..8512ce9992c 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -298,6 +298,7 @@ static bool check_builtin_init()
   SETCAT(topology_rake_projection, "Smoothing");
   SETCAT(topology_rake_use_spacing, "Smoothing");
   SETCAT(topology_rake_spacing, "Smoothing");
+  SETCAT(topology_rake_mode, "Smoothing");
 
   SETCAT(boundary_smooth, "Smoothing");
   SETCAT(fset_slide, "Smoothing");
@@ -1367,6 +1368,7 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
 case SCULPT_TOOL_SIMPLIFY:
   SHOWCTX(autosmooth);
   SHOWCTX(topology_rake);
+  SHOWCTX(topology_rake_mode);
   break;
 case SCULPT_TOOL_LAYER:
   SHOWWRK(use_persistent);
diff --git a/source/blender/blenkernel/intern/dyntopo.c 
b/source/blender/blenkernel/intern/dyntopo.c
index 67384fb9cb8..8818299ea33 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/

[Bf-blender-cvs] [c2f2a8260c5] sculpt-dev: Merge branch 'master' into sculpt-dev

2021-10-06 Thread Joseph Eagar
Commit: c2f2a8260c58b6417e4bc457941434816f395dc6
Author: Joseph Eagar
Date:   Wed Oct 6 18:33:08 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc2f2a8260c58b6417e4bc457941434816f395dc6

Merge branch 'master' into sculpt-dev

===



===

diff --cc release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 534cb8fb209,b8b27b0e8ba..41c99de86ad
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@@ -70,14 -71,13 +70,14 @@@ class Params
  # (derived from other settings).
  #
  # This case needs to be checked often,
- # Shorthand for: `(params.use_fallback_tool if params.select_mouse ==
- # 'RIGHT' else False)`.
+ # Shorthand for: `(params.use_fallback_tool if params.select_mouse == 
'RIGHTMOUSE' else False)`.
  "use_fallback_tool_rmb",
 -# Shorthand for: `('CLICK' if params.use_fallback_tool_rmb else 
params.select_mouse_value)`.
 +# Shorthand for: `('CLICK' if params.use_fallback_tool_rmb else
 +# params.select_mouse_value)`.
  "select_mouse_value_fallback",
- # Shorthand for: `('CLICK_DRAG' if params.use_pie_click_drag else
- # 'PRESS')`
+ # Shorthand for: `{"type": params.select_tweak, "value": 'ANY'}`.
+ "select_tweak_event",
+ # Shorthand for: `('CLICK_DRAG' if params.use_pie_click_drag else 
'PRESS')`
  "pie_value",
  # Shorthand for: `{"type": params.tool_tweak, "value": 'ANY'}`.
  "tool_tweak_event",
@@@ -2482,11 -2813,20 +2477,18 @@@ def km_sequencer(params)
  
  def km_sequencerpreview(params):
  items = []
 -keymap = (
 -"SequencerPreview",
 +keymap = ("SequencerPreview",
  {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
 -{"items": items},
 -)
 +{"items": items},)
  
- items.extend([("sequencer.view_all_preview", {"type": 'HOME', "value": 
'PRESS'}, None),
+ items.extend([
+ # Selection.
+ *_template_sequencer_preview_select(
+ type=params.select_mouse,
+ value=params.select_mouse_value_fallback,
+ legacy=params.legacy,
+ ),
+ ("sequencer.view_all_preview", {"type": 'HOME', "value": 'PRESS'}, 
None),
  ("sequencer.view_all_preview", {"type": 'NDOF_BUTTON_FIT', "value": 
'PRESS'}, None),
  ("sequencer.view_ghost_border", {"type": 'O', "value": 'PRESS'}, 
None),
  ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS', 
"ctrl": True},
@@@ -2503,12 -2843,15 +2505,13 @@@
   {"properties": [("ratio", 0.25)]}),
  ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS'},
   {"properties": [("ratio", 0.125)]}),
- ("sequencer.sample", {"type": params.action_mouse, "value": 'PRESS'}, 
None),
- op_tool_optional(("transform.translate", {"type": 'G', "value": 
'PRESS'}, None),
+ ("transform.translate", {"type": params.select_tweak, "value": 
'ANY'}, None),
+ op_tool_optional(
+ ("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
  (op_tool_cycle, "builtin.move"), params),
 -op_tool_optional(
 -("transform.rotate", {"type": 'R', "value": 'PRESS'}, None),
 +op_tool_optional(("transform.rotate", {"type": 'R', "value": 
'PRESS'}, None),
  (op_tool_cycle, "builtin.rotate"), params),
 -op_tool_optional(
 -("transform.resize", {"type": 'S', "value": 'PRESS'}, None),
 +op_tool_optional(("transform.resize", {"type": 'S', "value": 
'PRESS'}, None),
  (op_tool_cycle, "builtin.scale"), params),
  ("sequencer.strip_transform_clear", {"type": 'G', "alt": True, 
"value": 'PRESS'},
   {"properties": [("property", 'POSITION')]}),
@@@ -3756,9 -4314,10 +3761,9 @@@ def km_pose(params)
  ("pose.push", {"type": 'E', "value": 'PRESS', "ctrl": True}, None),
  ("pose.relax", {"type": 'E', "value": 'PRESS', "alt": True}, None),
  ("pose.breakdown", {"type": 'E', "value": 'PRESS', "shift": True}, 
None),
- ("pose.blend_to_neighbour", {"type": 'E', "value": 'PRESS', "shift": 
True, "alt": True}, None),
+ ("pose.blend_to_neighbor", {"type": 'E', "value": 'PRESS', "shift": 
True, "alt": True}, None),
  op_menu("VIEW3D_MT_pose_propagate", {"type": 'P', "value": 'PRESS', 
"alt": True}),
 -*(
 -(("object.hide_collection",
 +*((("object.hide_collection",
{"type": NUMBERS_1[i], "value": 'PRESS', "any": True},
{"properties": [("collection_index", i + 1)]})
   for i in range(10)
@@@ -4070,20 -4627,81 +4075,76 @@@ def _template_uv_select(*, type, value
  
  def _template_uv

[Bf-blender-cvs] [eadbacdbb06] master: Fix T91670: Strip text position is incorrect

2021-10-06 Thread Richard Antalik
Commit: eadbacdbb06ab1ea4b0c744c31959bdf2f41bc98
Author: Richard Antalik
Date:   Thu Oct 7 06:35:16 2021 +0200
Branches: master
https://developer.blender.org/rBeadbacdbb06ab1ea4b0c744c31959bdf2f41bc98

Fix T91670: Strip text position is incorrect

Use `sseq->timeline_overlay.flag` instead of `sseq->flag`.
Caused oversight in 7cb65e45814d.

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index bbe2def8081..e5e241c8b7e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1342,9 +1342,9 @@ static void draw_seq_strip(const bContext *C,
 
   float text_margin_y;
   bool y_threshold;
-  if ((sseq->flag & SEQ_TIMELINE_SHOW_STRIP_NAME) ||
-  (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE) ||
-  (sseq->flag & SEQ_TIMELINE_SHOW_STRIP_DURATION)) {
+  if ((sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_NAME) ||
+  (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_SOURCE) ||
+  (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_DURATION)) {
 
 /* Calculate height needed for drawing text on strip. */
 text_margin_y = y2 - min_ff(0.40f, 20 * U.dpi_fac * pixely);

___
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] [b970edb97e9] sculpt-dev: Sculpt: Add plane mode for draw sharp brush

2021-10-06 Thread Joseph Eagar
Commit: b970edb97e902adf8a7973149ae36c3abec26998
Author: Joseph Eagar
Date:   Wed Oct 6 18:26:19 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBb970edb97e902adf8a7973149ae36c3abec26998

Sculpt: Add plane mode for draw sharp brush

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index f7809f21af6..eb8db807fd2 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1907,10 +1907,16 @@ def brush_settings_advanced(layout, context, brush, 
popover=False):
 
 # Draw shared settings.
 if use_accumulate:
-layout.prop(brush, "use_accumulate")
+UnifiedPaintPanel.channel_unified(layout.column(),
+context,
+brush,
+"accumulate")
 
 if use_frontface:
-layout.prop(brush, "use_frontface", text="Front Faces Only")
+UnifiedPaintPanel.channel_unified(layout.column(),
+context,
+brush,
+"use_frontface", text="Front Faces Only")
 
 
 def draw_color_settings(context, layout, brush, color_type=False):
diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index d8112de760d..5ee86f9446e 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 34
+#define BLENDER_FILE_SUBVERSION 35
 
 /* 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
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index e7149aefd3b..a9b1bf2c7c3 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -578,6 +578,12 @@ MAKE_ENUM(smear_deform_type, "Deformation", "Deformation 
type that is used in th
 
 MAKE_FLOAT(smear_deform_blend, "Smear Blend", "Blend with existing paint", 
1.0f, 0.0f, 1.0f)
 
+MAKE_ENUM_EX(sharp_mode, "Sharp Mode", "", 0, 0, {
+{0, "SIMPLE", "NONE", "Simple", ""},
+{1, "PLANE", "NONE", "Plane", ""},
+{-1}
+})
+
 //MAKE_FLOAT3_EX
 /* clang-format on */
 #if defined(BRUSH_CHANNEL_DEFINE_TYPES) || 
defined(BRUSH_CHANNEL_DEFINE_EXTERNAL)
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index cb74a32aa01..b94b4382fdc 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -267,6 +267,7 @@ static bool check_builtin_init()
   // SETCAT(radius, "Basic");
   // SETCAT(direction, "Basic");
   SETCAT(accumulate, "Basic");
+  SETCAT(use_frontface, "Basic");
 
   SETCAT(smear_deform_type, "Smear");
   SETCAT(smear_deform_blend, "Smear");
@@ -973,7 +974,9 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
   ADDCH(strength);
   ADDCH(radius_unit);
   ADDCH(unprojected_radius);
+  ADDCH(use_frontface);
 
+  ADDCH(sharp_mode);
   ADDCH(show_origco);
 
   ADDCH(use_surface_falloff);
@@ -1245,6 +1248,7 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   if (!ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR)) {
 SHOWWRK(autosmooth);
 SHOWWRK(topology_rake);
+SHOWWRK(topology_rake_mode);
 SHOWCTX(autosmooth);
   }
 
@@ -1264,6 +1268,12 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   SHOWWRK(dyntopo_disabled);
 
   switch (tool) {
+case SCULPT_TOOL_DRAW_SHARP:
+  SHOWWRK(sharp_mode);
+  SHOWCTX(sharp_mode);
+  // SHOWWRK(plane_offset);
+  // SHOWCTX(plane_offset);
+  break;
 case SCULPT_TOOL_INFLATE:
 case SCULPT_TOOL_BLOB:
   SHOWCTX(crease_pinch_factor);
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 5020eb180d9..3906a2210d4 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1796,6 +1796,13 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
   }
 }
   }
+
+  if (!MAIN_VERSION

[Bf-blender-cvs] [70cc80ea1c7] master: Cleanup: Move VSE disk cache code into own file

2021-10-06 Thread Richard Antalik
Commit: 70cc80ea1c7f2678762c8ec31b924f9624172810
Author: Richard Antalik
Date:   Thu Oct 7 03:04:34 2021 +0200
Branches: master
https://developer.blender.org/rB70cc80ea1c7f2678762c8ec31b924f9624172810

Cleanup: Move VSE disk cache code into own file

No functional changes.

===

M   source/blender/sequencer/CMakeLists.txt
A   source/blender/sequencer/intern/disk_cache.c
A   source/blender/sequencer/intern/disk_cache.h
M   source/blender/sequencer/intern/image_cache.c
M   source/blender/sequencer/intern/image_cache.h

===

diff --git a/source/blender/sequencer/CMakeLists.txt 
b/source/blender/sequencer/CMakeLists.txt
index f060e6ad69b..eccc336141a 100644
--- a/source/blender/sequencer/CMakeLists.txt
+++ b/source/blender/sequencer/CMakeLists.txt
@@ -63,6 +63,8 @@ set(SRC
   SEQ_utils.h
 
   intern/clipboard.c
+  intern/disk_cache.c
+  intern/disk_cache.h
   intern/effects.c
   intern/effects.h
   intern/image_cache.c
diff --git a/source/blender/sequencer/intern/disk_cache.c 
b/source/blender/sequencer/intern/disk_cache.c
new file mode 100644
index 000..543c23b184b
--- /dev/null
+++ b/source/blender/sequencer/intern/disk_cache.c
@@ -0,0 +1,698 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2021 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup sequencer
+ */
+
+#include 
+#include 
+#include 
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_space_types.h" /* for FILE_MAX. */
+
+#include "IMB_colormanagement.h"
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_endian_defines.h"
+#include "BLI_endian_switch.h"
+#include "BLI_fileops.h"
+#include "BLI_fileops_types.h"
+#include "BLI_ghash.h"
+#include "BLI_listbase.h"
+#include "BLI_mempool.h"
+#include "BLI_path_util.h"
+#include "BLI_threads.h"
+
+#include "BKE_main.h"
+#include "BKE_scene.h"
+
+#include "SEQ_prefetch.h"
+#include "SEQ_relations.h"
+#include "SEQ_render.h"
+#include "SEQ_sequencer.h"
+
+#include "disk_cache.h"
+#include "image_cache.h"
+#include "prefetch.h"
+#include "strip_time.h"
+
+/**
+ * Disk Cache Design Notes
+ * ===
+ *
+ * Disk cache uses directory specified in user preferences
+ * For each cached non-temp image, image data and supplementary info are 
written to HDD.
+ * Multiple(DCACHE_IMAGES_PER_FILE) images share the same file.
+ * Each of these files contains header DiskCacheHeader followed by image data.
+ * Zlib compression with user definable level can be used to compress image 
data(per image)
+ * Images are written in order in which they are rendered.
+ * Overwriting of individual entry is not possible.
+ * Stored images are deleted by invalidation, or when size of all files 
exceeds maximum
+ * size specified in user preferences.
+ * To distinguish 2 blend files with same name, scene->ed->disk_cache_timestamp
+ * is used as UID. Blend file can still be copied manually which may cause 
conflict.
+ */
+
+/* -x-%()-.dcf */
+#define DCACHE_FNAME_FORMAT "%d-%dx%d-%d%%(%d)-%d.dcf"
+#define DCACHE_IMAGES_PER_FILE 100
+#define DCACHE_CURRENT_VERSION 2
+#define COLORSPACE_NAME_MAX 64 /* XXX: defined in imb intern */
+
+typedef struct DiskCacheHeaderEntry {
+  unsigned char encoding;
+  uint64_t frameno;
+  uint64_t size_compressed;
+  uint64_t size_raw;
+  uint64_t offset;
+  char colorspace_name[COLORSPACE_NAME_MAX];
+} DiskCacheHeaderEntry;
+
+typedef struct DiskCacheHeader {
+  DiskCacheHeaderEntry entry[DCACHE_IMAGES_PER_FILE];
+} DiskCacheHeader;
+
+typedef struct SeqDiskCache {
+  Main *bmain;
+  int64_t timestamp;
+  ListBase files;
+  ThreadMutex read_write_mutex;
+  size_t size_total;
+} SeqDiskCache;
+
+typedef struct DiskCacheFile {
+  struct DiskCacheFile *next, *prev;
+  char path[FILE_MAX];
+  char dir[FILE_MAXDIR];
+  char file[FILE_MAX];
+  BLI_stat_t fstat;
+  int cache_type;
+  int rectx;
+  int recty;
+  int render_size;
+  int view_id;
+  int start_frame;
+} DiskCacheFile;
+
+static ThreadMutex cache_create_lock = BLI_MUTEX_INITIALIZER;
+
+static char *seq_disk_cache_base_dir(void)
+{
+

[Bf-blender-cvs] [439c9b0b847] master: Cleanup: VSE iterator semantics

2021-10-06 Thread Richard Antalik
Commit: 439c9b0b8478336f987b532212650c59b5f9f30f
Author: Richard Antalik
Date:   Thu Oct 7 00:35:57 2021 +0200
Branches: master
https://developer.blender.org/rB439c9b0b8478336f987b532212650c59b5f9f30f

Cleanup: VSE iterator semantics

Use `BLI_gset_ensure_p_ex()` instead of `BLI_gset_insert()` after
checking `BLI_gset_lookup()`.

===

M   source/blender/sequencer/intern/iterator.c

===

diff --git a/source/blender/sequencer/intern/iterator.c 
b/source/blender/sequencer/intern/iterator.c
index 2429405350b..e83d158881e 100644
--- a/source/blender/sequencer/intern/iterator.c
+++ b/source/blender/sequencer/intern/iterator.c
@@ -189,10 +189,12 @@ SeqCollection *SEQ_query_by_reference(Sequence 
*seq_reference,
  */
 bool SEQ_collection_append_strip(Sequence *seq, SeqCollection *collection)
 {
-  if (BLI_gset_lookup(collection->set, seq) != NULL) {
+  void **key;
+  if (BLI_gset_ensure_p_ex(collection->set, seq, &key)) {
 return false;
   }
-  BLI_gset_insert(collection->set, seq);
+
+  *key = (void *)seq;
   return 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] [877ba6b251b] master: Fix T91972: Meta changes length when adding strip

2021-10-06 Thread Richard Antalik
Commit: 877ba6b251bb5af673d023b243fd6da03e4a0fab
Author: Richard Antalik
Date:   Thu Oct 7 00:10:37 2021 +0200
Branches: master
https://developer.blender.org/rB877ba6b251bb5af673d023b243fd6da03e4a0fab

Fix T91972: Meta changes length when adding strip

`SequencesMeta.new_movie()` API function caused meta strip to change
length. Similar issue has been fixed in transform code by checking
if `MetaStack` exists. `MetaStack` is not used when changing data in
python.

Provide `seqbase` to `SEQ_time_update_sequence()` so the function can
check if change happens inside of meta strip.

This patch also merges `seq_time_update_sequence_bounds()` into
`SEQ_time_update_sequence()`. This is because same issue applies for
both functions and it is confusing to have more time update
functions.re if this will lead anywhere.

Reviewed By: sergey

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

===

M   source/blender/editors/space_sequencer/sequencer_add.c
M   source/blender/editors/space_sequencer/sequencer_edit.c
M   source/blender/editors/transform/transform_convert_sequencer.c
M   source/blender/makesrna/intern/rna_sequencer.c
M   source/blender/makesrna/intern/rna_sequencer_api.c
M   source/blender/sequencer/SEQ_time.h
M   source/blender/sequencer/intern/sound.c
M   source/blender/sequencer/intern/strip_add.c
M   source/blender/sequencer/intern/strip_edit.c
M   source/blender/sequencer/intern/strip_relations.c
M   source/blender/sequencer/intern/strip_time.c
M   source/blender/sequencer/intern/strip_transform.c
M   source/blender/sequencer/intern/utils.c
M   source/blender/sequencer/intern/utils.h

===

diff --git a/source/blender/editors/space_sequencer/sequencer_add.c 
b/source/blender/editors/space_sequencer/sequencer_add.c
index bdfa639b327..8d6d81d7115 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -,7 +,7 @@ static int sequencer_add_image_strip_exec(bContext *C, 
wmOperator *op)
   /* Adjust length. */
   if (load_data.image.len == 1) {
 SEQ_transform_set_right_handle_frame(seq, load_data.image.end_frame);
-SEQ_time_update_sequence(scene, seq);
+SEQ_time_update_sequence(scene, SEQ_active_seqbase_get(ed), seq);
   }
 
   seq_load_apply_generic_options(C, op, seq);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index d55356eddec..b0273fe1e25 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -329,6 +329,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
   Scene *scene = CTX_data_scene(C);
 
   Editing *ed = SEQ_editing_get(scene);
+  ListBase *seqbase = SEQ_active_seqbase_get(ed);
   Sequence *seq;
   int snap_frame;
 
@@ -352,7 +353,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
 SEQ_transform_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & 
SEQ_RIGHTSEL);
 SEQ_transform_fix_single_image_seq_offsets(seq);
   }
-  SEQ_time_update_sequence(scene, seq);
+  SEQ_time_update_sequence(scene, seqbase, seq);
 }
   }
 
@@ -375,19 +376,19 @@ static int sequencer_snap_exec(bContext *C, wmOperator 
*op)
 if (!either_handle_selected) {
   SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp));
 }
-SEQ_time_update_sequence(scene, seq);
+SEQ_time_update_sequence(scene, seqbase, seq);
   }
   else if (seq->seq2 && (seq->seq2->flag & SELECT)) {
 if (!either_handle_selected) {
   SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp));
 }
-SEQ_time_update_sequence(scene, seq);
+SEQ_time_update_sequence(scene, seqbase, seq);
   }
   else if (seq->seq3 && (seq->seq3->flag & SELECT)) {
 if (!either_handle_selected) {
   SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp));
 }
-SEQ_time_update_sequence(scene, seq);
+SEQ_time_update_sequence(scene, seqbase, seq);
   }
 }
   }
@@ -629,7 +630,8 @@ static bool sequencer_slip_recursively(Scene *scene, 
SlipData *data, int offset)
  * we can skip calculating for effects.
  * This way we can avoid an extra loop just for effects. */
 if (!(seq->type & SEQ_TYPE_EFFECT)) {
-  SEQ_time_update_sequence(scene, seq);
+  ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
+  SEQ_time_update_sequence(scene, seqbase, seq);
 }
   }
   if (changed) {
@@ -810,7 +812,8 @@ static int sequencer_slip_modal(bContext *C, wmOperator 
*op, const wmEvent *even
   for (int i = 0; i < data->num_seq; i++) {
 Sequence *seq = data->seq_array[i];
 SEQ_add_reload_n

[Bf-blender-cvs] [306e9bff46a] master: Fix VSE pan property text printing

2021-10-06 Thread Richard Antalik
Commit: 306e9bff46ad721c1d3203bf7d83c1bef0d957f3
Author: Richard Antalik
Date:   Thu Oct 7 00:04:26 2021 +0200
Branches: master
https://developer.blender.org/rB306e9bff46ad721c1d3203bf7d83c1bef0d957f3

Fix VSE pan property text printing

Move text into separate label.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index dec754b8747..03a090255f6 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1801,15 +1801,26 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, 
Panel):
 split.label(text="Pitch")
 split.prop(strip, "pitch", text="")
 
+audio_channels = context.scene.render.ffmpeg.audio_channels
+pan_enabled = sound.use_mono and audio_channels != 'MONO'
+pan_text = "%.2f°" % (strip.pan * 90)
+
 split = col.split(factor=0.4)
 split.alignment = 'RIGHT'
 split.label(text="Pan")
-audio_channels = context.scene.render.ffmpeg.audio_channels
-pan_text = ""
+split.prop(strip, "pan", text="")
+split.enabled = pan_enabled
+
 if audio_channels != 'MONO' and audio_channels != 'STEREO':
-pan_text = "%.2f°" % (strip.pan * 90)
-split.prop(strip, "pan", text=pan_text)
-split.enabled = sound.use_mono and audio_channels != 'MONO'
+split = col.split(factor=0.4)
+split.alignment = 'RIGHT'
+split.label(text="Pan Angle")
+split.enabled = pan_enabled
+subsplit = split.row()
+subsplit.alignment = 'CENTER'
+subsplit.label(text=pan_text)
+subsplit.label(text=" ")  # Compensate for no decorate.
+subsplit.enabled = pan_enabled
 
 layout.use_property_split = False
 col = layout.column()

___
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] [313c6811c3a] sculpt-dev: Sculpt: fix nasty radius symmetry bug

2021-10-06 Thread Joseph Eagar
Commit: 313c6811c3ab155e9b0fcd432a36f3879586a0b6
Author: Joseph Eagar
Date:   Wed Oct 6 13:35:22 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB313c6811c3ab155e9b0fcd432a36f3879586a0b6

Sculpt: fix nasty radius symmetry bug

* Brush radius wasn't being calculated correctly if symmetry was on.
* Unnessed SCULPT_run_commandlist, it now calls
  do_symmetrical_brush_actions instead of the reverse.
* Renamed MDynTopoVert to MSculptVert.  Old name didn't
  make sense given that all three PBVH types now use it.
  Mercifully it's never saved in files, and even if it
  somehow was saved the CD file loading code checks for
  that.

===

M   source/blender/blenkernel/BKE_paint.h
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/dyntopo.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/blenkernel/intern/pbvh_intern.h
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_log.h
M   source/blender/editors/sculpt_paint/paint_mask.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_curvature.c
M   source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M   source/blender/editors/sculpt_paint/sculpt_face_set.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_smooth.c
M   source/blender/editors/sculpt_paint/sculpt_undo.c
M   source/blender/gpu/intern/gpu_buffers.c
M   source/blender/makesdna/DNA_meshdata_types.h

===

diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index 4845118693f..456d845613c 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -37,7 +37,7 @@ extern "C" {
 #endif
 
 struct SculptCustomLayer;
-struct MDynTopoVert;
+struct MSculptVert;
 struct BMFace;
 struct BMesh;
 struct BlendDataReader;
@@ -628,7 +628,7 @@ typedef struct SculptSession {
 
   /* BMesh for dynamic topology sculpting */
   struct BMesh *bm;
-  int cd_dyn_vert;
+  int cd_sculpt_vert;
   int cd_vert_node_offset;
   int cd_face_node_offset;
   int cd_vcol_offset;
@@ -771,7 +771,7 @@ typedef struct SculptSession {
   int stroke_id, boundary_symmetry;
 
   bool fast_draw;  // hides facesets/masks and forces smooth to save GPU 
bandwidth
-  struct MDynTopoVert *mdyntopo_verts;  // for non-bmesh
+  struct MSculptVert *mdyntopo_verts;  // for non-bmesh
   int mdyntopo_verts_size;
 
   /*list of up to date custom layer references,
diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 34dc6df8830..229fb7bb7e4 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -130,7 +130,7 @@ struct GPU_PBVH_Buffers;
 struct IsectRayPrecalc;
 struct MLoop;
 struct MLoopTri;
-struct MDynTopoVert;
+struct MSculptVert;
 struct MPoly;
 struct MVert;
 struct Mesh;
@@ -283,7 +283,7 @@ void BKE_pbvh_build_mesh(PBVH *pbvh,
  const struct MPoly *mpoly,
  const struct MLoop *mloop,
  struct MVert *verts,
- struct MDynTopoVert *mdyntopo_verts,
+ struct MSculptVert *mdyntopo_verts,
  int totvert,
  struct CustomData *vdata,
  struct CustomData *ldata,
@@ -305,13 +305,13 @@ void BKE_pbvh_build_bmesh(PBVH *pbvh,
   struct BMLog *log,
   const int cd_vert_node_offset,
   const int cd_face_node_offset,
-  const int cd_dyn_vert,
+  const int cd_sculpt_vert,
   const int cd_face_areas,
   bool fast_draw);
 void BKE_pbvh_update_offsets(PBVH *pbvh,
  const int cd_vert_node_offset,
  const int cd_face_node_offset,
- const int cd_dyn_vert,
+ const int cd_sculpt_vert,
  const int cd_face_areas);
 void BKE_pbvh_free(PBVH *pbvh);
 
@@ -500,7 +500,7 @@ void BKE_pbvh_check_tri_areas(PBVH *pbvh, PBVHNode *node);
 // updates boundaries and valences for whole mesh
 void BKE_pbvh_bmesh_on_mesh_change(PBVH *pbvh);
 bool BKE_pbvh_bmesh_check_valence(PBVH *pbvh, SculptVertRef vertex);
-void BKE_pbvh_bmesh_update_valence(int cd_dyn_vert, SculptVertRef vertex);
+void BKE_pbvh_bmesh_update_valence(int cd_sculpt_vert, SculptVertRef vertex);
 void BKE_pbvh_bmesh_update_all_valence(PBVH *pbvh);
 void BKE_pbvh_bmesh

[Bf-blender-cvs] [b7d20abaff8] temp-vert-normals-cleanup: Many fixes and code cleanups

2021-10-06 Thread Hans Goudey
Commit: b7d20abaff8e7c93172f2bfbd7d9714947994993
Author: Hans Goudey
Date:   Wed Oct 6 13:09:00 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBb7d20abaff8e7c93172f2bfbd7d9714947994993

Many fixes and code cleanups

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/BKE_shrinkwrap.h
M   source/blender/blenkernel/intern/DerivedMesh.cc
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/blenkernel/intern/geometry_component_mesh.cc
M   source/blender/blenkernel/intern/geometry_set_instances.cc
M   source/blender/blenkernel/intern/gpencil_geom.cc
M   source/blender/blenkernel/intern/mesh.c
M   source/blender/blenkernel/intern/mesh_convert.cc
M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/blenkernel/intern/mesh_runtime.c
M   source/blender/blenkernel/intern/mesh_tangent.c
M   source/blender/blenkernel/intern/mesh_validate.c
M   source/blender/blenkernel/intern/modifier.c
M   source/blender/blenkernel/intern/object_update.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/shrinkwrap.c
M   source/blender/blenkernel/intern/subdiv_eval.c
M   source/blender/blenkernel/intern/subdiv_mesh.c
M   source/blender/blenkernel/intern/subsurf_ccg.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_log.h
M   source/blender/bmesh/intern/bmesh_mesh_convert.c
M   source/blender/draw/intern/draw_cache_extract_mesh_render_data.c
M   source/blender/draw/intern/mesh_extractors/extract_mesh.h
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc
M   source/blender/editors/armature/meshlaplacian.c
M   source/blender/editors/mesh/mesh_data.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_boundary.c
M   source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M   source/blender/io/alembic/exporter/abc_writer_hair.cc
M   source/blender/io/alembic/intern/abc_reader_mesh.cc
M   source/blender/io/alembic/intern/abc_reader_points.cc
M   source/blender/io/usd/intern/usd_reader_mesh.cc
M   source/blender/io/usd/intern/usd_writer_mesh.cc
M   source/blender/makesdna/DNA_mesh_types.h
M   source/blender/modifiers/intern/MOD_array.c
M   source/blender/modifiers/intern/MOD_build.c
M   source/blender/modifiers/intern/MOD_explode.c
M   source/blender/modifiers/intern/MOD_normal_edit.c
M   source/blender/modifiers/intern/MOD_screw.c
M   source/blender/modifiers/intern/MOD_wave.c
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_circle.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
M   source/blender/render/intern/texture_pointdensity.c

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index 0066c22bd05..4b7ad4f3fa4 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -282,15 +282,9 @@ void BKE_mesh_calc_normals_poly(const struct MVert *mvert,
 const struct MPoly *mpoly,
 int mpoly_len,
 float (*r_poly_normals)[3]);
-void BKE_mesh_calc_normals_poly_and_vertex(struct MVert *mvert,
-   int mvert_len,
-   const struct MLoop *mloop,
-   int mloop_len,
-   const struct MPoly *mpolys,
-   int mpoly_len,
-   float (*r_poly_normals)[3],
-   float (*r_vert_normals)[3]);
 void BKE_mesh_calc_normals(struct Mesh *me);
+float (*BKE_mesh_vertex_normals_for_write(struct Mesh *mesh))[3];
+float (*BKE_mesh_face_normals_for_write(struct Mesh *mesh))[3];
 const float (*BKE_mesh_ensure_vertex_normals(const struct Mesh *mesh))[3];
 const float (*BKE_mesh_ensure_face_normals(const struct Mesh *mesh))[3];
 void BKE_mesh_ensure_normals_for_display(struct Mesh *mesh);
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h 
b/source/blender/blenkernel/BKE_shrinkwrap.h
index 70aeb37d995..22da681117b 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwr

[Bf-blender-cvs] [d238b77bdb7] temp-eevee-gpencil-rewrite: Small tweaks to panels

2021-10-06 Thread Antonio Vazquez
Commit: d238b77bdb74ca2906ec2b72deb3c696be09a142
Author: Antonio Vazquez
Date:   Wed Oct 6 18:24:17 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rBd238b77bdb74ca2906ec2b72deb3c696be09a142

Small tweaks to panels

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 249aca2..489eeecfa78 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -130,9 +130,11 @@ class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, 
Panel):
 
 def draw(self, context):
 layout = self.layout
+ob = context.active_object
+is_scene_render = ob.use_grease_pencil_scene_engine
 mat = context.material
-layout.prop(mat, "use_nodes", icon='NODETREE')
-layout.separator()
+if is_scene_render:
+layout.prop(mat, "use_nodes", icon='NODETREE')
 
 
 class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
@@ -276,26 +278,29 @@ class 
MATERIAL_PT_gpencil_custom_props(GPMaterialButtonsPanel, PropertyPanel, Pa
 
 
 def draw_material_settings(self, context):
+ob = context.active_object
+is_scene_render = ob.use_grease_pencil_scene_engine
 layout = self.layout
 layout.use_property_split = True
 layout.use_property_decorate = False
-
 mat = context.material
 
-layout.prop(mat, "use_backface_culling")
-layout.prop(mat, "blend_method")
-layout.prop(mat, "shadow_method")
+if is_scene_render:
+layout.prop(mat, "use_backface_culling")
+layout.prop(mat, "blend_method")
+layout.prop(mat, "shadow_method")
+
+row = layout.row()
+row.active = ((mat.blend_method == 'CLIP') or (mat.shadow_method == 
'CLIP'))
+row.prop(mat, "alpha_threshold")
 
-row = layout.row()
-row.active = ((mat.blend_method == 'CLIP') or (mat.shadow_method == 
'CLIP'))
-row.prop(mat, "alpha_threshold")
+if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
+layout.prop(mat, "show_transparent_back")
 
-if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
-layout.prop(mat, "show_transparent_back")
+layout.prop(mat, "use_screen_refraction")
+layout.prop(mat, "refraction_depth")
+layout.prop(mat, "use_sss_translucency")
 
-layout.prop(mat, "use_screen_refraction")
-layout.prop(mat, "refraction_depth")
-layout.prop(mat, "use_sss_translucency")
 layout.prop(mat, "pass_index")

___
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] [b6ee53fb550] temp-eevee-gpencil-rewrite: Hide unsupported features

2021-10-06 Thread Antonio Vazquez
Commit: b6ee53fb550ff52eab304caa82c601a3177a2cd5
Author: Antonio Vazquez
Date:   Wed Oct 6 17:39:33 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rBb6ee53fb550ff52eab304caa82c601a3177a2cd5

Hide unsupported features

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 3f11722f665..249aca2 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -149,7 +149,8 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 def draw(self, context):
 layout = self.layout
 layout.use_property_split = True
-
+ob = context.active_object
+is_scene_render = ob.use_grease_pencil_scene_engine
 ma = context.material
 if ma is not None and ma.grease_pencil is not None:
 gpcolor = ma.grease_pencil
@@ -162,7 +163,8 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 col.prop(gpcolor, "stroke_style", text="Style")
 
 col.prop(gpcolor, "color", text="Base Color")
-col.prop(gpcolor, "use_stroke_holdout")
+if not is_scene_render:
+col.prop(gpcolor, "use_stroke_holdout")
 
 if gpcolor.stroke_style == 'TEXTURE':
 row = col.row()
@@ -180,7 +182,7 @@ class 
MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
 col.prop(gpcolor, "alignment_mode")
 col.prop(gpcolor, "alignment_rotation")
 
-if gpcolor.mode == 'LINE':
+if gpcolor.mode == 'LINE' and not is_scene_render:
 col.prop(gpcolor, "use_overlap_strokes")
 
 
@@ -198,6 +200,8 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 layout = self.layout
 layout.use_property_split = True
 
+ob = context.active_object
+is_scene_render = ob.use_grease_pencil_scene_engine
 ma = context.material
 gpcolor = ma.grease_pencil
 
@@ -208,14 +212,16 @@ class 
MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
 
 if gpcolor.fill_style == 'SOLID':
 col.prop(gpcolor, "fill_color", text="Base Color")
-col.prop(gpcolor, "use_fill_holdout")
+if not is_scene_render:
+col.prop(gpcolor, "use_fill_holdout")
 
 elif gpcolor.fill_style == 'GRADIENT':
 col.prop(gpcolor, "gradient_type")
 
 col.prop(gpcolor, "fill_color", text="Base Color")
 col.prop(gpcolor, "mix_color", text="Secondary Color")
-col.prop(gpcolor, "use_fill_holdout")
+if not is_scene_render:
+col.prop(gpcolor, "use_fill_holdout")
 col.prop(gpcolor, "mix_factor", text="Blend", slider=True)
 col.prop(gpcolor, "flip", text="Flip Colors")
 
@@ -229,7 +235,8 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, 
Panel):
 
 elif gpcolor.fill_style == 'TEXTURE':
 col.prop(gpcolor, "fill_color", text="Base Color")
-col.prop(gpcolor, "use_fill_holdout")
+if not is_scene_render:
+col.prop(gpcolor, "use_fill_holdout")
 
 col.template_ID(gpcolor, "fill_image", open="image.open")

___
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] [4bbfdce004f] temp-eevee-gpencil-rewrite: Move GPStyle pass_index to Material

2021-10-06 Thread Antonio Vazquez
Commit: 4bbfdce004fc88ba5d6fcf825d4c9b212c8ce21c
Author: Antonio Vazquez
Date:   Wed Oct 6 17:17:29 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB4bbfdce004fc88ba5d6fcf825d4c9b212c8ce21c

Move GPStyle pass_index to Material

This was duplicated

===

M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
M   source/blender/makesdna/DNA_material_types.h
M   source/blender/makesrna/intern/rna_material.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index d7dace27c8c..3f11722f665 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -304,13 +304,6 @@ class MATERIAL_PT_gpencil_settings(GPMaterialButtonsPanel, 
Panel):
 def draw(self, context):
 draw_material_settings(self, context)
 
-# TODO: Remove prop pass_index and move to material struct
-layout = self.layout
-layout.use_property_split = True
-ma = context.material
-gpcolor = ma.grease_pencil
-layout.prop(gpcolor, "pass_index")
-
 
 class MATERIAL_PT_gpencil_material_presets(PresetPanel, Panel):
 """Material settings"""
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index e65fd3e6754..7becdcc2707 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1682,5 +1682,14 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
*/
   {
 /* Keep this block, even when empty. */
+/* Fix grease pencil material index. */
+{
+  LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
+if (mat->gp_style != NULL) {
+  mat->index = mat->gp_style->index;
+}
+  }
+
+}
   }
 }
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index df78ac8110e..c61851b374e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -85,7 +85,6 @@ bool is_stroke_affected_by_modifier(Object *ob,
 const bool inv4)
 {
   Material *ma = BKE_gpencil_material(ob, gps->mat_nr + 1);
-  MaterialGPencilStyle *gp_style = ma->gp_style;
 
   /* omit if filter by layer */
   if (mlayername[0] != '\0') {
@@ -129,12 +128,12 @@ bool is_stroke_affected_by_modifier(Object *ob,
   /* verify material pass */
   if (mpassindex > 0) {
 if (inv2 == false) {
-  if (gp_style->index != mpassindex) {
+  if (material->index != mpassindex) {
 return false;
   }
 }
 else {
-  if (gp_style->index == mpassindex) {
+  if (material->index == mpassindex) {
 return false;
   }
 }
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 67cd68afb8a..81c458cfa36 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -67,7 +67,7 @@ typedef struct MaterialGPencilStyle {
   /** Settings. */
   short flag;
   /** Custom index for passes. */
-  short index;
+  short index DNA_DEPRECATED;
   /** Style for drawing strokes (used to select shader type). */
   short stroke_style;
   /** Style for filling areas (used to select shader type). */
diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 22a75c0d992..94252feb4d6 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -610,12 +610,6 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
"Only applies in texture shading mode");
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 
"rna_MaterialGpencil_update");
 
-  /* pass index for future compositing and editing tools */
-  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
-  RNA_def_property_int_sdna(prop, NULL, "index");
-  RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Color 
Index\" pass");
-  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, 
"rna_MaterialGpencil_update");
-
   /* mode type */
   prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");

___
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] [4500e100bb7] temp-eevee-gpencil-rewrite: Changes in Material panels

2021-10-06 Thread Antonio Vazquez
Commit: 4500e100bb70e069bf03724cbad6bcb552ca2b7f
Author: Antonio Vazquez
Date:   Wed Oct 6 17:07:51 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB4500e100bb70e069bf03724cbad6bcb552ca2b7f

Changes in Material panels

===

M   release/scripts/startup/bl_ui/properties_material.py
M   release/scripts/startup/bl_ui/properties_material_gpencil.py

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index 1c7f3639f0a..c74578d47d2 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -64,7 +64,7 @@ class MaterialButtonsPanel:
 @classmethod
 def poll(cls, context):
 mat = context.material
-return mat and (context.engine in cls.COMPAT_ENGINES) and not 
mat.grease_pencil
+return mat and (((context.engine in cls.COMPAT_ENGINES) and not 
mat.grease_pencil) or (mat.grease_pencil and mat.use_nodes)) 
 
 
 class MATERIAL_PT_preview(MaterialButtonsPanel, Panel):
@@ -72,6 +72,11 @@ class MATERIAL_PT_preview(MaterialButtonsPanel, Panel):
 bl_options = {'DEFAULT_CLOSED'}
 COMPAT_ENGINES = {'BLENDER_EEVEE'}
 
+@classmethod
+def poll(cls, context):
+mat = context.material
+return mat and (((context.engine in cls.COMPAT_ENGINES) and not 
mat.grease_pencil) or (mat.grease_pencil and mat.use_nodes)) 
+
 def draw(self, context):
 self.layout.template_preview(context.material)
 
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 9d099ff2231..d7dace27c8c 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -120,12 +120,19 @@ class 
MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, Panel):
 class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel):
 bl_label = "Surface"
 
+@classmethod
+def poll(cls, context):
+mat = context.material
+return (mat and mat.use_nodes is False)
+
 def draw_header_preset(self, _context):
 MATERIAL_PT_gpencil_material_presets.draw_panel_header(self.layout)
 
-def draw(self, _context):
+def draw(self, context):
 layout = self.layout
-layout.use_property_split = True
+mat = context.material
+layout.prop(mat, "use_nodes", icon='NODETREE')
+layout.separator()
 
 
 class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
@@ -239,6 +246,11 @@ class MATERIAL_PT_gpencil_preview(GPMaterialButtonsPanel, 
Panel):
 COMPAT_ENGINES = {'BLENDER_EEVEE'}
 bl_options = {'DEFAULT_CLOSED'}
 
+@classmethod
+def poll(cls, context):
+mat = context.material
+return (mat and mat.grease_pencil and mat.use_nodes is False)
+
 def draw(self, context):
 ma = context.material
 self.layout.label(text=ma.name)
@@ -250,15 +262,51 @@ class 
MATERIAL_PT_gpencil_custom_props(GPMaterialButtonsPanel, PropertyPanel, Pa
 _context_path = "object.active_material"
 _property_type = bpy.types.Material
 
+@classmethod
+def poll(cls, context):
+mat = context.material
+return (mat and mat.grease_pencil and mat.use_nodes is False)
+
+
+def draw_material_settings(self, context):
+layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+mat = context.material
+
+layout.prop(mat, "use_backface_culling")
+layout.prop(mat, "blend_method")
+layout.prop(mat, "shadow_method")
+
+row = layout.row()
+row.active = ((mat.blend_method == 'CLIP') or (mat.shadow_method == 
'CLIP'))
+row.prop(mat, "alpha_threshold")
+
+if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
+layout.prop(mat, "show_transparent_back")
+
+layout.prop(mat, "use_screen_refraction")
+layout.prop(mat, "refraction_depth")
+layout.prop(mat, "use_sss_translucency")
+layout.prop(mat, "pass_index")
+
 
 class MATERIAL_PT_gpencil_settings(GPMaterialButtonsPanel, Panel):
 bl_label = "Settings"
 bl_options = {'DEFAULT_CLOSED'}
 
+@classmethod
+def poll(cls, context):
+mat = context.material
+return (mat and mat.grease_pencil and mat.use_nodes is False)
+
 def draw(self, context):
+draw_material_settings(self, context)
+
+# TODO: Remove prop pass_index and move to material struct
 layout = self.layout
 layout.use_property_split = True
-
 ma = context.material
 gpcolor = ma.grease_pencil
 layout.prop(gpcolor, "pass_index")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscript

[Bf-blender-cvs] [889d1f4e855] temp-eevee-gpencil-rewrite: Merge branch 'eevee-rewrite' into temp-eevee-gpencil-rewrite

2021-10-06 Thread Antonio Vazquez
Commit: 889d1f4e855c2dfdfe14fa95e390c7c2a78feeb2
Author: Antonio Vazquez
Date:   Wed Oct 6 12:09:46 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB889d1f4e855c2dfdfe14fa95e390c7c2a78feeb2

Merge branch 'eevee-rewrite' into temp-eevee-gpencil-rewrite

===



===



___
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] [20abefa18e2] temp-eevee-gpencil-rewrite: Revert different types of materials creation

2021-10-06 Thread Antonio Vazquez
Commit: 20abefa18e22cfdf92910ae48e6a150e9f2fc3b2
Author: Antonio Vazquez
Date:   Wed Oct 6 16:05:51 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB20abefa18e22cfdf92910ae48e6a150e9f2fc3b2

Revert different types of materials creation

===

M   source/blender/editors/render/render_shading.c

===

diff --git a/source/blender/editors/render/render_shading.c 
b/source/blender/editors/render/render_shading.c
index 737efd76118..7b2667905ff 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -767,7 +767,7 @@ static int new_material_exec(bContext *C, wmOperator 
*UNUSED(op))
   }
   else {
 const char *name = DATA_("Material");
-if ((!(ob != NULL && ob->type == OB_GPENCIL)) || 
(GP_OBJECT_USE_SCENE_RENDER(ob))) {
+if (!(ob != NULL && ob->type == OB_GPENCIL)) {
   ma = BKE_material_add(bmain, name);
 }
 else {

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


[Bf-blender-cvs] [0748444b5c3] temp-geometry-nodes-delete-geometry-image-texture: Geometry Nodes: Separate + Delete Geometry for fields

2021-10-06 Thread Wannes Malfait
Commit: 0748444b5c30a44a551f40fa7c78d5c0a7da1a23
Author: Wannes Malfait
Date:   Wed Oct 6 14:48:18 2021 +0200
Branches: temp-geometry-nodes-delete-geometry-image-texture
https://developer.blender.org/rB0748444b5c30a44a551f40fa7c78d5c0a7da1a23

Geometry Nodes: Separate + Delete Geometry for fields

Delete Geometry:
This adds a copy of the old node in the legacy folder and updates the node to
work with fields. The invert option is removed, because it something that should
be very easy with fields, and to be consistent with other nodes which have a
selection. There is also a dropdown to select the domain, because the domain
can't be determined from the field input. When the domain does not belong on
any of the components an info message is displayed.

{F10416062}

Separate Geometry:
A more general version of the old Point Separate node. The "inverted" output is 
the
same as using the delete geometry node.

{F10518721}

Possible things to change:
- The name of the outputs of the Separate Geometry node
- Add option for "smooth" {D10979} . This is probably best for a dedicated node 
since it only applies to meshes.

Reviewed By: JacquesLucke

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

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/RNA_enum_items.h
M   source/blender/makesrna/intern/rna_attribute.c
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/node_geometry_util.hh
M   source/blender/nodes/geometry/nodes/legacy/node_geo_delete_geometry.cc
A   source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
A   source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index fab57a85823..908a00ad9be 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -552,9 +552,11 @@ geometry_node_categories = [
 NodeItem("GeometryNodeProximity"),
 NodeItem("GeometryNodeBoundBox"),
 NodeItem("GeometryNodeConvexHull"),
+NodeItem("GeometryNodeDeleteGeometry"),
 NodeItem("GeometryNodeTransform"),
 NodeItem("GeometryNodeJoinGeometry"),
 NodeItem("GeometryNodeSeparateComponents"),
+NodeItem("GeometryNodeSeparateGeometry"),
 NodeItem("GeometryNodeSetPosition"),
 NodeItem("GeometryNodeRealizeInstances"),
 ]),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 79ae9d71762..025726cabb9 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1515,6 +1515,9 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_CURVE_SET_HANDLES 1100
 #define GEO_NODE_POINTS_TO_VOLUME 1101
 #define GEO_NODE_CURVE_HANDLE_TYPE_SELECTION 1102
+#define GEO_NODE_DELETE_GEOMETRY 1103
+#define GEO_NODE_SEPARATE_GEOMETRY 1104
+
 /** \} */
 
 /*  */
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 75b9d07ca98..d3eb33b1267 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5712,6 +5712,7 @@ static void registerGeometryNodes()
   register_node_type_geo_legacy_curve_set_handles();
   register_node_type_geo_legacy_attribute_proximity();
   register_node_type_geo_legacy_attribute_randomize();
+  register_node_type_geo_legacy_delete_geometry();
   register_node_type_geo_legacy_material_assign();
   register_node_type_geo_legacy_points_to_volume();
   register_node_type_geo_legacy_select_by_material();
@@ -5803,6 +5804,7 @@ static void registerGeometryNodes()
   register_node_type_geo_realize_instances();
   register_node_type_geo_sample_texture();
   register_node_type_geo_separate_components();
+  register_node_type_geo_separate_geometry();
   register_node_type_geo_set_position();
   register_node_type_geo_string_join();
   register_node_type_geo_string_to_curves();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index ea87cef1118..732c487e51f 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1538,6 +1538,18 @@ typedef struct NodeGeometryStringToCurves {
   char _pad[1];
 } NodeGeometryStringToCurves;
 
+typedef struct NodeGeometryDeleteGeometry {
+  /* AttributeDomain. */
+  int8_t domain;
+  /* GeometryNodeDeleteG

[Bf-blender-cvs] [9d216ef72b8] temp-geometry-nodes-delete-geometry-image-texture: Geometry Nodes: Add Image texture node (WIP)

2021-10-06 Thread Charlie Jolly
Commit: 9d216ef72b84e96ced1afac4f2991f1d5a918f5a
Author: Charlie Jolly
Date:   Wed Oct 6 10:55:26 2021 +0200
Branches: temp-geometry-nodes-delete-geometry-image-texture
https://developer.blender.org/rB9d216ef72b84e96ced1afac4f2991f1d5a918f5a

Geometry Nodes: Add Image texture node (WIP)

Port shader image texture node

**Core devs: Please take over if you want to.**

{F10797876}

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

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/modifiers/intern/MOD_nodes_evaluator.cc
M   source/blender/nodes/CMakeLists.txt
R050source/blender/nodes/shader/nodes/node_shader_tex_image.c   
source/blender/nodes/shader/nodes/node_shader_tex_image.cc
M   source/tools

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 4833954c0ac..3d01b77226f 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 4833954c0ac85cc407e1d5a153aa11b1d1823ec0
+Subproject commit 3d01b77226fcd99024ffaa0c12a6c14f22914d9f
diff --git a/release/scripts/addons b/release/scripts/addons
index f86f25e6221..1f38515d87f 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit f86f25e62217264495d05f116ccb09d575fe9841
+Subproject commit 1f38515d87fb78443f2ead17b4e95411f43dc1b2
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 5a82baad9f9..42da56aa737 16
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 5a82baad9f986722104280e8354a4427d8e9eab1
+Subproject commit 42da56aa73726710107031787af5eea186797984
diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 923ea22e1e3..fab57a85823 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -633,6 +633,7 @@ geometry_node_categories = [
 ]),
 GeometryNodeCategory("GEO_TEXTURE", "Texture", items=[
 NodeItem("ShaderNodeTexNoise"),
+NodeItem("ShaderNodeTexImage"),
 ]),
 GeometryNodeCategory("GEO_VECTOR", "Vector", items=[
 NodeItem("ShaderNodeVectorCurve"),
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc 
b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index c5213dc304b..c69096759ab 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -331,6 +331,7 @@ static void get_socket_value(const SocketRef &socket, void 
*r_value)
 if (bsocket.type == SOCK_VECTOR) {
   if (ELEM(bnode.type,
GEO_NODE_SET_POSITION,
+   SH_NODE_TEX_IMAGE,
SH_NODE_TEX_NOISE,
GEO_NODE_MESH_TO_POINTS,
GEO_NODE_PROXIMITY)) {
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index dab7579d946..7e355310b62 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -324,7 +324,7 @@ set(SRC
   shader/nodes/node_shader_tex_coord.c
   shader/nodes/node_shader_tex_environment.c
   shader/nodes/node_shader_tex_gradient.cc
-  shader/nodes/node_shader_tex_image.c
+  shader/nodes/node_shader_tex_image.cc
   shader/nodes/node_shader_tex_magic.c
   shader/nodes/node_shader_tex_musgrave.cc
   shader/nodes/node_shader_tex_noise.cc
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c 
b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
similarity index 50%
rename from source/blender/nodes/shader/nodes/node_shader_tex_image.c
rename to source/blender/nodes/shader/nodes/node_shader_tex_image.cc
index 09d06c35a5f..5a0dc59317d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
@@ -19,31 +19,26 @@
 
 #include "../node_shader_util.h"
 
-/*  OUTPUT  */
+#include "BKE_image.h"
+#include "BLI_noise.hh"
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
 
-static bNodeSocketTemplate sh_node_tex_image_in[] = {
-{SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, 
SOCK_HIDE_VALUE},
-{-1, ""},
-};
+namespace blender::nodes {
 
-static bNodeSocketTemplate sh_node_tex_image_out[] = {
-{SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, 
SOCK_NO_INTERNAL_LINK},
-{SOCK_FLOAT,
- N_("Alpha"),
- 0.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- 0.0f,
- 1.0f,
- PROP_NONE,
- SOCK_NO_INTERNAL_LINK},
-{-1, ""},
+static void sh_node_tex_image_declare(NodeDeclarationBuilder &b)
+{
+  b.is_function_node();
+  b.add_input("Vector"

[Bf-blender-cvs] [04857cc8efb] master: Cycles: fully decouple triangle and curve primitive storage from BVH2

2021-10-06 Thread Brecht Van Lommel
Commit: 04857cc8efb385af5d8f40b655eeca41e2b73494
Author: Brecht Van Lommel
Date:   Sun Feb 28 23:23:24 2021 +0100
Branches: master
https://developer.blender.org/rB04857cc8efb385af5d8f40b655eeca41e2b73494

Cycles: fully decouple triangle and curve primitive storage from BVH2

Previously the storage here was optimized to avoid indirections in BVH2
traversal. This helps improve performance a bit, but makes performance
and memory usage of Embree and OptiX BVHs a bit worse also. It also adds
code complexity in other parts of the code.

Now decouple triangle and curve primitive storage from BVH2.
* Reduced peak memory usage on all devices
* Bit better performance for OptiX and Embree
* Bit worse performance for CUDA
* Simplified code:
** Intersection.prim/object now matches ShaderData.prim/object
** No more offset manipulation for mesh displacement before a BVH is built
** Remove primitive packing code and flags for Embree and OptiX
** Curve segments are now stored in a KernelCurve struct
* Also happens to fix a bug in baking with incorrect prim/object

Fixes T91968, T91770, T91902

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

===

M   intern/cycles/bvh/bvh.h
M   intern/cycles/bvh/bvh2.cpp
M   intern/cycles/bvh/bvh_build.cpp
M   intern/cycles/bvh/bvh_embree.cpp
M   intern/cycles/device/optix/device_impl.cpp
M   intern/cycles/kernel/bvh/bvh_embree.h
M   intern/cycles/kernel/bvh/bvh_shadow_all.h
M   intern/cycles/kernel/bvh/bvh_traversal.h
M   intern/cycles/kernel/bvh/bvh_util.h
M   intern/cycles/kernel/device/optix/kernel.cu
M   intern/cycles/kernel/geom/geom_curve.h
M   intern/cycles/kernel/geom/geom_curve_intersect.h
M   intern/cycles/kernel/geom/geom_motion_triangle.h
M   intern/cycles/kernel/geom/geom_motion_triangle_intersect.h
M   intern/cycles/kernel/geom/geom_shader_data.h
M   intern/cycles/kernel/geom/geom_triangle.h
M   intern/cycles/kernel/geom/geom_triangle_intersect.h
M   intern/cycles/kernel/integrator/integrator_intersect_closest.h
M   intern/cycles/kernel/integrator/integrator_shade_background.h
M   intern/cycles/kernel/integrator/integrator_subsurface.h
M   intern/cycles/kernel/kernel_textures.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/kernel/svm/svm_bevel.h
M   intern/cycles/render/geometry.cpp
M   intern/cycles/render/geometry.h
M   intern/cycles/render/hair.cpp
M   intern/cycles/render/hair.h
M   intern/cycles/render/mesh.cpp
M   intern/cycles/render/mesh.h
M   intern/cycles/render/object.cpp
M   intern/cycles/render/scene.cpp
M   intern/cycles/render/scene.h

===

diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h
index 94935c26f10..d9e2ad9526c 100644
--- a/intern/cycles/bvh/bvh.h
+++ b/intern/cycles/bvh/bvh.h
@@ -50,10 +50,6 @@ struct PackedBVH {
   array leaf_nodes;
   /* object index to BVH node index mapping for instances */
   array object_node;
-  /* Mapping from primitive index to index in triangle array. */
-  array prim_tri_index;
-  /* Continuous storage of triangle vertices. */
-  array prim_tri_verts;
   /* primitive type - triangle or strand */
   array prim_type;
   /* visibility visibilitys for primitives */
diff --git a/intern/cycles/bvh/bvh2.cpp b/intern/cycles/bvh/bvh2.cpp
index 379ae9b25ff..4a90a1e8796 100644
--- a/intern/cycles/bvh/bvh2.cpp
+++ b/intern/cycles/bvh/bvh2.cpp
@@ -439,61 +439,20 @@ void BVH2::refit_primitives(int start, int end, BoundBox 
&bbox, uint &visibility
 
 /* Triangles */
 
-void BVH2::pack_triangle(int idx, float4 tri_verts[3])
-{
-  int tob = pack.prim_object[idx];
-  assert(tob >= 0 && tob < objects.size());
-  const Mesh *mesh = static_cast(objects[tob]->get_geometry());
-
-  int tidx = pack.prim_index[idx];
-  Mesh::Triangle t = mesh->get_triangle(tidx);
-  const float3 *vpos = &mesh->verts[0];
-  float3 v0 = vpos[t.v[0]];
-  float3 v1 = vpos[t.v[1]];
-  float3 v2 = vpos[t.v[2]];
-
-  tri_verts[0] = float3_to_float4(v0);
-  tri_verts[1] = float3_to_float4(v1);
-  tri_verts[2] = float3_to_float4(v2);
-}
-
 void BVH2::pack_primitives()
 {
   const size_t tidx_size = pack.prim_index.size();
-  size_t num_prim_triangles = 0;
-  /* Count number of triangles primitives in BVH. */
-  for (unsigned int i = 0; i < tidx_size; i++) {
-if ((pack.prim_index[i] != -1)) {
-  if ((pack.prim_type[i] & PRIMITIVE_ALL_TRIANGLE) != 0) {
-++num_prim_triangles;
-  }
-}
-  }
   /* Reserve size for arrays. */
-  pack.prim_tri_index.clear();
-  pack.prim_tri_index.resize(tidx_size);
-  pack.prim_tri_verts.clear();
-  pack.prim_tri_verts.resize(num_prim_triangles * 3);
   pack.prim_visibility.clear();
   pack.prim_visibility.resize(tidx_size);
   /* Fill in all the arrays. */
-  size_t prim_triangle_index = 0;
   for (unsigned int i = 0; i < tidx_size; i

[Bf-blender-cvs] [0fd0b0643a7] master: Build: search for hipcc in HIP_ROOT_DIR/bin

2021-10-06 Thread Brecht Van Lommel
Commit: 0fd0b0643a7a1c0334f39bddba4067d8fa8eede6
Author: Brecht Van Lommel
Date:   Wed Oct 6 16:13:21 2021 +0200
Branches: master
https://developer.blender.org/rB0fd0b0643a7a1c0334f39bddba4067d8fa8eede6

Build: search for hipcc in HIP_ROOT_DIR/bin

===

M   build_files/cmake/Modules/FindHIP.cmake

===

diff --git a/build_files/cmake/Modules/FindHIP.cmake 
b/build_files/cmake/Modules/FindHIP.cmake
index c68d78e5796..c331a19eb33 100644
--- a/build_files/cmake/Modules/FindHIP.cmake
+++ b/build_files/cmake/Modules/FindHIP.cmake
@@ -27,6 +27,8 @@ find_program(HIP_HIPCC_EXECUTABLE
 hipcc
   HINTS
 ${_hip_SEARCH_DIRS}
+  PATH_SUFFIXES
+bin
 )
 
 if(HIP_HIPCC_EXECUTABLE AND NOT EXISTS ${HIP_HIPCC_EXECUTABLE})

___
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] [8a6f224e260] master: Fix logic error when trying to find hovered item

2021-10-06 Thread Julian Eisel
Commit: 8a6f224e260b2ec7e39d2a02fca62f9614049091
Author: Julian Eisel
Date:   Wed Oct 6 16:52:16 2021 +0200
Branches: master
https://developer.blender.org/rB8a6f224e260b2ec7e39d2a02fca62f9614049091

Fix logic error when trying to find hovered item

Was just comparing this item's and the parent item's names. But if an item has
no parents, only its own name has to match for the check to return true. Make
sure that the number of parents also matches.

===

M   source/blender/editors/interface/tree_view.cc

===

diff --git a/source/blender/editors/interface/tree_view.cc 
b/source/blender/editors/interface/tree_view.cc
index 7bcf679a5ea..f3070481da2 100644
--- a/source/blender/editors/interface/tree_view.cc
+++ b/source/blender/editors/interface/tree_view.cc
@@ -439,6 +439,9 @@ bool AbstractTreeViewItem::matches_including_parents(const 
AbstractTreeViewItem
   if (!matches(other)) {
 return false;
   }
+  if (count_parents() != other.count_parents()) {
+return false;
+  }
 
   for (AbstractTreeViewItem *parent = parent_, *other_parent = other.parent_;
parent && other_parent;

___
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] [bbfa6a92cf1] master: Fix T91987: Linking overrides does not apply overrides rules.

2021-10-06 Thread Bastien Montagne
Commit: bbfa6a92cf1c7581a09712401f50c0f0fc02240d
Author: Bastien Montagne
Date:   Wed Oct 6 16:41:47 2021 +0200
Branches: master
https://developer.blender.org/rBbbfa6a92cf1c7581a09712401f50c0f0fc02240d

Fix T91987: Linking overrides does not apply overrides rules.

Just a matter of calling `BKE_lib_override_library_main_update` in
`library_link_end`.

===

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

===

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index 3ee5e41bf1f..491322e06df 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5040,7 +5040,6 @@ static void library_link_end(Main *mainl,
 add_main_to_main(mainvar, main_newid);
   }
 
-  BKE_main_free(main_newid);
   blo_join_main((*fd)->mainlist);
   mainvar = (*fd)->mainlist->first;
   MEM_freeN((*fd)->mainlist);
@@ -5054,6 +5053,15 @@ static void library_link_end(Main *mainl,
 
   placeholders_ensure_valid(mainvar);
 
+  /* Apply overrides of newly linked data if needed. Already existing IDs need 
to split out, to
+   * avoid re-applying their own overrides. */
+  BLI_assert(BKE_main_is_empty(main_newid));
+  split_main_newid(mainvar, main_newid);
+  BKE_lib_override_library_main_validate(main_newid, (*fd)->reports->reports);
+  BKE_lib_override_library_main_update(main_newid);
+  add_main_to_main(mainvar, main_newid);
+  BKE_main_free(main_newid);
+
   BKE_main_id_tag_all(mainvar, LIB_TAG_NEW, false);
 
   /* Make all relative paths, relative to the open blend file. */

___
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] [b7dc0346aae] master: BMain: Add utils to check if a Main is empty or not.

2021-10-06 Thread Bastien Montagne
Commit: b7dc0346aae849d2ba3f81839a6fd682ff24114a
Author: Bastien Montagne
Date:   Wed Oct 6 16:41:08 2021 +0200
Branches: master
https://developer.blender.org/rBb7dc0346aae849d2ba3f81839a6fd682ff24114a

BMain: Add utils to check if a Main is empty or not.

Mostly intended for debug code (asserts).

===

M   source/blender/blenkernel/BKE_main.h
M   source/blender/blenkernel/intern/main.c

===

diff --git a/source/blender/blenkernel/BKE_main.h 
b/source/blender/blenkernel/BKE_main.h
index 93d5b5c5aa6..3108dfd5d8f 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -201,6 +201,8 @@ typedef struct Main {
 struct Main *BKE_main_new(void);
 void BKE_main_free(struct Main *mainvar);
 
+bool BKE_main_is_empty(struct Main *bmain);
+
 void BKE_main_lock(struct Main *bmain);
 void BKE_main_unlock(struct Main *bmain);
 
diff --git a/source/blender/blenkernel/intern/main.c 
b/source/blender/blenkernel/intern/main.c
index 9c3291edbcc..583feacc04b 100644
--- a/source/blender/blenkernel/intern/main.c
+++ b/source/blender/blenkernel/intern/main.c
@@ -205,6 +205,17 @@ void BKE_main_free(Main *mainvar)
   MEM_freeN(mainvar);
 }
 
+/* Check whether given `bmain` is empty or contains some IDs. */
+bool BKE_main_is_empty(struct Main *bmain)
+{
+  ID *id_iter;
+  FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
+return false;
+  }
+  FOREACH_MAIN_ID_END;
+  return true;
+}
+
 void BKE_main_lock(struct Main *bmain)
 {
   BLI_spin_lock((SpinLock *)bmain->lock);

___
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] [0194e54fd32] master: Fix compilation error with MSVC

2021-10-06 Thread Sergey Sharybin
Commit: 0194e54fd3276a722ea5c2a8cdff6486c30dcbad
Author: Sergey Sharybin
Date:   Wed Oct 6 16:49:20 2021 +0200
Branches: master
https://developer.blender.org/rB0194e54fd3276a722ea5c2a8cdff6486c30dcbad

Fix compilation error with MSVC

MSVC does not support variable size array definition.
Use maximum possible stack, similar to the GPU case.

Not expected to have user-measurable difference.

===

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

===

diff --git 
a/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h 
b/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
index 99f6cf35e9e..00e90701d19 100644
--- a/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
+++ b/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
@@ -42,7 +42,7 @@ ccl_device void 
integrator_volume_stack_update_for_subsurface(INTEGRATOR_STATE_A
   const uint volume_stack_size = kernel_data.volume_stack_size;
 
 #ifdef __VOLUME_RECORD_ALL__
-  Intersection hits[2 * volume_stack_size + 1];
+  Intersection hits[2 * MAX_VOLUME_STACK_SIZE + 1];
   uint num_hits = scene_intersect_volume_all(
   kg, &volume_ray, hits, 2 * volume_stack_size, PATH_RAY_ALL_VISIBILITY);
   if (num_hits > 0) {
@@ -98,11 +98,11 @@ ccl_device void 
integrator_intersect_volume_stack(INTEGRATOR_STATE_ARGS)
   const uint volume_stack_size = kernel_data.volume_stack_size;
 
 #ifdef __VOLUME_RECORD_ALL__
-  Intersection hits[2 * volume_stack_size + 1];
+  Intersection hits[2 * MAX_VOLUME_STACK_SIZE + 1];
   uint num_hits = scene_intersect_volume_all(
   kg, &volume_ray, hits, 2 * volume_stack_size, visibility);
   if (num_hits > 0) {
-int enclosed_volumes[volume_stack_size];
+int enclosed_volumes[MAX_VOLUME_STACK_SIZE];
 Intersection *isect = hits;
 
 qsort(hits, num_hits, sizeof(Intersection), intersections_compare);

___
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] [75fbf6f17e6] master: Asset Browser: Show catalog add & delete icons on mouse hover (only)

2021-10-06 Thread Julian Eisel
Commit: 75fbf6f17e69ee9c6487173ae5957cfff5193d1f
Author: Julian Eisel
Date:   Wed Oct 6 16:29:10 2021 +0200
Branches: master
https://developer.blender.org/rB75fbf6f17e69ee9c6487173ae5957cfff5193d1f

Asset Browser: Show catalog add & delete icons on mouse hover (only)

Now the icons to add or delete catalogs are only shown when mouse hovering a
catalog item in the tree. This is convenient for quick creation of catalogs,
and doesn't require activating a catalog to edit it first.

Determining if a tree item is hovered isn't trivial actually. The UI tree-view
code has to find the matching tree-row button in the previous layout to do so,
since the new layout isn't calculated yet.

===

M   source/blender/editors/include/UI_tree_view.hh
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_view.cc
M   source/blender/editors/interface/tree_view.cc
M   source/blender/editors/space_file/asset_catalog_tree_view.cc

===

diff --git a/source/blender/editors/include/UI_tree_view.hh 
b/source/blender/editors/include/UI_tree_view.hh
index 8f8681896fe..7693a833210 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -185,6 +185,7 @@ class AbstractTreeView : public TreeViewItemContainer {
  const TreeViewItemContainer 
&old_items);
   static AbstractTreeViewItem *find_matching_child(const AbstractTreeViewItem 
&lookup_item,
const TreeViewItemContainer 
&items);
+
   /**
* Items may want to do additional work when state changes. But these state 
changes can only be
* reliably detected after the tree has completed reconstruction (see 
#is_reconstructed()). So
@@ -290,6 +291,12 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
* can't be sure about the item state.
*/
   bool is_active() const;
+  /**
+   * Can be called from the #AbstractTreeViewItem::build_row() implementation, 
but not earlier. The
+   * hovered state can't be queried reliably otherwise.
+   * Note that this does a linear lookup in the old block, so isn't too great 
performance-wise.
+   */
+  bool is_hovered() const;
   void toggle_collapsed();
   /**
* Requires the tree to have completed reconstruction, see 
#is_reconstructed(). Otherwise we
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 8e69ac40a34..5c06f8cfd13 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -1293,6 +1293,8 @@ void ui_interface_tag_script_reload_queries(void);
 void ui_block_free_views(struct uiBlock *block);
 uiTreeViewHandle *ui_block_view_find_matching_in_old_block(const uiBlock 
*new_block,
const 
uiTreeViewHandle *new_view);
+uiButTreeRow *ui_block_view_find_treerow_in_old_block(const uiBlock *new_block,
+  const 
uiTreeViewItemHandle *new_item_handle);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/editors/interface/interface_view.cc 
b/source/blender/editors/interface/interface_view.cc
index b199ce9562e..8122b965892 100644
--- a/source/blender/editors/interface/interface_view.cc
+++ b/source/blender/editors/interface/interface_view.cc
@@ -106,26 +106,71 @@ static StringRef ui_block_view_find_idname(const uiBlock 
&block, const AbstractT
   return {};
 }
 
+static AbstractTreeView *ui_block_view_find_matching_in_old_block(const 
uiBlock &new_block,
+  const 
AbstractTreeView &new_view)
+{
+  uiBlock *old_block = new_block.oldblock;
+  if (!old_block) {
+return nullptr;
+  }
+
+  StringRef idname = ui_block_view_find_idname(new_block, new_view);
+  if (idname.is_empty()) {
+return nullptr;
+  }
+
+  LISTBASE_FOREACH (ViewLink *, old_view_link, &old_block->views) {
+if (old_view_link->idname == idname) {
+  return get_view_from_link(*old_view_link);
+}
+  }
+
+  return nullptr;
+}
+
 uiTreeViewHandle *ui_block_view_find_matching_in_old_block(const uiBlock 
*new_block,
const 
uiTreeViewHandle *new_view_handle)
 {
-  const AbstractTreeView &needle_view = reinterpret_cast(
-  *new_view_handle);
+  BLI_assert(new_block && new_view_handle);
+  const AbstractTreeView &new_view = reinterpret_cast(*new_view_handle);
 
+  AbstractTreeView *old_view = 
ui_block_view_find_matching_in_old_block(*new_block, new_view);
+  return reinterpret_cast(old_view);
+}
+
+uiButTreeRow *ui_block_view_find_treerow_in_old_block(const uiBlock *new_block,
+  co

[Bf-blender-cvs] [536109b4ec3] master: Fix possibly wrong matching of tree-view item buttons

2021-10-06 Thread Julian Eisel
Commit: 536109b4ec336e86de5a7e22e51804584bca74f5
Author: Julian Eisel
Date:   Wed Oct 6 16:15:12 2021 +0200
Branches: master
https://developer.blender.org/rB536109b4ec336e86de5a7e22e51804584bca74f5

Fix possibly wrong matching of tree-view item buttons

The UI code to ensure consistent button state over redraws was just comparing
the name of the item, ignoring the parent names. So with multiple items of the
same name, there might have been glitches (didn't see any myself though).

There's a leftover to-do though, we don't check yet if the matched buttons are
actually from the same tree. Added TODO comment.

===

M   source/blender/editors/include/UI_tree_view.hh
M   source/blender/editors/interface/tree_view.cc

===

diff --git a/source/blender/editors/include/UI_tree_view.hh 
b/source/blender/editors/include/UI_tree_view.hh
index 51737067648..8f8681896fe 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -301,6 +301,7 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
   bool is_renaming() const;
 
   void ensure_parents_uncollapsed();
+  bool matches_including_parents(const AbstractTreeViewItem &other) const;
 
  protected:
   /**
diff --git a/source/blender/editors/interface/tree_view.cc 
b/source/blender/editors/interface/tree_view.cc
index 8f272143b2c..d2971f791c2 100644
--- a/source/blender/editors/interface/tree_view.cc
+++ b/source/blender/editors/interface/tree_view.cc
@@ -419,6 +419,23 @@ void AbstractTreeViewItem::ensure_parents_uncollapsed()
   }
 }
 
+bool AbstractTreeViewItem::matches_including_parents(const 
AbstractTreeViewItem &other) const
+{
+  if (!matches(other)) {
+return false;
+  }
+
+  for (AbstractTreeViewItem *parent = parent_, *other_parent = other.parent_;
+   parent && other_parent;
+   parent = parent->parent_, other_parent = other_parent->parent_) {
+if (!parent->matches(*other_parent)) {
+  return false;
+}
+  }
+
+  return true;
+}
+
 void AbstractTreeViewItem::change_state_delayed()
 {
   if (is_active_fn_()) {
@@ -538,7 +555,8 @@ bool UI_tree_view_item_matches(const uiTreeViewItemHandle 
*a_handle,
 {
   const AbstractTreeViewItem &a = reinterpret_cast(*a_handle);
   const AbstractTreeViewItem &b = reinterpret_cast(*b_handle);
-  return a.matches(b);
+  /* TODO should match the tree-view as well. */
+  return a.matches_including_parents(b);
 }
 
 bool UI_tree_view_item_can_drop(const uiTreeViewItemHandle *item_, const 
wmDrag *drag)

___
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] [2012d541ae3] master: Asset Browser: Always show icon to add catalog next to "All" item

2021-10-06 Thread Julian Eisel
Commit: 2012d541ae3b9fb4ef099e7c490083b463e60d4f
Author: Julian Eisel
Date:   Wed Oct 6 14:50:15 2021 +0200
Branches: master
https://developer.blender.org/rB2012d541ae3b9fb4ef099e7c490083b463e60d4f

Asset Browser: Always show icon to add catalog next to "All" item

Feedback was that it's unclear sometimes how to add a new item and that some
people expect a button to add a new item next to the "All" item.

===

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

===

diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc 
b/source/blender/editors/space_file/asset_catalog_tree_view.cc
index 85912268286..552a0a7acd0 100644
--- a/source/blender/editors/space_file/asset_catalog_tree_view.cc
+++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc
@@ -339,10 +339,6 @@ void AssetCatalogTreeViewAllItem::build_row(uiLayout &row)
 {
   ui::BasicTreeViewItem::build_row(row);
 
-  if (!is_active()) {
-return;
-  }
-
   PointerRNA *props;
   props = UI_but_extra_operator_icon_add(
   button(), "ASSET_OT_catalog_new", WM_OP_INVOKE_DEFAULT, ICON_ADD);

___
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] [12c66854bd0] master: Pass correct array size to BKE_object_material_remap_calc

2021-10-06 Thread Jacob Lewallen
Commit: 12c66854bd02c27595d41a83301638f4e46fa29a
Author: Jacob Lewallen
Date:   Wed Oct 6 10:23:10 2021 -0400
Branches: master
https://developer.blender.org/rB12c66854bd02c27595d41a83301638f4e46fa29a

Pass correct array size to BKE_object_material_remap_calc

This was patch D12460 from jlewallen and fixes T91339 and T90818.

===

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

===

diff --git a/source/blender/modifiers/intern/MOD_boolean.cc 
b/source/blender/modifiers/intern/MOD_boolean.cc
index c5d6902e1bc..95167b5c82e 100644
--- a/source/blender/modifiers/intern/MOD_boolean.cc
+++ b/source/blender/modifiers/intern/MOD_boolean.cc
@@ -386,7 +386,7 @@ static void BMD_mesh_intersection(BMesh *bm,
  * Caller owns the returned array. */
 static Array get_material_remap(Object *dest_ob, Object *src_ob)
 {
-  int n = dest_ob->totcol;
+  int n = src_ob->totcol;
   if (n <= 0) {
 n = 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] [c6275da852e] master: Fix T91922: Cycles artifacts with high volume nested level

2021-10-06 Thread Sergey Sharybin
Commit: c6275da852eab77e2cea1ae601a43a2dbaad6c27
Author: Sergey Sharybin
Date:   Tue Oct 5 15:05:12 2021 +0200
Branches: master
https://developer.blender.org/rBc6275da852eab77e2cea1ae601a43a2dbaad6c27

Fix T91922: Cycles artifacts with high volume nested level

Make volume stack allocated conditionally, potentially based on the
actual nested level of objects in the scene.

Currently the nested level is estimated by number of volume objects.
This is a non-expensive check which is probably enough in practice
to get almost perfect memory usage and performance.

The conditional allocation is a bit tricky.

For the CPU we declare and define maximum possible volume stack,
because there are only that many integrator states on the CPU.

On the GPU we declare outer SoA to have all volume stack elements,
but only allocate actually needed ones. The actually used volume
stack size is passed as a pre-processor, which seems to be easiest
and fastest for the GPU state copy.

There seems to be no speed regression in the demo files on RTX6000.

Note that scenes with high nested level of volume will now be slower
but correct.

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

===

M   intern/cycles/integrator/path_trace_work_gpu.cpp
M   intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
M   intern/cycles/kernel/integrator/integrator_state.h
M   intern/cycles/kernel/integrator/integrator_state_template.h
M   intern/cycles/kernel/integrator/integrator_state_util.h
M   intern/cycles/kernel/integrator/integrator_volume_stack.h
M   intern/cycles/kernel/kernel_types.h
M   intern/cycles/render/graph.cpp
M   intern/cycles/render/object.cpp
M   intern/cycles/render/object.h
M   intern/cycles/render/scene.cpp
M   intern/cycles/render/scene.h

===

diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp 
b/intern/cycles/integrator/path_trace_work_gpu.cpp
index c29b0fb039e..8af8f9a02e2 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -23,6 +23,7 @@
 #include "render/buffers.h"
 #include "render/scene.h"
 #include "util/util_logging.h"
+#include "util/util_string.h"
 #include "util/util_tbb.h"
 #include "util/util_time.h"
 
@@ -30,7 +31,7 @@
 
 CCL_NAMESPACE_BEGIN
 
-static size_t estimate_single_state_size()
+static size_t estimate_single_state_size(DeviceScene *device_scene)
 {
   size_t state_size = 0;
 
@@ -45,12 +46,14 @@ static size_t estimate_single_state_size()
 break; \
   } \
   }
+#define KERNEL_STRUCT_VOLUME_STACK_SIZE (device_scene->data.volume_stack_size)
 #include "kernel/integrator/integrator_state_template.h"
 #undef KERNEL_STRUCT_BEGIN
 #undef KERNEL_STRUCT_MEMBER
 #undef KERNEL_STRUCT_ARRAY_MEMBER
 #undef KERNEL_STRUCT_END
 #undef KERNEL_STRUCT_END_ARRAY
+#undef KERNEL_STRUCT_VOLUME_STACK_SIZE
 
   return state_size;
 }
@@ -72,7 +75,7 @@ PathTraceWorkGPU::PathTraceWorkGPU(Device *device,
   num_queued_paths_(device, "num_queued_paths", MEM_READ_WRITE),
   work_tiles_(device, "work_tiles", MEM_READ_WRITE),
   display_rgba_half_(device, "display buffer half", MEM_READ_WRITE),
-  
max_num_paths_(queue_->num_concurrent_states(estimate_single_state_size())),
+  
max_num_paths_(queue_->num_concurrent_states(estimate_single_state_size(device_scene))),
   min_num_active_paths_(queue_->num_concurrent_busy_states()),
   max_active_path_index_(0)
 {
@@ -125,12 +128,23 @@ void PathTraceWorkGPU::alloc_integrator_soa()
 break; \
   } \
   }
+#define KERNEL_STRUCT_VOLUME_STACK_SIZE (device_scene_->data.volume_stack_size)
 #include "kernel/integrator/integrator_state_template.h"
 #undef KERNEL_STRUCT_BEGIN
 #undef KERNEL_STRUCT_MEMBER
 #undef KERNEL_STRUCT_ARRAY_MEMBER
 #undef KERNEL_STRUCT_END
 #undef KERNEL_STRUCT_END_ARRAY
+#undef KERNEL_STRUCT_VOLUME_STACK_SIZE
+
+  if (VLOG_IS_ON(3)) {
+size_t total_soa_size = 0;
+for (auto &&soa_memory : integrator_state_soa_) {
+  total_soa_size += soa_memory->memory_size();
+}
+
+VLOG(3) << "GPU SoA state size: " << 
string_human_readable_size(total_soa_size);
+  }
 }
 
 void PathTraceWorkGPU::alloc_integrator_queue()
diff --git 
a/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h 
b/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
index 60d8a8e3e54..99f6cf35e9e 100644
--- a/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
+++ b/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h
@@ -38,10 +38,13 @@ ccl_device void 
integrator_volume_stack_update_for_subsurface(INTEGRATOR_STATE_A
   volume_ray.P = from_P;
   volume_ray.D = normalize_len(to_P - from_P, &volume_ray.t);
 
+  /* Store to avoid global fetches on every intersection step. */
+  const uint volume_stack_size = kernel_data.volume_stac

[Bf-blender-cvs] [e41dddd29a1] master: Gizmo: remove wmGizmoGroup.use_fallback_keymap

2021-10-06 Thread Campbell Barton
Commit: e4129a17a77e60bde6a2336fcd3937819bec
Author: Campbell Barton
Date:   Thu Oct 7 00:01:46 2021 +1100
Branches: master
https://developer.blender.org/rBe4129a17a77e60bde6a2336fcd3937819bec

Gizmo: remove wmGizmoGroup.use_fallback_keymap

This ended up being a copy of:
`toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK`
requiring boiler plate assignment in gizmos refresh callbacks.

Remove this struct member and check `toolsettings->workspace_tool_type`
directly, since so far there has been no advantage in gizmo-groups
being able to control this themselves.

===

M   source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
M   source/blender/editors/transform/transform_gizmo_2d.c
M   source/blender/editors/transform/transform_gizmo_3d.c
M   source/blender/editors/transform/transform_gizmo_extrude_3d.c
M   source/blender/windowmanager/gizmo/WM_gizmo_types.h
M   source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
M   source/blender/windowmanager/intern/wm_event_system.c

===

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c 
b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
index 0e0d59764e5..1de08e75f80 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
@@ -140,13 +140,10 @@ static void WIDGETGROUP_tool_generic_refresh(const 
bContext *C, wmGizmoGroup *gz
 
   ToolSettings *ts = CTX_data_tool_settings(C);
   if (ts->workspace_tool_type != SCE_WORKSPACE_TOOL_FALLBACK) {
-gzgroup->use_fallback_keymap = false;
 WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, true);
 return;
   }
 
-  gzgroup->use_fallback_keymap = true;
-
   /* skip, we don't draw anything anyway */
   {
 int orientation;
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c 
b/source/blender/editors/transform/transform_gizmo_2d.c
index 4f6556cd2a2..aa4d5c03d74 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -465,16 +465,6 @@ static void gizmo2d_xform_refresh(const bContext *C, 
wmGizmoGroup *gzgroup)
   copy_v2_v2(ggd->origin, origin);
   bool show_cage = !ggd->no_cage && !equals_v2v2(ggd->min, ggd->max);
 
-  if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) {
-Scene *scene = CTX_data_scene(C);
-if (scene->toolsettings->workspace_tool_type == 
SCE_WORKSPACE_TOOL_FALLBACK) {
-  gzgroup->use_fallback_keymap = true;
-}
-else {
-  gzgroup->use_fallback_keymap = false;
-}
-  }
-
   if (has_select == false) {
 for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
   ggd->translate_xy[i]->flag |= WM_GIZMO_HIDDEN;
@@ -641,16 +631,6 @@ static void gizmo2d_resize_draw_prepare(const bContext *C, 
wmGizmoGroup *gzgroup
   GizmoGroup_Resize2D *ggd = gzgroup->customdata;
   float origin[3] = {UNPACK2(ggd->origin), 0.0f};
 
-  if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) {
-Scene *scene = CTX_data_scene(C);
-if (scene->toolsettings->workspace_tool_type == 
SCE_WORKSPACE_TOOL_FALLBACK) {
-  gzgroup->use_fallback_keymap = true;
-}
-else {
-  gzgroup->use_fallback_keymap = false;
-}
-  }
-
   gizmo2d_origin_to_region(region, origin);
 
   for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
@@ -793,16 +773,6 @@ static void gizmo2d_rotate_draw_prepare(const bContext *C, 
wmGizmoGroup *gzgroup
   GizmoGroup_Rotate2D *ggd = gzgroup->customdata;
   float origin[3] = {UNPACK2(ggd->origin), 0.0f};
 
-  if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) {
-Scene *scene = CTX_data_scene(C);
-if (scene->toolsettings->workspace_tool_type == 
SCE_WORKSPACE_TOOL_FALLBACK) {
-  gzgroup->use_fallback_keymap = true;
-}
-else {
-  gzgroup->use_fallback_keymap = false;
-}
-  }
-
   gizmo2d_origin_to_region(region, origin);
 
   wmGizmo *gz = ggd->gizmo;
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c 
b/source/blender/editors/transform/transform_gizmo_3d.c
index 0fa179c4f74..e4c20fa0be1 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1670,13 +1670,6 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, 
wmGizmoGroup *gzgroup)
   RegionView3D *rv3d = region->regiondata;
   struct TransformBounds tbounds;
 
-  if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) 
{
-gzgroup->use_fallback_keymap = true;
-  }
-  else {
-gzgroup->use_fallback_keymap = false;
-  }
-
   if (ggd->use_twtype_refresh) {
 ggd->twtype = v3d->gizmo_show_object & ggd->twtype_init;
 if (ggd->twtype != ggd->twtype_prev) {
@@ -2105,13 +2098,6 @@ static void WIDGETGROUP_xform_cage_refresh(

[Bf-blender-cvs] [cda20a7af89] master: Keymap: ignore the fallback keymap when "Active Tool" is set

2021-10-06 Thread Campbell Barton
Commit: cda20a7af89c7da76a5016667f24f06eaa8afdb1
Author: Campbell Barton
Date:   Wed Oct 6 23:43:34 2021 +1100
Branches: master
https://developer.blender.org/rBcda20a7af89c7da76a5016667f24f06eaa8afdb1

Keymap: ignore the fallback keymap when "Active Tool" is set

Resolve regression in c9d9bfa84ad5cb985e3feccffa702b2f3cc2adf8,
which added support for tools to be tagged as using a fallback too.

In these cases the "Active Tool" setting was ignored and the fallback
tool would be used (the spin tool would box select for example).

===

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

===

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index b4abc4f2fde..a2625f233b5 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -4025,6 +4025,7 @@ void 
WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm,
   const char *keymap_id_list[ARRAY_SIZE(km_result->keymaps)];
   int keymap_id_list_len = 0;
 
+  const Scene *scene = wm->winactive->scene;
   ScrArea *area = handler->dynamic.user_data;
   handler->keymap_tool = NULL;
   bToolRef_Runtime *tref_rt = area->runtime.tool ? area->runtime.tool->runtime 
: NULL;
@@ -4036,7 +4037,8 @@ void 
WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm,
   bool is_gizmo_visible = false;
   bool is_gizmo_highlight = false;
 
-  if (tref_rt && tref_rt->keymap_fallback[0]) {
+  if ((tref_rt && tref_rt->keymap_fallback[0]) &&
+  (scene->toolsettings->workspace_tool_type == 
SCE_WORKSPACE_TOOL_FALLBACK)) {
 bool add_keymap = false;
 /* Support for the gizmo owning the tool keymap. */

___
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] [6f6e33e9d3b] temp-angavrilov: Animation: support filtering for curves that don't match the action cycle.

2021-10-06 Thread Alexander Gavrilov
Commit: 6f6e33e9d3b8eb28adf2e2ec941ff59dc4276713
Author: Alexander Gavrilov
Date:   Mon May 3 17:27:53 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB6f6e33e9d3b8eb28adf2e2ec941ff59dc4276713

Animation: support filtering for curves that don't match the action cycle.

Since the looping behavior is defined per curve rather than at
action level, it is possible for curve loop periods to get out of
sync with each other. This commit adds an option to compare curves
against the frame range specified in the action, and treat any
mismatches as errors for the purpose of F-Curve filtering.

When enabled, the check verifies that curves within the action
have valid cyclic extrapolation, the action period evenly
divides by the curve period (since a curve looping at e.g. half
of the action period length still repeats in sync with the action),
and the end values match if the cycle is supposed to be perfect.

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

===

M   release/scripts/startup/bl_ui/space_dopesheet.py
M   source/blender/blenkernel/BKE_fcurve.h
M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/makesdna/DNA_action_types.h
M   source/blender/makesrna/intern/rna_action.c

===

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py 
b/release/scripts/startup/bl_ui/space_dopesheet.py
index aac24ed44d5..f0dac42e4d5 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -715,6 +715,10 @@ class DOPESHEET_PT_action(Panel):
 
 col.prop(action, "use_cyclic")
 
+row = col.row()
+row.active = action.use_cyclic
+row.prop(action, "use_cyclic_errors")
+
 
 class LayersDopeSheetPanel:
 bl_space_type = 'DOPESHEET_EDITOR'
diff --git a/source/blender/blenkernel/BKE_fcurve.h 
b/source/blender/blenkernel/BKE_fcurve.h
index f494c2e30cc..96a14bd744a 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -294,7 +294,7 @@ typedef enum eFCU_Cycle_Type {
   FCU_CYCLE_OFFSET,
 } eFCU_Cycle_Type;
 
-eFCU_Cycle_Type BKE_fcurve_get_cycle_type(struct FCurve *fcu);
+eFCU_Cycle_Type BKE_fcurve_get_cycle_type(const struct FCurve *fcu);
 
 /* Recompute handles to neatly subdivide the prev-next range at bezt. */
 bool BKE_fcurve_bezt_subdivide_handles(struct BezTriple *bezt,
diff --git a/source/blender/blenkernel/intern/fcurve.c 
b/source/blender/blenkernel/intern/fcurve.c
index 8e9c504dcbf..a8635fffcd3 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1232,7 +1232,7 @@ void fcurve_samples_to_keyframes(FCurve *fcu, const int 
start, const int end)
  */
 
 /* Checks if the F-Curve has a Cycles modifier, and returns the type of the 
cycle behavior. */
-eFCU_Cycle_Type BKE_fcurve_get_cycle_type(FCurve *fcu)
+eFCU_Cycle_Type BKE_fcurve_get_cycle_type(const FCurve *fcu)
 {
   FModifier *fcm = fcu->modifiers.first;
 
diff --git a/source/blender/editors/animation/anim_filter.c 
b/source/blender/editors/animation/anim_filter.c
index e1d046428a8..7872e20c618 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -79,6 +79,7 @@
 #include "BLI_alloca.h"
 #include "BLI_blenlib.h"
 #include "BLI_ghash.h"
+#include "BLI_math.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
@@ -1225,12 +1226,56 @@ static bool skip_fcurve_with_name(
   return true;
 }
 
+/* Check if the F-Curve doesn't cycle properly based on action settings. */
+static bool fcurve_has_cyclic_errors(const FCurve *fcu, const bAction *act)
+{
+  /* Check if the curve has enough points. */
+  if (fcu->totvert < 2 || !fcu->bezt) {
+return true;
+  }
+
+  /* Check if it is cyclic. */
+  const eFCU_Cycle_Type cycle_type = BKE_fcurve_get_cycle_type(fcu);
+
+  if (cycle_type == FCU_CYCLE_NONE) {
+return true;
+  }
+
+  /* Check that it has a nonzero period length. */
+  const BezTriple *first = &fcu->bezt[0], *last = &fcu->bezt[fcu->totvert - 1];
+
+  const float curve_period = last->vec[1][0] - first->vec[1][0];
+
+  if (curve_period < 0.1f) {
+return true;
+  }
+
+  /* Check that the action period is divisible by the curve period. */
+  const float action_period = act->frame_end - act->frame_start;
+  const float gap = action_period - roundf(action_period / curve_period) * 
curve_period;
+
+  if (fabsf(gap) > 1e-3f) {
+return true;
+  }
+
+  /* Check that the start and end values match in a perfect cycle. */
+  if (cycle_type == FCU_CYCLE_PERFECT) {
+const float magnitude = max_fff(fabsf(first->vec[1][1]), 
fabsf(last->vec[1][1]), 0.01f);
+
+if (fabsf(first->vec[1][1] - last->vec[1][1]) > magnitude * 1e-4f) {
+  return true;
+}
+  }
+
+  return fal

[Bf-blender-cvs] [db0715ee467] temp-angavrilov: Bone Overlay: support bone wireframe opacity settings.

2021-10-06 Thread Alexander Gavrilov
Commit: db0715ee46778c391500fb02392b270d7aeaded4
Author: Alexander Gavrilov
Date:   Sun Jan 3 23:40:44 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rBdb0715ee46778c391500fb02392b270d7aeaded4

Bone Overlay: support bone wireframe opacity settings.

When weight painting the bone overlay is extremely intrusive,
effectively requiring either extensive use of hiding individual
bones, or disabling the whole bone overlay between selections.

This addresses the issue by adding two bone opacity sliders that
are used for the 'wireframe' armature drawing mode. One directly
controls the uniform opacity as the straightforward option.

The other one allows fade based on the depth from the camera,
using exponential decay with the slider specifying the 'half-life'
depth. This is intended as a way to automatically hide bones
in distant parts of the mesh while focused on a specific part.

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

===

M   release/scripts/startup/bl_ui/space_view3d.py
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/draw/CMakeLists.txt
M   source/blender/draw/engines/overlay/overlay_armature.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/overlay_shader.c
A   source/blender/draw/engines/overlay/shaders/armature_alpha_lib.glsl
M   source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl
M   
source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl
M   
source/blender/draw/engines/overlay/shaders/armature_shape_solid_frag.glsl
M   
source/blender/draw/engines/overlay/shaders/armature_sphere_solid_frag.glsl
M   source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl
M   source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl
M   source/blender/makesdna/DNA_view3d_defaults.h
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 59991eac92a..31039e8f7fe 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6492,17 +6492,18 @@ class VIEW3D_PT_overlay_sculpt(Panel):
 row.prop(overlay, "sculpt_mode_face_sets_opacity", text="Face Sets")
 
 
-class VIEW3D_PT_overlay_pose(Panel):
+class VIEW3D_PT_overlay_bones(Panel):
 bl_space_type = 'VIEW_3D'
 bl_region_type = 'HEADER'
 bl_parent_id = 'VIEW3D_PT_overlay'
-bl_label = "Pose Mode"
+bl_label = "Bones"
 
 @classmethod
 def poll(cls, context):
 mode = context.mode
 return (
 (mode == 'POSE') or
+(mode == 'EDIT_ARMATURE') or
 (mode == 'PAINT_WEIGHT' and context.pose_object)
 )
 
@@ -6522,10 +6523,18 @@ class VIEW3D_PT_overlay_pose(Panel):
 sub = row.row()
 sub.active = display_all and overlay.show_xray_bone
 sub.prop(overlay, "xray_alpha_bone", text="Fade Geometry")
-else:
+elif mode == 'PAINT_WEIGHT':
 row = col.row()
 row.prop(overlay, "show_xray_bone")
 
+col.prop(overlay, "bone_wire_alpha")
+
+row = col.row()
+row.prop(overlay, "bone_wire_use_fade_depth", text="")
+sub = row.row()
+sub.active = overlay.bone_wire_use_fade_depth
+sub.prop(overlay, "bone_wire_fade_depth")
+
 
 class VIEW3D_PT_overlay_texture_paint(Panel):
 bl_space_type = 'VIEW_3D'
@@ -7692,7 +7701,7 @@ classes = (
 VIEW3D_PT_overlay_texture_paint,
 VIEW3D_PT_overlay_vertex_paint,
 VIEW3D_PT_overlay_weight_paint,
-VIEW3D_PT_overlay_pose,
+VIEW3D_PT_overlay_bones,
 VIEW3D_PT_overlay_sculpt,
 VIEW3D_PT_snapping,
 VIEW3D_PT_proportional_edit,
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index e2e36accfa5..e05f8cdf295 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -42,6 +42,8 @@
 #include "DNA_listBase.h"
 #include "DNA_material_types.h"
 #include "DNA_modifier_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
 #include "DNA_text_types.h"
 #include "DNA_workspace_types.h"
 
@@ -1629,6 +1631,21 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
  temp_idname + strlen("FunctionNode"));
   }
 }
+
+/* Initialize the bone wireframe opacity setting. */
+if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", 
"bone_wire_alpha")) {
+  for (bScreen *screen = bmain->screens.first; screen; screen = 
screen->id.next) {
+LISTBASE_FOREACH (ScrAre

[Bf-blender-cvs] [5abdc5082e4] temp-angavrilov: Constraints: refactor the D7437 patch adding Custom Space for constraints.

2021-10-06 Thread Alexander Gavrilov
Commit: 5abdc5082e4753b78d6b91825c5f4125b3d8c984
Author: Alexander Gavrilov
Date:   Mon Nov 23 23:42:05 2020 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB5abdc5082e4753b78d6b91825c5f4125b3d8c984

Constraints: refactor the D7437 patch adding Custom Space for constraints.

As mentioned in the comments to that patch, I had an idea for
a different way to do some technical aspects, but it was too
complicated to force changes in the original patch. Thus I submit
this follow up patch.

First, instead of modifying all the get_constraint_targets and
flush_constraint_targets callbacks, introduce wrapper functions
for accessing constraint targets, convert all code to use them,
and handle the new reference there uniformly for all constraints.

This incidentally revealed a place in the Collada exporter that
didn't clean up after retrieving the targets.

Also, tag the special target with a flag so other code can
handle it appropriately where necessary. This for instance
allows dependency graph to know that the Use B-Bone Shape
option doesn't affect this specific target.

Finally, rename and simplify the function for initializing the
custom space, and make sure it is called everywhere necessary.

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

===

M   source/blender/blenkernel/BKE_constraint.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/constraint.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/draw/engines/overlay/overlay_extra.c
M   source/blender/editors/armature/armature_add.c
M   source/blender/editors/armature/armature_naming.c
M   source/blender/editors/armature/armature_relations.c
M   source/blender/editors/armature/pose_select.c
M   source/blender/editors/object/object_constraint.c
M   source/blender/editors/transform/transform_mode.c
M   source/blender/io/collada/BCAnimationSampler.cpp
M   source/blender/io/collada/SceneExporter.cpp
M   source/blender/makesdna/DNA_constraint_types.h
M   source/blender/makesrna/intern/rna_constraint.c

===

diff --git a/source/blender/blenkernel/BKE_constraint.h 
b/source/blender/blenkernel/BKE_constraint.h
index 784b395dfa5..3fb0db680fd 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -236,6 +236,8 @@ void BKE_constraint_mat_convertspace(struct Object *ob,
  short to,
  const bool keep_scale);
 
+int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *list);
+void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase 
*list, bool no_copy);
 void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph,
   struct Scene *scene,
   struct bConstraint *con,
@@ -249,7 +251,7 @@ void BKE_constraint_targets_for_solving_get(struct 
Depsgraph *depsgraph,
 struct bConstraintOb *ob,
 struct ListBase *targets,
 float ctime);
-void BKE_constraint_custom_object_space_get(float r_mat[4][4], struct 
bConstraint *con);
+void BKE_constraint_custom_object_space_init(struct bConstraintOb *cob, struct 
bConstraint *con);
 void BKE_constraints_solve(struct Depsgraph *depsgraph,
struct ListBase *conlist,
struct bConstraintOb *cob,
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index cac33bdaa87..3a9ef58463f 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1014,13 +1014,10 @@ void BKE_pose_channels_remove(Object *ob,
   else {
 /* Maybe something the bone references is being removed instead? */
 for (con = pchan->constraints.first; con; con = con->next) {
-  const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
   ListBase targets = {NULL, NULL};
   bConstraintTarget *ct;
 
-  if (cti && cti->get_constraint_targets) {
-cti->get_constraint_targets(con, &targets);
-
+  if (BKE_constraint_targets_get(con, &targets)) {
 for (ct = targets.first; ct; ct = ct->next) {
   if (ct->tar == ob) {
 if (ct->subtarget[0]) {
@@ -1032,9 +1029,7 @@ void BKE_pose_channels_remove(Object *ob,
   }
 }
 
-if (cti->flush_constraint_targets) {
-  cti->flush_constraint_targets(con, &targets, 0);
-}
+BKE_const

[Bf-blender-cvs] [14fda3c51e7] temp-angavrilov: Animation: allow marking actions as cyclic for Cycle-Aware Keying.

2021-10-06 Thread Alexander Gavrilov
Commit: 14fda3c51e71e582c5cd3cfe9afbfa635b370c3d
Author: Alexander Gavrilov
Date:   Tue Jul 27 10:39:52 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB14fda3c51e71e582c5cd3cfe9afbfa635b370c3d

Animation: allow marking actions as cyclic for Cycle-Aware Keying.

When a manual frame range is set, allow marking an action as having
Cyclic Animation. This does not affect how the action is evaluated,
but the Cycle-Aware Keying option will automatically make any newly
added F-Curves cyclic. This allows using the option from the start
to build the cycle, rather than only for tweaking an existing loop.

The curves are made cyclic when they have only one key, either
after inserting the first key, or before adding the second one.
The latter case avoids the need to manually make the first added
curve cyclic after marking a newly added action cyclic.

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

===

M   release/scripts/startup/bl_ui/space_dopesheet.py
M   source/blender/blenkernel/BKE_action.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/nla.c
M   source/blender/editors/animation/keyframing.c
M   source/blender/makesdna/DNA_action_types.h
M   source/blender/makesrna/intern/rna_action.c
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py 
b/release/scripts/startup/bl_ui/space_dopesheet.py
index 1f37c7e98ca..aac24ed44d5 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -713,6 +713,8 @@ class DOPESHEET_PT_action(Panel):
 row.prop(action, "frame_start", text="Start")
 row.prop(action, "frame_end", text="End")
 
+col.prop(action, "use_cyclic")
+
 
 class LayersDopeSheetPanel:
 bl_space_type = 'DOPESHEET_EDITOR'
diff --git a/source/blender/blenkernel/BKE_action.h 
b/source/blender/blenkernel/BKE_action.h
index d37f4e9e7ea..92437941594 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -98,6 +98,9 @@ void BKE_action_get_frame_range(const struct bAction *act, 
float *r_start, float
 /* Does action have any motion data at all? */
 bool action_has_motion(const struct bAction *act);
 
+/* Is the action configured as cyclic. */
+bool BKE_action_is_cyclic(const struct bAction *act);
+
 /* Action Groups API - */
 
 /* Get the active action-group for an Action */
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 64c382c2b01..cac33bdaa87 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1524,6 +1524,12 @@ void BKE_action_get_frame_range(const struct bAction 
*act, float *r_start, float
   }
 }
 
+/* Is the action configured as cyclic. */
+bool BKE_action_is_cyclic(const struct bAction *act)
+{
+  return act && (act->flag & ACT_FRAME_RANGE) && (act->flag & ACT_CYCLIC);
+}
+
 /* Return flags indicating which transforms the given object/posechannel has
  * - if 'curves' is provided, a list of links to these curves are also returned
  */
diff --git a/source/blender/blenkernel/intern/nla.c 
b/source/blender/blenkernel/intern/nla.c
index 310fee8620b..69f8071f36f 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -399,6 +399,10 @@ NlaStrip *BKE_nlastrip_new(bAction *act)
*/
   BKE_action_get_frame_range(strip->act, &strip->actstart, &strip->actend);
 
+  if (BKE_action_is_cyclic(strip->act)) {
+strip->flag |= NLASTRIP_FLAG_USR_TIME_CYCLIC;
+  }
+
   strip->start = strip->actstart;
   strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 
1.0f) :
   (strip->actend);
diff --git a/source/blender/editors/animation/keyframing.c 
b/source/blender/editors/animation/keyframing.c
index 95df8b69cd4..3075c6ddceb 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -35,6 +35,7 @@
 
 #include "BLT_translation.h"
 
+#include "DNA_action_types.h"
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
@@ -375,6 +376,43 @@ static eFCU_Cycle_Type 
remap_cyclic_keyframe_location(FCurve *fcu, float *px, fl
   return type;
 }
 
+/* Used to make curves newly added to a cyclic Action cycle with the correct 
period. */
+static void make_new_fcurve_cyclic(const bAction *act, FCurve *fcu)
+{
+  /* The curve must contain one (newly-added) keyframe. */
+  if (fcu->totvert != 1 || !fcu->bezt) {
+return;
+  }
+
+  const float period = act->frame_end - act->frame_start;
+
+  if (period < 0.1f) {
+return;
+  }
+
+  /* Move the keyframe into the range. */
+  const float

[Bf-blender-cvs] [eb8cda58310] temp-angavrilov: Armature: apply Y scale to B-Bone segments.

2021-10-06 Thread Alexander Gavrilov
Commit: eb8cda58310780430c7ec1e7bc17ad8a29cfa64f
Author: Alexander Gavrilov
Date:   Tue Jun 15 13:52:23 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rBeb8cda58310780430c7ec1e7bc17ad8a29cfa64f

Armature: apply Y scale to B-Bone segments.

This fixes a strange behavior where the segments were not actually
scaled in the Y direction to match their actual length, thus
producing gaps or overlap depending on the shape of the curve. For
transformation the change should be very small if enough segments
are used, but this will affect the results of the Copy Transforms
and Armature constraints, so a backwards compatibility option is
provided. Newly created bones default to the new behavior.

===

M   release/scripts/startup/bl_ui/properties_data_bone.py
M   source/blender/blenkernel/BKE_armature.h
M   source/blender/blenkernel/intern/armature.c
M   source/blender/draw/engines/overlay/overlay_armature.c
M   source/blender/makesdna/DNA_armature_types.h
M   source/blender/makesrna/intern/rna_armature.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py 
b/release/scripts/startup/bl_ui/properties_data_bone.py
index daf64642f68..d141501d6bc 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -178,6 +178,8 @@ class BONE_PT_curved(BoneButtonsPanel, Panel):
 col.prop(bbone, "bbone_easeout", text="Out")
 col.prop(bone, "use_scale_easing")
 
+topcol.prop(bone, "use_unscaled_segments")
+
 col = topcol.column(align=True)
 col.prop(bone, "bbone_handle_type_start", text="Start Handle")
 
diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index e13475fd78c..069e0b09671 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -303,7 +303,7 @@ typedef struct BBoneSplineParameters {
   float length;
 
   /* Non-uniform scale correction. */
-  bool do_scale;
+  bool do_scale, do_scale_segments;
   float scale[3];
 
   /* Handle control bone data. */
diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index d60f7a0a2a1..b848f0e8091 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -966,6 +966,8 @@ void BKE_pchan_bbone_spline_params_get(struct bPoseChannel 
*pchan,
   param->segments = bone->segments;
   param->length = bone->length;
 
+  param->do_scale_segments = (bone->bbone_flag & BBONE_SCALE_SEGMENTS) != 0;
+
   if (!rest) {
 float scale[3];
 
@@ -1334,6 +1336,7 @@ static void 
make_bbone_spline_matrix(BBoneSplineParameters *param,
  const float axis[3],
  float roll,
  float scalex,
+ float scaley,
  float scalez,
  float result[4][4])
 {
@@ -1351,6 +1354,7 @@ static void 
make_bbone_spline_matrix(BBoneSplineParameters *param,
 
   /* BBone scale... */
   mul_v3_fl(result[0], scalex);
+  mul_v3_fl(result[1], scaley);
   mul_v3_fl(result[2], scalez);
 }
 
@@ -1417,6 +1421,8 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters 
*param,
   equalize_cubic_bezier(
   bezt_controls, MAX_BBONE_SUBDIV, param->segments, segment_scales, 
bezt_points);
 
+  const float scale_fac = param->segments / length;
+
   /* Deformation uses N+1 matrices computed at points between the segments. */
   if (for_deform) {
 /* Bezier derivatives. */
@@ -1429,6 +1435,32 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters 
*param,
   sub_v3_v3v3(bezt_deriv2[i], bezt_deriv1[i + 1], bezt_deriv1[i]);
 }
 
+/* Inner segment points. */
+float points[MAX_BBONE_SUBDIV][3], tangents[MAX_BBONE_SUBDIV][3];
+
+copy_v3_v3(points[0], bezt_controls[0]);
+
+for (int a = 1; a < param->segments; a++) {
+  evaluate_cubic_bezier(bezt_controls, bezt_points[a], points[a], 
tangents[a]);
+}
+
+/* Segment lengths. */
+float seg_length[MAX_BBONE_SUBDIV + 1];
+
+if (param->do_scale_segments) {
+  for (int a = 1; a < param->segments; a++) {
+seg_length[a] = len_v3v3(points[a - 1], points[a]) * scale_fac;
+  }
+
+  seg_length[param->segments] = len_v3v3(points[param->segments - 1], 
bezt_controls[3]) *
+scale_fac;
+}
+else {
+  for (int a = 1; a <= param->segments; a++) {
+seg_length[a] = 1;
+  }
+}
+
 /* End points require special handling to fix zero length handles. */
 ease_handle_axis(bezt_deriv1[0], bezt_deriv2[0], axis);
 make_bbone_spline_matrix(param,
@@ -1437,19 +1469,26 @@ int 
BKE_pchan_bbo

[Bf-blender-cvs] [1ae43197e96] temp-angavrilov: Temporary Hack: provide B-Bone scale versioning for files with old patch.

2021-10-06 Thread Alexander Gavrilov
Commit: 1ae43197e965dff17b6905e745c20a106ca4d808
Author: Alexander Gavrilov
Date:   Tue Jun 22 16:38:26 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB1ae43197e965dff17b6905e745c20a106ca4d808

Temporary Hack: provide B-Bone scale versioning for files with old patch.

Run the versioning code for the conversion of bbone scale to an xyz
vector if it has fields that correspond to the old version of the
patch before that change requiring versioning.

The actual Y (length) scale value from the old patch isn't versioned
and will be lost, requiring manual fixing.

===

M   source/blender/blenloader/intern/versioning_300.c

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 95fa3058931..e2e36accfa5 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1092,7 +1092,8 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
 
 /* Initialize length-wise scale B-Bone settings. */
-if (!DNA_struct_elem_find(fd->filesdna, "Bone", "int", "bbone_flag")) {
+if (!DNA_struct_elem_find(fd->filesdna, "Bone", "int", "bbone_flag") ||
+DNA_struct_elem_find(fd->filesdna, "Bone", "float", "scale_in_len")) {
   /* Update armature data and pose channels. */
   LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
 do_version_bones_bbone_len_scale(&arm->bonebase);

___
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] [332b9eeabac] temp-angavrilov: Depsgraph: connect up drivers on various physics properties.

2021-10-06 Thread Alexander Gavrilov
Commit: 332b9eeabac658f82b53bf814e56ec6fbcaa8fc4
Author: Alexander Gavrilov
Date:   Sat Jan 9 21:19:37 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB332b9eeabac658f82b53bf814e56ec6fbcaa8fc4

Depsgraph: connect up drivers on various physics properties.

It seems drivers for physics properties weren't being linked to
evaluation nodes. This connects settings used by modifiers
to Geometry; particle settings and rigid body data to Transform
which seems to contain rigid body evaluation; and force fields
to object Transform, since fields can exist on empties.

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

===

M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/depsgraph/intern/builder/deg_builder_rna.cc
M   source/blender/makesrna/RNA_access.h

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 55e8c5ed033..24d7c979cd3 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1865,6 +1865,27 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene 
*scene)
 }
 FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
   }
+  /* Constraints. */
+  if (rbw->constraints != nullptr) {
+build_collection(nullptr, nullptr, rbw->constraints);
+FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, object) {
+  if (object->rigidbody_constraint == nullptr) {
+continue;
+  }
+  if (object->rigidbody_object != nullptr) {
+/* Avoid duplicate relations for constraints attached to objects. */
+continue;
+  }
+
+  /* Simulation uses object transformation after parenting and solving 
constraints. */
+  OperationKey object_transform_simulation_init_key(
+  &object->id, NodeType::TRANSFORM, 
OperationCode::TRANSFORM_SIMULATION_INIT);
+  add_relation(object_transform_simulation_init_key,
+   rb_simulate_key,
+   "Object Transform -> Rigidbody Sim Eval");
+}
+FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+  }
 }
 
 void DepsgraphRelationBuilder::build_particle_systems(Object *object)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
index 40e59875832..1f70ae1f1f6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc
@@ -278,7 +278,16 @@ RNANodeIdentifier 
RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
RNA_struct_is_a(ptr->type, &RNA_LatticePoint) ||
RNA_struct_is_a(ptr->type, &RNA_MeshUVLoop) ||
RNA_struct_is_a(ptr->type, &RNA_MeshLoopColor) ||
-   RNA_struct_is_a(ptr->type, &RNA_VertexGroupElement)) {
+   RNA_struct_is_a(ptr->type, &RNA_VertexGroupElement) ||
+   ELEM(ptr->type,
+&RNA_CollisionSettings,
+&RNA_SoftBodySettings,
+&RNA_ClothSettings,
+&RNA_ClothCollisionSettings,
+&RNA_DynamicPaintSurface,
+&RNA_DynamicPaintCanvasSettings,
+&RNA_DynamicPaintBrushSettings) ||
+   (ELEM(ptr->type, &RNA_EffectorWeights) && 
GS(node_identifier.id->name) == ID_OB)) {
 /* When modifier is used as FROM operation this is likely referencing to
  * the property (for example, modifier's influence).
  * But when it's used as TO operation, this is geometry component. */
@@ -379,6 +388,20 @@ RNANodeIdentifier 
RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
 node_identifier.type = NodeType::GEOMETRY;
 return node_identifier;
   }
+  else if (GS(node_identifier.id->name) == ID_PA &&
+   ELEM(ptr->type, &RNA_EffectorWeights, &RNA_FieldSettings, 
&RNA_ParticleSettings)) {
+node_identifier.type = NodeType::PARTICLE_SETTINGS;
+return node_identifier;
+  }
+  else if (ELEM(ptr->type,
+&RNA_EffectorWeights,
+&RNA_RigidBodyWorld,
+&RNA_FieldSettings,
+&RNA_RigidBodyObject,
+&RNA_RigidBodyConstraint)) {
+node_identifier.type = NodeType::TRANSFORM;
+return node_identifier;
+  }
   if (prop != nullptr) {
 /* All unknown data effectively falls under "parameter evaluation". */
 node_identifier.type = NodeType::PARAMETERS;
diff --git a/source/blender/makesrna/RNA_access.h 
b/source/blender/makesrna/RNA_access.h
index 188f933dba5..b07d2f5ad5f 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -519,7 +519,7 @@ extern StructRNA RNA_RenderLayer;
 extern StructRNA RNA_RenderPass;
 extern StructRNA RNA_RenderResult;
 ex

[Bf-blender-cvs] [1e6de473269] temp-angavrilov: Force Fields: implement new true power and custom falloff options.

2021-10-06 Thread Alexander Gavrilov
Commit: 1e6de4732697507d7c59e715664375be2c6423af
Author: Alexander Gavrilov
Date:   Sun Sep 12 19:35:48 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB1e6de4732697507d7c59e715664375be2c6423af

Force Fields: implement new true power and custom falloff options.

The 'power' falloff option in Blender force fields does not actually
generate a true power falloff function, as pointed out in D2389.
However, that patch adds a special 'gravity' falloff option to Force
fields, without addressing the shortcoming in the common options.

The reason for not using the true curve in the options, as far as
one can tell, is that the power curve goes up to infinity as the
distance is reduced to 0, while the falloff options are designed
so that the maximum value of the curve is 1.

However, in reality forces with a power falloff don't actually go
to infinity, because real objects have a nonzero size, and the force
reaches its maximum at the surface of the object. This can be used
to integrate an option to use a true power falloff with the design
of falloff settings, if it requires a nonzero 'minimum' distance
to be set, and uses a curve that reaches 1 at that distance.

Since this is adding a new feature to the minimum distance value,
it is also a good opportunity to add a feature to the maximum
distance. Specifically, the new options can be used to apply
arbitrary brush-style falloff curves between min and max,
including a fully custom curve option. When used together with
power falloff, the two curves are multiplied together.

While the true power option allows creating more physically
correct forces, the custom curves aid artistic effects.

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

===

M   release/scripts/startup/bl_ui/properties_physics_common.py
M   release/scripts/startup/bl_ui/properties_physics_field.py
M   source/blender/blenkernel/BKE_effect.h
M   source/blender/blenkernel/BKE_particle.h
M   source/blender/blenkernel/intern/effect.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/particle.c
M   source/blender/makesdna/DNA_object_force_types.h
M   source/blender/makesrna/intern/rna_object_force.c

===

diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py 
b/release/scripts/startup/bl_ui/properties_physics_common.py
index f13a808e324..a535f750279 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -355,6 +355,10 @@ def basic_force_field_falloff_ui(self, field):
 sub.prop(field, "distance_min", text="")
 row.prop_decorator(field, "distance_min")
 
+col = layout.column()
+col.active = field.use_min_distance and field.distance_min > 0
+col.prop(field, "use_true_power")
+
 col = layout.column(align=False, heading="Max Distance")
 col.use_property_decorate = False
 row = col.row(align=True)
@@ -365,6 +369,13 @@ def basic_force_field_falloff_ui(self, field):
 sub.prop(field, "distance_max", text="")
 row.prop_decorator(field, "distance_max")
 
+col = layout.column()
+col.active = field.use_max_distance and field.distance_max > 
field.distance_min
+col.prop(field, "falloff_curve_type", text="Curve")
+
+if field.falloff_curve_type == 'CUSTOM':
+col.template_curve_mapping(field, "falloff_curve", type='NONE', 
brush=True)
+
 
 classes = (
 PHYSICS_PT_add,
diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py 
b/release/scripts/startup/bl_ui/properties_physics_field.py
index 7e017b121b3..c22bee4140b 100644
--- a/release/scripts/startup/bl_ui/properties_physics_field.py
+++ b/release/scripts/startup/bl_ui/properties_physics_field.py
@@ -248,20 +248,36 @@ class 
PHYSICS_PT_field_falloff_angular(PhysicButtonsPanel, Panel):
 col = flow.column()
 col.prop(field, "radial_falloff", text="Power")
 
-col = flow.column()
-col.prop(field, "use_radial_min", text="Use Min Angle")
-
-sub = col.column()
+col = layout.column(align=False, heading="Min Angle")
+col.use_property_decorate = False
+row = col.row(align=True)
+sub = row.row(align=True)
+sub.prop(field, "use_radial_min", text="")
+sub = sub.row(align=True)
 sub.active = field.use_radial_min
-sub.prop(field, "radial_min", text="Min Angle")
-
-col = flow.column()
-col.prop(field, "use_radial_max", text="Use Max Angle")
+sub.prop(field, "radial_min", text="")
+row.prop_decorator(field, "radial_min")
 
-sub = col.column()
+col = layout.column()
+col.active = field.use_radial_min and field.radial_min > 0
+col.prop(field, "use_radial_true_power")
+
+col = layout.column(align=False, heading="Max 

[Bf-blender-cvs] [59233cdf058] temp-angavrilov: Animation: allow manually setting the intended playback range for actions.

2021-10-06 Thread Alexander Gavrilov
Commit: 59233cdf05884f68390cbd8ac0e50f542284b055
Author: Alexander Gavrilov
Date:   Mon May 3 00:03:00 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB59233cdf05884f68390cbd8ac0e50f542284b055

Animation: allow manually setting the intended playback range for actions.

Some operations, e.g. adding a new action strip to NLA, require
knowing the active frame range of an action. However, currently it
can only be deduced by scanning the keyframes of the curves within
it. This is not ideal if e.g. curves are staggered for overlap.

As suggested by Nathan Vegdahl in comments to T54724, this patch adds
Action properties that allow manually specifying its active frame range.
The settings are exposed via a panel in the Dopesheet and Action Editor.
When enabled, the range is highlighted in the background using a striped
fill to distinguish it from the solid filled regular playback range.

When set, the frame range is used when adding or updating NLA tracks,
and by add-ons using `Action.frame_range`, e.g. FBX exporter.

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

===

M   release/scripts/startup/bl_ui/space_dopesheet.py
M   source/blender/blenkernel/BKE_action.h
M   source/blender/blenkernel/intern/action.c
M   source/blender/blenkernel/intern/nla.c
M   source/blender/editors/animation/anim_draw.c
M   source/blender/editors/include/ED_anim_api.h
M   source/blender/editors/space_action/action_data.c
M   source/blender/editors/space_action/action_draw.c
M   source/blender/editors/space_action/space_action.c
M   source/blender/editors/space_nla/nla_edit.c
M   source/blender/makesdna/DNA_action_types.h
M   source/blender/makesrna/intern/rna_action.c

===

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py 
b/release/scripts/startup/bl_ui/space_dopesheet.py
index 781c430a752..1f37c7e98ca 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -688,6 +688,32 @@ class DOPESHEET_MT_snap_pie(Menu):
 pie.operator("action.snap", text="Selection to Nearest Marker").type = 
'NEAREST_MARKER'
 
 
+class DOPESHEET_PT_action(Panel):
+bl_space_type = 'DOPESHEET_EDITOR'
+bl_region_type = 'UI'
+bl_category = "Item"
+bl_label = "Action"
+
+@classmethod
+def poll(cls, context):
+return bool(context.selected_visible_actions)
+
+def draw(self, context):
+layout = self.layout
+action = context.selected_visible_actions[0]
+
+layout.label(text=action.name, icon='ACTION')
+
+layout.prop(action, "use_frame_range")
+
+col = layout.column()
+col.active = action.use_frame_range
+
+row = col.row(align=True)
+row.prop(action, "frame_start", text="Start")
+row.prop(action, "frame_end", text="End")
+
+
 class LayersDopeSheetPanel:
 bl_space_type = 'DOPESHEET_EDITOR'
 bl_region_type = 'UI'
@@ -779,6 +805,7 @@ classes = (
 DOPESHEET_MT_channel_context_menu,
 DOPESHEET_MT_snap_pie,
 DOPESHEET_PT_filters,
+DOPESHEET_PT_action,
 DOPESHEET_PT_gpencil_mode,
 DOPESHEET_PT_gpencil_layer_masks,
 DOPESHEET_PT_gpencil_layer_transform,
diff --git a/source/blender/blenkernel/BKE_action.h 
b/source/blender/blenkernel/BKE_action.h
index 9f69c5e3976..d37f4e9e7ea 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -91,6 +91,10 @@ short action_get_item_transforms(struct bAction *act,
 /* Some kind of bounding box operation on the action */
 void calc_action_range(const struct bAction *act, float *start, float *end, 
short incl_modifiers);
 
+/* Retrieve the intended playback frame range, using the manually set range if 
available,
+ * or falling back to scanning F-Curves for their first & last frames 
otherwise. */
+void BKE_action_get_frame_range(const struct bAction *act, float *r_start, 
float *r_end);
+
 /* Does action have any motion data at all? */
 bool action_has_motion(const struct bAction *act);
 
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index 16d269f9e26..64c382c2b01 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1506,6 +1506,24 @@ void calc_action_range(const bAction *act, float *start, 
float *end, short incl_
   }
 }
 
+/* Retrieve the intended playback frame range, using the manually set range if 
available,
+ * or falling back to scanning F-Curves for their first & last frames 
otherwise. */
+void BKE_action_get_frame_range(const struct bAction *act, float *r_start, 
float *r_end)
+{
+  if (act && (act->flag & ACT_FRAME_RANGE)) {
+*r_start = act->frame_start;
+*r_end = act->frame_end;
+  }
+  else {
+calc_action_range(act, r_start, r_end, false);
+

[Bf-blender-cvs] [b616f3ce28d] temp-angavrilov: Context: add accessors returning selected actions for animation editors.

2021-10-06 Thread Alexander Gavrilov
Commit: b616f3ce28d35cd96bedcc5f6b52e9f28da18f57
Author: Alexander Gavrilov
Date:   Fri Jul 16 12:36:57 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rBb616f3ce28d35cd96bedcc5f6b52e9f28da18f57

Context: add accessors returning selected actions for animation editors.

Add a new 'selected_visible_actions' property to allow querying
actions that are selected in animation related editors for use in
UI and operators. The 'selected_editable_actions' variant excludes
linked actions (the only reason an action can be read-only).

In the Action and Shape Key editors there is only one action
that is specified by the field at the top of the editor.

In Dope Sheet it scans the channel rows and returns all actions
related to the selected items. This includes summary items for
actions and groups.

In Graph Editor, it lists actions associated with selected curves.

The new property is also used for Copy To Selected and Alt-Click.

Ref D11803

===

M   doc/python_api/sphinx_doc_gen.py
M   source/blender/editors/animation/anim_channels_defines.c
M   source/blender/editors/include/ED_anim_api.h
M   source/blender/editors/interface/interface_ops.c
M   source/blender/editors/screen/screen_context.c

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index ec636036f95..a8fbc3d902c 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1103,6 +1103,7 @@ context_type_map = {
 "selectable_objects": ("Object", True),
 "selected_asset_files": ("FileSelectEntry", True),
 "selected_bones": ("EditBone", True),
+"selected_editable_actions": ("Action", True),
 "selected_editable_bones": ("EditBone", True),
 "selected_editable_fcurves": ("FCurve", True),
 "selected_editable_keyframes": ("Keyframe", True),
@@ -1115,6 +1116,7 @@ context_type_map = {
 "selected_pose_bones": ("PoseBone", True),
 "selected_pose_bones_from_active_object": ("PoseBone", True),
 "selected_sequences": ("Sequence", True),
+"selected_visible_actions": ("Action", True),
 "selected_visible_fcurves": ("FCurve", True),
 "sequences": ("Sequence", True),
 "soft_body": ("SoftBodyModifier", False),
diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index e5dc9a83ebb..2a9e76ba60e 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -4212,6 +4212,24 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, 
short indent_level)
   }
 }
 
+/* Retrieves the Action associated with this animation channel. */
+bAction *ANIM_channel_action_get(const bAnimListElem *ale)
+{
+  if (ale->datatype == ALE_ACT) {
+return (bAction *)ale->key_data;
+  }
+
+  if (ELEM(ale->type, ANIMTYPE_GROUP, ANIMTYPE_FCURVE)) {
+ID *owner = ale->fcurve_owner_id;
+
+if (owner && GS(owner->name) == ID_AC) {
+  return (bAction *)owner;
+}
+  }
+
+  return NULL;
+}
+
 /* --- */
 
 /* Check if some setting for a channel is enabled
diff --git a/source/blender/editors/include/ED_anim_api.h 
b/source/blender/editors/include/ED_anim_api.h
index e9601220f2e..5d5d9140a24 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -577,6 +577,9 @@ const bAnimChannelType 
*ANIM_channel_get_typeinfo(bAnimListElem *ale);
 /* Print debugging info about a given channel */
 void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level);
 
+/* Retrieves the Action associated with this animation channel. */
+bAction *ANIM_channel_action_get(const bAnimListElem *ale);
+
 /* Draw the given channel */
 void ANIM_channel_draw(
 bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t 
channel_index);
diff --git a/source/blender/editors/interface/interface_ops.c 
b/source/blender/editors/interface/interface_ops.c
index 1fc07bce341..8c74a2b6434 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -846,6 +846,9 @@ bool UI_context_copy_to_selected_list(bContext *C,
   else if (RNA_struct_is_a(ptr->type, &RNA_Keyframe)) {
 *r_lb = CTX_data_collection_get(C, "selected_editable_keyframes");
   }
+  else if (RNA_struct_is_a(ptr->type, &RNA_Action)) {
+*r_lb = CTX_data_collection_get(C, "selected_editable_actions");
+  }
   else if (RNA_struct_is_a(ptr->type, &RNA_NlaStrip)) {
 *r_lb = CTX_data_collection_get(C, "selected_nla_strips");
   }
diff --git a/source/blender/editors/screen/screen_context.c 
b/source/blender/editors/screen/screen_context.c
index 3d447d90626..c09c38e45aa 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@

[Bf-blender-cvs] [330dc8b29f0] temp-angavrilov: Python API: implement `PoseBone.children` via `Bone.children`.

2021-10-06 Thread Alexander Gavrilov
Commit: 330dc8b29f06d800206badf2a3a2b66aaaeb12fd
Author: Alexander Gavrilov
Date:   Fri Oct 1 15:30:12 2021 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB330dc8b29f06d800206badf2a3a2b66aaaeb12fd

Python API: implement `PoseBone.children` via `Bone.children`.

Currently `PoseBone.children` is implemented by a linear scan of
the list of armature bones. This is doubly inefficient, since
not only is it scanning all bones, the `obj.data.bones` list
is actually synthetic and generated from Bone children lists.

Instead, use the `Bone.children` native RNA property.

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

===

M   release/scripts/modules/bpy_types.py

===

diff --git a/release/scripts/modules/bpy_types.py 
b/release/scripts/modules/bpy_types.py
index 8a1615ad99f..214752d475c 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -378,10 +378,9 @@ class PoseBone(StructRNA, _GenericBone, 
metaclass=StructMetaPropGroup):
 def children(self):
 obj = self.id_data
 pbones = obj.pose.bones
-self_bone = self.bone
 
-return tuple(pbones[bone.name] for bone in obj.data.bones
- if bone.parent == self_bone)
+# Use Bone.children, which is a native RNA property
+return tuple(pbones[bone.name] for bone in self.bone.children)
 
 
 class Bone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):

___
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] [539575b585a] master: Assets: Support Renaming Catalogs in the UI

2021-10-06 Thread Julian Eisel
Commit: 539575b585a018eabda9137d724967692433165a
Author: Julian Eisel
Date:   Wed Oct 6 14:18:12 2021 +0200
Branches: master
https://developer.blender.org/rB539575b585a018eabda9137d724967692433165a

Assets: Support Renaming Catalogs in the UI

Catalogs can now be renamed by double clicking them in the Asset
Browser. This is mostly done through the tree-view API, the asset
specific code is very little.

There is some polish left to be done here, e.g. the double click
currently also collapses/uncollapses and activates the clicked item. And
the rename button takes the full width of the row. But addressing these
is better done as part of some other behavioral changes that are planned
anyway.

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/include/UI_tree_view.hh
M   source/blender/editors/interface/interface_handlers.c
M   source/blender/editors/interface/tree_view.cc
M   source/blender/editors/space_file/asset_catalog_tree_view.cc

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index f642895f64e..e8b71a41439 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -2770,6 +2770,8 @@ char *UI_tree_view_item_drop_tooltip(const 
uiTreeViewItemHandle *item,
  const struct bContext *C,
  const struct wmDrag *drag,
  const struct wmEvent *event);
+bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle);
+void UI_tree_view_item_begin_rename(uiTreeViewItemHandle *item_handle);
 
 uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const struct ARegion 
*region, int x, int y);
 
diff --git a/source/blender/editors/include/UI_tree_view.hh 
b/source/blender/editors/include/UI_tree_view.hh
index dbafd1b3a2b..51737067648 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -23,10 +23,13 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
 
+#include "DNA_defs.h"
+
 #include "BLI_function_ref.hh"
 #include "BLI_vector.hh"
 
@@ -144,8 +147,14 @@ class TreeViewLayoutBuilder {
  * \{ */
 
 class AbstractTreeView : public TreeViewItemContainer {
+  friend AbstractTreeViewItem;
   friend TreeViewBuilder;
-  friend TreeViewLayoutBuilder;
+
+  /**
+   * Only one item can be renamed at a time. So the tree is informed about the 
renaming state to
+   * enforce that.
+   */
+  std::unique_ptr> rename_buffer_;
 
   bool is_reconstructed_ = false;
 
@@ -154,6 +163,8 @@ class AbstractTreeView : public TreeViewItemContainer {
 
   void foreach_item(ItemIterFn iter_fn, IterOptions options = 
IterOptions::None) const;
 
+  /** Only one item can be renamed at a time. */
+  bool is_renaming() const;
   /**
* Check if the tree is fully (re-)constructed. That means, both 
#build_tree() and
* #update_from_old() have finished.
@@ -198,6 +209,7 @@ class AbstractTreeView : public TreeViewItemContainer {
  */
 class AbstractTreeViewItem : public TreeViewItemContainer {
   friend class AbstractTreeView;
+  friend class TreeViewLayoutBuilder;
 
  public:
   using IsActiveFn = std::function;
@@ -205,12 +217,15 @@ class AbstractTreeViewItem : public TreeViewItemContainer 
{
  private:
   bool is_open_ = false;
   bool is_active_ = false;
+  bool is_renaming_ = false;
 
   IsActiveFn is_active_fn_;
 
  protected:
   /** This label is used for identifying an item (together with its parent's 
labels). */
   std::string label_{};
+  /** Every item gets a button of type during the layout building 
#UI_BTYPE_TREEROW. */
+  uiButTreeRow *tree_row_but_ = nullptr;
 
  public:
   virtual ~AbstractTreeViewItem() = default;
@@ -234,6 +249,19 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
   virtual std::string drop_tooltip(const bContext &C,
const wmDrag &drag,
const wmEvent &event) const;
+  /**
+   * Queries if the tree-view item supports renaming in principle. Renaming 
may still fail, e.g. if
+   * another item is already being renamed.
+   */
+  virtual bool can_rename() const;
+  /**
+   * Try renaming the item, or the data it represents. Can assume
+   * #AbstractTreeViewItem::can_rename() returned true. Sub-classes that 
override this should
+   * usually call this, unless they have a custom 
#AbstractTreeViewItem.matches().
+   *
+   * \return True if the renaming was successful.
+   */
+  virtual bool rename(StringRefNull new_name);
 
   /**
* Copy persistent state (e.g. is-collapsed flag, selection, etc.) from a 
matching item of
@@ -250,7 +278,11 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
*/
   virtual bool matches(const Abstrac

[Bf-blender-cvs] [335f40ebfa2] master: Tests: include device type in benchmark graph labels

2021-10-06 Thread Brecht Van Lommel
Commit: 335f40ebfa28d36d0e4c3c562eb572554282a3ff
Author: Brecht Van Lommel
Date:   Tue Oct 5 17:23:06 2021 +0200
Branches: master
https://developer.blender.org/rB335f40ebfa28d36d0e4c3c562eb572554282a3ff

Tests: include device type in benchmark graph labels

===

M   tests/performance/api/graph.py

===

diff --git a/tests/performance/api/graph.py b/tests/performance/api/graph.py
index e54adc194de..c7d3c5043ec 100644
--- a/tests/performance/api/graph.py
+++ b/tests/performance/api/graph.py
@@ -22,7 +22,7 @@ class TestGraph:
 
 for entry in queue.entries:
 if entry.status in ('done', 'outdated'):
-device_name = entry.device_name
+device_name = entry.device_name + " (" + entry.device_type 
+ ")"
 if device_name in devices.keys():
 devices[device_name].append(entry)
 else:

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


[Bf-blender-cvs] [18c6314e266] master: Cleanup: don't detect duplicate intersections in Embree

2021-10-06 Thread Brecht Van Lommel
Commit: 18c6314e2660820778c555143b234dff3ba35ffa
Author: Brecht Van Lommel
Date:   Tue Oct 5 16:33:29 2021 +0200
Branches: master
https://developer.blender.org/rB18c6314e2660820778c555143b234dff3ba35ffa

Cleanup: don't detect duplicate intersections in Embree

It's unclear why this code was added in the first place, but it seems
unnecessary, it can be restored if we find this breaks something.

The Embree docs mention that the same primitive may be hit multiple times, but
my understanding is that about e.g. curves where both the frontside and backside
may be hit. However those hits would be at different distances.

The context for this change is that we want to add an optimization where we
can immediately update throughput for transparent shadows instead of recording
intersections, and avoid duplicate would require extra work. However there is
an Embree example that does something similar without worrying about duplicate
hits either.

===

M   intern/cycles/bvh/bvh_embree.cpp

===

diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 9250af419cb..eebc1e1e547 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -89,20 +89,9 @@ static void rtc_filter_occluded_func(const 
RTCFilterFunctionNArguments *args)
 
   /* Test if we need to record this transparent intersection. */
   if (ctx->num_hits < ctx->max_hits || ray->tfar < ctx->max_t) {
-/* Skip already recorded intersections. */
-int num_recorded_hits = min(ctx->num_hits, ctx->max_hits);
-
-for (int i = 0; i < num_recorded_hits; ++i) {
-  if (current_isect.object == ctx->isect_s[i].object &&
-  current_isect.prim == ctx->isect_s[i].prim && current_isect.t == 
ctx->isect_s[i].t) {
-/* This intersection was already recorded, skip it. */
-*args->valid = 0;
-return;
-  }
-}
-
 /* If maximum number of hits was reached, replace the intersection 
with the
  * highest distance. We want to find the N closest intersections. */
+const int num_recorded_hits = min(ctx->num_hits, ctx->max_hits);
 int isect_index = num_recorded_hits;
 if (num_recorded_hits + 1 >= ctx->max_hits) {
   float max_t = ctx->isect_s[0].t;
@@ -213,14 +202,6 @@ static void rtc_filter_occluded_func(const 
RTCFilterFunctionNArguments *args)
   if (ctx->num_hits < ctx->max_hits) {
 Intersection current_isect;
 kernel_embree_convert_hit(kg, ray, hit, ¤t_isect);
-for (size_t i = 0; i < ctx->num_hits; ++i) {
-  if (current_isect.object == ctx->isect_s[i].object &&
-  current_isect.prim == ctx->isect_s[i].prim && current_isect.t == 
ctx->isect_s[i].t) {
-/* This intersection was already recorded, skip it. */
-*args->valid = 0;
-break;
-  }
-}
 Intersection *isect = &ctx->isect_s[ctx->num_hits];
 ++ctx->num_hits;
 *isect = current_isect;

___
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] [03f8c1abd06] master: Build: add ccache support for CUDA kernels on Linux

2021-10-06 Thread Brecht Van Lommel
Commit: 03f8c1abd06e204f5a46046e71f29054a6fc0ed0
Author: Brecht Van Lommel
Date:   Tue Oct 5 14:53:27 2021 +0200
Branches: master
https://developer.blender.org/rB03f8c1abd06e204f5a46046e71f29054a6fc0ed0

Build: add ccache support for CUDA kernels on Linux

===

M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 514b7f8263c..c53d3d4b962 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -404,16 +404,27 @@ if(WITH_CYCLES_CUDA_BINARIES)
 -cuda-toolkit-dir "${cuda_toolkit_root_dir}"
 DEPENDS ${kernel_sources} cycles_cubin_cc)
 else()
-  add_custom_command(
-OUTPUT ${cuda_file}
-COMMAND ${cuda_nvcc_executable}
+  set(_cuda_nvcc_args
 -arch=${arch}
 ${CUDA_NVCC_FLAGS}
 --${format}
 ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
 --ptxas-options="-v"
-${cuda_flags}
-DEPENDS ${kernel_sources})
+${cuda_flags})
+
+  if(WITH_COMPILER_CCACHE AND CCACHE_PROGRAM)
+add_custom_command(
+  OUTPUT ${cuda_file}
+  COMMAND ${CCACHE_PROGRAM} ${cuda_nvcc_executable} ${_cuda_nvcc_args}
+  DEPENDS ${kernel_sources})
+  else()
+add_custom_command(
+  OUTPUT ${cuda_file}
+  COMMAND ${cuda_nvcc_executable} ${_cuda_nvcc_args}
+  DEPENDS ${kernel_sources})
+  endif()
+
+  unset(_cuda_nvcc_args)
 endif()
 delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_file}" 
${CYCLES_INSTALL_PATH}/lib)
 list(APPEND cuda_cubins ${cuda_file})

___
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] [3c4537cd38f] master: Cleanup: Improve readability & comments in UI tree-view header

2021-10-06 Thread Julian Eisel
Commit: 3c4537cd38f715485826d5db040afe776c958861
Author: Julian Eisel
Date:   Wed Oct 6 13:06:20 2021 +0200
Branches: master
https://developer.blender.org/rB3c4537cd38f715485826d5db040afe776c958861

Cleanup: Improve readability & comments in UI tree-view header

===

M   source/blender/editors/include/UI_tree_view.hh

===

diff --git a/source/blender/editors/include/UI_tree_view.hh 
b/source/blender/editors/include/UI_tree_view.hh
index 46eaf56a3c0..dbafd1b3a2b 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -16,6 +16,9 @@
 
 /** \file
  * \ingroup editorui
+ *
+ * API for simple creation of tree UIs supporting advanced features.
+ * https://wiki.blender.org/wiki/Source/Interface/Views
  */
 
 #pragma once
@@ -78,18 +81,23 @@ class TreeViewItemContainer {
   using ItemIterFn = FunctionRef;
 
   /**
-   * Convenience wrapper taking the arguments needed to construct an item of 
type \a ItemT. Calls
-   * the version just below.
+   * Convenience wrapper constructing the item by forwarding given arguments 
to the constructor of
+   * the type (\a ItemT).
+   *
+   * E.g. if your tree-item type has the following constructor:
+   * \code{.cpp}
+   * MyTreeItem(std::string str, int i);
+   * \endcode
+   * You can add an item like this:
+   * \code
+   * add_tree_item("blabla", 42);
+   * \endcode
+   */
+  template inline ItemT &add_tree_item(Args 
&&...args);
+  /**
+   * Add an already constructed tree item to this parent. Ownership is moved 
to it.
+   * All tree items must be added through this, it handles important 
invariants!
*/
-  template ItemT &add_tree_item(Args &&...args)
-  {
-static_assert(std::is_base_of::value,
-  "Type must derive from and implement the 
AbstractTreeViewItem interface");
-
-return dynamic_cast(
-add_tree_item(std::make_unique(std::forward(args)...)));
-  }
-
   AbstractTreeViewItem &add_tree_item(std::unique_ptr 
item);
 
  protected:
@@ -146,25 +154,31 @@ class AbstractTreeView : public TreeViewItemContainer {
 
   void foreach_item(ItemIterFn iter_fn, IterOptions options = 
IterOptions::None) const;
 
-  /** Check if the tree is fully (re-)constructed. That means, both 
#build_tree() and
-   * #update_from_old() have finished. */
+  /**
+   * Check if the tree is fully (re-)constructed. That means, both 
#build_tree() and
+   * #update_from_old() have finished.
+   */
   bool is_reconstructed() const;
 
  protected:
   virtual void build_tree() = 0;
 
  private:
-  /** Match the tree-view against an earlier version of itself (if any) and 
copy the old UI state
-   * (e.g. collapsed, active, selected) to the new one. See
-   * #AbstractTreeViewItem.update_from_old(). */
+  /**
+   * Match the tree-view against an earlier version of itself (if any) and 
copy the old UI state
+   * (e.g. collapsed, active, selected, renaming, etc.) to the new one. See
+   * #AbstractTreeViewItem.update_from_old().
+   */
   void update_from_old(uiBlock &new_block);
   static void update_children_from_old_recursive(const TreeViewItemContainer 
&new_items,
  const TreeViewItemContainer 
&old_items);
   static AbstractTreeViewItem *find_matching_child(const AbstractTreeViewItem 
&lookup_item,
const TreeViewItemContainer 
&items);
-  /** Items may want to do additional work when state changes. But these state 
changes can only be
-   * reliably detected after the tree was reconstructed (see 
#is_reconstructed()). So this is done
-   * delayed. */
+  /**
+   * Items may want to do additional work when state changes. But these state 
changes can only be
+   * reliably detected after the tree has completed reconstruction (see 
#is_reconstructed()). So
+   * the actual state changes are done in a delayed manner through this 
function.
+   */
   void change_state_delayed();
   void build_layout_from_tree(const TreeViewLayoutBuilder &builder);
 };
@@ -204,48 +218,63 @@ class AbstractTreeViewItem : public TreeViewItemContainer 
{
   virtual void build_row(uiLayout &row) = 0;
 
   virtual void on_activate();
+  /**
+   * Set a custom callback to check if this item should be active. There's a 
version without
+   * arguments for checking if the item is currently in an active state.
+   */
   virtual void is_active(IsActiveFn is_active_fn);
   virtual bool on_drop(const wmDrag &drag);
   virtual bool can_drop(const wmDrag &drag) const;
-  /** Custom text to display when dragging over a tree item. Should explain 
what happens when
+  /**
+   * Custom text to display when dragging over a tree item. Should explain 
what happens when
* dropping the data onto this item. Will only be used if 
#AbstractTreeViewItem::can_drop()
* returns true, so the implementing override doesn't

[Bf-blender-cvs] [ac9ec52e9e2] master: UI: Draw tree-views (e.g. asset catalogs) in a box

2021-10-06 Thread Julian Eisel
Commit: ac9ec52e9e26544f15ed1f8596d46b82f2577a61
Author: Julian Eisel
Date:   Wed Oct 6 11:42:47 2021 +0200
Branches: master
https://developer.blender.org/rBac9ec52e9e26544f15ed1f8596d46b82f2577a61

UI: Draw tree-views (e.g. asset catalogs) in a box

Makes things look more appealing visually. Plus it's a way to visually
group the tree rows together, which can be important if there are more
widgets surrounding the tree.

===

M   source/blender/editors/interface/tree_view.cc

===

diff --git a/source/blender/editors/interface/tree_view.cc 
b/source/blender/editors/interface/tree_view.cc
index 28c757ddc79..8bd2be7dc77 100644
--- a/source/blender/editors/interface/tree_view.cc
+++ b/source/blender/editors/interface/tree_view.cc
@@ -80,7 +80,8 @@ void AbstractTreeView::build_layout_from_tree(const 
TreeViewLayoutBuilder &build
 {
   uiLayout *prev_layout = builder.current_layout();
 
-  uiLayoutColumn(prev_layout, true);
+  uiLayout *box = uiLayoutBox(prev_layout);
+  uiLayoutColumn(box, true);
 
   foreach_item([&builder](AbstractTreeViewItem &item) { 
builder.build_row(item); },
IterOptions::SkipCollapsed);

___
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] [0930a70e811] blender-v2.93-release: Version bump: 2.93.6-rc

2021-10-06 Thread Jeroen Bakker
Commit: 0930a70e8110557641a98d5caf2e8892b4e2c345
Author: Jeroen Bakker
Date:   Wed Oct 6 12:52:36 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB0930a70e8110557641a98d5caf2e8892b4e2c345

Version bump: 2.93.6-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 12d2a184a51..d161c71ad99 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -33,9 +33,9 @@ extern "C" {
 /* Blender major and minor version. */
 #define BLENDER_VERSION 293
 /* Blender patch version for bugfix releases. */
-#define BLENDER_VERSION_PATCH 5
+#define BLENDER_VERSION_PATCH 6
 /** 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] [4ab8212e1a0] master: Fix errors in 68dc970219ef7a559b48bd1b3e45d033367b4172

2021-10-06 Thread Campbell Barton
Commit: 4ab8212e1a0fbeff0ab7e33a37b6f2f97182566b
Author: Campbell Barton
Date:   Wed Oct 6 21:38:42 2021 +1100
Branches: master
https://developer.blender.org/rB4ab8212e1a0fbeff0ab7e33a37b6f2f97182566b

Fix errors in 68dc970219ef7a559b48bd1b3e45d033367b4172

Swapped preview/timeline keymap and incorrect center measurement.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/editors/space_sequencer/sequencer_select.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 1ab0e25b59d..b8b27b0e8ba 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4647,7 +4647,7 @@ def _template_sequencer_generic_select(*, type, value, 
legacy):
 )]
 
 
-def _template_sequencer_timeline_select(*, type, value, legacy):
+def _template_sequencer_preview_select(*, type, value, legacy):
 return _template_sequencer_generic_select(
 type=type, value=value, legacy=legacy,
 ) + [(
@@ -4665,7 +4665,7 @@ def _template_sequencer_timeline_select(*, type, value, 
legacy):
 )]
 
 
-def _template_sequencer_preview_select(*, type, value, legacy):
+def _template_sequencer_timeline_select(*, type, value, legacy):
 return _template_sequencer_generic_select(
 type=type, value=value, legacy=legacy,
 ) + [(
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c 
b/source/blender/editors/space_sequencer/sequencer_select.c
index 5b5b5e002f6..7722909190f 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -671,8 +671,7 @@ static Sequence *seq_select_seq_from_preview(const bContext 
*C,
 SEQ_ITERATOR_FOREACH (seq, strips) {
   float co[2];
   SEQ_image_transform_origin_offset_pixelspace_get(scene, seq, co);
-  sub_v2_v2(co, mouseco_view);
-  const float center_dist_sq_test = len_squared_v2(co);
+  const float center_dist_sq_test = len_squared_v2v2(co, mouseco_view);
   if ((seq_best == NULL) || (center_dist_sq_test < center_dist_sq_best)) {
 seq_best = seq;
 center_dist_sq_best = center_dist_sq_test;

___
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] [88efbf7d1ec] sculpt-dev: Sculpt: fix multi-res crash

2021-10-06 Thread Joseph Eagar
Commit: 88efbf7d1ec6982fd6805d92d22fc870fd5ba71b
Author: Joseph Eagar
Date:   Wed Oct 6 03:10:57 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB88efbf7d1ec6982fd6805d92d22fc870fd5ba71b

Sculpt: fix multi-res crash

===

M   source/blender/blenkernel/intern/paint.c

===

diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index 7b2f41f82b1..efafa1723a6 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1836,6 +1836,22 @@ static void sculpt_update_object(Depsgraph *depsgraph,
   }
 }
   }
+
+  int totvert = 0;
+
+  switch (BKE_pbvh_type(pbvh)) {
+case PBVH_FACES:
+  totvert = me->totvert;
+  break;
+case PBVH_BMESH:
+  totvert = ss->bm ? ss->bm->totvert : me->totvert;
+  break;
+case PBVH_GRIDS:
+  totvert = BKE_pbvh_get_grid_num_vertices(ss->pbvh);
+  break;
+  }
+
+  BKE_sculptsession_check_mdyntopo(ob->sculpt, pbvh, totvert);
 }
 
 void BKE_sculpt_update_object_before_eval(Object *ob)
@@ -2311,6 +2327,8 @@ bool BKE_sculptsession_check_mdyntopo(SculptSession *ss, 
PBVH *pbvh, int totvert
 return true;
   }
 
+  BKE_pbvh_set_mdyntopo_verts(pbvh, ss->mdyntopo_verts);
+
   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] [bcd5bd6cd51] eevee-rewrite: EEVEE: Fix double Stroke color in Panel

2021-10-06 Thread Antonio Vazquez
Commit: bcd5bd6cd51146250341e78de2a34ff693cee154
Author: Antonio Vazquez
Date:   Wed Oct 6 12:08:59 2021 +0200
Branches: eevee-rewrite
https://developer.blender.org/rBbcd5bd6cd51146250341e78de2a34ff693cee154

EEVEE: Fix double Stroke color in Panel

The stroke color was displayed in the side panel and this must be used only in 
3D View.

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py 
b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index c31881fa194..6ca13674234 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -591,7 +591,7 @@ class GreasePencilMaterialsPanel:
 if len(ob.material_slots) > 0 and ob.active_material_index >= 
0:
 ma = ob.material_slots[ob.active_material_index].material
 
-if ma is not None and ma.grease_pencil is not None:
+if is_view3d and ma is not None and ma.grease_pencil is not None:
 gpcolor = ma.grease_pencil
 if gpcolor.stroke_style == 'SOLID':
 row = layout.row()

___
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] [9ed19db5392] master: Fix handling of overrides during append.

2021-10-06 Thread Bastien Montagne
Commit: 9ed19db5392d76bc810afabeb93fcd34a23fd88d
Author: Bastien Montagne
Date:   Wed Oct 6 11:38:11 2021 +0200
Branches: master
https://developer.blender.org/rB9ed19db5392d76bc810afabeb93fcd34a23fd88d

Fix handling of overrides during append.

Liboverride references need a special handling during append, since
those pointers should never be made local, nor reampped to newly
localized data. And liboverride references should never be directly made
local either, to ensure their liboverride usages remain pointing to
linked data and not local one.

Issue was reported by the studio, and also probably as part of T91892.

===

M   source/blender/blenkernel/intern/lib_remap.c
M   source/blender/windowmanager/intern/wm_files_link.c

===

diff --git a/source/blender/blenkernel/intern/lib_remap.c 
b/source/blender/blenkernel/intern/lib_remap.c
index 48396c5e6d9..b5c45c0902b 100644
--- a/source/blender/blenkernel/intern/lib_remap.c
+++ b/source/blender/blenkernel/intern/lib_remap.c
@@ -719,7 +719,7 @@ void BKE_libblock_relink_to_newid(ID *id)
 static int id_relink_to_newid_looper_new(LibraryIDLinkCallbackData *cb_data)
 {
   const int cb_flag = cb_data->cb_flag;
-  if (cb_flag & IDWALK_CB_EMBEDDED) {
+  if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
 return IDWALK_RET_NOP;
   }
 
@@ -730,7 +730,11 @@ static int 
id_relink_to_newid_looper_new(LibraryIDLinkCallbackData *cb_data)
   if (id) {
 /* See: NEW_ID macro */
 if (id->newid != NULL) {
-  BKE_libblock_relink_ex(bmain, id_owner, id, id->newid, 
ID_REMAP_SKIP_INDIRECT_USAGE);
+  BKE_libblock_relink_ex(bmain,
+ id_owner,
+ id,
+ id->newid,
+ ID_REMAP_SKIP_INDIRECT_USAGE | 
ID_REMAP_SKIP_OVERRIDE_LIBRARY);
   id = id->newid;
 }
 if (id->tag & LIB_TAG_NEW) {
diff --git a/source/blender/windowmanager/intern/wm_files_link.c 
b/source/blender/windowmanager/intern/wm_files_link.c
index cf3536213d2..12ab10e3a70 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -595,7 +595,10 @@ static void 
wm_append_loose_data_instantiate(WMLinkAppendData *lapp_data,
 
 static int foreach_libblock_append_callback(LibraryIDLinkCallbackData *cb_data)
 {
-  if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_INTERNAL | 
IDWALK_CB_LOOPBACK)) {
+  /* NOTE: It is important to also skip liboverride references here, as those 
should never be made
+   * local. */
+  if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_INTERNAL | 
IDWALK_CB_LOOPBACK |
+  IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
 return IDWALK_RET_NOP;
   }
 
@@ -652,7 +655,8 @@ static void wm_append_do(WMLinkAppendData *lapp_data,
 
   LinkNode *itemlink;
 
-  /* Generate a mapping between newly linked IDs and their items. */
+  /* Generate a mapping between newly linked IDs and their items, and tag 
linked IDs used as
+   * liboverride references as already existing. */
   lapp_data->new_id_to_item = BLI_ghash_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, __func__);
   for (itemlink = lapp_data->items.list; itemlink; itemlink = itemlink->next) {
 WMLinkAppendDataItem *item = itemlink->link;
@@ -661,6 +665,13 @@ static void wm_append_do(WMLinkAppendData *lapp_data,
   continue;
 }
 BLI_ghash_insert(lapp_data->new_id_to_item, id, item);
+
+/* This ensures that if a liboverride reference is also linked/used by 
some other appended
+ * data, it gets a local copy instead of being made directly local, so 
that the liboverride
+ * references remain valid (i.e. linked data). */
+if (ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
+  id->override_library->reference->tag |= LIB_TAG_PRE_EXISTING;
+}
   }
 
   lapp_data->library_weak_reference_mapping = 
BKE_main_library_weak_reference_create(bmain);
@@ -704,7 +715,6 @@ static void wm_append_do(WMLinkAppendData *lapp_data,
   item->append_action = WM_APPEND_ACT_COPY_LOCAL;
 }
 else {
-  /* In future we could search for already existing matching local ID etc. 
*/
   CLOG_INFO(&LOG, 3, "Appended ID '%s' will be made local...", id->name);
   item->append_action = WM_APPEND_ACT_MAKE_LOCAL;
 }

___
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] [b5ea3d2c09c] master: Fix possible use-after-free when cancelling temporary rename button

2021-10-06 Thread Julian Eisel
Commit: b5ea3d2c09c5df49ed783dabdc83820c55effdd2
Author: Julian Eisel
Date:   Wed Oct 6 11:20:15 2021 +0200
Branches: master
https://developer.blender.org/rBb5ea3d2c09c5df49ed783dabdc83820c55effdd2

Fix possible use-after-free when cancelling temporary rename button

If a renaming button was removed via `UI_but_active_only_ex()` and that
button was placed using the layout system, the button was still in the
layout.
So far this didn't cause issues, because all cases where the button may
be removed were not using the layout system.

===

M   source/blender/editors/interface/interface.c
M   source/blender/editors/interface/interface_intern.h
M   source/blender/editors/interface/interface_layout.c

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 9a294162f34..88b23e07f54 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1014,6 +1014,9 @@ bool UI_but_active_only_ex(
   else if ((found == true) && (isactive == false)) {
 if (remove_on_failure) {
   BLI_remlink(&block->buttons, but);
+  if (but->layout) {
+ui_layout_remove_but(but->layout, but);
+  }
   ui_but_free(C, but);
 }
 return false;
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 8b45d9faae6..8e69ac40a34 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -1107,6 +1107,7 @@ void ui_resources_free(void);
 
 /* interface_layout.c */
 void ui_layout_add_but(uiLayout *layout, uiBut *but);
+void ui_layout_remove_but(uiLayout *layout, const uiBut *but);
 bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, 
uiBut *new_but);
 uiBut *ui_but_add_search(uiBut *but,
  PointerRNA *ptr,
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index 64c16e57f56..e54b261facd 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5605,28 +5605,52 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but)
   ui_button_group_add_but(uiLayoutGetBlock(layout), but);
 }
 
-bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, 
uiBut *new_but)
+static uiButtonItem *ui_layout_find_button_item(const uiLayout *layout, const 
uiBut *but)
 {
-  ListBase *child_list = layout->child_items_layout ? 
&layout->child_items_layout->items :
-  &layout->items;
+  const ListBase *child_list = layout->child_items_layout ? 
&layout->child_items_layout->items :
+&layout->items;
 
   LISTBASE_FOREACH (uiItem *, item, child_list) {
 if (item->type == ITEM_BUTTON) {
   uiButtonItem *bitem = (uiButtonItem *)item;
 
-  if (bitem->but == old_but_ptr) {
-bitem->but = new_but;
-return true;
+  if (bitem->but == but) {
+return bitem;
   }
 }
 else {
-  if (ui_layout_replace_but_ptr((uiLayout *)item, old_but_ptr, new_but)) {
-return true;
+  uiButtonItem *nested_item = ui_layout_find_button_item((uiLayout *)item, 
but);
+  if (nested_item) {
+return nested_item;
   }
 }
   }
 
-  return false;
+  return NULL;
+}
+
+void ui_layout_remove_but(uiLayout *layout, const uiBut *but)
+{
+  uiButtonItem *bitem = ui_layout_find_button_item(layout, but);
+  if (!bitem) {
+return;
+  }
+
+  BLI_freelinkN(&layout->items, bitem);
+}
+
+/**
+ * \return true if the button was successfully replaced.
+ */
+bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, 
uiBut *new_but)
+{
+  uiButtonItem *bitem = ui_layout_find_button_item(layout, old_but_ptr);
+  if (!bitem) {
+return false;
+  }
+
+  bitem->but = new_but;
+  return true;
 }
 
 void uiLayoutSetFixedSize(uiLayout *layout, bool fixed_size)

___
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] [f6a8d745c22] sculpt-dev: Sculpt: fix broken ray casting of original data in pbvh

2021-10-06 Thread Joseph Eagar
Commit: f6a8d745c22b2f77210dcc87cbe75aad699eb267
Author: Joseph Eagar
Date:   Wed Oct 6 01:46:25 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBf6a8d745c22b2f77210dcc87cbe75aad699eb267

Sculpt: fix broken ray casting of original data in pbvh

Not sure if this ever worked.

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/blenkernel/intern/pbvh_intern.h
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/gpu/intern/gpu_buffers.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 1c5c4eefa52..86fbbda83db 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1278,6 +1278,15 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
 """
 
 col.separator()
+
+UnifiedPaintPanel.channel_unified(layout.column(),
+context,
+brush,
+"show_origco",
+toolsettings_only=True, ui_editing=False)
+
+col.separator()
+
 col.operator("sculpt.set_limit_surface")
 
 
diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index b9975d3dd5b..34dc6df8830 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -505,6 +505,7 @@ void BKE_pbvh_bmesh_update_all_valence(PBVH *pbvh);
 void BKE_pbvh_bmesh_flag_all_disk_sort(PBVH *pbvh);
 bool BKE_pbvh_bmesh_mark_update_valence(PBVH *pbvh, SculptVertRef vertex);
 
+void BKE_pbvh_node_mark_original_update(PBVHNode *node);
 void BKE_pbvh_node_mark_update_tri_area(PBVHNode *node);
 void BKE_pbvh_update_all_tri_areas(PBVH *pbvh);
 void BKE_pbvh_node_mark_update(PBVHNode *node);
@@ -836,6 +837,7 @@ void BKE_pbvh_update_vert_boundary(int cd_dyn_vert,
int cd_faceset_offset,
int cd_vert_node_offset,
int cd_face_node_offset,
+   int cd_vcol,
struct BMVert *v,
int symmetry);
 
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index fe23ca93fbc..e7149aefd3b 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -277,6 +277,7 @@ places in rna_engine_codebase are relevent:
   MAKE_FLOAT(hardness, "Hardness", "Brush falloff hardness", 0.0f, 0.0f, 1.0f)
   MAKE_FLOAT(tip_roundness, "Tip Roundness", "", 1.0f, 0.0f, 1.0f)
   MAKE_BOOL(accumulate, "Accumulate", "", false)
+  MAKE_BOOL_EX(show_origco, "Show OrigCo", "", false, BRUSH_CHANNEL_INHERIT)
   MAKE_ENUM(direction, "Direction", "", 0, {\
 {0, "ADD", "ADD", "Add", "Add effect of brush"},
 {1, "SUBTRACT", "REMOVE", "Subtract", "Subtract effect of brush"},
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index a22180c3d2b..cb74a32aa01 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -974,6 +974,8 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
   ADDCH(radius_unit);
   ADDCH(unprojected_radius);
 
+  ADDCH(show_origco);
+
   ADDCH(use_surface_falloff);
 
   if (!BRUSHSET_LOOKUP(chset, use_smoothed_rake)) {
@@ -1781,6 +1783,8 @@ void BKE_brush_check_toolsettings(Sculpt *sd)
   ADDCH(radius_unit);
   ADDCH(unprojected_radius);
 
+  ADDCH(show_origco);
+
   ADDCH(smooth_strength_factor);
   ADDCH(smooth_strength_projection);
 
diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index 8edc13a423b..58ee35e86b8 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -153,26 +153,75 @@ void BBC_update_centroid(BBC *bbc)
 }
 
 /* Not recursive */
-static void update_node_vb(PBVH *pbvh, PBVHNode *node)
+static void update_node_vb(PBVH *pbvh, PBVHNode *node, int updateflag)
 {
+  if (!(updateflag & (PBVH_UpdateBB | PBVH_UpdateOriginalBB))) {
+return;
+  }
+
+  /* cannot clear flag here, causes leaky pbvh */
+  // node->flag &= ~(updateflag & (PBVH_UpdateBB | PBVH_UpdateOriginalBB));
+
   BB vb;
+  BB orig_vb;

[Bf-blender-cvs] [ca0450feeff] master: Fix T91064: Cycles low poly meshes having black edges when shade smoothed

2021-10-06 Thread Mikhail Matrosov
Commit: ca0450feeffdb07eea11c17aa617bfd7b9a04913
Author: Mikhail Matrosov
Date:   Wed Oct 6 10:16:56 2021 +0200
Branches: master
https://developer.blender.org/rBca0450feeffdb07eea11c17aa617bfd7b9a04913

Fix T91064: Cycles low poly meshes having black edges when shade smoothed

Fixes:{T91064}

Caused by {rBcd118c5581f482afc8554ff88b5b6f3b552b1682}

- Applies `ensure_valid_reflection()` to the normal input on all BSDFs for CPU 
and GPU.
- This doesn't affect hair.
- Removes `ensure_valid_reflection()` from the output of Bump Map and Normal 
Map nodes for CPU/GPU as it is not needed.
- The fix doesn't touch OSL.

Reviewed By: brecht, leesonw

Maniphest Tasks: T91064

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

===

M   intern/cycles/kernel/closure/bsdf_principled_diffuse.h
M   intern/cycles/kernel/svm/svm_closure.h
M   intern/cycles/kernel/svm/svm_tex_coord.h

===

diff --git a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h 
b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h
index a72af519482..55fe364db70 100644
--- a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h
+++ b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h
@@ -35,21 +35,25 @@ static_assert(sizeof(ShaderClosure) >= 
sizeof(PrincipledDiffuseBsdf),
   "PrincipledDiffuseBsdf is too large!");
 
 ccl_device float3 calculate_principled_diffuse_brdf(
-const PrincipledDiffuseBsdf *bsdf, float3 N, float3 V, float3 L, float3 H, 
float *pdf)
+const PrincipledDiffuseBsdf *bsdf, float3 N, float3 V, float3 L, float 
*pdf)
 {
   float NdotL = dot(N, L);
-  float NdotV = dot(N, V);
 
-  if (NdotL <= 0 || NdotV <= 0) {
-*pdf = 0.0f;
+  if (NdotL <= 0) {
 return make_float3(0.0f, 0.0f, 0.0f);
   }
 
-  float LdotH = dot(L, H);
+  float NdotV = dot(N, V);
+
+  /* H = normalize(L + V);  // Bissector of an angle between L and V
+   * LH2 = 2 * dot(L, H)^2 = 2cos(x)^2 = cos(2x) + 1 = dot(L, V) + 1,
+   * half-angle x between L and V is at most 90 deg
+   */
+  float LH2 = dot(L, V) + 1;
 
   float FL = schlick_fresnel(NdotL), FV = schlick_fresnel(NdotV);
-  const float Fd90 = 0.5f + 2.0f * LdotH * LdotH * bsdf->roughness;
-  float Fd = (1.0f * (1.0f - FL) + Fd90 * FL) * (1.0f * (1.0f - FV) + Fd90 * 
FV);
+  const float Fd90 = 0.5f + LH2 * bsdf->roughness;
+  float Fd = (1.0f - FL + Fd90 * FL) * (1.0f - FV + Fd90 * FV);
 
   float value = M_1_PI_F * NdotL * Fd;
 
@@ -72,11 +76,10 @@ ccl_device float3 
bsdf_principled_diffuse_eval_reflect(const ShaderClosure *sc,
   float3 N = bsdf->N;
   float3 V = I; // outgoing
   float3 L = omega_in;  // incoming
-  float3 H = normalize(L + V);
 
   if (dot(N, omega_in) > 0.0f) {
 *pdf = fmaxf(dot(N, omega_in), 0.0f) * M_1_PI_F;
-return calculate_principled_diffuse_brdf(bsdf, N, V, L, H, pdf);
+return calculate_principled_diffuse_brdf(bsdf, N, V, L, pdf);
   }
   else {
 *pdf = 0.0f;
@@ -112,9 +115,7 @@ ccl_device int bsdf_principled_diffuse_sample(const 
ShaderClosure *sc,
   sample_cos_hemisphere(N, randu, randv, omega_in, pdf);
 
   if (dot(Ng, *omega_in) > 0) {
-float3 H = normalize(I + *omega_in);
-
-*eval = calculate_principled_diffuse_brdf(bsdf, N, I, *omega_in, H, pdf);
+*eval = calculate_principled_diffuse_brdf(bsdf, N, I, *omega_in, pdf);
 
 #ifdef __RAY_DIFFERENTIALS__
 // TODO: find a better approximation for the diffuse bounce
diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index e2f6dde4ace..3e0cbe3a483 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -85,6 +85,9 @@ ccl_device_noinline int svm_node_closure_bsdf(
   }
 
   float3 N = stack_valid(data_node.x) ? stack_load_float3(stack, data_node.x) 
: sd->N;
+  if (!(sd->type & PRIMITIVE_ALL_CURVE)) {
+N = ensure_valid_reflection(sd->Ng, sd->I, N);
+  }
 
   float param1 = (stack_valid(param1_offset)) ? stack_load_float(stack, 
param1_offset) :
 __uint_as_float(node.z);
@@ -166,6 +169,9 @@ ccl_device_noinline int svm_node_closure_bsdf(
   float3 clearcoat_normal = stack_valid(data_cn_ssr.x) ?
 stack_load_float3(stack, data_cn_ssr.x) :
 sd->N;
+  if (!(sd->type & PRIMITIVE_ALL_CURVE)) {
+clearcoat_normal = ensure_valid_reflection(sd->Ng, sd->I, 
clearcoat_normal);
+  }
   float3 subsurface_radius = stack_valid(data_cn_ssr.y) ?
  stack_load_float3(stack, data_cn_ssr.y) :
  make_float3(1.0f, 1.0f, 1.0f);
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h 
b/intern/cycles/kernel/svm/svm_tex_coord.h
index a35253080da..8869001015b 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/sv

[Bf-blender-cvs] [2f35045fd15] temp-eevee-gpencil-rewrite: Revert python changes in material panel

2021-10-06 Thread Antonio Vazquez
Commit: 2f35045fd157b818dfba820ec1d7e08118b360ee
Author: Antonio Vazquez
Date:   Wed Oct 6 10:35:40 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB2f35045fd157b818dfba820ec1d7e08118b360ee

Revert python changes in material panel

===

M   release/scripts/startup/bl_ui/properties_material.py
M   release/scripts/startup/bl_ui/properties_material_gpencil.py

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index a32f3ed4042..1c7f3639f0a 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -93,9 +93,8 @@ class 
EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
 ob = context.object
 mat = context.material
 
-if (ob and ob.type == 'GPENCIL' and ob.use_grease_pencil_scene_engine 
is False):
-if mat and mat.grease_pencil:
-return False
+if (ob and ob.type == 'GPENCIL') or (mat and mat.grease_pencil):
+return False
 
 return (ob or mat) and (context.engine in cls.COMPAT_ENGINES)
 
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 170593cd727..9d099ff2231 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -97,11 +97,6 @@ class GPMaterialButtonsPanel:
 
 @classmethod
 def poll(cls, context):
-ob = context.active_object
-# If using scene engine, don't use this type of materials
-if ob and ob.type == 'GPENCIL' and ob.use_grease_pencil_scene_engine:
-return False
-
 ma = context.material
 return ma and ma.grease_pencil
 
@@ -117,9 +112,6 @@ class MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, 
Panel):
 def poll(cls, context):
 ob = context.object
 ma = context.material
-# If using scene engine, don't use this type of materials
-if ob and ob.type == 'GPENCIL' and ob.use_grease_pencil_scene_engine:
-return False
 
 return (ma and ma.grease_pencil) or (ob and ob.type == 'GPENCIL')

___
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] [85267ec1ae9] master: Correct error in 68dc970219ef7a559b48bd1b3e45d033367b4172

2021-10-06 Thread Campbell Barton
Commit: 85267ec1ae9edba1167b2f6248fbf7307ee73544
Author: Campbell Barton
Date:   Wed Oct 6 18:12:01 2021 +1100
Branches: master
https://developer.blender.org/rB85267ec1ae9edba1167b2f6248fbf7307ee73544

Correct error in 68dc970219ef7a559b48bd1b3e45d033367b4172

Included invalid keyword argument.

===

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 265db782eff..1ab0e25b59d 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4687,7 +4687,6 @@ def _template_sequencer_select_for_fallback(params, 
fallback):
 return _template_sequencer_generic_select(
 type=params.select_mouse,
 value=params.select_mouse_value,
-preview=False,
 legacy=params.legacy,
 )
 return []
@@ -7471,7 +7470,7 @@ def km_sequencer_editor_tool_select(params, *, fallback):
   _template_items_tool_select(params, "sequencer.select", 
"sequencer.sample", extend="toggle")
   ),
 *([] if (not params.use_fallback_tool_rmb) else 
_template_sequencer_generic_select(
-type=params.select_mouse, value=params.select_mouse_value, 
preview=False, legacy=params.legacy)),
+type=params.select_mouse, value=params.select_mouse_value, 
legacy=params.legacy)),
 
 *_template_items_change_frame(params),
 ]},

___
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] [68dc970219e] master: Sequencer: improvements to preview selection

2021-10-06 Thread Campbell Barton
Commit: 68dc970219ef7a559b48bd1b3e45d033367b4172
Author: Campbell Barton
Date:   Wed Oct 6 17:27:52 2021 +1100
Branches: master
https://developer.blender.org/rB68dc970219ef7a559b48bd1b3e45d033367b4172

Sequencer: improvements to preview selection

- Support toggle/deselect/deselect_all options
  (matching 3D viewport object selection).
- Support legacy selection behavior.
- Support selecting by the center in preview views (holding Ctrl).

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   source/blender/editors/space_sequencer/sequencer_select.c

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 80ec9e0edfe..265db782eff 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2767,21 +2767,11 @@ def km_sequencer(params):
  for i in range(10)
  )
 ),
-*_template_sequencer_select(
+*_template_sequencer_timeline_select(
 type=params.select_mouse,
 value=params.select_mouse_value_fallback,
 legacy=params.legacy,
 ),
-("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', 
"alt": True},
- {"properties": [("linked_handle", True)]}),
-("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', 
"shift": True, "alt": True},
- {"properties": [("extend", True), ("linked_handle", True)]}),
-("sequencer.select",
- {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True},
- {"properties": [("side_of_frame", True), ("linked_time", True)]}),
-("sequencer.select",
- {"type": params.select_mouse, "value": 'PRESS' if params.legacy else 
'CLICK', "ctrl": True, "shift": True},
- {"properties": [("side_of_frame", True), ("linked_time", True), 
("extend", True)]}),
 ("sequencer.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', 
"ctrl": True, "repeat": True}, None),
 ("sequencer.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', 
"ctrl": True, "repeat": True}, None),
 ("sequencer.select_linked_pick", {"type": 'L', "value": 'PRESS'}, 
None),
@@ -2831,7 +2821,7 @@ def km_sequencerpreview(params):
 
 items.extend([
 # Selection.
-*_template_sequencer_select(
+*_template_sequencer_preview_select(
 type=params.select_mouse,
 value=params.select_mouse_value_fallback,
 legacy=params.legacy,
@@ -4646,32 +4636,58 @@ def _template_uv_select_for_fallback(params, fallback):
 return []
 
 
-def _template_sequencer_select(*, type, value, legacy):
-# FIXME.
-legacy = True
+def _template_sequencer_generic_select(*, type, value, legacy):
 return [(
 "sequencer.select",
 {"type": type, "value": value, **{m: True for m in mods}},
 {"properties": [(c, True) for c in props]},
 ) for props, mods in (
 (("deselect_all",) if not legacy else (), ()),
-(("extend",), ("shift",)),
+(("toggle",), ("shift",)),
+)]
+
+
+def _template_sequencer_timeline_select(*, type, value, legacy):
+return _template_sequencer_generic_select(
+type=type, value=value, legacy=legacy,
+) + [(
+"sequencer.select",
+{"type": type, "value": value, **{m: True for m in mods}},
+{"properties": [(c, True) for c in props]},
+) for props, mods in (
+(("center",), ("ctrl",)),
 # TODO:
-# (("center", "object"), ("ctrl",)),
 # (("enumerate",), ("alt",)),
-# (("toggle", "center"), ("shift", "ctrl")),
+(("toggle", "center"), ("shift", "ctrl")),
 # (("center", "enumerate"), ("ctrl", "alt")),
 # (("toggle", "enumerate"), ("shift", "alt")),
 # (("toggle", "center", "enumerate"), ("shift", "ctrl", "alt")),
 )]
 
 
+def _template_sequencer_preview_select(*, type, value, legacy):
+return _template_sequencer_generic_select(
+type=type, value=value, legacy=legacy,
+) + [(
+"sequencer.select",
+{"type": type, "value": value, **{m: True for m in mods}},
+{"properties": [(c, True) for c in props]},
+) for props, mods in (
+(("linked_handle",), ("alt",)),
+(("linked_handle", "extend"), ("shift", "alt",)),
+
+(("side_of_frame", "linked_time"), ("ctrl",)),
+(("side_of_frame", "linked_time", "extend"), ("ctrl", "shift")),
+)]
+
+
 def _template_sequencer_select_for_fallback(params, fallback):
 if (not fallback) and params.use_fallback_tool_rmb:
 # Needed so we have immediate select+tweak when the default select 
tool is active.
-ret