[Bf-blender-cvs] [c209e0902df] sculpt-dev: Sculpt: Fixed a few sculpt color issues

2021-10-05 Thread Joseph Eagar
Commit: c209e0902df3d9c0f5b5bd0e5e58847b2957
Author: Joseph Eagar
Date:   Tue Oct 5 21:55:53 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc209e0902df3d9c0f5b5bd0e5e58847b2957

Sculpt: Fixed a few sculpt color issues

* Fixed broken smear brush
* Tweaked ui defaults a bit

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/BKE_brush_engine.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_paint_color.c
M   source/blender/makesrna/intern/rna_brush_engine.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 812bfc01517..f7809f21af6 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1113,7 +1113,7 @@ def brush_settings(layout, context, brush, popover=False):
 brush,
 "autosmooth_spacing",
 slider=True,
-text="Spacing")
+text="Smooth Spacing")
 
 UnifiedPaintPanel.prop_unified(box,
 context,
@@ -1161,7 +1161,7 @@ def brush_settings(layout, context, brush, popover=False):
 brush,
 "topology_rake_spacing",
 slider=True,
-text="Spacing")
+text="Rake Spacing")
 
 UnifiedPaintPanel.prop_unified(box,
 context,
diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index ceb19e87b40..d8112de760d 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 33
+#define BLENDER_FILE_SUBVERSION 34
 
 /* 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/BKE_brush_engine.h 
b/source/blender/blenkernel/BKE_brush_engine.h
index 58cc33170cd..ea539b27c23 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -309,8 +309,14 @@ extern void 
BKE_brush_channelset_to_unified_settings(BrushChannelSet *chset,
 
 void BKE_brush_init_toolsettings(struct Sculpt *sd);
 void BKE_brush_builtin_create(struct Brush *brush, int tool);
+
 BrushCommandList *BKE_brush_commandlist_create();
+void BKE_brush_commandlist_start(BrushCommandList *list,
+ struct Brush *brush,
+ BrushChannelSet *chset_final);
+
 void BKE_brush_commandlist_free(BrushCommandList *cl);
+
 BrushCommand *BKE_brush_commandlist_add(BrushCommandList *cl,
 BrushChannelSet *chset_template,
 bool auto_inherit);
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index 9df57642975..fe23ca93fbc 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -194,7 +194,7 @@ places in rna_engine_codebase are relevent:
   {-1}
 })
 
-  MAKE_FLOAT_EX(spacing, "Spacing", "", 10.0f, 0.25f, 1000.0f, 1.0f, 500.0f, 
false)
+  MAKE_FLOAT_EX(spacing, "Spacing", "", 10.0f, 0.25f, 1000.0f, 1.0f, 200.0f, 
false)
   MAKE_FLOAT_EX(topology_rake, "Topology Rake", "Automatically align edges to 
the brush direction to "
"generate cleaner topology and define sharp 
features. "
"Best used on low-poly meshes as it has a 
performance impact", 0.0f, 0.0f, 5.0f, 0.0f, 2.0f, false)
@@ -335,7 +335,7 @@ MAKE_FLOAT_EX(vcol_boundary_exponent, "Exponent", 
"Hardening exponent (smaller v
 MAKE_FLOAT_EX(vcol_boundary_radius_scale, "Radius Scale",
   "Scale brush radius for vcol boundary hardening",
   1.0f, 0.0001f, 100.0f, 0.001f, 3.0f, false)
-MAKE_FLOAT_EX(vcol_boundary_spacing, "Spacing", "Spacing for vcol boundary 
hardening", 15, 0.25, 5000, 0.5, 300, false)
+MAKE_FLOAT_EX(vcol_boundary_spacing, "Color Hardening Spacing", "Spacing for 
vcol boundary hardening", 15, 0.25, 5000, 0.5, 300, false)
 MAKE_BOOL(invert_to_scrape_fill,"Invert to Scrape

[Bf-blender-cvs] [82f0e4948c3] master: UI: Boolean rename "Self" to "Self Intersection"

2021-10-05 Thread Aaron Carlisle
Commit: 82f0e4948c36a4d69d0c3dc3e14d9b4376e0be37
Author: Aaron Carlisle
Date:   Wed Oct 6 00:00:00 2021 -0400
Branches: master
https://developer.blender.org/rB82f0e4948c36a4d69d0c3dc3e14d9b4376e0be37

UI: Boolean rename "Self" to "Self Intersection"

Better to be more explicit here, also this matches the recent Boolean Node.

===

M   source/blender/editors/mesh/editmesh_intersect.c
M   source/blender/makesrna/intern/rna_modifier.c

===

diff --git a/source/blender/editors/mesh/editmesh_intersect.c 
b/source/blender/editors/mesh/editmesh_intersect.c
index f2691580a9d..5dfa804ad85 100644
--- a/source/blender/editors/mesh/editmesh_intersect.c
+++ b/source/blender/editors/mesh/editmesh_intersect.c
@@ -480,7 +480,7 @@ void MESH_OT_intersect_boolean(struct wmOperatorType *ot)
   false,
   "Swap",
   "Use with difference intersection to swap which side is 
kept");
-  RNA_def_boolean(ot->srna, "use_self", false, "Self", "Do self-union or 
self-intersection");
+  RNA_def_boolean(ot->srna, "use_self", false, "Self Intersection", "Do 
self-union or self-intersection");
   RNA_def_float_distance(
   ot->srna, "threshold", 0.01f, 0.0, 0.01, "Merge Threshold", "", 0.0, 
0.001);
   RNA_def_enum(ot->srna,
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index c99dfea524f..028b6b6e11f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2746,7 +2746,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", eBooleanModifierFlag_Self);
-  RNA_def_property_ui_text(prop, "Self", "Allow self-intersection in 
operands");
+  RNA_def_property_ui_text(prop, "Self Intersection", "Allow self-intersection 
in operands");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
   prop = RNA_def_property(srna, "use_hole_tolerant", PROP_BOOLEAN, PROP_NONE);

___
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] [c73a550e904] master: UI: rename sequencer "Select" to "Tweak"

2021-10-05 Thread Campbell Barton
Commit: c73a550e904086b06b5a02e24660970a847d
Author: Campbell Barton
Date:   Wed Oct 6 14:45:33 2021 +1100
Branches: master
https://developer.blender.org/rBc73a550e904086b06b5a02e24660970a847d

UI: rename sequencer "Select" to "Tweak"

This matches the tweak tool elsewhere.

Match names since this name is shown prominently
in the fall back tool selector.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 81a8a621594..c89f858602f 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -7446,7 +7446,7 @@ def km_3d_view_tool_sculpt_gpencil_select_lasso(params):
 
 def km_sequencer_editor_tool_select(params, *, fallback):
 return (
-_fallback_id("Sequencer Tool: Select", fallback),
+_fallback_id("Sequencer Tool: Tweak", fallback),
 {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
 {"items": [
 # TODO: Use 2D cursor for preview region (currently 
`sequencer.sample`).
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 5970d6fdf2b..6478cff3597 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -2508,10 +2508,10 @@ class _defs_sequencer_select:
 def select():
 return dict(
 idname="builtin.select",
-label="Select",
+label="Tweak",
 icon="ops.generic.select",
 widget=None,
-keymap="Sequencer Tool: Select",
+keymap="Sequencer Tool: Tweak",
 )
 
 @ToolDef.from_fn

___
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] [ce66075d002] master: UI: add sequencer preview context menu

2021-10-05 Thread Campbell Barton
Commit: ce66075d0027d21044fe46591cd10d211443162a
Author: Campbell Barton
Date:   Wed Oct 6 14:45:34 2021 +1100
Branches: master
https://developer.blender.org/rBce66075d0027d21044fe46591cd10d211443162a

UI: add sequencer preview context menu

This is mostly a place-holder since many items
have not yet been implemented.

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_sequencer.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index c89f858602f..80ec9e0edfe 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2869,6 +2869,7 @@ def km_sequencerpreview(params):
  {"properties": [("property", 'SCALE')]}),
 ("sequencer.strip_transform_clear", {"type": 'R', "alt": True, 
"value": 'PRESS'},
  {"properties": [("property", 'ROTATION')]}),
+*_template_items_context_menu("SEQUENCER_MT_preview_context_menu", 
params.context_menu_event),
 ])
 
 return keymap
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index b5904422beb..dec754b8747 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1021,6 +1021,27 @@ class SEQUENCER_MT_context_menu(Menu):
 layout.menu("SEQUENCER_MT_strip_lock_mute")
 
 
+class SEQUENCER_MT_preview_context_menu(Menu):
+bl_label = "Sequencer Preview Context Menu"
+
+def draw(self, context):
+layout = self.layout
+
+layout.operator_context = 'INVOKE_REGION_WIN'
+
+props = layout.operator("wm.call_panel", text="Rename...")
+props.name = "TOPBAR_PT_name"
+props.keep_open = False
+
+# TODO: support in preview.
+# layout.operator("sequencer.delete", text="Delete")
+
+strip = context.active_sequence_strip
+
+if strip:
+pass
+
+
 class SequencerButtonsPanel:
 bl_space_type = 'SEQUENCE_EDITOR'
 bl_region_type = 'UI'
@@ -2431,6 +2452,7 @@ classes = (
 SEQUENCER_MT_strip_lock_mute,
 SEQUENCER_MT_color_tag_picker,
 SEQUENCER_MT_context_menu,
+SEQUENCER_MT_preview_context_menu,
 
 SEQUENCER_PT_color_tag_picker,

___
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] [ba95cf6234a] master: Keymap: remove selection from the common sequencer map

2021-10-05 Thread Campbell Barton
Commit: ba95cf6234af1255a794e02f831e0924ddfc1f46
Author: Campbell Barton
Date:   Wed Oct 6 14:45:30 2021 +1100
Branches: master
https://developer.blender.org/rBba95cf6234af1255a794e02f831e0924ddfc1f46

Keymap: remove selection from the common sequencer map

Needed for further changes as selection behaves differently
in the preview region.

===

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 650ade4d111..c1db5128151 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2685,9 +2685,6 @@ def km_sequencercommon(params):
 ("wm.context_toggle_enum", {"type": 'TAB', "value": 'PRESS', "ctrl": 
True},
  {"properties": [("data_path", 'space_data.view_type'), ("value_1", 
'SEQUENCER'), ("value_2", 'PREVIEW')]}),
 ("sequencer.refresh_all", {"type": 'R', "value": 'PRESS', "ctrl": 
True}, None),
-("sequencer.select", {"type": params.select_mouse, "value": 'PRESS'}, 
None),
-("sequencer.select", {"type": params.select_mouse, "value": 'PRESS', 
"shift": True},
- {"properties": [("extend", True)]}),
 ])
 
 if params.select_mouse == 'LEFTMOUSE' and not params.legacy:
@@ -2770,6 +2767,11 @@ def km_sequencer(params):
  for i in range(10)
  )
 ),
+*_template_sequencer_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},
@@ -2828,6 +2830,12 @@ def km_sequencerpreview(params):
 )
 
 items.extend([
+# Selection.
+*_template_sequencer_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),
@@ -4637,6 +4645,26 @@ def _template_uv_select_for_fallback(params, fallback):
 return []
 
 
+def _template_sequencer_select(*, type, value, legacy):
+# FIXME.
+legacy = True
+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",)),
+# TODO:
+# (("center", "object"), ("ctrl",)),
+# (("enumerate",), ("alt",)),
+# (("toggle", "center"), ("shift", "ctrl")),
+# (("center", "enumerate"), ("ctrl", "alt")),
+# (("toggle", "enumerate"), ("shift", "alt")),
+# (("toggle", "center", "enumerate"), ("shift", "ctrl", "alt")),
+)]
+
+
 def km_image_paint(params):
 items = []
 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] [876b2504997] master: Keymap: fallback tool support for the sequencer

2021-10-05 Thread Campbell Barton
Commit: 876b2504997e296bc926feb8b530ff1898f35cbc
Author: Campbell Barton
Date:   Wed Oct 6 14:45:32 2021 +1100
Branches: master
https://developer.blender.org/rB876b2504997e296bc926feb8b530ff1898f35cbc

Keymap: fallback tool support for the sequencer

Note that sample is no longer in the sequencer preview keymap,
it is still accessible as a tool.

This conflicted with click-drag to transform.

===

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 c1db5128151..81a8a621594 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2853,7 +2853,7 @@ def km_sequencerpreview(params):
  {"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),
+("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),
@@ -4665,6 +4665,17 @@ def _template_sequencer_select(*, type, value, legacy):
 )]
 
 
+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.
+return _template_sequencer_select(
+type=params.select_mouse,
+value=params.select_mouse_value,
+legacy=params.legacy,
+)
+return []
+
+
 def km_image_paint(params):
 items = []
 keymap = (
@@ -7435,11 +7446,16 @@ def km_3d_view_tool_sculpt_gpencil_select_lasso(params):
 
 def km_sequencer_editor_tool_select(params, *, fallback):
 return (
-# TODO, fall-back tool support.
 _fallback_id("Sequencer Tool: Select", fallback),
 {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
 {"items": [
-("sequencer.select", {"type": params.select_mouse, "value": 
'PRESS'}, None),
+# TODO: Use 2D cursor for preview region (currently 
`sequencer.sample`).
+*([] if fallback else
+  _template_items_tool_select(params, "sequencer.select", 
"sequencer.sample", extend="extend")
+  ),
+*([] if (not params.use_fallback_tool_rmb) else 
_template_sequencer_select(
+type=params.select_mouse, value=params.select_mouse_value, 
legacy=params.legacy)),
+
 *_template_items_change_frame(params),
 ]},
 )
@@ -7447,15 +7463,16 @@ def km_sequencer_editor_tool_select(params, *, 
fallback):
 
 def km_sequencer_editor_tool_select_box(params, *, fallback):
 return (
-# TODO, fall-back tool support.
 _fallback_id("Sequencer Tool: Select Box", fallback),
 {"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
 {"items": [
 # Don't use `tool_maybe_tweak_event`, see comment for this slot.
-*_template_items_tool_select_actions_simple(
-"sequencer.select_box", **params.tool_tweak_event,
-properties=[("tweak", params.select_mouse == 'LEFTMOUSE')],
-),
+*([] if (fallback and not params.use_fallback_tool) else 
_template_items_tool_select_actions_simple(
+"sequencer.select_box",
+**(params.select_tweak_event if fallback else 
params.tool_tweak_event),
+properties=[("tweak", params.select_mouse == 'LEFTMOUSE')])),
+*_template_sequencer_select_for_fallback(params, fallback),
+
 # RMB select can already set the frame, match the tweak tool.
 *(_template_items_change_frame(params)
   if params.select_mouse == 'LEFTMOUSE' 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] [df8f507f411] master: Cleanup: spelling in comments

2021-10-05 Thread Campbell Barton
Commit: df8f507f411fd71e649e9a896f53c2e574558525
Author: Campbell Barton
Date:   Wed Oct 6 14:44:27 2021 +1100
Branches: master
https://developer.blender.org/rBdf8f507f411fd71e649e9a896f53c2e574558525

Cleanup: spelling in comments

===

M   intern/cycles/kernel/geom/geom_shader_data.h
M   intern/cycles/kernel/kernel_shader.h
M   intern/cycles/kernel/kernel_types.h
M   intern/ghost/intern/GHOST_SystemPathsUnix.cpp
M   intern/ghost/intern/GHOST_SystemX11.cpp
M   source/blender/blenfont/intern/blf_internal_types.h
M   source/blender/blenkernel/intern/editmesh_bvh.c
M   source/blender/blenkernel/intern/image.c
M   source/blender/blenkernel/intern/mask_rasterize.c
M   source/blender/blenkernel/intern/vfont.c
M   source/blender/blenkernel/intern/vfontdata_freetype.c
M   source/blender/blenlib/BLI_array.hh
M   source/blender/editors/interface/interface.c
M   source/blender/editors/object/object_bake_api.c
M   source/blender/editors/render/render_preview.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/imbuf/intern/jp2.c
M   source/blender/imbuf/intern/oiio/openimageio_api.cpp
M   source/blender/imbuf/intern/png.c
M   source/blender/imbuf/intern/tiff.c
M   source/blender/io/avi/intern/avi_rgb.c
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/nodes/shader/nodes/node_shader_valToRgb.cc
M   source/blender/python/intern/bpy_rna.c
M   source/blender/render/intern/texture_procedural.c
M   source/blender/simulation/intern/ConstrainedConjugateGradient.h

===

diff --git a/intern/cycles/kernel/geom/geom_shader_data.h 
b/intern/cycles/kernel/geom/geom_shader_data.h
index 0e373c10086..5dc03940238 100644
--- a/intern/cycles/kernel/geom/geom_shader_data.h
+++ b/intern/cycles/kernel/geom/geom_shader_data.h
@@ -37,7 +37,7 @@ ccl_device void shader_setup_object_transforms(const 
KernelGlobals *ccl_restrict
 #endif
 
 /* TODO: break this up if it helps reduce register pressure to load data from
- * global memory as we write it to shaderdata. */
+ * global memory as we write it to shader-data. */
 ccl_device_inline void shader_setup_from_ray(const KernelGlobals *ccl_restrict 
kg,
  ShaderData *ccl_restrict sd,
  const Ray *ccl_restrict ray,
diff --git a/intern/cycles/kernel/kernel_shader.h 
b/intern/cycles/kernel/kernel_shader.h
index e7133724c85..a50f3fb214b 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -780,8 +780,8 @@ ccl_device_inline void 
shader_eval_volume(INTEGRATOR_STATE_CONST_ARGS,
   break;
 }
 
-/* setup shaderdata from stack. it's mostly setup already in
- * shader_setup_from_volume, this switching should be quick */
+/* Setup shader-data from stack. it's mostly setup already in
+ * shader_setup_from_volume, this switching should be quick. */
 sd->object = entry.object;
 sd->lamp = LAMP_NONE;
 sd->shader = entry.shader;
diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index 1a986c58878..6107e1028ba 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -190,7 +190,7 @@ enum SamplingPattern {
   SAMPLING_NUM_PATTERNS,
 };
 
-/* these flags values correspond to raytypes in osl.cpp, so keep them in sync! 
*/
+/* These flags values correspond to `raytypes` in `osl.cpp`, so keep them in 
sync! */
 
 enum PathRayFlag {
   /* 
diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp 
b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
index b58799e9c2a..8bc2ff9227d 100644
--- a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
@@ -142,7 +142,7 @@ const char 
*GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes
   }
 
   static string path = "";
-  /* Pipe stderr to /dev/null to avoid error prints. We will fail gracefully 
still. */
+  /* Pipe `stderr` to `/dev/null` to avoid error prints. We will fail 
gracefully still. */
   string command = string("xdg-user-dir ") + type_str + " 2> /dev/null";
 
   FILE *fstream = popen(command.c_str(), "r");
@@ -152,7 +152,7 @@ const char 
*GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes
   std::stringstream path_stream;
   while (!feof(fstream)) {
 char c = fgetc(fstream);
-/* xdg-user-dir ends the path with '\n'. */
+/* `xdg-user-dir` ends the path with '\n'. */
 if (c == '\n') {
   break;
 }
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index 86b4245ca67..ab8039ea95d 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/

[Bf-blender-cvs] [9161993e021] master: Sequencer: use pass-through for preview select

2021-10-05 Thread Campbell Barton
Commit: 9161993e0214c1d4c44db1a26e251d9d4d3008b2
Author: Campbell Barton
Date:   Wed Oct 6 14:45:27 2021 +1100
Branches: master
https://developer.blender.org/rB9161993e0214c1d4c44db1a26e251d9d4d3008b2

Sequencer: use pass-through for preview select

Needed for select-drag action as done in the 3D view and UV editor.

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_select.c 
b/source/blender/editors/space_sequencer/sequencer_select.c
index aa6599a7c53..c7d97ea16a7 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -801,6 +801,16 @@ static int sequencer_select_exec(bContext *C, wmOperator 
*op)
   return ret_value;
 }
 
+static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
+{
+  const int retval = WM_generic_select_invoke(C, op, event);
+  ARegion *region = CTX_wm_region(C);
+  if (region && (region->regiontype == RGN_TYPE_PREVIEW)) {
+return WM_operator_flag_only_pass_through_on_press(retval, event);
+  }
+  return retval;
+}
+
 void SEQUENCER_OT_select(wmOperatorType *ot)
 {
   PropertyRNA *prop;
@@ -812,7 +822,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
 
   /* Api callbacks. */
   ot->exec = sequencer_select_exec;
-  ot->invoke = WM_generic_select_invoke;
+  ot->invoke = sequencer_select_invoke;
   ot->modal = WM_generic_select_modal;
   ot->poll = ED_operator_sequencer_active;

___
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] [8e2a21e8624] master: Keymap: show sequencer tools in key-map editor

2021-10-05 Thread Campbell Barton
Commit: 8e2a21e8624df8df5ac42e8c5f6d196068d30d73
Author: Campbell Barton
Date:   Wed Oct 6 14:45:28 2021 +1100
Branches: master
https://developer.blender.org/rB8e2a21e8624df8df5ac42e8c5f6d196068d30d73

Keymap: show sequencer tools in key-map editor

Re-order common sequencer key-map to be at the top level
(shared by preview and sequence view).

Without this sequencer tools would be displayed at different levels
in the hierarchy which is confusing and doesn't represent the separation
between "Sequencer" and "SequencerPreview" key-maps.

===

M   release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py

===

diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py 
b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
index 0784a91d174..c3bc0f429c1 100644
--- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
+++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py
@@ -168,9 +168,13 @@ _km_hierarchy = [
 ('Node Editor', 'NODE_EDITOR', 'WINDOW', [
 ('Node Generic', 'NODE_EDITOR', 'WINDOW', []),
 ]),
-('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', [
-('SequencerCommon', 'SEQUENCE_EDITOR', 'WINDOW', []),
-('SequencerPreview', 'SEQUENCE_EDITOR', 'WINDOW', []),
+('SequencerCommon', 'SEQUENCE_EDITOR', 'WINDOW', [
+('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', [
+_km_expand_from_toolsystem('SEQUENCE_EDITOR', 'SEQUENCER'),
+]),
+('SequencerPreview', 'SEQUENCE_EDITOR', 'WINDOW', [
+_km_expand_from_toolsystem('SEQUENCE_EDITOR', 'PREVIEW'),
+]),
 ]),
 
 ('File Browser', 'FILE_BROWSER', 'WINDOW', [

___
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] [0e590f90784] master: Fix sequencer sample poll function

2021-10-05 Thread Campbell Barton
Commit: 0e590f90784a4c7b2f427ba133c0b0f749d4d6b4
Author: Campbell Barton
Date:   Wed Oct 6 14:07:20 2021 +1100
Branches: master
https://developer.blender.org/rB0e590f90784a4c7b2f427ba133c0b0f749d4d6b4

Fix sequencer sample poll function

Sequencer poll was succeeding outside of a preview region.

This meant it couldn't be used in tool key maps which are currently
shared between preview & sequencer regions.

===

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

===

diff --git a/source/blender/editors/util/ed_util_imbuf.c 
b/source/blender/editors/util/ed_util_imbuf.c
index d57640e16dc..ca21f88b230 100644
--- a/source/blender/editors/util/ed_util_imbuf.c
+++ b/source/blender/editors/util/ed_util_imbuf.c
@@ -565,6 +565,10 @@ bool ED_imbuf_sample_poll(bContext *C)
   if (SEQ_editing_get(CTX_data_scene(C)) == NULL) {
 return false;
   }
+  ARegion *region = CTX_wm_region(C);
+  if (!(region && (region->regiontype == RGN_TYPE_PREVIEW))) {
+return false;
+  }
   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] [bf35dba7fba] master: Nodes: Composite: Fix wrong socket type for color ramp node

2021-10-05 Thread Aaron Carlisle
Commit: bf35dba7fbab568e857b85e9a74ae0f1eb5838f6
Author: Aaron Carlisle
Date:   Tue Oct 5 23:28:12 2021 -0400
Branches: master
https://developer.blender.org/rBbf35dba7fbab568e857b85e9a74ae0f1eb5838f6

Nodes: Composite: Fix wrong socket type for color ramp node

===

M   source/blender/nodes/composite/nodes/node_composite_valToRgb.cc

===

diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc 
b/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc
index ba98ee12f30..9e4f1329fbd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.cc
@@ -31,7 +31,7 @@ static void cmp_node_valtorgb_declare(NodeDeclarationBuilder 
&b)
 {
   
b.add_input("Fac").default_value(0.5f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
   b.add_output("Image");
-  b.add_output("Alpha");
+  b.add_output("Alpha");
 }
 
 }  // namespace blender::nodes

___
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] [6264a6327f7] sculpt-dev: remove ATTR_NO_OPTs

2021-10-05 Thread Joseph Eagar
Commit: 6264a6327f742eb4ac9304f6e85154596e144207
Author: Joseph Eagar
Date:   Tue Oct 5 20:09:45 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB6264a6327f742eb4ac9304f6e85154596e144207

remove ATTR_NO_OPTs

===

M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/dyntopo.c
M   source/blender/editors/mesh/mesh_data.c
M   source/blender/editors/sculpt_paint/sculpt_dyntopo.c

===

diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index b2d1b0c544f..65462e6a8c1 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -74,7 +74,7 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *)NULL)->typemap) 
== CD_NUMTYPES, "siz
 
 static CLG_LogRef LOG = {"bke.customdata"};
 
-ATTR_NO_OPT bool CustomData_layout_is_same(const CustomData *_a, const 
CustomData *_b)
+bool CustomData_layout_is_same(const CustomData *_a, const CustomData *_b)
 {
   CustomData a = *_a;
   CustomData b = *_b;
@@ -2240,7 +2240,7 @@ void CustomData_update_typemap(CustomData *data)
   }
 }
 
-ATTR_NO_OPT void CustomData_regen_active_refs(CustomData *data)
+void CustomData_regen_active_refs(CustomData *data)
 {
   int i, j;
 
diff --git a/source/blender/blenkernel/intern/dyntopo.c 
b/source/blender/blenkernel/intern/dyntopo.c
index bf37ecb12ec..6de21ce0f80 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -2597,14 +2597,14 @@ static void edge_queue_init(EdgeQueueContext *eq_ctx,
  *
  * The highest priority (lowest number) is given to the longest edge.
  */
-ATTR_NO_OPT static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
-   PBVH *pbvh,
-   const float center[3],
-   const float view_normal[3],
-   float radius,
-   const bool use_frontface,
-   const bool use_projected,
-   const bool local_mode)
+static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
+   PBVH *pbvh,
+   const float center[3],
+   const float view_normal[3],
+   float radius,
+   const bool use_frontface,
+   const bool use_projected,
+   const bool local_mode)
 {
   if (local_mode) {
 edge_queue_create_local(
diff --git a/source/blender/editors/mesh/mesh_data.c 
b/source/blender/editors/mesh/mesh_data.c
index b26a5b07201..baaee2d6346 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -512,10 +512,7 @@ static bool sculpt_vertex_color_remove_poll(bContext *C)
 }
 
 /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */
-ATTR_NO_OPT int ED_mesh_sculpt_color_add(Mesh *me,
- const char *name,
- const bool active_set,
- const bool do_init)
+int ED_mesh_sculpt_color_add(Mesh *me, const char *name, const bool 
active_set, const bool do_init)
 {
   BMEditMesh *em;
   int layernum;
diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c 
b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
index 9d44e4ec472..a2b684c99cf 100644
--- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
@@ -641,7 +641,7 @@ void SCULPT_dyntopo_node_layers_add(SculptSession *ss)
 /**
   Syncs customdata layers with internal bmesh, but ignores deleted layers.
 */
-ATTR_NO_OPT void SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me)
+void SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me)
 {
   SculptSession *ss = ob->sculpt;

___
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] [a0dbcd890da] sculpt-dev: Sculpt: more nasty customdata bugs

2021-10-05 Thread Joseph Eagar
Commit: a0dbcd890dac6c9002eba2d9c92f4d897db9a43b
Author: Joseph Eagar
Date:   Tue Oct 5 20:07:25 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBa0dbcd890dac6c9002eba2d9c92f4d897db9a43b

Sculpt: more nasty customdata bugs

* Fixed mesh_sculpt_vertex_color_add_exec,
  it's post-exec undo push was overwriting
  the mesh cd layout.

===

M   source/blender/blenkernel/BKE_customdata.h
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/editors/mesh/mesh_data.c
M   source/blender/editors/sculpt_paint/sculpt_dyntopo.c

===

diff --git a/source/blender/blenkernel/BKE_customdata.h 
b/source/blender/blenkernel/BKE_customdata.h
index 8757e8f3017..c330c2de8be 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -631,6 +631,7 @@ void CustomData_unmark_temporary_nocopy(struct CustomData 
*data);
 void CustomData_mark_temporary_nocopy(struct CustomData *data);
 
 int CustomData_get_elem_size(CustomDataLayer *layer);
+void CustomData_regen_active_refs(CustomData *data);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index 2eed24b7139..b2d1b0c544f 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -2240,10 +2240,21 @@ void CustomData_update_typemap(CustomData *data)
   }
 }
 
-void customdata_regen_active_refs(CustomData *data)
+ATTR_NO_OPT void CustomData_regen_active_refs(CustomData *data)
 {
   int i, j;
-  bool changed = false;
+
+  for (int i = 0; i < CD_NUMTYPES; i++) {
+data->typemap[i] = -1;
+  }
+
+  for (i = 0, j = 0; i < data->totlayer; i++) {
+CustomDataLayer *layer = &data->layers[i];
+
+if (data->typemap[layer->type] == -1) {
+  data->typemap[layer->type] = i;
+}
+  }
 
   /* explicitly flag active layers */
   for (i = 0, j = 0; i < data->totlayer; i++) {
@@ -2283,6 +2294,15 @@ void customdata_regen_active_refs(CustomData *data)
 
 int n = layer - base;
 
+if (n < 0) {
+  printf("error!\n");
+  for (int j = 0; j < data->totlayer; j++) {
+printf("%s", i == j ? "->" : "  ");
+printf("%d : \"%s\"\n",
+   data->layers[i].type,
+   data->layers[i].name ? data->layers[i].name : "");
+  }
+}
 if (layer->active) {
   base->active = n;
 }
@@ -2338,7 +2358,7 @@ void CustomData_copy_all_layout(const struct CustomData 
*source, struct CustomDa
 }
   }
 
-  customdata_regen_active_refs(dest);
+  CustomData_regen_active_refs(dest);
 }
 
 bool CustomData_merge(const struct CustomData *source,
@@ -2430,7 +2450,7 @@ bool CustomData_merge(const struct CustomData *source,
   }
 
   CustomData_update_typemap(dest);
-  customdata_regen_active_refs(dest);
+  CustomData_regen_active_refs(dest);
 
   return changed;
 }
@@ -3191,18 +3211,6 @@ void CustomData_free_temporary(CustomData *data, int 
totelem)
   int i, j;
   bool changed = false;
 
-  /* explicitly flag active layers */
-  for (i = 0, j = 0; i < data->totlayer; i++) {
-CustomDataLayer *layer = &data->layers[i];
-CustomDataLayer *base = data->layers + data->typemap[layer->type];
-int n = layer - base;
-
-layer->active = n == base->active;
-layer->active_clone = n == base->active_clone;
-layer->active_mask = n == base->active_mask;
-layer->active_rnd = n == base->active_rnd;
-  }
-
   /* free temp layers */
   for (i = 0, j = 0; i < data->totlayer; i++) {
 CustomDataLayer *layer = &data->layers[i];
@@ -3222,48 +3230,6 @@ void CustomData_free_temporary(CustomData *data, int 
totelem)
 }
   }
 
-  CustomData_update_typemap(data);
-
-  /* regenerate active refs */
-  for (int i = 0; i < CD_NUMTYPES; i++) {
-if (data->typemap[i] != -1) {
-  CustomDataLayer *base = data->layers + data->typemap[i];
-  base->active = base->active_clone = base->active_mask = base->active_rnd 
= 0;
-}
-  }
-
-  /* set active n in base layer for all types */
-  for (i = 0; i < data->totlayer; i++) {
-CustomDataLayer *layer = &data->layers[i];
-CustomDataLayer *base = data->layers + data->typemap[layer->type];
-
-int n = layer - base;
-
-if (layer->active) {
-  base->active = n;
-}
-if (layer->active_mask) {
-  base->active_mask = n;
-}
-if (layer->active_clone) {
-  base->active_clone = n;
-}
-if (layer->active_rnd) {
-  base->active_rnd = n;
-}
-  }
-
-  /* set active n in all layers */
-  for (i = 0; i < data->totlayer; i++) {
-CustomDataLayer *layer = &data->layers[i];
-CustomDataLayer *base = data->layers + data->typemap[layer->type];
-
-layer->active = base->active;
-layer->active_mask = base->active_

[Bf-blender-cvs] [b534806ecb9] master: VSE: Reduce memory footprint when using thumbnails

2021-10-05 Thread Richard Antalik
Commit: b534806ecb9847c6929d5ef107a2cb729fb636c9
Author: Richard Antalik
Date:   Wed Oct 6 04:43:26 2021 +0200
Branches: master
https://developer.blender.org/rBb534806ecb9847c6929d5ef107a2cb729fb636c9

VSE: Reduce memory footprint when using thumbnails

Free strip `anim` data immediately after rendering. This doesn't affect
rendering performance, because each new loop would have to seek to start
of strip. Also strips are now freed anyway, but after rendering loop
ends.

With SF edit file, thumbnail rendering used around 60GB of memory.
Now it uses few hundreds MB (depends on movie file resolution, codec,
etc.)

Freeing of strips caused UI to be unresponsive for brief period. This
issue is not removed, but is more spread out so it is less noticable.

===

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

===

diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c 
b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
index f67b40b9674..0ea952d0999 100644
--- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c
+++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
@@ -36,6 +36,7 @@
 
 #include "BIF_glutil.h"
 
+#include "SEQ_relations.h"
 #include "SEQ_render.h"
 #include "SEQ_sequencer.h"
 
@@ -176,6 +177,7 @@ static void thumbnail_start_job(void *data,
   SEQ_render_thumbnails(
   &tj->context, val->seq_dupli, seq_orig, start_frame, frame_step, 
tj->view_area, stop);
   SEQ_render_thumbnails_base_set(&tj->context, val->seq_dupli, seq_orig, 
tj->view_area, stop);
+  SEQ_relations_sequence_free_anim(val->seq_dupli);
 }
 BLI_ghashIterator_step(&gh_iter);
   }

___
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] [0d68d7baa3c] master: Cleanup: clang-format, correct doxy groups

2021-10-05 Thread Campbell Barton
Commit: 0d68d7baa3c55971ce6640738716690ff819a052
Author: Campbell Barton
Date:   Wed Oct 6 11:37:50 2021 +1100
Branches: master
https://developer.blender.org/rB0d68d7baa3c55971ce6640738716690ff819a052

Cleanup: clang-format, correct doxy groups

===

M   source/blender/blenkernel/BKE_appdir.h
M   source/blender/blenkernel/BKE_curve_to_mesh.hh
M   source/blender/blenkernel/BKE_ocean.h
M   source/blender/blenkernel/BKE_rigidbody.h
M   source/blender/blenkernel/intern/bpath.c
M   source/blender/blenkernel/intern/ocean_intern.h
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/blenkernel/intern/rigidbody.c
M   source/blender/blenkernel/intern/vfont.c
M   source/blender/blenkernel/intern/vfontdata_freetype.c
M   source/blender/blenlib/BLI_timecode.h
M   source/blender/blenlib/BLI_timer.h
M   source/blender/blenlib/intern/timecode.c

===

diff --git a/source/blender/blenkernel/BKE_appdir.h 
b/source/blender/blenkernel/BKE_appdir.h
index fee52479cd0..0f00d391973 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -16,7 +16,7 @@
 #pragma once
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 #include 
diff --git a/source/blender/blenkernel/BKE_curve_to_mesh.hh 
b/source/blender/blenkernel/BKE_curve_to_mesh.hh
index cc1ef08908d..87bec6203a9 100644
--- a/source/blender/blenkernel/BKE_curve_to_mesh.hh
+++ b/source/blender/blenkernel/BKE_curve_to_mesh.hh
@@ -20,7 +20,7 @@ struct Mesh;
 struct CurveEval;
 
 /** \file
- * \ingroup geo
+ * \ingroup bke
  */
 
 namespace blender::bke {
diff --git a/source/blender/blenkernel/BKE_ocean.h 
b/source/blender/blenkernel/BKE_ocean.h
index 380f9045520..186e0ec174b 100644
--- a/source/blender/blenkernel/BKE_ocean.h
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -19,7 +19,7 @@
 #include 
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 #ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_rigidbody.h 
b/source/blender/blenkernel/BKE_rigidbody.h
index ae1e437cd60..e28f668d189 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -18,7 +18,7 @@
  */
 
 /** \file
- * \ingroup blenkernel
+ * \ingroup bke
  * \brief API for Blender-side Rigid Body stuff
  */
 
diff --git a/source/blender/blenkernel/intern/bpath.c 
b/source/blender/blenkernel/intern/bpath.c
index 07ac0086f0d..9ce58d8129b 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -15,7 +15,7 @@
  */
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 /* TODO:
diff --git a/source/blender/blenkernel/intern/ocean_intern.h 
b/source/blender/blenkernel/intern/ocean_intern.h
index 4ebd03789af..df9dcd7e2f5 100644
--- a/source/blender/blenkernel/intern/ocean_intern.h
+++ b/source/blender/blenkernel/intern/ocean_intern.h
@@ -17,7 +17,7 @@
 #pragma once
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 #ifdef __cplusplus
diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index ca1fada8c76..a24b53e48b7 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -15,7 +15,7 @@
  */
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 #include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c 
b/source/blender/blenkernel/intern/pbvh_bmesh.c
index c30f94a4cf6..679a8b378b9 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -15,7 +15,7 @@
  */
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 #include "MEM_guardedalloc.h"
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h 
b/source/blender/blenkernel/intern/pbvh_intern.h
index 84c4ae4dead..79b25c027ba 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -17,7 +17,7 @@
 #pragma once
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 /* Axis-aligned bounding box */
diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 242bad163d8..4482285c271 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -18,7 +18,7 @@
  */
 
 /** \file
- * \ingroup blenkernel
+ * \ingroup bke
  * \brief Blender-side interface and methods for dealing with Rigid Body 
simulations
  */
 
diff --git a/source/blender/blenkernel/intern/vfont.c 
b/source/blender/blenkernel/intern/vfont.c
index e650ae696b5..01c232e5a70 100644
--- a/source/blender/blenkernel/intern/vfont.c
+++ b/source/blender/blenkernel/intern/vfont.c
@@ -50,12 +50,12 @@
 
 #include "BKE_anim_path.h"
 #include "BKE_cur

[Bf-blender-cvs] [8113b8391ae] master: Cleanup: VSE: Move thumbnail drawing to own file

2021-10-05 Thread Richard Antalik
Commit: 8113b8391ae0f4d1f1612fb446f2268d093b5240
Author: Richard Antalik
Date:   Wed Oct 6 04:16:50 2021 +0200
Branches: master
https://developer.blender.org/rB8113b8391ae0f4d1f1612fb446f2268d093b5240

Cleanup: VSE: Move thumbnail drawing to own file

No functional changes.

===

M   source/blender/editors/space_sequencer/CMakeLists.txt
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/sequencer_intern.h
A   source/blender/editors/space_sequencer/sequencer_thumbnails.c

===

diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt 
b/source/blender/editors/space_sequencer/CMakeLists.txt
index e1c193b0c15..1471929defb 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -45,6 +45,7 @@ set(SRC
   sequencer_proxy.c
   sequencer_scopes.c
   sequencer_select.c
+  sequencer_thumbnails.c
   sequencer_view.c
   space_sequencer.c
 
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index d5cd5d11a35..bbe2def8081 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -25,7 +25,6 @@
 #include 
 
 #include "BLI_blenlib.h"
-#include "BLI_ghash.h"
 #include "BLI_math.h"
 #include "BLI_string_utils.h"
 #include "BLI_threads.h"
@@ -45,7 +44,6 @@
 #include "BKE_context.h"
 #include "BKE_fcurve.h"
 #include "BKE_global.h"
-#include "BKE_main.h"
 #include "BKE_scene.h"
 #include "BKE_sound.h"
 
@@ -103,7 +101,6 @@
 #define SEQ_HANDLE_SIZE 8.0f
 #define SEQ_SCROLLER_TEXT_OFFSET 8
 #define MUTE_ALPHA 120
-#define OVERLAP_ALPHA 180
 
 static Sequence *special_seq_update = NULL;
 
@@ -349,8 +346,8 @@ static void draw_seq_waveform_overlay(View2D *v2d,
   float y2,
   float frames_per_pixel)
 {
-  if (seq->sound &&
-  ((sseq->timeline_overlay.flag & SEQ_TIMELINE_ALL_WAVEFORMS) || 
(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
+  if (seq->sound && ((sseq->timeline_overlay.flag & 
SEQ_TIMELINE_ALL_WAVEFORMS) ||
+ (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM))) {
 /* Make sure that the start drawing position is aligned to the pixels on 
the screen to avoid
  * flickering when moving around the strip.
  * To do this we figure out the fractional offset in pixel space by 
checking where the
@@ -1312,526 +1309,6 @@ static void draw_seq_fcurve_overlay(
   }
 }
 
-typedef struct ThumbnailDrawJob {
-  SeqRenderData context;
-  GHash *sequences_ghash;
-  Scene *scene;
-  rctf *view_area;
-  float pixelx;
-  float pixely;
-} ThumbnailDrawJob;
-
-typedef struct ThumbDataItem {
-  Sequence *seq_dupli;
-  Scene *scene;
-} ThumbDataItem;
-
-static void thumbnail_hash_data_free(void *val)
-{
-  ThumbDataItem *item = val;
-  SEQ_sequence_free(item->scene, item->seq_dupli, 0);
-  MEM_freeN(val);
-}
-
-static void thumbnail_freejob(void *data)
-{
-  ThumbnailDrawJob *tj = data;
-  BLI_ghash_free(tj->sequences_ghash, NULL, thumbnail_hash_data_free);
-  MEM_freeN(tj->view_area);
-  MEM_freeN(tj);
-}
-
-static void thumbnail_endjob(void *data)
-{
-  ThumbnailDrawJob *tj = data;
-  WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
-}
-
-static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area)
-{
-  if (seq->type != SEQ_TYPE_MOVIE && seq->type != SEQ_TYPE_IMAGE) {
-return false;
-  }
-  if (min_ii(seq->startdisp, seq->start) > view_area->xmax) {
-return false;
-  }
-  if (max_ii(seq->enddisp, seq->start + seq->len) < view_area->xmin) {
-return false;
-  }
-  if (seq->machine + 1.0f < view_area->ymin) {
-return false;
-  }
-  if (seq->machine > view_area->ymax) {
-return false;
-  }
-
-  return true;
-}
-
-static void seq_get_thumb_image_dimensions(Sequence *seq,
-   float pixelx,
-   float pixely,
-   float *r_thumb_width,
-   float *r_thumb_height,
-   float *r_image_width,
-   float *r_image_height)
-{
-  float image_width = seq->strip->stripdata->orig_width;
-  float image_height = seq->strip->stripdata->orig_height;
-
-  /* Fix the dimensions to be max SEQ_RENDER_THUMB_SIZE (256) for x or y. */
-  float aspect_ratio = (float)image_width / image_height;
-  if (image_width > image_height) {
-image_width = SEQ_RENDER_THUMB_SIZE;
-image_height = round_fl_to_int(image_width / aspect_ratio);
-  }
-  else {
-image_height = SEQ_RENDER_THUMB_SIZE;
-image_width = round_fl_to_int(image_height * aspect_ratio);
-  }
-
-  /* Calculate thumb dimensi

[Bf-blender-cvs] [76de3ac4ce4] master: Cleanup: Remove data duplication from various lookup tables in Cycles

2021-10-05 Thread Jesse Yurkovich
Commit: 76de3ac4ce436dac4e3354fb7edbb67281ca9b54
Author: Jesse Yurkovich
Date:   Tue Oct 5 19:09:01 2021 -0700
Branches: master
https://developer.blender.org/rB76de3ac4ce436dac4e3354fb7edbb67281ca9b54

Cleanup: Remove data duplication from various lookup tables in Cycles

This effectively undoes some of the following commit:
rB4537e8558468c71a03bf53f59c60f888b3412de2

The tables in question were duplicated 5-6 times into the blender
executable due to the headers being used in multiple translation units.
This contributes ~6.3kb worth of duplicate data into the binary.

Some further details are in the below revision.

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

===

M   intern/cycles/kernel/svm/svm_math_util.h
M   intern/cycles/kernel/svm/svm_wavelength.h

===

diff --git a/intern/cycles/kernel/svm/svm_math_util.h 
b/intern/cycles/kernel/svm/svm_math_util.h
index 9e654f2247f..11b1e8f57f8 100644
--- a/intern/cycles/kernel/svm/svm_math_util.h
+++ b/intern/cycles/kernel/svm/svm_math_util.h
@@ -200,42 +200,42 @@ ccl_device float svm_math(NodeMathType type, float a, 
float b, float c)
   }
 }
 
-/* Calculate color in range 800..12000 using an approximation
- * a/x+bx+c for R and G and ((at + b)t + c)t + d) for B
- * Max absolute error for RGB is (0.00095, 0.00077, 0.00057),
- * which is enough to get the same 8 bit/channel color.
- */
+ccl_device float3 svm_math_blackbody_color(float t)
+{
+  /* TODO(lukas): Reimplement in XYZ. */
 
-ccl_static_constant float blackbody_table_r[6][3] = {
-{2.52432244e+03f, -1.06185848e-03f, 3.11067539e+00f},
-{3.37763626e+03f, -4.34581697e-04f, 1.64843306e+00f},
-{4.10671449e+03f, -8.61949938e-05f, 6.41423749e-01f},
-{4.66849800e+03f, 2.85655028e-05f, 1.29075375e-01f},
-{4.60124770e+03f, 2.89727618e-05f, 1.48001316e-01f},
-{3.78765709e+03f, 9.36026367e-06f, 3.98995841e-01f},
-};
+  /* Calculate color in range 800..12000 using an approximation
+   * a/x+bx+c for R and G and ((at + b)t + c)t + d) for B
+   * Max absolute error for RGB is (0.00095, 0.00077, 0.00057),
+   * which is enough to get the same 8 bit/channel color.
+   */
 
-ccl_static_constant float blackbody_table_g[6][3] = {
-{-7.50343014e+02f, 3.15679613e-04f, 4.73464526e-01f},
-{-1.00402363e+03f, 1.29189794e-04f, 9.08181524e-01f},
-{-1.22075471e+03f, 2.56245413e-05f, 1.20753416e+00f},
-{-1.42546105e+03f, -4.01730887e-05f, 1.44002695e+00f},
-{-1.18134453e+03f, -2.18913373e-05f, 1.30656109e+00f},
-{-5.00279505e+02f, -4.59745390e-06f, 1.09090465e+00f},
-};
+  const float blackbody_table_r[6][3] = {
+  {2.52432244e+03f, -1.06185848e-03f, 3.11067539e+00f},
+  {3.37763626e+03f, -4.34581697e-04f, 1.64843306e+00f},
+  {4.10671449e+03f, -8.61949938e-05f, 6.41423749e-01f},
+  {4.66849800e+03f, 2.85655028e-05f, 1.29075375e-01f},
+  {4.60124770e+03f, 2.89727618e-05f, 1.48001316e-01f},
+  {3.78765709e+03f, 9.36026367e-06f, 3.98995841e-01f},
+  };
 
-ccl_static_constant float blackbody_table_b[6][4] = {
-{0.0f, 0.0f, 0.0f, 0.0f}, /* zeros should be optimized by compiler */
-{0.0f, 0.0f, 0.0f, 0.0f},
-{0.0f, 0.0f, 0.0f, 0.0f},
-{-2.02524603e-11f, 1.79435860e-07f, -2.60561875e-04f, -1.41761141e-02f},
-{-2.22463426e-13f, -1.55078698e-08f, 3.81675160e-04f, -7.30646033e-01f},
-{6.72595954e-13f, -2.73059993e-08f, 4.24068546e-04f, -7.52204323e-01f},
-};
+  const float blackbody_table_g[6][3] = {
+  {-7.50343014e+02f, 3.15679613e-04f, 4.73464526e-01f},
+  {-1.00402363e+03f, 1.29189794e-04f, 9.08181524e-01f},
+  {-1.22075471e+03f, 2.56245413e-05f, 1.20753416e+00f},
+  {-1.42546105e+03f, -4.01730887e-05f, 1.44002695e+00f},
+  {-1.18134453e+03f, -2.18913373e-05f, 1.30656109e+00f},
+  {-5.00279505e+02f, -4.59745390e-06f, 1.09090465e+00f},
+  };
 
-ccl_device float3 svm_math_blackbody_color(float t)
-{
-  /* TODO(lukas): Reimplement in XYZ. */
+  const float blackbody_table_b[6][4] = {
+  {0.0f, 0.0f, 0.0f, 0.0f}, /* zeros should be optimized by compiler */
+  {0.0f, 0.0f, 0.0f, 0.0f},
+  {0.0f, 0.0f, 0.0f, 0.0f},
+  {-2.02524603e-11f, 1.79435860e-07f, -2.60561875e-04f, -1.41761141e-02f},
+  {-2.22463426e-13f, -1.55078698e-08f, 3.81675160e-04f, -7.30646033e-01f},
+  {6.72595954e-13f, -2.73059993e-08f, 4.24068546e-04f, -7.52204323e-01f},
+  };
 
   if (t >= 12000.0f) {
 return make_float3(0.826270103f, 0.994478524f, 1.56626022f);
diff --git a/intern/cycles/kernel/svm/svm_wavelength.h 
b/intern/cycles/kernel/svm/svm_wavelength.h
index fba8aa63d31..aa291fd2741 100644
--- a/intern/cycles/kernel/svm/svm_wavelength.h
+++ b/intern/cycles/kernel/svm/svm_wavelength.h
@@ -34,44 +34,44 @@ CCL_NAMESPACE_BEGIN
 
 /* Wavelength to RGB */
 
-// CIE colour matching functions xBar, yBar, and zBar for
-//   wavelengths from 380 through 780 nanometers, every 5
-//   na

[Bf-blender-cvs] [66c8a8ac245] sculpt-dev: Fix typo in last commit

2021-10-05 Thread Joseph Eagar
Commit: 66c8a8ac24526b23a13fd00b89bf6c490752913e
Author: Joseph Eagar
Date:   Tue Oct 5 18:52:23 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB66c8a8ac24526b23a13fd00b89bf6c490752913e

Fix typo in last commit

===

M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/editors/sculpt_paint/sculpt.c

===

diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c 
b/source/blender/blenkernel/intern/pbvh_bmesh.c
index b4a4cdb6488..a90e6df76c4 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -14,30 +14,30 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
- /** \file
-  * \ingroup bli
-  */
+/** \file
+ * \ingroup bli
+ */
 
-  /*
+/*
 
-  TODO:
+TODO:
 
-  Convergence improvements:
-  1. DONE: Limit number of edges processed per run.
-  2. DONE: Scale split steps by ratio of long to short edges to
- prevent runaway tesselation.
-  3. DONE: Detect and dissolve three and four valence vertices that are 
surrounded by
- all tris.
-  4. DONE: Use different (coarser) brush spacing for applying dyntopo
+Convergence improvements:
+1. DONE: Limit number of edges processed per run.
+2. DONE: Scale split steps by ratio of long to short edges to
+   prevent runaway tesselation.
+3. DONE: Detect and dissolve three and four valence vertices that are 
surrounded by
+   all tris.
+4. DONE: Use different (coarser) brush spacing for applying dyntopo
 
-  Drawing improvements:
-  4. PARTIAL DONE: Build and cache vertex index buffers, to reduce GPU 
bandwidth
+Drawing improvements:
+4. PARTIAL DONE: Build and cache vertex index buffers, to reduce GPU bandwidth
 
-  Topology rake:
-  5. DONE: Enable new curvature topology rake code and add to UI.
-  6. DONE: Add code to cache curvature data per vertex in a CD layer.
+Topology rake:
+5. DONE: Enable new curvature topology rake code and add to UI.
+6. DONE: Add code to cache curvature data per vertex in a CD layer.
 
-  */
+*/
 
 #include "MEM_guardedalloc.h"
 
@@ -74,11 +74,11 @@
 
 #include 
 
-static void _debugprint(const char *fmt,...)
+static void _debugprint(const char *fmt, ...)
 {
   va_list args;
-  va_start(args,fmt);
-  vprintf(fmt,args);
+  va_start(args, fmt);
+  vprintf(fmt, args);
   va_end(args);
 }
 
@@ -239,10 +239,10 @@ void pbvh_bmesh_pbvh_bmesh_check_nodes(PBVH *pbvh)
 
 /* Update node data after splitting */
 static void pbvh_bmesh_node_finalize(PBVH *pbvh,
-  const int node_index,
-  const int cd_vert_node_offset,
-  const int cd_face_node_offset,
-  bool add_orco)
+ const int node_index,
+ const int cd_vert_node_offset,
+ const int cd_face_node_offset,
+ bool add_orco)
 {
   PBVHNode *n = &pbvh->nodes[node_index];
   bool has_visible = false;
@@ -256,9 +256,9 @@ static void pbvh_bmesh_node_finalize(PBVH *pbvh,
   BB_reset(&n->vb);
   BMFace *f;
 
-  TGSET_ITER (f,n->bm_faces) {
+  TGSET_ITER (f, n->bm_faces) {
 /* Update ownership of faces */
-BM_ELEM_CD_SET_INT(f,cd_face_node_offset,node_index);
+BM_ELEM_CD_SET_INT(f, cd_face_node_offset, node_index);
 
 /* Update vertices */
 BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
@@ -266,58 +266,59 @@ static void pbvh_bmesh_node_finalize(PBVH *pbvh,
 
 do {
   BMVert *v = l_iter->v;
-  MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert,v);
-  MV_ADD_FLAG(mv,DYNVERT_NEED_BOUNDARY);
+  MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, v);
+  MV_ADD_FLAG(mv, DYNVERT_NEED_BOUNDARY);
 
-  if (!BLI_table_gset_haskey(n->bm_unique_verts,v)) {
-if (BM_ELEM_CD_GET_INT(v,cd_vert_node_offset) != DYNTOPO_NODE_NONE) {
-  BLI_table_gset_add(n->bm_other_verts,v);
-} else {
-  BLI_table_gset_insert(n->bm_unique_verts,v);
-  BM_ELEM_CD_SET_INT(v,cd_vert_node_offset,node_index);
+  if (!BLI_table_gset_haskey(n->bm_unique_verts, v)) {
+if (BM_ELEM_CD_GET_INT(v, cd_vert_node_offset) != DYNTOPO_NODE_NONE) {
+  BLI_table_gset_add(n->bm_other_verts, v);
+}
+else {
+  BLI_table_gset_insert(n->bm_unique_verts, v);
+  BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, node_index);
 }
   }
   /* Update node bounding box */
-  BB_expand(&n->vb,v->co);
+  BB_expand(&n->vb, v->co);
 } while ((l_iter = l_iter->next) != l_first);
 
-if (!BM_elem_flag_test(f,BM_ELEM_HIDDEN)) {
+if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
   has_visible = true;
 }
   }
   TGSET_ITER_END
 
-BLI_assert(n->vb.bmin[0] <= n->vb.bmax[0] && n->vb.bmin[1] <= 
n->vb.bmax[1] &&
-  n->vb.bmin[2] <= n->vb.bmax[2]);
+  BLI_assert(n->vb.bmin[0] <= n->vb.bmax[0] && n->vb.bmin[1] <= n->vb

[Bf-blender-cvs] [86ee4dc571e] sculpt-dev: Sculpt: Fix customdata_regen_active_refs

2021-10-05 Thread Joseph Eagar
Commit: 86ee4dc571ee838104a32cba0d41150a276d10d2
Author: Joseph Eagar
Date:   Tue Oct 5 18:38:29 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB86ee4dc571ee838104a32cba0d41150a276d10d2

Sculpt: Fix customdata_regen_active_refs

===

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/pbvh_bmesh.c
M   source/blender/bmesh/intern/bmesh_log.c

===

diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index acdfe117931..b9975d3dd5b 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -953,6 +953,7 @@ void BKE_pbvh_update_vert_boundary_grids(PBVH *pbvh,
  SculptVertRef vertex);
 
 void BKE_pbvh_set_mdyntopo_verts(PBVH *pbvh, struct MDynTopoVert 
*mdyntopoverts);
+
 #if 0
 #  include "DNA_meshdata_types.h"
 ATTR_NO_OPT static void MV_ADD_FLAG(MDynTopoVert *mv, int flag)
diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index e470251e496..2eed24b7139 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -74,7 +74,7 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *)NULL)->typemap) 
== CD_NUMTYPES, "siz
 
 static CLG_LogRef LOG = {"bke.customdata"};
 
-bool CustomData_layout_is_same(const CustomData *_a, const CustomData *_b)
+ATTR_NO_OPT bool CustomData_layout_is_same(const CustomData *_a, const 
CustomData *_b)
 {
   CustomData a = *_a;
   CustomData b = *_b;
@@ -2240,7 +2240,7 @@ void CustomData_update_typemap(CustomData *data)
   }
 }
 
-static void customdata_regen_active_refs(CustomData *data)
+void customdata_regen_active_refs(CustomData *data)
 {
   int i, j;
   bool changed = false;
@@ -2251,24 +2251,34 @@ static void customdata_regen_active_refs(CustomData 
*data)
 CustomDataLayer *base = data->layers + data->typemap[layer->type];
 int n = layer - base;
 
+if (layer == base) {
+  continue;
+}
+
 layer->active = n == base->active;
 layer->active_clone = n == base->active_clone;
 layer->active_mask = n == base->active_mask;
 layer->active_rnd = n == base->active_rnd;
   }
 
-  /* regenerate active refs */
-  for (i = 0; i < CD_NUMTYPES; i++) {
-if (data->typemap[i] != -1) {
-  CustomDataLayer *base = data->layers + data->typemap[i];
-
-  base->active = base->active_clone = base->active_mask = base->active_rnd 
= 0;
+  /* handle case of base layers being active */
+  for (int i = 0; i < CD_NUMTYPES; i++) {
+if (data->typemap[i] == -1) {
+  continue;
 }
+
+CustomDataLayer *base = data->layers + data->typemap[i];
+
+base->active = !base->active;
+base->active_mask = !base->active_mask;
+base->active_clone = !base->active_clone;
+base->active_rnd = !base->active_rnd;
   }
 
+  /* regenerate active refs */
   /* set active n in base layer for all types */
   for (i = 0; i < data->totlayer; i++) {
-CustomDataLayer *layer = &data->layers[i];
+CustomDataLayer *layer = data->layers + i;
 CustomDataLayer *base = data->layers + data->typemap[layer->type];
 
 int n = layer - base;
diff --git a/source/blender/blenkernel/intern/dyntopo.c 
b/source/blender/blenkernel/intern/dyntopo.c
index 6223a748028..bf37ecb12ec 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -1598,11 +1598,15 @@ static bool edge_queue_tri_in_sphere(const EdgeQueue 
*q, BMFace *f)
 #endif
 
   /* Check if triangle intersects the sphere */
+#if 1
   float dis = dist_to_tri_sphere_simple((float *)q->center,
 (float *)l->v->co,
 (float *)l->next->v->co,
 (float *)l->prev->v->co,
 (float *)f->no);
+#else
+  float dis = len_squared_v3v3(q->center, l->v->co);
+#endif
 
   return dis <= q->radius_squared;
 }
@@ -2593,14 +2597,14 @@ static void edge_queue_init(EdgeQueueContext *eq_ctx,
  *
  * The highest priority (lowest number) is given to the longest edge.
  */
-static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
-   PBVH *pbvh,
-   const float center[3],
-   const float view_normal[3],
-   float radius,
-   const bool use_frontface,
-   const bool use_projected,
-   const bool local_mode)
+ATTR_NO_OPT static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
+

[Bf-blender-cvs] [12ff7b4297d] sculpt-dev: Sculpt: fix problem with smooth brush defaults

2021-10-05 Thread Joseph Eagar
Commit: 12ff7b4297dbe1bb3dca0f18775009614348776a
Author: Joseph Eagar
Date:   Tue Oct 5 17:27:23 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB12ff7b4297dbe1bb3dca0f18775009614348776a

Sculpt: fix problem with smooth brush defaults

Also wrapped some mv->flag OR's in a
macro, that can be switched with a macro
for debugging.

===

M   source/blender/blenkernel/BKE_blender_version.h
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/paint.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_face_set.c
M   source/blender/editors/sculpt_paint/sculpt_undo.c

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 31ce1b124e9..ceb19e87b40 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 32
+#define BLENDER_FILE_SUBVERSION 33
 
 /* 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/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 69640117f48..acdfe117931 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -953,7 +953,19 @@ void BKE_pbvh_update_vert_boundary_grids(PBVH *pbvh,
  SculptVertRef vertex);
 
 void BKE_pbvh_set_mdyntopo_verts(PBVH *pbvh, struct MDynTopoVert 
*mdyntopoverts);
+#if 0
+#  include "DNA_meshdata_types.h"
+ATTR_NO_OPT static void MV_ADD_FLAG(MDynTopoVert *mv, int flag)
+{
+  if (flag & DYNVERT_NEED_BOUNDARY) {
+flag |= flag;
+  }
 
+  mv->flag |= flag;
+}
+#else
+#  define MV_ADD_FLAG(mv, flag1) (mv)->flag |= (flag1)
+#endif
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index c14615246a3..f32b4ae3f24 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -1244,6 +1244,7 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
 
   SHOWWRK(normal_radius_factor);
   SHOWWRK(hardness);
+  SHOWWRK(dyntopo_disabled);
 
   switch (tool) {
 case SCULPT_TOOL_INFLATE:
@@ -1263,6 +1264,7 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   SHOWWRK(smooth_deform_type);
   SHOWCTX(smooth_deform_type);
   SHOWWRK(projection);
+  SHOWCTX(dyntopo_disabled);
   break;
 case SCULPT_TOOL_SCRAPE:
 case SCULPT_TOOL_FILL:
@@ -1596,6 +1598,8 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
   BRUSHSET_SET_FLOAT(chset, spacing, 5.0f);
   BRUSHSET_SET_FLOAT(chset, strength, 0.3f);
 
+  BRUSHSET_SET_BOOL(chset, dyntopo_disabled, true);
+
   ADDCH(surface_smooth_shape_preservation);
   ADDCH(surface_smooth_current_vertex);
   ADDCH(surface_smooth_iterations);
diff --git a/source/blender/blenkernel/intern/dyntopo.c 
b/source/blender/blenkernel/intern/dyntopo.c
index 834652000a7..6223a748028 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -200,8 +200,9 @@ static void fix_mesh(PBVH *pbvh, BMesh *bm)
 v->e = NULL;
 MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, v);
 
-mv->flag |= DYNVERT_NEED_VALENCE | DYNVERT_NEED_BOUNDARY | 
DYNVERT_NEED_DISK_SORT |
-DYNVERT_NEED_TRIANGULATE;
+MV_ADD_FLAG(mv,
+DYNVERT_NEED_VALENCE | DYNVERT_NEED_BOUNDARY | 
DYNVERT_NEED_DISK_SORT |
+DYNVERT_NEED_TRIANGULATE);
   }
 
   BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
@@ -804,7 +805,7 @@ static BMVert *pbvh_bmesh_vert_create(PBVH *pbvh,
   BMVert *v = BM_vert_create(pbvh->bm, co, NULL, BM_CREATE_NOP);
   MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, v);
 
-  mv->flag |= DYNVERT_NEED_BOUNDARY | DYNVERT_NEED_DISK_SORT | 
DYNVERT_NEED_VALENCE;
+  MV_ADD_FLAG(mv, DYNVERT_NEED_BOUNDARY | DYNVERT_NEED_DISK_SORT | 
DYNVERT_NEED_VALENCE);
 
   if (v_example) {
 v->head.hflag = v_example->head.hflag;
@@ -925,7 +926,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *pbvh,
   }
 
   MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, l->v);
-  mv->flag |= DYNVERT_NEED_DISK_SORT | DYNVERT_NEED_BOUNDARY | 

[Bf-blender-cvs] [b93e9473065] master: Cleanup: rename BKE_font.h -> BKE_vfont.h

2021-10-05 Thread Campbell Barton
Commit: b93e947306517a5b6ab879aab35c8fdccff8887e
Author: Campbell Barton
Date:   Wed Oct 6 11:15:53 2021 +1100
Branches: master
https://developer.blender.org/rBb93e947306517a5b6ab879aab35c8fdccff8887e

Cleanup: rename BKE_font.h -> BKE_vfont.h

Match API naming prefix (BKE_vfont_*) and DNA_vfont_types.h.

===

R100source/blender/blenkernel/BKE_font.h
source/blender/blenkernel/BKE_vfont.h
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/blenkernel/intern/bpath.c
M   source/blender/blenkernel/intern/curve.c
M   source/blender/blenkernel/intern/curve_convert.c
M   source/blender/blenkernel/intern/displist.cc
M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/blenkernel/intern/material.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/blenkernel/intern/object_dupli.cc
M   source/blender/blenkernel/intern/packedFile.c
R099source/blender/blenkernel/intern/font.c 
source/blender/blenkernel/intern/vfont.c
M   source/blender/blenlib/BLI_string_utf8.h
M   source/blender/draw/engines/overlay/overlay_edit_text.c
M   source/blender/draw/intern/draw_cache_impl_curve.cc
M   source/blender/draw/intern/draw_manager_profiling.c
M   source/blender/editors/curve/editfont.c
M   source/blender/editors/curve/editfont_undo.c
M   source/blender/editors/object/object_add.c
M   source/blender/editors/render/render_shading.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/makesrna/intern/rna_ID.c
M   source/blender/makesrna/intern/rna_curve.c
M   source/blender/makesrna/intern/rna_main_api.c
M   source/blender/makesrna/intern/rna_object_api.c
M   source/blender/makesrna/intern/rna_vfont.c
M   source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
M   source/blender/windowmanager/intern/wm_init_exit.c
M   source/creator/creator.c

===

diff --git a/source/blender/blenkernel/BKE_font.h 
b/source/blender/blenkernel/BKE_vfont.h
similarity index 100%
rename from source/blender/blenkernel/BKE_font.h
rename to source/blender/blenkernel/BKE_vfont.h
diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index e727730770c..47c1d698360 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -143,7 +143,6 @@ set(SRC
   intern/fcurve_driver.c
   intern/fluid.c
   intern/fmodifier.c
-  intern/font.c
   intern/freestyle.c
   intern/geometry_component_curve.cc
   intern/geometry_component_instances.cc
@@ -289,6 +288,7 @@ set(SRC
   intern/tracking_util.c
   intern/undo_system.c
   intern/unit.c
+  intern/vfont.c
   intern/vfontdata_freetype.c
   intern/volume.cc
   intern/volume_render.cc
@@ -364,7 +364,6 @@ set(SRC
   BKE_fcurve.h
   BKE_fcurve_driver.h
   BKE_fluid.h
-  BKE_font.h
   BKE_freestyle.h
   BKE_geometry_set.h
   BKE_geometry_set.hh
@@ -457,6 +456,7 @@ set(SRC
   BKE_tracking.h
   BKE_undo_system.h
   BKE_unit.h
+  BKE_vfont.h
   BKE_vfontdata.h
   BKE_volume.h
   BKE_volume_render.h
diff --git a/source/blender/blenkernel/intern/bpath.c 
b/source/blender/blenkernel/intern/bpath.c
index 371ec14876b..07ac0086f0d 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -66,13 +66,13 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
-#include "BKE_font.h"
 #include "BKE_image.h"
 #include "BKE_lib_id.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
 #include "BKE_report.h"
+#include "BKE_vfont.h"
 
 #include "BKE_bpath.h" /* own include */
 
diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index 0dcfea78ca5..b0fc1426093 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -52,13 +52,13 @@
 #include "BKE_curve.h"
 #include "BKE_curveprofile.h"
 #include "BKE_displist.h"
-#include "BKE_font.h"
 #include "BKE_idtype.h"
 #include "BKE_key.h"
 #include "BKE_lib_id.h"
 #include "BKE_lib_query.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
+#include "BKE_vfont.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
diff --git a/source/blender/blenkernel/intern/curve_convert.c 
b/source/blender/blenkernel/intern/curve_convert.c
index 5bcce9c339e..98a9cbc2bcf 100644
--- a/source/blender/blenkernel/intern/curve_convert.c
+++ b/source/blender/blenkernel/intern/curve_convert.c
@@ -26,9 +26,9 @@
 
 #include "BKE_curve.h"
 #include "BKE_displist.h"
-#include "BKE_font.h"
 #include "BKE_lib_id.h"
 #include "BKE_modifier.h"
+#include "BKE_vfont.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
diff --git a/source/blender/blenkernel/intern/displist.cc 
b/source/blender/blenkernel/intern/displist.cc
index 0776f3b9a68..ebe00531e6

[Bf-blender-cvs] [fd592538d98] master: Cleanup: move BLI_vfontdata.h to BKE_vfontdata.h

2021-10-05 Thread Campbell Barton
Commit: fd592538d983bec51e331f1d073c39582d43520f
Author: Campbell Barton
Date:   Wed Oct 6 10:44:11 2021 +1100
Branches: master
https://developer.blender.org/rBfd592538d983bec51e331f1d073c39582d43520f

Cleanup: move BLI_vfontdata.h to BKE_vfontdata.h

This didn't belong on blenlib since it uses DNA data types
and included a bad-level call to BKE_curve.h.

It also meant linking in blenlib would depend on the freetype library,
noticeable for thumbnail extraction (see D6408).

===

R081source/blender/blenlib/BLI_vfontdata.h  
source/blender/blenkernel/BKE_vfontdata.h
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/blenkernel/intern/font.c
R096source/blender/blenlib/intern/freetypefont.c
source/blender/blenkernel/intern/vfontdata_freetype.c
M   source/blender/blenlib/CMakeLists.txt

===

diff --git a/source/blender/blenlib/BLI_vfontdata.h 
b/source/blender/blenkernel/BKE_vfontdata.h
similarity index 81%
rename from source/blender/blenlib/BLI_vfontdata.h
rename to source/blender/blenkernel/BKE_vfontdata.h
index 0bb32ca24b7..b162958f69d 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenkernel/BKE_vfontdata.h
@@ -20,7 +20,7 @@
 #pragma once
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  * \brief A structure to represent vector fonts,
  *   and to load them from PostScript fonts.
  */
@@ -49,11 +49,11 @@ typedef struct VChar {
   float width;
 } VChar;
 
-VFontData *BLI_vfontdata_from_freetypefont(struct PackedFile *pf);
-VFontData *BLI_vfontdata_copy(const VFontData *vfont_src, const int flag);
+VFontData *BKE_vfontdata_from_freetypefont(struct PackedFile *pf);
+VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int flag);
 
-VChar *BLI_vfontchar_from_freetypefont(struct VFont *vfont, unsigned long 
character);
-VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int flag);
+VChar *BKE_vfontdata_char_from_freetypefont(struct VFont *vfont, unsigned long 
character);
+VChar *BKE_vfontdata_char_copy(const VChar *vchar_src, const int flag);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index 37581ad5c00..e727730770c 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -60,6 +60,9 @@ set(INC
 
 set(INC_SYS
   ${ZLIB_INCLUDE_DIRS}
+
+  # For `vfontdata_freetype.c`.
+  ${FREETYPE_INCLUDE_DIRS}
 )
 
 set(SRC
@@ -286,6 +289,7 @@ set(SRC
   intern/tracking_util.c
   intern/undo_system.c
   intern/unit.c
+  intern/vfontdata_freetype.c
   intern/volume.cc
   intern/volume_render.cc
   intern/volume_to_mesh.cc
@@ -453,6 +457,7 @@ set(SRC
   BKE_tracking.h
   BKE_undo_system.h
   BKE_unit.h
+  BKE_vfontdata.h
   BKE_volume.h
   BKE_volume_render.h
   BKE_volume_to_mesh.hh
@@ -502,6 +507,9 @@ set(LIB
   bf_rna
   bf_shader_fx
   bf_simulation
+
+  # For `vfontdata_freetype.c`.
+  ${FREETYPE_LIBRARY}
 )
 
 if(WITH_BINRELOC)
diff --git a/source/blender/blenkernel/intern/font.c 
b/source/blender/blenkernel/intern/font.c
index 0e159418724..d749237971a 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -40,7 +40,6 @@
 #include "BLI_string_utf8.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
-#include "BLI_vfontdata.h"
 
 #include "BLT_translation.h"
 
@@ -57,6 +56,7 @@
 #include "BKE_lib_id.h"
 #include "BKE_main.h"
 #include "BKE_packedFile.h"
+#include "BKE_vfontdata.h"
 
 #include "BLO_read_write.h"
 
@@ -77,7 +77,7 @@ static void vfont_init_data(ID *id)
   if (pf) {
 VFontData *vfd;
 
-vfd = BLI_vfontdata_from_freetypefont(pf);
+vfd = BKE_vfontdata_from_freetypefont(pf);
 if (vfd) {
   vfont->data = vfd;
 
@@ -107,7 +107,7 @@ static void vfont_copy_data(Main *UNUSED(bmain),
   }
 
   if (vfont_dst->data) {
-vfont_dst->data = BLI_vfontdata_copy(vfont_dst->data, flag_subdata);
+vfont_dst->data = BKE_vfontdata_copy(vfont_dst->data, flag_subdata);
   }
 }
 
@@ -300,7 +300,7 @@ static VFontData *vfont_get_data(VFont *vfont)
 }
 
 if (pf) {
-  vfont->data = BLI_vfontdata_from_freetypefont(pf);
+  vfont->data = BKE_vfontdata_from_freetypefont(pf);
   if (pf != vfont->packedfile) {
 BKE_packedfile_free(pf);
   }
@@ -335,7 +335,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
   if (pf) {
 VFontData *vfd;
 
-vfd = BLI_vfontdata_from_freetypefont(pf);
+vfd = BKE_vfontdata_from_freetypefont(pf);
 if (vfd) {
   /* If there's a font name, use it for the ID name. */
   vfont = BKE_libblock_alloc(bmain, ID_VF, vfd->name[0] ? vfd->name : 
filename, 0);
@@ -954,7 +954,7 @@ static bool vfont_to_curve(Object *ob,
  * happen often once all the chars are load.
  */
 if ((che = find_vfont_char(vfd, ascii)) == NULL) {
-  che = B

[Bf-blender-cvs] [dcac86f4f11] master: Cleanup: remove unused flag argument

2021-10-05 Thread Campbell Barton
Commit: dcac86f4f11fb4e464a8f2dc3f2ef69eff4f4f21
Author: Campbell Barton
Date:   Wed Oct 6 10:54:30 2021 +1100
Branches: master
https://developer.blender.org/rBdcac86f4f11fb4e464a8f2dc3f2ef69eff4f4f21

Cleanup: remove unused flag argument

===

M   source/blender/blenkernel/BKE_vfontdata.h
M   source/blender/blenkernel/intern/vfontdata_freetype.c

===

diff --git a/source/blender/blenkernel/BKE_vfontdata.h 
b/source/blender/blenkernel/BKE_vfontdata.h
index b162958f69d..b6e57dad934 100644
--- a/source/blender/blenkernel/BKE_vfontdata.h
+++ b/source/blender/blenkernel/BKE_vfontdata.h
@@ -53,7 +53,7 @@ VFontData *BKE_vfontdata_from_freetypefont(struct PackedFile 
*pf);
 VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int flag);
 
 VChar *BKE_vfontdata_char_from_freetypefont(struct VFont *vfont, unsigned long 
character);
-VChar *BKE_vfontdata_char_copy(const VChar *vchar_src, const int flag);
+VChar *BKE_vfontdata_char_copy(const VChar *vchar_src);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/intern/vfontdata_freetype.c 
b/source/blender/blenkernel/intern/vfontdata_freetype.c
index bba6768017d..db9fdef75c0 100644
--- a/source/blender/blenkernel/intern/vfontdata_freetype.c
+++ b/source/blender/blenkernel/intern/vfontdata_freetype.c
@@ -427,7 +427,7 @@ VFontData *BKE_vfontdata_from_freetypefont(PackedFile *pf)
 
 static void *vfontdata_copy_characters_value_cb(const void *src)
 {
-  return BKE_vfontdata_char_copy(src, 0);
+  return BKE_vfontdata_char_copy(src);
 }
 
 VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int 
UNUSED(flag))
@@ -466,7 +466,7 @@ VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, 
unsigned long characte
   return che;
 }
 
-VChar *BKE_vfontdata_char_copy(const VChar *vchar_src, const int UNUSED(flag))
+VChar *BKE_vfontdata_char_copy(const VChar *vchar_src)
 {
   VChar *vchar_dst = MEM_dupallocN(vchar_src);

___
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] [3d4e14b7e19] sculpt-dev: Sculpt: various fixes

2021-10-05 Thread Joseph Eagar
Commit: 3d4e14b7e19d97f851be37e1c42c9c5a18245706
Author: Joseph Eagar
Date:   Tue Oct 5 16:50:37 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB3d4e14b7e19d97f851be37e1c42c9c5a18245706

Sculpt: various fixes

* Fixed very nasty customdata bug where
  if the first layer of a given type was
  CD_TEMPORARY, then on being stripped out
  of the customdata set the active references.

  I think I tracked down where this happened, but
  just to be safe I also wrote code to detect it and
  regenerate the active refs too.

* Fixed rotate brush.
* Fixed mesh filter crashing with automasking on.

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/bmesh/intern/bmesh_construct.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_mesh_convert.c
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_automasking.c
M   source/blender/editors/sculpt_paint/sculpt_face_set.c
M   source/blender/editors/sculpt_paint/sculpt_filter_mesh.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 a2d00aeff99..812bfc01517 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -65,8 +65,7 @@ class DynamicBrushCategoryPanel(Panel):
 if not ok:
 continue
 
-UnifiedPaintPanel.channel_unified(
-layout,
+UnifiedPaintPanel.channel_unified(layout,
 context,
 brush,
 ch.idname,
@@ -145,7 +144,8 @@ class DynamicPaintPanelGen:
 name = name2
 
 for cls in classes[:]:
-#print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name)  
# r, dir(cls.bl_rna)) #.name)
+#print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name) #
+#r, dir(cls.bl_rna)) #.name)
 
 if cls.bl_rna.identifier == name:
 try:
@@ -471,7 +471,8 @@ class UnifiedPaintPanel:
 row2.use_property_split = False
 row2.use_property_decorate = False
 
-# replicate pre-existing functionality of direction showing up as 
+/-  in the header
+# replicate pre-existing functionality of direction showing up as
+# +/- in the header
 row2.prop_enum(finalch, typeprop, "ADD", text="")
 row2.prop_enum(finalch, typeprop, "SUBTRACT", text="")
 pass
@@ -486,13 +487,15 @@ class UnifiedPaintPanel:
 row.prop(pressurech.mappings["PRESSURE"], "enabled", text="", 
icon="STYLUS_PRESSURE")
 
 # if ch.is_color:
-#UnifiedPaintPanel.prop_unified_color_picker(row, context, brush, 
prop_name)
+#UnifiedPaintPanel.prop_unified_color_picker(row, context, brush,
+#prop_name)
 
 # if pressure_name:
 #row.prop(brush, pressure_name, text="")
 
 # if unified_name and not header:
-## NOTE: We don't draw UnifiedPaintSettings in the header to 
reduce clutter. D5928#136281
+## NOTE: We don't draw UnifiedPaintSettings in the header to reduce
+#clutter.  D5928#136281
 #row.prop(ups, unified_name, text="", icon='BRUSHES_ALL')
 if not header:
 if ch.type == "BITMASK" and not toolsettings_only and ch == 
finalch:
@@ -551,8 +554,7 @@ class UnifiedPaintPanel:
 return row
 
 @staticmethod
-def prop_unified(
-layout,
+def prop_unified(layout,
 context,
 brush,
 prop_name,
@@ -562,8 +564,7 @@ class UnifiedPaintPanel:
 text=None,
 slider=False,
 header=False,
-expand=None
-):
+expand=None):
 """ Generalized way of adding brush options to the UI,
 along with their pen pressure setting and global toggle, if they 
exist. """
 
@@ -572,7 +573,9 @@ class UnifiedPaintPanel:
 prop_name = channel_name_map[prop_name]
 
 if prop_name in brush.channels:
-#def channel_unified(layout, context, brush, prop_name, 
icon='NONE', pressure=True, text=None, slider=False, header=False):
+#def channel_unified(layout, context, brush, prop_name,
+#icon='NONE', pressure=True, text=None, slider=

[Bf-blender-cvs] [6d2b486e431] master: Cleanup: spelling in comments

2021-10-05 Thread Campbell Barton
Commit: 6d2b486e431dae57536a5a7d9b64c62144754363
Author: Campbell Barton
Date:   Wed Oct 6 09:28:00 2021 +1100
Branches: master
https://developer.blender.org/rB6d2b486e431dae57536a5a7d9b64c62144754363

Cleanup: spelling in comments

===

M   intern/cycles/bvh/bvh_embree.cpp
M   intern/cycles/render/session.cpp
M   source/blender/blenkernel/BKE_image.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/draw/intern/draw_manager.h
M   source/blender/draw/intern/draw_texture_pool.cc
M   source/blender/editors/sculpt_paint/paint_image_proj.c
M   source/blender/imbuf/intern/anim_movie.c
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/xr/intern/wm_xr_intern.h

===

diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 20430cb164c..9250af419cb 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -249,7 +249,7 @@ static void rtc_filter_func_thick_curve(const 
RTCFilterFunctionNArguments *args)
   const RTCRay *ray = (RTCRay *)args->ray;
   RTCHit *hit = (RTCHit *)args->hit;
 
-  /* Always ignore backfacing intersections. */
+  /* Always ignore back-facing intersections. */
   if (dot(make_float3(ray->dir_x, ray->dir_y, ray->dir_z),
   make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z)) > 0.0f) {
 *args->valid = 0;
@@ -262,7 +262,7 @@ static void rtc_filter_occluded_func_thick_curve(const 
RTCFilterFunctionNArgumen
   const RTCRay *ray = (RTCRay *)args->ray;
   RTCHit *hit = (RTCHit *)args->hit;
 
-  /* Always ignore backfacing intersections. */
+  /* Always ignore back-facing intersections. */
   if (dot(make_float3(ray->dir_x, ray->dir_y, ray->dir_z),
   make_float3(hit->Ng_x, hit->Ng_y, hit->Ng_z)) > 0.0f) {
 *args->valid = 0;
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 8d2d950f661..a18c61599c2 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -157,7 +157,7 @@ void Session::run_main_render_loop()
   continue;
 }
 
-/* Stop rendering if error happenned during scene update or other step of 
preparing scene
+/* Stop rendering if error happened during scene update or other step of 
preparing scene
  * for render. */
 if (device->have_error()) {
   progress.set_error(device->error_message());
@@ -179,7 +179,7 @@ void Session::run_main_render_loop()
   /* update status and timing */
   update_status_time();
 
-  /* Stop rendering if error happenned during path tracing. */
+  /* Stop rendering if error happened during path tracing. */
   if (device->have_error()) {
 progress.set_error(device->error_message());
 break;
diff --git a/source/blender/blenkernel/BKE_image.h 
b/source/blender/blenkernel/BKE_image.h
index b62ad3ad24a..09463246e27 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -253,13 +253,13 @@ bool BKE_image_is_stereo(struct Image *ima);
 struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, 
struct Image *ima);
 void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);
 
-/* for multilayer images as well as for singlelayer */
+/* For multi-layer images as well as for single-layer. */
 bool BKE_image_is_openexr(struct Image *ima);
 
-/* for multiple slot render, call this before render */
+/* For multiple slot render, call this before render. */
 void BKE_image_backup_render(struct Scene *scene, struct Image *ima, bool 
free_current_slot);
 
-/* for singlelayer openexr saving */
+/* For single-layer OpenEXR saving */
 bool BKE_image_save_openexr_multiview(struct Image *ima,
   struct ImBuf *ibuf,
   const char *filepath,
@@ -285,22 +285,22 @@ void BKE_image_packfiles_from_mem(struct ReportList 
*reports,
   char *data,
   const size_t data_len);
 
-/* prints memory statistics for images */
+/* Prints memory statistics for images. */
 void BKE_image_print_memlist(struct Main *bmain);
 
-/* merge source into dest, and free source */
+/* Merge source into dest, and free source. */
 void BKE_image_merge(struct Main *bmain, struct Image *dest, struct Image 
*source);
 
-/* scale the image */
+/* Scale the image. */
 bool BKE_image_scale(struct Image *image, int width, int height);
 
-/* check if texture has alpha (depth=32) */
+/* Check if texture has alpha (depth=32). */
 bool BKE_image_has_alpha(struct Image *image);
 
-/* check if texture has gpu texture code */
+/* Check if texture has GPU texture code. */
 bool BKE_image_has_opengl_texture(struct Image *ima);
 
-/* get tile index for tiled image

[Bf-blender-cvs] [26dac33ce18] master: Cleanup: simplify ED_imbuf_sample_poll

2021-10-05 Thread Campbell Barton
Commit: 26dac33ce18f8a5655883b759d271da4a9b94982
Author: Campbell Barton
Date:   Wed Oct 6 09:29:09 2021 +1100
Branches: master
https://developer.blender.org/rB26dac33ce18f8a5655883b759d271da4a9b94982

Cleanup: simplify ED_imbuf_sample_poll

Access the space data directly from the area.

Also remove redundant NULL check.

===

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

===

diff --git a/source/blender/editors/util/ed_util_imbuf.c 
b/source/blender/editors/util/ed_util_imbuf.c
index fcbc0807893..d57640e16dc 100644
--- a/source/blender/editors/util/ed_util_imbuf.c
+++ b/source/blender/editors/util/ed_util_imbuf.c
@@ -535,37 +535,38 @@ void ED_imbuf_sample_cancel(bContext *C, wmOperator *op)
 
 bool ED_imbuf_sample_poll(bContext *C)
 {
-  ScrArea *sa = CTX_wm_area(C);
-
-  if (sa && sa->spacetype == SPACE_IMAGE) {
-SpaceImage *sima = CTX_wm_space_image(C);
-if (sima == NULL) {
-  return false;
-}
+  ScrArea *area = CTX_wm_area(C);
+  if (area == NULL) {
+return false;
+  }
 
-Object *obedit = CTX_data_edit_object(C);
-if (obedit) {
-  /* Disable when UV editing so it doesn't swallow all click events
-   * (use for setting cursor). */
-  if (ED_space_image_show_uvedit(sima, obedit)) {
+  switch (area->spacetype) {
+case SPACE_IMAGE: {
+  SpaceImage *sima = area->spacedata.first;
+  Object *obedit = CTX_data_edit_object(C);
+  if (obedit) {
+/* Disable when UV editing so it doesn't swallow all click events
+ * (use for setting cursor). */
+if (ED_space_image_show_uvedit(sima, obedit)) {
+  return false;
+}
+  }
+  else if (sima->mode != SI_MODE_VIEW) {
 return false;
   }
+  return true;
 }
-else if (sima->mode != SI_MODE_VIEW) {
-  return false;
-}
+case SPACE_SEQ: {
+  SpaceSeq *sseq = area->spacedata.first;
 
-return true;
-  }
-
-  if (sa && sa->spacetype == SPACE_SEQ) {
-SpaceSeq *sseq = CTX_wm_space_seq(C);
-
-if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
-  return false;
+  if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
+return false;
+  }
+  if (SEQ_editing_get(CTX_data_scene(C)) == NULL) {
+return false;
+  }
+  return true;
 }
-
-return sseq && SEQ_editing_get(CTX_data_scene(C)) != NULL;
   }
 
   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] [7b5835c793f] master: Fix: Add missing function node declaration for RGB and Float Curve nodes

2021-10-05 Thread Charlie Jolly
Commit: 7b5835c793fbc5459ad64be4e8c7ceabd45cd668
Author: Charlie Jolly
Date:   Tue Oct 5 22:38:41 2021 +0100
Branches: master
https://developer.blender.org/rB7b5835c793fbc5459ad64be4e8c7ceabd45cd668

Fix: Add missing function node declaration for RGB and Float Curve nodes

===

M   source/blender/nodes/shader/nodes/node_shader_curves.cc

===

diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc 
b/source/blender/nodes/shader/nodes/node_shader_curves.cc
index 8657d9e517d..875e6fa0c35 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc
@@ -174,6 +174,7 @@ namespace blender::nodes {
 
 static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b)
 {
+  b.is_function_node();
   
b.add_input("Fac").min(0.0f).max(1.0f).default_value(1.0f).subtype(PROP_FACTOR);
   b.add_input("Color").default_value({1.0f, 1.0f, 1.0f, 1.0f});
   b.add_output("Color");
@@ -350,6 +351,7 @@ namespace blender::nodes {
 
 static void sh_node_curve_float_declare(NodeDeclarationBuilder &b)
 {
+  b.is_function_node();
   
b.add_input("Factor").min(0.0f).max(1.0f).default_value(1.0f).subtype(PROP_FACTOR);
   b.add_input("Value").default_value(1.0f);
   b.add_output("Value");

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


[Bf-blender-cvs] [0b5b8d0beb5] sculpt-dev: Sculpt: disable freelist mesh id backend, trying to keep it disabled in builds until I've tested it a bit more.

2021-10-05 Thread Joseph Eagar
Commit: 0b5b8d0beb5dfa40fc95ae478dea8196d5ceeaae
Author: Joseph Eagar
Date:   Tue Oct 5 14:28:33 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB0b5b8d0beb5dfa40fc95ae478dea8196d5ceeaae

Sculpt: disable freelist mesh id backend,
trying to keep it disabled in builds
until I've tested it a bit more.

===

M   source/blender/bmesh/bmesh_class.h

===

diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 42c0bec06a7..7aec1ea0721 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -292,7 +292,7 @@ typedef struct BMFlagLayer {
 
 struct RangeTreeUInt;
 
-#define WITH_BM_ID_FREELIST
+//#define WITH_BM_ID_FREELIST
 
 typedef struct BMesh {
   int totvert, totedge, totloop, totface;

___
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] [727f5efa7bb] sculpt-dev: Add comment for last one-liner commit.

2021-10-05 Thread Joseph Eagar
Commit: 727f5efa7bb42d331630f5dde780b1679a64cc9b
Author: Joseph Eagar
Date:   Tue Oct 5 14:27:31 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB727f5efa7bb42d331630f5dde780b1679a64cc9b

Add comment for last one-liner commit.

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c 
b/source/blender/editors/sculpt_paint/sculpt_transform.c
index d09fad42290..b8697340bc3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_transform.c
+++ b/source/blender/editors/sculpt_paint/sculpt_transform.c
@@ -67,6 +67,7 @@ void ED_sculpt_init_transform(struct bContext *C, Object *ob)
   SculptSession *ss = ob->sculpt;
   Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
 
+  /* flag update of original data */
   ss->stroke_id++;
 
   copy_v3_v3(ss->init_pivot_pos, ss->pivot_pos);

___
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] [8082b19c10f] sculpt-dev: Sculpt: Fix transform sculpt tools

2021-10-05 Thread Joseph Eagar
Commit: 8082b19c10ffd1f7c2928d0e8c643c6351a87d69
Author: Joseph Eagar
Date:   Tue Oct 5 14:25:27 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB8082b19c10ffd1f7c2928d0e8c643c6351a87d69

Sculpt: Fix transform sculpt tools

===

M   source/blender/bmesh/bmesh_class.h
M   source/blender/editors/sculpt_paint/sculpt_transform.c

===

diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 7aec1ea0721..42c0bec06a7 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -292,7 +292,7 @@ typedef struct BMFlagLayer {
 
 struct RangeTreeUInt;
 
-//#define WITH_BM_ID_FREELIST
+#define WITH_BM_ID_FREELIST
 
 typedef struct BMesh {
   int totvert, totedge, totloop, totface;
diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c 
b/source/blender/editors/sculpt_paint/sculpt_transform.c
index 0c7009fbca7..d09fad42290 100644
--- a/source/blender/editors/sculpt_paint/sculpt_transform.c
+++ b/source/blender/editors/sculpt_paint/sculpt_transform.c
@@ -67,6 +67,8 @@ void ED_sculpt_init_transform(struct bContext *C, Object *ob)
   SculptSession *ss = ob->sculpt;
   Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
 
+  ss->stroke_id++;
+
   copy_v3_v3(ss->init_pivot_pos, ss->pivot_pos);
   copy_v4_v4(ss->init_pivot_rot, ss->pivot_rot);
   copy_v3_v3(ss->init_pivot_scale, ss->pivot_scale);

___
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] [47cbb9b1ac5] sculpt-dev: Sculpt: fix rotate brush

2021-10-05 Thread Joseph Eagar
Commit: 47cbb9b1ac5e78bdca4d03dd9d794df4fdfcc9af
Author: Joseph Eagar
Date:   Tue Oct 5 14:19:53 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB47cbb9b1ac5e78bdca4d03dd9d794df4fdfcc9af

Sculpt: fix rotate brush

===

M   source/blender/blenkernel/intern/brush_engine.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/bmesh/bmesh_class.h
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_array.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h

===

diff --git a/source/blender/blenkernel/intern/brush_engine.c 
b/source/blender/blenkernel/intern/brush_engine.c
index 2accea81659..3075e3a9758 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -1547,11 +1547,11 @@ void BKE_builtin_apply_hard_edge_mode(BrushChannelSet 
*chset, bool do_apply)
   }
 }
 
-ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
-BrushChannelSet *chset,
-BrushCommandList *cl,
-int tool,
-BrushMappingData *mapdata)
+void BKE_builtin_commandlist_create(Brush *brush,
+BrushChannelSet *chset,
+BrushCommandList *cl,
+int tool,
+BrushMappingData *mapdata)
 {
   BrushCommand *cmd;
   BrushChannel *ch;
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c 
b/source/blender/blenkernel/intern/pbvh_bmesh.c
index ce25fb8780c..bfaea1b9aee 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -5155,7 +5155,7 @@ void pbvh_bmesh_do_cache_test()
 }
 
 /* saves all bmesh references to internal indices, to be restored later */
-ATTR_NO_OPT void BKE_pbvh_bmesh_save_indices(PBVH *pbvh)
+void BKE_pbvh_bmesh_save_indices(PBVH *pbvh)
 {
   BM_mesh_elem_index_ensure(pbvh->bm, BM_VERT | BM_EDGE | BM_FACE);
 
@@ -5242,7 +5242,7 @@ ATTR_NO_OPT void BKE_pbvh_bmesh_save_indices(PBVH *pbvh)
 }
 
 /* restore bmesh references from previously indices saved by 
BKE_pbvh_bmesh_save_indices */
-ATTR_NO_OPT void BKE_pbvh_bmesh_from_saved_indices(PBVH *pbvh)
+void BKE_pbvh_bmesh_from_saved_indices(PBVH *pbvh)
 {
   BM_mesh_elem_table_ensure(pbvh->bm, BM_VERT | BM_EDGE | BM_FACE);
   BM_mesh_elem_index_ensure(pbvh->bm, BM_VERT | BM_EDGE | BM_FACE);
diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 42c0bec06a7..7aec1ea0721 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -292,7 +292,7 @@ typedef struct BMFlagLayer {
 
 struct RangeTreeUInt;
 
-#define WITH_BM_ID_FREELIST
+//#define WITH_BM_ID_FREELIST
 
 typedef struct BMesh {
   int totvert, totedge, totloop, totface;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 2f3e0d7b495..3047e10aa0e 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -322,6 +322,23 @@ float *SCULPT_vertex_origco_get(SculptSession *ss, 
SculptVertRef vertex)
   return NULL;
 }
 
+float *SCULPT_vertex_origno_get(SculptSession *ss, SculptVertRef vertex)
+{
+  switch (BKE_pbvh_type(ss->pbvh)) {
+case PBVH_BMESH: {
+  BMVert *v = (BMVert *)vertex.i;
+  return BKE_PBVH_DYNVERT(ss->cd_dyn_vert, v)->origno;
+}
+
+case PBVH_GRIDS:
+case PBVH_FACES: {
+  return ss->mdyntopo_verts[vertex.i].origno;
+}
+  }
+
+  return NULL;
+}
+
 const float *SCULPT_vertex_co_get(SculptSession *ss, SculptVertRef index)
 {
   if (ss->bm) {
@@ -3391,7 +3408,7 @@ static float calc_overlap(StrokeCache *cache, const char 
symm, const char axis,
 
   distsq = len_squared_v3v3(mirror, cache->true_location);
 
-  if (distsq <= 4.0f * (cache->radius_squared)) {
+  if (cache->radius > 0.0f && distsq <= 4.0f * (cache->radius_squared)) {
 return (2.0f * (cache->radius) - sqrtf(distsq)) / (2.0f * (cache->radius));
   }
   return 0.0f;
@@ -3432,7 +3449,9 @@ static float calc_symmetry_feather(Sculpt *sd, 
StrokeCache *cache)
 overlap += calc_radial_symmetry_feather(sd, cache, i, 'Y');
 overlap += calc_radial_symmetry_feather(sd, cache, i, 'Z');
   }
-  return 1.0f / overlap;
+
+  /* mathwise divice by zero is infinity, so use maximum value (1) in that 
case? */
+  return overlap != 0.0f ? 1.0f / overlap : 1.0f;
 }
 
 /*  */
@@ -4105,7 +4124,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
 }
 
 /* Test AABB against sphere. */
-ATTR_NO_OPT bool SCULPT_search_sphere_cb

[Bf-blender-cvs] [27d0062d495] temp-vert-normals-cleanup: The branch finally compiles and opens the startup file

2021-10-05 Thread Hans Goudey
Commit: 27d0062d49588d46e5d5228c9b22a21fe43b78c1
Author: Hans Goudey
Date:   Tue Oct 5 13:58:51 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rB27d0062d49588d46e5d5228c9b22a21fe43b78c1

The branch finally compiles and opens the startup file

===

M   source/blender/blenkernel/intern/mesh_normals.cc
M   source/blender/blenkernel/intern/subsurf_ccg.c
M   source/blender/blenloader/intern/versioning_300.c

===

diff --git a/source/blender/blenkernel/intern/mesh_normals.cc 
b/source/blender/blenkernel/intern/mesh_normals.cc
index 643ae607525..e04d3c56db6 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -264,8 +264,15 @@ void BKE_mesh_calc_normals_poly_and_vertex(MVert *mvert,
 /** \name Mesh Normal Calculation
  * \{ */
 
+/**
+ * \warning May still return null if the mesh is empty.
+ */
 const float (*BKE_mesh_ensure_vertex_normals(const Mesh *mesh))[3]
 {
+  if (mesh->totvert == 0) {
+return nullptr;
+  }
+
   if (!(mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL ||
 mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL)) {
 BLI_assert(CustomData_has_layer(&mesh->vdata, CD_NORMAL));
@@ -294,14 +301,22 @@ const float (*BKE_mesh_ensure_vertex_normals(const Mesh 
*mesh))[3]
me.totpoly},
   vert_normals);
 
-  BLI_assert(!(me.runtime.cd_dirty_vert & CD_MASK_NORMAL ||
-   mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL));
+  /* Clear the dirty flags, since the normals have been calculated. */
+  me.runtime.cd_dirty_vert &= ~CD_MASK_NORMAL;
+  me.runtime.cd_dirty_poly &= ~CD_MASK_NORMAL;
 
   return (const float(*)[3])vert_normals.data();
 }
 
+/**
+ * \warning May still return null if the mesh has no faces.
+ */
 const float (*BKE_mesh_ensure_face_normals(const Mesh *mesh))[3]
 {
+  if (mesh->totpoly == 0) {
+return nullptr;
+  }
+
   if (!(mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL)) {
 BLI_assert(CustomData_has_layer(&mesh->vdata, CD_NORMAL));
 return (const float(*)[3])CustomData_get_layer(&mesh->vdata, CD_NORMAL);
@@ -322,7 +337,9 @@ const float (*BKE_mesh_ensure_face_normals(const Mesh 
*mesh))[3]
   BKE_mesh_calc_normals_poly(
   me.mvert, me.totvert, me.mloop, me.totloop, me.mpoly, me.totpoly, 
poly_normals);
 
-  BLI_assert(!(mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL));
+  /* Clear the dirty flags, since the normals have been calculated. */
+  me.runtime.cd_dirty_poly &= ~CD_MASK_NORMAL;
+
   return poly_normals;
 }
 
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index 0c58c8e8a5a..4ad4870448b 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -804,17 +804,11 @@ static int ccgDM_getNumLoops(DerivedMesh *dm)
   return 4 * ccgSubSurf_getNumFinalFaces(ccgdm->ss);
 }
 
-static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
+static CCGElem *get_vertex_elem(CCGDerivedMesh *ccgdm, int vertNum)
 {
-  CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
   CCGSubSurf *ss = ccgdm->ss;
-  CCGElem *vd;
-  CCGKey key;
   int i;
 
-  CCG_key_top_level(&key, ss);
-  memset(mv, 0, sizeof(*mv));
-
   if ((vertNum < ccgdm->edgeMap[0].startVert) && (ccgSubSurf_getNumFaces(ss) > 
0)) {
 /* this vert comes from face data */
 int lastface = ccgSubSurf_getNumFaces(ss) - 1;
@@ -843,30 +837,24 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int 
vertNum, MVert *mv)
 
 offset = vertNum - ccgdm->faceMap[i].startVert;
 if (offset < 1) {
-  vd = ccgSubSurf_getFaceCenterData(f);
-  copy_v3_v3(mv->co, CCG_elem_co(&key, vd));
-  normal_float_to_short_v3(mv->no, CCG_elem_no(&key, vd));
+  return ccgSubSurf_getFaceCenterData(f);
 }
-else if (offset < gridSideEnd) {
+if (offset < gridSideEnd) {
   offset -= 1;
   grid = offset / gridSideVerts;
   x = offset % gridSideVerts + 1;
-  vd = ccgSubSurf_getFaceGridEdgeData(ss, f, grid, x);
-  copy_v3_v3(mv->co, CCG_elem_co(&key, vd));
-  normal_float_to_short_v3(mv->no, CCG_elem_no(&key, vd));
+  return ccgSubSurf_getFaceGridEdgeData(ss, f, grid, x);
 }
-else if (offset < gridInternalEnd) {
+if (offset < gridInternalEnd) {
   offset -= gridSideEnd;
   grid = offset / gridInternalVerts;
   offset %= gridInternalVerts;
   y = offset / gridSideVerts + 1;
   x = offset % gridSideVerts + 1;
-  vd = ccgSubSurf_getFaceGridData(ss, f, grid, x, y);
-  copy_v3_v3(mv->co, CCG_elem_co(&key, vd));
-  normal_float_to_short_v3(mv->no, CCG_elem_no(&key, vd));
+  return ccgSubSurf_getFaceGridData(ss, f, grid, x, y);
 }
   }
-  else if ((vertNum < ccgdm->vertMap[0].startVert) && 
(ccgSubSurf_getNumEdges(ss) > 0)) {
+  if ((vertNum < ccgdm->vertMap[0].startVert) && (ccgSu

[Bf-blender-cvs] [eba11da9b46] temp-vert-normals-cleanup: Merge branch 'master' into temp-vert-normals-cleanup

2021-10-05 Thread Hans Goudey
Commit: eba11da9b460aa076f2a88d5322cd5c2c748bdf0
Author: Hans Goudey
Date:   Tue Oct 5 13:17:23 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBeba11da9b460aa076f2a88d5322cd5c2c748bdf0

Merge branch 'master' into temp-vert-normals-cleanup

===



===



___
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] [432d5bc692e] master: Cleanup: Remove unused DerivedMesh functions

2021-10-05 Thread Hans Goudey
Commit: 432d5bc692e229430e09d429184958b2de18e504
Author: Hans Goudey
Date:   Tue Oct 5 13:16:50 2021 -0500
Branches: master
https://developer.blender.org/rB432d5bc692e229430e09d429184958b2de18e504

Cleanup: Remove unused DerivedMesh functions

The long term goal is completely removing DerivedMesh, and these
functions are making some refactoring of mesh normals (T91186) more
complicated. They are not used anywhere.

===

M   source/blender/blenkernel/BKE_DerivedMesh.h
M   source/blender/blenkernel/intern/cdderivedmesh.c
M   source/blender/blenkernel/intern/subsurf_ccg.c

===

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h 
b/source/blender/blenkernel/BKE_DerivedMesh.h
index e3954e134da..c95190d2c83 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -157,15 +157,6 @@ struct DerivedMesh {
   int (*getNumLoops)(DerivedMesh *dm);
   int (*getNumPolys)(DerivedMesh *dm);
 
-  /** Copy a single vert/edge/tessellated face from the derived mesh into
-   * `*r_{vert/edge/face}`. note that the current implementation
-   * of this function can be quite slow, iterating over all
-   * elements (editmesh)
-   */
-  void (*getVert)(DerivedMesh *dm, int index, struct MVert *r_vert);
-  void (*getEdge)(DerivedMesh *dm, int index, struct MEdge *r_edge);
-  void (*getTessFace)(DerivedMesh *dm, int index, struct MFace *r_face);
-
   /** Return a pointer to the entire array of verts/edges/face from the
* derived mesh. if such an array does not exist yet, it will be created,
* and freed on the next ->release(). consider using getVert/Edge/Face if
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c 
b/source/blender/blenkernel/intern/cdderivedmesh.c
index 039a971fe2c..c93d320787a 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -103,24 +103,6 @@ static int cdDM_getNumPolys(DerivedMesh *dm)
   return dm->numPolyData;
 }
 
-static void cdDM_getVert(DerivedMesh *dm, int index, MVert *r_vert)
-{
-  CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-  *r_vert = cddm->mvert[index];
-}
-
-static void cdDM_getEdge(DerivedMesh *dm, int index, MEdge *r_edge)
-{
-  CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-  *r_edge = cddm->medge[index];
-}
-
-static void cdDM_getTessFace(DerivedMesh *dm, int index, MFace *r_face)
-{
-  CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-  *r_face = cddm->mface[index];
-}
-
 static void cdDM_copyVertArray(DerivedMesh *dm, MVert *r_vert)
 {
   CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
@@ -231,10 +213,6 @@ static CDDerivedMesh *cdDM_create(const char *desc)
   dm->getNumLoops = cdDM_getNumLoops;
   dm->getNumPolys = cdDM_getNumPolys;
 
-  dm->getVert = cdDM_getVert;
-  dm->getEdge = cdDM_getEdge;
-  dm->getTessFace = cdDM_getTessFace;
-
   dm->copyVertArray = cdDM_copyVertArray;
   dm->copyEdgeArray = cdDM_copyEdgeArray;
   dm->copyTessFaceArray = cdDM_copyTessFaceArray;
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index a1b45c2ac7d..0c58c8e8a5a 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -912,141 +912,6 @@ static void ccgDM_getFinalVertNo(DerivedMesh *dm, int 
vertNum, float r_no[3])
   normal_short_to_float_v3(r_no, mvert.no);
 }
 
-static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
-{
-  CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
-  CCGSubSurf *ss = ccgdm->ss;
-  int i;
-
-  memset(med, 0, sizeof(*med));
-
-  if (edgeNum < ccgdm->edgeMap[0].startEdge) {
-/* this edge comes from face data */
-int lastface = ccgSubSurf_getNumFaces(ss) - 1;
-CCGFace *f;
-int x, y, grid /*, numVerts*/;
-int offset;
-int gridSize = ccgSubSurf_getGridSize(ss);
-int edgeSize = ccgSubSurf_getEdgeSize(ss);
-int gridSideEdges;
-int gridInternalEdges;
-
-i = 0;
-while (i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge) {
-  i++;
-}
-
-f = ccgdm->faceMap[i].face;
-/* numVerts = ccgSubSurf_getFaceNumVerts(f); */ /*UNUSED*/
-
-gridSideEdges = gridSize - 1;
-gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2;
-
-offset = edgeNum - ccgdm->faceMap[i].startEdge;
-grid = offset / (gridSideEdges + gridInternalEdges);
-offset %= (gridSideEdges + gridInternalEdges);
-
-if (offset < gridSideEdges) {
-  x = offset;
-  med->v1 = getFaceIndex(ss, f, grid, x, 0, edgeSize, gridSize);
-  med->v2 = getFaceIndex(ss, f, grid, x + 1, 0, edgeSize, gridSize);
-}
-else {
-  offset -= gridSideEdges;
-  x = (offset / 2) / gridSideEdges + 1;
-  y = (offset / 2) % gridSideEdges;
-  if (offset % 2 == 0) {
-med->v1 = getFaceIndex(ss, f, grid, x, y, edgeSize, gridSize);
-med-

[Bf-blender-cvs] [16e7a7b5b19] master: Cleanup: Clang tidy

2021-10-05 Thread Hans Goudey
Commit: 16e7a7b5b192fe19f271a28cfb55c1b19118ccb1
Author: Hans Goudey
Date:   Tue Oct 5 13:15:31 2021 -0500
Branches: master
https://developer.blender.org/rB16e7a7b5b192fe19f271a28cfb55c1b19118ccb1

Cleanup: Clang tidy

===

M   source/blender/draw/intern/draw_texture_pool.cc

===

diff --git a/source/blender/draw/intern/draw_texture_pool.cc 
b/source/blender/draw/intern/draw_texture_pool.cc
index 544a763ddb9..61697465784 100644
--- a/source/blender/draw/intern/draw_texture_pool.cc
+++ b/source/blender/draw/intern/draw_texture_pool.cc
@@ -28,10 +28,10 @@
 
 using namespace blender;
 
-typedef struct DRWTexturePoolHandle {
+struct DRWTexturePoolHandle {
   uint64_t users_bits;
   GPUTexture *texture;
-} DRWTexturePoolHandle;
+};
 
 struct DRWTexturePool {
   Vector users;

___
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] [ef631e2cb38] temp-vert-normals-cleanup: Merge branch 'master' into temp-vert-normals-cleanup

2021-10-05 Thread Hans Goudey
Commit: ef631e2cb388a6e1e7ce814f078ddd3649eb19e9
Author: Hans Goudey
Date:   Tue Oct 5 12:23:33 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBef631e2cb388a6e1e7ce814f078ddd3649eb19e9

Merge branch 'master' into temp-vert-normals-cleanup

===



===

diff --cc source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
index bcf39e646b7,5a2495afb9e..14e446b1114
--- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
@@@ -28,19 -28,70 +28,19 @@@ namespace blender::nodes 
  
  static void geo_node_input_normal_declare(NodeDeclarationBuilder &b)
  {
-   b.add_output("Normal");
+   b.add_output("Normal").field_source();
  }
  
 -static GVArrayPtr mesh_face_normals(const Mesh &mesh,
 -const Span verts,
 -const Span polys,
 -const Span loops,
 -const IndexMask mask)
 +static GVArrayPtr mesh_face_normals_gvarray(const Mesh &mesh)
  {
 -  /* Use existing normals to avoid unnecessarily recalculating them, if 
possible. */
 -  if (!(mesh.runtime.cd_dirty_poly & CD_MASK_NORMAL) &&
 -  CustomData_has_layer(&mesh.pdata, CD_NORMAL)) {
 -const void *data = CustomData_get_layer(&mesh.pdata, CD_NORMAL);
 -
 -return std::make_unique>(
 -Span((const float3 *)data, polys.size()));
 -  }
 -
 -  auto normal_fn = [verts, polys, loops](const int i) -> float3 {
 -float3 normal;
 -const MPoly &poly = polys[i];
 -BKE_mesh_calc_poly_normal(&poly, &loops[poly.loopstart], verts.data(), 
normal);
 -return normal;
 -  };
 -
 -  return std::make_unique<
 -  fn::GVArray_For_EmbeddedVArray>>(
 -  mask.min_array_size(), mask.min_array_size(), normal_fn);
 +  Span face_normals{(float3 *)BKE_mesh_ensure_face_normals(&mesh), 
mesh.totpoly};
 +  return std::make_unique(face_normals);
  }
  
 -static GVArrayPtr mesh_vertex_normals(const Mesh &mesh,
 -  const Span verts,
 -  const Span polys,
 -  const Span loops,
 -  const IndexMask mask)
 +static GVArrayPtr mesh_vert_normals_gvarray(const Mesh &mesh)
  {
 -  /* Use existing normals to avoid unnecessarily recalculating them, if 
possible. */
 -  if (!(mesh.runtime.cd_dirty_vert & CD_MASK_NORMAL) &&
 -  CustomData_has_layer(&mesh.vdata, CD_NORMAL)) {
 -const void *data = CustomData_get_layer(&mesh.pdata, CD_NORMAL);
 -
 -return std::make_unique>(
 -Span((const float3 *)data, mesh.totvert));
 -  }
 -
 -  /* If the normals are dirty, they must be recalculated for the output of 
this node's field
 -   * source. Ideally vertex normals could be calculated lazily on a const 
mesh, but that's not
 -   * possible at the moment, so we take ownership of the results. Sadly we 
must also create a copy
 -   * of MVert to use the mesh normals API. This can be improved by adding 
mutex-protected lazy
 -   * calculation of normals on meshes.
 -   *
 -   * Use mask.min_array_size() to avoid calculating a final chunk of data if 
possible. */
 -  Array temp_verts(verts);
 -  Array normals(verts.size()); /* Use full size for accumulation from 
faces. */
 -  BKE_mesh_calc_normals_poly_and_vertex(temp_verts.data(),
 -mask.min_array_size(),
 -loops.data(),
 -loops.size(),
 -polys.data(),
 -polys.size(),
 -nullptr,
 -(float(*)[3])normals.data());
 -
 -  return 
std::make_unique>>(std::move(normals));
 +  Span vert_normals{(float3 *)BKE_mesh_ensure_vertex_normals(&mesh), 
mesh.totvert};
 +  return std::make_unique(vert_normals);
  }
  
  static const GVArray *construct_mesh_normals_gvarray(const MeshComponent 
&mesh_component,
diff --cc source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
index 72f130d7fdb,059e6e8680c..61501be7aac
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
@@@ -527,9 -643,59 +643,58 @@@ static void calculate_cone_uvs(Mesh *me
  }
}
  
+   uv_attribute.save();
+ }
+ 
+ static Mesh *create_vertex_mesh()
+ {
+   /* Returns a mesh with a single vertex at the origin. */
+   Mesh *mesh = BKE_mesh_new_nomain(1, 0, 0, 0, 0);
+   copy_v3_fl3(mesh->mvert[0].co, 0.0f, 0.0f, 0.0f);
 -  const short up[3] = {0, 0, SHRT_MAX};
 -  copy_v3_v3_short(mesh->mvert[0].no, up);
 +  BKE_mesh_normals_tag_dirty(mesh);
+   return mesh;
+ }
  
-   calcu

[Bf-blender-cvs] [ebb81050c58] studio-sprite-fright: VSE: Free animation strip data if they are not visible

2021-10-05 Thread Sebastian Parborg
Commit: ebb81050c588bb39a3adf8664bc04f04382a02cb
Author: Sebastian Parborg
Date:   Tue Oct 5 18:49:45 2021 +0200
Branches: studio-sprite-fright
https://developer.blender.org/rBebb81050c588bb39a3adf8664bc04f04382a02cb

VSE: Free animation strip data if they are not visible

Previously we would only free animation strip data when doing final
renders. If not doing a final render or simply just playing back videos
in the VSE, we would not free decoders or non VSE cache data from the
strips.

This would lead to memory usage exploding in complex VSE scenes.

Now we instead use the dumb apporach of freeing everything that is not
currently visible.

===

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

===

diff --git a/source/blender/render/intern/pipeline.c 
b/source/blender/render/intern/pipeline.c
index 6c5f9a4ed4c..1685fab744a 100644
--- a/source/blender/render/intern/pipeline.c
+++ b/source/blender/render/intern/pipeline.c
@@ -1466,7 +1466,7 @@ static void do_render_full_pipeline(Render *re)
 
   /* ensure no images are in memory from previous animated sequences */
   BKE_image_all_free_anim_ibufs(re->main, re->r.cfra);
-  SEQ_relations_free_all_anim_ibufs(re->scene, re->r.cfra);
+  SEQ_cache_cleanup(re->scene);
 
   if (RE_engine_render(re, true)) {
 /* in this case external render overrides all */
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index 6c4502a3608..41fb640a407 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -69,6 +69,7 @@
 #include "SEQ_iterator.h"
 #include "SEQ_modifier.h"
 #include "SEQ_proxy.h"
+#include "SEQ_relations.h"
 #include "SEQ_render.h"
 #include "SEQ_sequencer.h"
 #include "SEQ_time.h"
@@ -1950,6 +1951,8 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, 
float timeline_frame,
   }
 
   seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame);
+  /* Make sure we only keep the `anim` data for strips that are in view. */
+  SEQ_relations_free_all_anim_ibufs(context->scene, timeline_frame);
 
   if (count && !out) {
 BLI_mutex_lock(&seq_render_mutex);
diff --git a/source/blender/sequencer/intern/strip_relations.c 
b/source/blender/sequencer/intern/strip_relations.c
index 46fdd2c3d14..6b0452b69d5 100644
--- a/source/blender/sequencer/intern/strip_relations.c
+++ b/source/blender/sequencer/intern/strip_relations.c
@@ -354,7 +354,6 @@ void SEQ_relations_update_changed_seq_and_deps(Scene *scene,
   }
 }
 
-/* Unused */
 static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int 
timeline_frame)
 {
   for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) {
@@ -367,7 +366,6 @@ static void sequencer_all_free_anim_ibufs(ListBase 
*seqbase, int timeline_frame)
   }
 }
 
-/* Unused */
 void SEQ_relations_free_all_anim_ibufs(Scene *scene, int timeline_frame)
 {
   Editing *ed = SEQ_editing_get(scene);
@@ -375,7 +373,6 @@ void SEQ_relations_free_all_anim_ibufs(Scene *scene, int 
timeline_frame)
 return;
   }
   sequencer_all_free_anim_ibufs(&ed->seqbase, timeline_frame);
-  SEQ_cache_cleanup(scene);
 }
 
 static Sequence *sequencer_check_scene_recursion(Scene *scene, ListBase 
*seqbase)

___
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] [0a1a173e57d] master: Cleanup: Make anim_getnew in the VSE less confusing

2021-10-05 Thread Sebastian Parborg
Commit: 0a1a173e57d0f9e797dbb4972adda2993fccd6d7
Author: Sebastian Parborg
Date:   Tue Oct 5 18:45:47 2021 +0200
Branches: master
https://developer.blender.org/rB0a1a173e57d0f9e797dbb4972adda2993fccd6d7

Cleanup: Make anim_getnew in the VSE less confusing

It was using dummy image buffers to indicate if an animation container
could be initialized or not.

Use booleans instead.

===

M   source/blender/imbuf/intern/anim_movie.c

===

diff --git a/source/blender/imbuf/intern/anim_movie.c 
b/source/blender/imbuf/intern/anim_movie.c
index 13f9356751e..4eb078113dd 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1496,16 +1496,15 @@ static void free_anim_ffmpeg(struct anim *anim)
 
 #endif
 
-/* Try next picture to read */
-/* No picture, try to open next animation */
-/* Succeed, remove first image from animation */
+/* Try to init the anim struct.
+ * Returns true on success.*/
 
-static ImBuf *anim_getnew(struct anim *anim)
+static bool anim_getnew(struct anim *anim)
 {
-  struct ImBuf *ibuf = NULL;
-
+  BLI_assert(anim->curtype == ANIM_NONE);
   if (anim == NULL) {
-return NULL;
+/* Nothing to init. */
+return false;
   }
 
   free_anim_movie(anim);
@@ -1518,44 +1517,43 @@ static ImBuf *anim_getnew(struct anim *anim)
   free_anim_ffmpeg(anim);
 #endif
 
-  if (anim->curtype != 0) {
-return NULL;
-  }
   anim->curtype = imb_get_anim_type(anim->name);
 
   switch (anim->curtype) {
-case ANIM_SEQUENCE:
-  ibuf = IMB_loadiffname(anim->name, anim->ib_flags, anim->colorspace);
+case ANIM_SEQUENCE: {
+  ImBuf *ibuf = IMB_loadiffname(anim->name, anim->ib_flags, 
anim->colorspace);
   if (ibuf) {
 BLI_strncpy(anim->first, anim->name, sizeof(anim->first));
 anim->duration_in_frames = 1;
+IMB_freeImBuf(ibuf);
+  }
+  else {
+return false;
   }
   break;
+}
 case ANIM_MOVIE:
   if (startmovie(anim)) {
-return NULL;
+return false;
   }
-  ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0); /* fake */
   break;
 #ifdef WITH_AVI
 case ANIM_AVI:
   if (startavi(anim)) {
 printf("couldn't start avi\n");
-return NULL;
+return false;
   }
-  ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0);
   break;
 #endif
 #ifdef WITH_FFMPEG
 case ANIM_FFMPEG:
   if (startffmpeg(anim)) {
-return 0;
+return false;
   }
-  ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0);
   break;
 #endif
   }
-  return ibuf;
+  return true;
 }
 
 struct ImBuf *IMB_anim_previewframe(struct anim *anim)
@@ -1589,14 +1587,10 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
   filter_y = (anim->ib_flags & IB_animdeinterlace);
 
   if (preview_size == IMB_PROXY_NONE) {
-if (anim->curtype == 0) {
-  ibuf = anim_getnew(anim);
-  if (ibuf == NULL) {
+if (anim->curtype == ANIM_NONE) {
+  if (!anim_getnew(anim)) {
 return NULL;
   }
-
-  IMB_freeImBuf(ibuf); /*  */
-  ibuf = NULL;
 }
 
 if (position < 0) {

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


[Bf-blender-cvs] [88c02bf826d] master: VSE: Free animation strip data if they are not visible

2021-10-05 Thread Sebastian Parborg
Commit: 88c02bf826df371be89af326515a3216fb449673
Author: Sebastian Parborg
Date:   Tue Oct 5 18:49:45 2021 +0200
Branches: master
https://developer.blender.org/rB88c02bf826df371be89af326515a3216fb449673

VSE: Free animation strip data if they are not visible

Previously we would only free animation strip data when doing final
renders. If not doing a final render or simply just playing back videos
in the VSE, we would not free decoders or non VSE cache data from the
strips.

This would lead to memory usage exploding in complex VSE scenes.

Now we instead use the dumb apporach of freeing everything that is not
currently visible.

===

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

===

diff --git a/source/blender/render/intern/pipeline.c 
b/source/blender/render/intern/pipeline.c
index 7c5259a1c5c..1bf0dfe079c 100644
--- a/source/blender/render/intern/pipeline.c
+++ b/source/blender/render/intern/pipeline.c
@@ -1440,7 +1440,7 @@ static void do_render_full_pipeline(Render *re)
 
   /* ensure no images are in memory from previous animated sequences */
   BKE_image_all_free_anim_ibufs(re->main, re->r.cfra);
-  SEQ_relations_free_all_anim_ibufs(re->scene, re->r.cfra);
+  SEQ_cache_cleanup(re->scene);
 
   if (RE_engine_render(re, true)) {
 /* in this case external render overrides all */
diff --git a/source/blender/sequencer/intern/render.c 
b/source/blender/sequencer/intern/render.c
index cf3f9d5cba5..6b233cd20fb 100644
--- a/source/blender/sequencer/intern/render.c
+++ b/source/blender/sequencer/intern/render.c
@@ -69,6 +69,7 @@
 #include "SEQ_iterator.h"
 #include "SEQ_modifier.h"
 #include "SEQ_proxy.h"
+#include "SEQ_relations.h"
 #include "SEQ_render.h"
 #include "SEQ_sequencer.h"
 #include "SEQ_time.h"
@@ -1882,6 +1883,8 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, 
float timeline_frame,
   }
 
   seq_cache_free_temp_cache(context->scene, context->task_id, timeline_frame);
+  /* Make sure we only keep the `anim` data for strips that are in view. */
+  SEQ_relations_free_all_anim_ibufs(context->scene, timeline_frame);
 
   if (count && !out) {
 BLI_mutex_lock(&seq_render_mutex);
diff --git a/source/blender/sequencer/intern/strip_relations.c 
b/source/blender/sequencer/intern/strip_relations.c
index 9822bfe38f9..444d3581b3d 100644
--- a/source/blender/sequencer/intern/strip_relations.c
+++ b/source/blender/sequencer/intern/strip_relations.c
@@ -354,7 +354,6 @@ void SEQ_relations_update_changed_seq_and_deps(Scene *scene,
   }
 }
 
-/* Unused */
 static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int 
timeline_frame)
 {
   for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) {
@@ -367,7 +366,6 @@ static void sequencer_all_free_anim_ibufs(ListBase 
*seqbase, int timeline_frame)
   }
 }
 
-/* Unused */
 void SEQ_relations_free_all_anim_ibufs(Scene *scene, int timeline_frame)
 {
   Editing *ed = SEQ_editing_get(scene);
@@ -375,7 +373,6 @@ void SEQ_relations_free_all_anim_ibufs(Scene *scene, int 
timeline_frame)
 return;
   }
   sequencer_all_free_anim_ibufs(&ed->seqbase, timeline_frame);
-  SEQ_cache_cleanup(scene);
 }
 
 static Sequence *sequencer_check_scene_recursion(Scene *scene, ListBase 
*seqbase)

___
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] [6eefcd7d783] master: GPencil: Remove unused spacetype check in Paint operator

2021-10-05 Thread Antonio Vazquez
Commit: 6eefcd7d78389fbcb92f6d482024224ceea5d1fa
Author: Antonio Vazquez
Date:   Tue Oct 5 17:09:44 2021 +0200
Branches: master
https://developer.blender.org/rB6eefcd7d78389fbcb92f6d482024224ceea5d1fa

GPencil: Remove unused spacetype check in Paint operator

The Paint operator only works in SPACE_VIEW3D and this is checked in the poll 
mtehod, so it's not logic check again.

These checkings were part of the old grease pencil but it was not removed.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index ffc50a86fc6..2aa4b3b3282 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -869,7 +869,7 @@ static short gpencil_stroke_addpoint(tGPsdata *p,
 pt->time = (float)(curtime - p->inittime);
 
 /* point uv (only 3d view) */
-if ((p->area->spacetype == SPACE_VIEW3D) && (gpd->runtime.sbuffer_used > 
0)) {
+if (gpd->runtime.sbuffer_used > 0) {
   tGPspoint *ptb = (tGPspoint *)gpd->runtime.sbuffer + 
gpd->runtime.sbuffer_used - 1;
   bGPDspoint spt, spt2;
 
@@ -1335,8 +1335,7 @@ static bool gpencil_stroke_eraser_is_occluded(
 gp_settings = eraser->gpencil_settings;
   }
 
-  if ((gp_settings != NULL) && (p->area->spacetype == SPACE_VIEW3D) &&
-  (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
+  if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
 RegionView3D *rv3d = p->region->regiondata;
 
 const int mval_i[2] = {x, y};
@@ -1729,12 +1728,10 @@ static void gpencil_stroke_doeraser(tGPsdata *p)
   rect.xmax = p->mval[0] + calc_radius;
   rect.ymax = p->mval[1] + calc_radius;
 
-  if (p->area->spacetype == SPACE_VIEW3D) {
-if ((gp_settings != NULL) && (gp_settings->flag & 
GP_BRUSH_OCCLUDE_ERASER)) {
-  View3D *v3d = p->area->spacedata.first;
-  view3d_region_operator_needs_opengl(p->win, p->region);
-  ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, 
V3D_DEPTH_NO_GPENCIL, NULL);
-}
+  if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
+View3D *v3d = p->area->spacedata.first;
+view3d_region_operator_needs_opengl(p->win, p->region);
+ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, 
V3D_DEPTH_NO_GPENCIL, NULL);
   }
 
   /* loop over all layers too, since while it's easy to restrict editing to
@@ -1961,47 +1958,34 @@ static bool gpencil_session_initdata(bContext *C, 
wmOperator *op, tGPsdata *p)
   unit_m4(p->imat);
   unit_m4(p->mat);
 
-  switch (curarea->spacetype) {
-/* supported views first */
-case SPACE_VIEW3D: {
-  /* set current area
-   * - must verify that region data is 3D-view (and not something else)
-   */
-  /* CAUTION: If this is the "toolbar", then this will change on the first 
stroke */
-  p->area = curarea;
-  p->region = region;
-  p->align_flag = &ts->gpencil_v3d_align;
-
-  if (region->regiondata == NULL) {
-p->status = GP_STATUS_ERROR;
-return 0;
-  }
-
-  if ((!obact) || (obact->type != OB_GPENCIL)) {
-View3D *v3d = p->area->spacedata.first;
-/* if active object doesn't exist or isn't a GP Object, create one */
-const float *cur = p->scene->cursor.location;
+  /* set current area
+   * - must verify that region data is 3D-view (and not something else)
+   */
+  /* CAUTION: If this is the "toolbar", then this will change on the first 
stroke */
+  p->area = curarea;
+  p->region = region;
+  p->align_flag = &ts->gpencil_v3d_align;
 
-ushort local_view_bits = 0;
-if (v3d->localvd) {
-  local_view_bits = v3d->local_view_uuid;
-}
-/* create new default object */
-obact = ED_gpencil_add_object(C, cur, local_view_bits);
-  }
-  /* assign object after all checks to be sure we have one active */
-  p->ob = obact;
-  p->ob_eval = (Object *)DEG_get_evaluated_object(p->depsgraph, p->ob);
+  if (region->regiondata == NULL) {
+p->status = GP_STATUS_ERROR;
+return 0;
+  }
 
-  break;
-}
+  if ((!obact) || (obact->type != OB_GPENCIL)) {
+View3D *v3d = p->area->spacedata.first;
+/* if active object doesn't exist or isn't a GP Object, create one */
+const float *cur = p->scene->cursor.location;
 
-/* unsupported views */
-default: {
-  p->status = GP_STATUS_ERROR;
-  return 0;
+ushort local_view_bits = 0;
+if (v3d->localvd) {
+  local_view_bits = v3d->local_view_uuid;
 }
+/* create new default object */
+obact = ED_gpencil_add_object(C, cur, local_view_bits);
   }
+  /* assign object after all checks to be sure we have one active */
+  p->ob = obact;
+  p->ob_eval = (Object *)DEG_get_evaluated_object(p->depsgraph, p->ob);
 
   /*

[Bf-blender-cvs] [11be9edae26] master: Fix missing proper 'make local' call for liboverrides from outliner.

2021-10-05 Thread Bastien Montagne
Commit: 11be9edae263194d0ce4fa0d43ad44f04db9a491
Author: Bastien Montagne
Date:   Tue Oct 5 17:04:35 2021 +0200
Branches: master
https://developer.blender.org/rB11be9edae263194d0ce4fa0d43ad44f04db9a491

Fix missing proper 'make local' call for liboverrides from outliner.

Also includes minor improvements to
`BKE_lib_override_library_make_local` itself.

This is a complement to rB37458798fa02c.

===

M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/editors/space_outliner/outliner_tools.c

===

diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 68675e5fc91..59e431b737c 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -1918,6 +1918,16 @@ void BKE_lib_override_library_delete(Main *bmain, ID 
*id_root)
  */
 void BKE_lib_override_library_make_local(ID *id)
 {
+ if (!ID_IS_OVERRIDE_LIBRARY(id)) {
+return;
+  }
+  if (ID_IS_OVERRIDE_LIBRARY_VIRTUAL(id)) {
+/* We should never directly 'make local' virtual overrides (aka shape 
keys). */
+BLI_assert_unreachable();
+id->flag &= ~LIB_EMBEDDED_DATA_LIB_OVERRIDE;
+return;
+  }
+
   BKE_lib_override_library_free(&id->override_library, true);
 
   Key *shape_key = BKE_key_from_id(id);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c 
b/source/blender/editors/space_outliner/outliner_tools.c
index 9e314701719..75bdc5dbac6 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -742,7 +742,7 @@ static void id_local_fn(bContext *C,
 }
   }
   else if (ID_IS_OVERRIDE_LIBRARY_REAL(tselem->id)) {
-BKE_lib_override_library_free(&tselem->id->override_library, true);
+BKE_lib_override_library_make_local(tselem->id);
   }
 }

___
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] [fe58ba2ade6] temp-eevee-gpencil-rewrite: New property to define render engine for grease pencil

2021-10-05 Thread Antonio Vazquez
Commit: fe58ba2ade6509546eeb7146f2f02727c4636da9
Author: Antonio Vazquez
Date:   Tue Oct 5 16:25:13 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rBfe58ba2ade6509546eeb7146f2f02727c4636da9

New property to define render engine for grease pencil

===

M   release/scripts/startup/bl_ui/properties_material.py
M   release/scripts/startup/bl_ui/properties_material_gpencil.py
M   release/scripts/startup/bl_ui/properties_object.py
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/render/render_shading.c
M   source/blender/makesdna/DNA_object_types.h
M   source/blender/makesrna/intern/rna_object.c

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index 1c7f3639f0a..a32f3ed4042 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -93,8 +93,9 @@ class 
EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
 ob = context.object
 mat = context.material
 
-if (ob and ob.type == 'GPENCIL') or (mat and mat.grease_pencil):
-return False
+if (ob and ob.type == 'GPENCIL' and ob.use_grease_pencil_scene_engine 
is False):
+if 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 9d099ff2231..170593cd727 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -97,6 +97,11 @@ 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
 
@@ -112,6 +117,9 @@ 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')
 
diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index 81a641a20cf..85b6263cc5b 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -405,8 +405,13 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
 
 if context.object.type == 'GPENCIL':
 col = layout.column(heading="Grease Pencil")
-col.prop(ob, "use_grease_pencil_lights", toggle=False)
+subcol = layout.column()
+subcol.prop(ob, "use_grease_pencil_lights", toggle=False)
+subcol.active = not ob.use_grease_pencil_scene_engine
 
+subcol = layout.column()
+subcol.prop(ob, "use_grease_pencil_scene_engine", toggle=False)
+subcol.active = context.scene.render.engine == 'BLENDER_EEVEE'
 layout.separator()
 col = layout.column(heading="Mask")
 col.prop(ob, "is_holdout")
diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 8811a9febb9..7cbc74be7e7 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -696,6 +696,7 @@ bool DRW_object_is_in_edit_mode(const struct Object *ob);
 int DRW_object_visibility_in_active_context(const struct Object *ob);
 bool DRW_object_is_flat_normal(const struct Object *ob);
 bool DRW_object_use_hide_faces(const struct Object *ob);
+bool DRW_object_use_gpencil_engine(const struct Object *ob);
 
 bool DRW_object_is_visible_psys_in_active_context(const struct Object *object,
   const struct ParticleSystem 
*psys);
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 5ae0351cdd3..4f5c7fa054a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -271,6 +271,17 @@ bool DRW_object_use_hide_faces(const struct Object *ob)
   return false;
 }
 
+bool DRW_object_use_gpencil_engine(const struct Object *ob)
+{
+  BLI_assert((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0);
+
+  if (ob->type == OB_GPENCIL) {
+return (ob->dtx & OB_USE_GP

[Bf-blender-cvs] [95210568b75] temp-eevee-gpencil-rewrite: Merge branch 'temp-eevee-gpencil-rewrite' of ssh://git.blender.org/blender into temp-eevee-gpencil-rewrite

2021-10-05 Thread Antonio Vazquez
Commit: 95210568b750cd96befdb658edc4710b460b591f
Author: Antonio Vazquez
Date:   Tue Oct 5 16:51:50 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB95210568b750cd96befdb658edc4710b460b591f

Merge branch 'temp-eevee-gpencil-rewrite' of ssh://git.blender.org/blender 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] [c11585a82f9] master: Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW

2021-10-05 Thread Patrick Mours
Commit: c11585a82f97e51c01c4f4f309b85bdf7602ca08
Author: Patrick Mours
Date:   Tue Oct 5 16:36:33 2021 +0200
Branches: master
https://developer.blender.org/rBc11585a82f97e51c01c4f4f309b85bdf7602ca08

Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW

This is required for Cycles to report a meaningful error message when it fails 
to load a PTX module
created with a newer CUDA toolkit version than the driver supports.

Ref T91879

===

M   extern/cuew/include/cuew.h
M   extern/cuew/src/cuew.c

===

diff --git a/extern/cuew/include/cuew.h b/extern/cuew/include/cuew.h
index a2142b8f2ba..5979f48e43d 100644
--- a/extern/cuew/include/cuew.h
+++ b/extern/cuew/include/cuew.h
@@ -609,6 +609,7 @@ typedef enum cudaError_enum {
   CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
   CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
   CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
+  CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
   CUDA_ERROR_INVALID_SOURCE = 300,
   CUDA_ERROR_FILE_NOT_FOUND = 301,
   CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
diff --git a/extern/cuew/src/cuew.c b/extern/cuew/src/cuew.c
index 7a1b0018a24..9eba9306323 100644
--- a/extern/cuew/src/cuew.c
+++ b/extern/cuew/src/cuew.c
@@ -736,6 +736,7 @@ const char *cuewErrorString(CUresult result) {
 case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics 
context";
 case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable";
 case CUDA_ERROR_JIT_COMPILER_NOT_FOUND: return "Jit compiler not found";
+case CUDA_ERROR_UNSUPPORTED_PTX_VERSION: return "Unsupported PTX version";
 case CUDA_ERROR_INVALID_SOURCE: return "Invalid source";
 case CUDA_ERROR_FILE_NOT_FOUND: return "File not found";
 case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared 
object failed to resolve";

___
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] [6e268a749fe] master: Fix adaptive sampling artifacts on tile boundaries

2021-10-05 Thread Sergey Sharybin
Commit: 6e268a749fee16b442bcb3fba6cb6e08850d8389
Author: Sergey Sharybin
Date:   Tue Sep 21 17:03:22 2021 +0200
Branches: master
https://developer.blender.org/rB6e268a749fee16b442bcb3fba6cb6e08850d8389

Fix adaptive sampling artifacts on tile boundaries

Implement an overscan support for tiles, so that adaptive sampling can
rely on the pixels neighbourhood.

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

===

M   intern/cycles/blender/blender_camera.cpp
M   intern/cycles/device/optix/device_impl.cpp
M   intern/cycles/integrator/denoiser_oidn.cpp
M   intern/cycles/integrator/pass_accessor_cpu.cpp
M   intern/cycles/integrator/pass_accessor_gpu.cpp
M   intern/cycles/integrator/path_trace.cpp
M   intern/cycles/integrator/path_trace_work.cpp
M   intern/cycles/integrator/path_trace_work_gpu.cpp
M   intern/cycles/kernel/device/gpu/kernel.h
M   intern/cycles/render/buffers.cpp
M   intern/cycles/render/buffers.h
M   intern/cycles/render/session.cpp
M   intern/cycles/render/tile.cpp
M   intern/cycles/render/tile.h

===

diff --git a/intern/cycles/blender/blender_camera.cpp 
b/intern/cycles/blender/blender_camera.cpp
index 4e8df5a99a6..93f19b73f53 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -927,6 +927,9 @@ BufferParams BlenderSync::get_buffer_params(
 params.height = height;
   }
 
+  params.window_width = params.width;
+  params.window_height = params.height;
+
   return params;
 }
 
diff --git a/intern/cycles/device/optix/device_impl.cpp 
b/intern/cycles/device/optix/device_impl.cpp
index 49d4e22143f..f9a15553aa9 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -768,7 +768,13 @@ void OptiXDevice::denoise_color_read(DenoiseContext 
&context, const DenoisePass
   destination.num_components = 3;
   destination.pixel_stride = context.buffer_params.pass_stride;
 
-  pass_accessor.get_render_tile_pixels(context.render_buffers, 
context.buffer_params, destination);
+  BufferParams buffer_params = context.buffer_params;
+  buffer_params.window_x = 0;
+  buffer_params.window_y = 0;
+  buffer_params.window_width = buffer_params.width;
+  buffer_params.window_height = buffer_params.height;
+
+  pass_accessor.get_render_tile_pixels(context.render_buffers, buffer_params, 
destination);
 }
 
 bool OptiXDevice::denoise_filter_color_preprocess(DenoiseContext &context, 
const DenoisePass &pass)
diff --git a/intern/cycles/integrator/denoiser_oidn.cpp 
b/intern/cycles/integrator/denoiser_oidn.cpp
index 7fc2b2b1892..ee3b62668a7 100644
--- a/intern/cycles/integrator/denoiser_oidn.cpp
+++ b/intern/cycles/integrator/denoiser_oidn.cpp
@@ -289,7 +289,13 @@ class OIDNDenoiseContext {
  * pixels. */
 const PassAccessorCPU pass_accessor(pass_access_info, 1.0f, num_samples_);
 
-pass_accessor.get_render_tile_pixels(render_buffers_, buffer_params_, 
destination);
+BufferParams buffer_params = buffer_params_;
+buffer_params.window_x = 0;
+buffer_params.window_y = 0;
+buffer_params.window_width = buffer_params.width;
+buffer_params.window_height = buffer_params.height;
+
+pass_accessor.get_render_tile_pixels(render_buffers_, buffer_params, 
destination);
   }
 
   /* Read pass pixels using PassAccessor into a temporary buffer which is 
owned by the pass.. */
diff --git a/intern/cycles/integrator/pass_accessor_cpu.cpp 
b/intern/cycles/integrator/pass_accessor_cpu.cpp
index 3c6691f6d43..80908271ff6 100644
--- a/intern/cycles/integrator/pass_accessor_cpu.cpp
+++ b/intern/cycles/integrator/pass_accessor_cpu.cpp
@@ -99,17 +99,22 @@ inline void 
PassAccessorCPU::run_get_pass_kernel_processor_float(
 {
   DCHECK_EQ(destination.stride, 0) << "Custom stride for float destination is 
not implemented.";
 
-  const float *buffer_data = render_buffers->buffer.data();
+  const int64_t pass_stride = buffer_params.pass_stride;
+  const int64_t buffer_row_stride = buffer_params.stride * 
buffer_params.pass_stride;
+
+  const float *window_data = render_buffers->buffer.data() + 
buffer_params.window_x * pass_stride +
+ buffer_params.window_y * buffer_row_stride;
+
   const int pixel_stride = destination.pixel_stride ? destination.pixel_stride 
:
   
destination.num_components;
 
-  tbb::parallel_for(0, buffer_params.height, [&](int64_t y) {
-int64_t pixel_index = y * buffer_params.width;
-for (int64_t x = 0; x < buffer_params.width; ++x, ++pixel_index) {
-  const int64_t input_pixel_offset = pixel_index * 
buffer_params.pass_stride;
-  const float *buffer = buffer_data + input_pixel_offset;
-  float *pixel = destination.pixels + (pixel_index + destination.offset) * 
pixel_stride;
+  tbb::parallel_for(0, buffer_para

[Bf-blender-cvs] [758f3f7456a] master: Fix T91940: Asset Browser catalogs continuously redraw

2021-10-05 Thread Julian Eisel
Commit: 758f3f7456ac1e31f411c4ac1b19760ad6e5539c
Author: Julian Eisel
Date:   Tue Oct 5 16:01:01 2021 +0200
Branches: master
https://developer.blender.org/rB758f3f7456ac1e31f411c4ac1b19760ad6e5539c

Fix T91940: Asset Browser catalogs continuously redraw

Issue was that the `on_activate()` callback of tree-items were
continuously called, because the active-state was queried before we
fully reconstructed the tree and its state from the previous redraw.
Such issues could happen in more places, so I've refactored the API a
bit to reflect the requirements for state queries, and include some
sanity checks.
The actual fix for the issue is to delay the state change until the tree
is fully reconstructed, by letting the tree-items pass a callback to
check if they should be active.

===

M   source/blender/editors/include/UI_tree_view.hh
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 4028bee9e15..46eaf56a3c0 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -139,11 +139,17 @@ class AbstractTreeView : public TreeViewItemContainer {
   friend TreeViewBuilder;
   friend TreeViewLayoutBuilder;
 
+  bool is_reconstructed_ = false;
+
  public:
   virtual ~AbstractTreeView() = default;
 
   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. */
+  bool is_reconstructed() const;
+
  protected:
   virtual void build_tree() = 0;
 
@@ -156,6 +162,10 @@ 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 was reconstructed (see 
#is_reconstructed()). So this is done
+   * delayed. */
+  void change_state_delayed();
   void build_layout_from_tree(const TreeViewLayoutBuilder &builder);
 };
 
@@ -175,9 +185,15 @@ class AbstractTreeView : public TreeViewItemContainer {
 class AbstractTreeViewItem : public TreeViewItemContainer {
   friend class AbstractTreeView;
 
+ public:
+  using IsActiveFn = std::function;
+
+ private:
   bool is_open_ = false;
   bool is_active_ = false;
 
+  IsActiveFn is_active_fn_;
+
  protected:
   /** This label is used for identifying an item (together with its parent's 
labels). */
   std::string label_{};
@@ -188,6 +204,7 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
   virtual void build_row(uiLayout &row) = 0;
 
   virtual void on_activate();
+  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
@@ -211,16 +228,29 @@ class AbstractTreeViewItem : public TreeViewItemContainer 
{
 
   const AbstractTreeView &get_tree_view() const;
   int count_parents() const;
-  /** Activates this item, deactivates other items, calls the 
#AbstractTreeViewItem::on_activate()
-   * function and ensures this item's parents are not collapsed (so the item 
is visible). */
-  void activate();
   void deactivate();
+  /** Must not be called before the tree was reconstructed (see 
#is_reconstructed()). Otherwise we
+   * can't be sure about the item state. */
   bool is_active() const;
   void toggle_collapsed();
+  /** Must not be called before the tree was reconstructed (see 
#is_reconstructed()). Otherwise we
+   * can't be sure about the item state. */
   bool is_collapsed() const;
   void set_collapsed(bool collapsed);
   bool is_collapsible() const;
   void ensure_parents_uncollapsed();
+
+ protected:
+  /** Activates this item, deactivates other items, calls the 
#AbstractTreeViewItem::on_activate()
+   * function and ensures this item's parents are not collapsed (so the item 
is visible).
+   * Must not be called before the tree was reconstructed (see 
#is_reconstructed()). Otherwise we
+   * can't be sure about the current item state and may call state-change 
update functions
+   * incorrectly. */
+  void activate();
+
+ private:
+  /** See #AbstractTreeView::change_state_delayed() */
+  void change_state_delayed();
 };
 
 /** \} */
@@ -242,7 +272,6 @@ class BasicTreeViewItem : public AbstractTreeViewItem {
   BasicTreeViewItem(StringRef label, BIFIcon

[Bf-blender-cvs] [dbe3981b0a8] master: Cleanup: Better way to pass activate callbacks to Tree-View items

2021-10-05 Thread Julian Eisel
Commit: dbe3981b0a805c1a40f42f57dc7ccc3d28270fda
Author: Julian Eisel
Date:   Tue Oct 5 14:25:40 2021 +0200
Branches: master
https://developer.blender.org/rBdbe3981b0a805c1a40f42f57dc7ccc3d28270fda

Cleanup: Better way to pass activate callbacks to Tree-View items

The `ui::BasicTreeViewItem` took a function-like object to execute on
item activation via the constructor. This was mainly intended to be used
with lambdas. However, it's confusing to just have this lambda there,
with no indication of what it's for (activation).
Instead, assign the function-like object via an explicit `on_activate()`
function.

===

M   source/blender/editors/include/UI_tree_view.hh
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 a82aae021f2..4028bee9e15 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -239,10 +239,11 @@ class BasicTreeViewItem : public AbstractTreeViewItem {
   using ActivateFn = std::function;
   BIFIconID icon;
 
-  BasicTreeViewItem(StringRef label, BIFIconID icon = ICON_NONE, ActivateFn 
activate_fn = nullptr);
+  BasicTreeViewItem(StringRef label, BIFIconID icon = ICON_NONE);
 
   void build_row(uiLayout &row) override;
   void on_activate() override;
+  void on_activate(ActivateFn fn);
 
  protected:
   /** Created in the #build() function. */
diff --git a/source/blender/editors/interface/tree_view.cc 
b/source/blender/editors/interface/tree_view.cc
index 202e3dba2ab..63b12d4fc89 100644
--- a/source/blender/editors/interface/tree_view.cc
+++ b/source/blender/editors/interface/tree_view.cc
@@ -278,8 +278,7 @@ uiLayout *TreeViewLayoutBuilder::current_layout() const
 
 /* -- */
 
-BasicTreeViewItem::BasicTreeViewItem(StringRef label, BIFIconID icon_, 
ActivateFn activate_fn)
-: icon(icon_), activate_fn_(activate_fn)
+BasicTreeViewItem::BasicTreeViewItem(StringRef label, BIFIconID icon_) : 
icon(icon_)
 {
   label_ = label;
 }
@@ -330,6 +329,11 @@ void BasicTreeViewItem::on_activate()
   }
 }
 
+void BasicTreeViewItem::on_activate(ActivateFn fn)
+{
+  activate_fn_ = fn;
+}
+
 BIFIconID BasicTreeViewItem::get_draw_icon() const
 {
   if (icon) {
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 9d6af5136d9..ff8775155c2 100644
--- a/source/blender/editors/space_file/asset_catalog_tree_view.cc
+++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc
@@ -165,11 +165,12 @@ void AssetCatalogTreeView::add_all_item()
 {
   FileAssetSelectParams *params = params_;
 
-  ui::AbstractTreeViewItem &item = add_tree_item(
-  IFACE_("All"), ICON_HOME, [params](ui::BasicTreeViewItem & /*item*/) {
-params->asset_catalog_visibility = FILE_SHOW_ASSETS_ALL_CATALOGS;
-WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
-  });
+  AssetCatalogTreeViewAllItem &item = 
add_tree_item(IFACE_("All"),
+   
  ICON_HOME);
+  item.on_activate([params](ui::BasicTreeViewItem & /*item*/) {
+params->asset_catalog_visibility = FILE_SHOW_ASSETS_ALL_CATALOGS;
+WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
+  });
   if (params->asset_catalog_visibility == FILE_SHOW_ASSETS_ALL_CATALOGS) {
 item.activate();
   }
@@ -180,10 +181,13 @@ void AssetCatalogTreeView::add_unassigned_item()
   FileAssetSelectParams *params = params_;
 
   AssetCatalogTreeViewUnassignedItem &item = 
add_tree_item(
-  IFACE_("Unassigned"), ICON_FILE_HIDDEN, [params](ui::BasicTreeViewItem & 
/*item*/) {
-params->asset_catalog_visibility = FILE_SHOW_ASSETS_WITHOUT_CATALOG;
-WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
-  });
+  IFACE_("Unassigned"), ICON_FILE_HIDDEN);
+
+  item.on_activate([params](ui::BasicTreeViewItem & /*item*/) {
+params->asset_catalog_visibility = FILE_SHOW_ASSETS_WITHOUT_CATALOG;
+WM_main_add_notifier(NC_SPACE | ND_SPACE_ASSET_PARAMS, nullptr);
+  });
+
   if (params->asset_catalog_visibility == FILE_SHOW_ASSETS_WITHOUT_CATALOG) {
 item.activate();
   }

___
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] [9a0850c8c25] master: Cycles: Fix wrong GPU state calculation

2021-10-05 Thread Sergey Sharybin
Commit: 9a0850c8c25ea0c28f6ac313f076fd6a8563d0b4
Author: Sergey Sharybin
Date:   Tue Oct 5 15:52:49 2021 +0200
Branches: master
https://developer.blender.org/rB9a0850c8c25ea0c28f6ac313f076fd6a8563d0b4

Cycles: Fix wrong GPU state calculation

Currently was only used for logging, but better to fix the size so
that it matches reality.

The issue was caused by decoupling number of shadow intersections
and using much higher number for CPU. This caused the total state
on GPU to be logged as 10s of gigabytes instead of 100s of megabytes.

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

===

M   intern/cycles/integrator/path_trace_work_gpu.cpp

===

diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp 
b/intern/cycles/integrator/path_trace_work_gpu.cpp
index 17c49f244d2..7babc9d09fa 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -30,6 +30,31 @@
 
 CCL_NAMESPACE_BEGIN
 
+static size_t estimate_single_state_size()
+{
+  size_t state_size = 0;
+
+#define KERNEL_STRUCT_BEGIN(name) for (int array_index = 0;; array_index++) {
+#define KERNEL_STRUCT_MEMBER(parent_struct, type, name, feature) state_size += 
sizeof(type);
+#define KERNEL_STRUCT_ARRAY_MEMBER(parent_struct, type, name, feature) 
state_size += sizeof(type);
+#define KERNEL_STRUCT_END(name) \
+  break; \
+  }
+#define KERNEL_STRUCT_END_ARRAY(name, cpu_array_size, gpu_array_size) \
+  if (array_index == gpu_array_size - 1) { \
+break; \
+  } \
+  }
+#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
+
+  return state_size;
+}
+
 PathTraceWorkGPU::PathTraceWorkGPU(Device *device,
Film *film,
DeviceScene *device_scene,
@@ -47,7 +72,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(sizeof(IntegratorStateCPU))),
+  
max_num_paths_(queue_->num_concurrent_states(estimate_single_state_size())),
   min_num_active_paths_(queue_->num_concurrent_busy_states()),
   max_active_path_index_(0)
 {

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


[Bf-blender-cvs] [c2c2f0b284d] temp-eevee-gpencil-rewrite: Create material depending of type

2021-10-05 Thread Antonio Vazquez
Commit: c2c2f0b284d8f169e93b04dbdabe95325da50160
Author: Antonio Vazquez
Date:   Tue Oct 5 16:08:29 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rBc2c2f0b284d8f169e93b04dbdabe95325da50160

Create material depending of type

===

M   source/blender/editors/render/render_shading.c
M   source/blender/makesdna/DNA_object_types.h

===

diff --git a/source/blender/editors/render/render_shading.c 
b/source/blender/editors/render/render_shading.c
index 7b2667905ff..737efd76118 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)) {
+if ((!(ob != NULL && ob->type == OB_GPENCIL)) || 
(GP_OBJECT_USE_SCENE_RENDER(ob))) {
   ma = BKE_material_add(bmain, name);
 }
 else {
diff --git a/source/blender/makesdna/DNA_object_types.h 
b/source/blender/makesdna/DNA_object_types.h
index 76a9e0dcba9..f00554b2ddd 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -231,6 +231,9 @@ enum eObjectLineArt_Flags {
   OBJECT_LRT_OWN_CREASE = (1 << 0),
 };
 
+#define GP_OBJECT_USE_SCENE_RENDER(ob) \
+((ob) && ((ob->dtx & OB_USE_GPENCIL_SCENE_ENGINE) != 0))
+
 typedef struct Object {
   ID id;
   /** Animation data (must be immediately after id for utilities to use it). */

___
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] [b1e6e63c222] master: Cleanup: Geometry Nodes dashed lines

2021-10-05 Thread Dalai Felinto
Commit: b1e6e63c22249edfb501a7579efa22810ea55aee
Author: Dalai Felinto
Date:   Tue Oct 5 15:37:19 2021 +0200
Branches: master
https://developer.blender.org/rBb1e6e63c22249edfb501a7579efa22810ea55aee

Cleanup: Geometry Nodes dashed lines

No functional change, just cleaning up the shader code a bit.

Part of this is removing dead code (the discard was never called), and
part is shuffling mix/max around based on feedback by Sybren Stüvel.

===

M   source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl

===

diff --git a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl 
b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
index 55d5d941290..402a07ad4e8 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl
@@ -28,13 +28,10 @@ void main()
 float t = ANTIALIAS / DASH_WIDTH;
 float slope = 1.0 / (2.0 * t);
 
-float alpha = min(1.0, max(0.0, slope * (normalized_distance_triangle - 
dashFactor + t)));
+float unclamped_alpha = 1.0 - slope * (normalized_distance_triangle - 
dashFactor + t);
+float alpha = max(0.0, min(unclamped_alpha, 1.0));
 
-if (alpha < 0.0) {
-  discard;
-}
-
-fragColor.a *= 1.0 - alpha;
+fragColor.a *= alpha;
   }
 
   fragColor.a *= smoothstep(1.0, 0.1, abs(colorGradient));

___
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] [9fdd21d1531] temp-eevee-gpencil-rewrite: Basic show material panel

2021-10-05 Thread Antonio Vazquez
Commit: 9fdd21d1531a243ffd03a85368d97aaf4609c263
Author: Antonio Vazquez
Date:   Tue Oct 5 14:13:30 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB9fdd21d1531a243ffd03a85368d97aaf4609c263

Basic show material panel

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material.py 
b/release/scripts/startup/bl_ui/properties_material.py
index 1c7f3639f0a..a32f3ed4042 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -93,8 +93,9 @@ class 
EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
 ob = context.object
 mat = context.material
 
-if (ob and ob.type == 'GPENCIL') or (mat and mat.grease_pencil):
-return False
+if (ob and ob.type == 'GPENCIL' and ob.use_grease_pencil_scene_engine 
is False):
+if mat and mat.grease_pencil:
+return False
 
 return (ob or mat) and (context.engine in cls.COMPAT_ENGINES)

___
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] [efa55c157a3] temp-eevee-gpencil-rewrite: New property to define render engine for grease pencil

2021-10-05 Thread Antonio Vazquez
Commit: efa55c157a301ff3c4a682090a4fb1af1f5ad329
Author: Antonio Vazquez
Date:   Sun Sep 12 20:08:31 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rBefa55c157a301ff3c4a682090a4fb1af1f5ad329

New property to define render engine for grease pencil

===

M   release/scripts/startup/bl_ui/properties_object.py
M   source/blender/draw/intern/DRW_render.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/makesdna/DNA_object_types.h
M   source/blender/makesrna/intern/rna_object.c

===

diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index 81a641a20cf..812c18052b9 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -407,6 +407,9 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
 col = layout.column(heading="Grease Pencil")
 col.prop(ob, "use_grease_pencil_lights", toggle=False)
 
+subcol = layout.column()
+subcol.prop(ob, "use_grease_pencil_scene_engine", toggle=False)
+subcol.active = context.scene.render.engine == 'BLENDER_EEVEE'
 layout.separator()
 col = layout.column(heading="Mask")
 col.prop(ob, "is_holdout")
diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 8811a9febb9..7cbc74be7e7 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -696,6 +696,7 @@ bool DRW_object_is_in_edit_mode(const struct Object *ob);
 int DRW_object_visibility_in_active_context(const struct Object *ob);
 bool DRW_object_is_flat_normal(const struct Object *ob);
 bool DRW_object_use_hide_faces(const struct Object *ob);
+bool DRW_object_use_gpencil_engine(const struct Object *ob);
 
 bool DRW_object_is_visible_psys_in_active_context(const struct Object *object,
   const struct ParticleSystem 
*psys);
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 5ae0351cdd3..4f5c7fa054a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -271,6 +271,17 @@ bool DRW_object_use_hide_faces(const struct Object *ob)
   return false;
 }
 
+bool DRW_object_use_gpencil_engine(const struct Object *ob)
+{
+  BLI_assert((ob->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0);
+
+  if (ob->type == OB_GPENCIL) {
+return (ob->dtx & OB_USE_GPENCIL_SCENE_ENGINE) == 0;
+  }
+
+  return false;
+}
+
 bool DRW_object_is_visible_psys_in_active_context(const Object *object, const 
ParticleSystem *psys)
 {
   const bool for_render = DRW_state_is_image_render();
diff --git a/source/blender/makesdna/DNA_object_types.h 
b/source/blender/makesdna/DNA_object_types.h
index 5a88ce7c9f5..76a9e0dcba9 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -601,6 +601,8 @@ enum {
   OB_DRAW_NO_SHADOW_CAST = 1 << 9,
   /* Enable lights for grease pencil. */
   OB_USE_GPENCIL_LIGHTS = 1 << 10,
+  /* Use Scene Render Engine for grease pencil. */
+  OB_USE_GPENCIL_SCENE_ENGINE = 1 << 11,
 };
 
 /* empty_drawtype: no flags */
diff --git a/source/blender/makesrna/intern/rna_object.c 
b/source/blender/makesrna/intern/rna_object.c
index 99865078cbe..80249922c15 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -3704,6 +3704,15 @@ static void rna_def_object(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Use Lights", "Lights affect grease pencil 
object");
   RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
 
+  prop = RNA_def_property(srna, "use_grease_pencil_scene_engine", 
PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "dtx", 
OB_USE_GPENCIL_SCENE_ENGINE);
+  RNA_def_property_boolean_default(prop, false);
+  RNA_def_property_ui_text(
+  prop,
+  "Use Scene Render Engine",
+  "Use the scene render engine to render this object instead of the Grease 
Pencil engine");
+  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GPencil_update");
+
   prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
   RNA_def_property_ui_text(

___
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] [a74350af582] temp-eevee-gpencil-rewrite: More python changes

2021-10-05 Thread Antonio Vazquez
Commit: a74350af582ce013079563c1f477601f3b3bf991
Author: Antonio Vazquez
Date:   Mon Sep 13 15:57:04 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rBa74350af582ce013079563c1f477601f3b3bf991

More python changes

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py 
b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 9d099ff2231..170593cd727 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -97,6 +97,11 @@ 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
 
@@ -112,6 +117,9 @@ 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')
 
diff --git a/release/scripts/startup/bl_ui/properties_object.py 
b/release/scripts/startup/bl_ui/properties_object.py
index 812c18052b9..85b6263cc5b 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -405,7 +405,9 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
 
 if context.object.type == 'GPENCIL':
 col = layout.column(heading="Grease Pencil")
-col.prop(ob, "use_grease_pencil_lights", toggle=False)
+subcol = layout.column()
+subcol.prop(ob, "use_grease_pencil_lights", toggle=False)
+subcol.active = not ob.use_grease_pencil_scene_engine
 
 subcol = layout.column()
 subcol.prop(ob, "use_grease_pencil_scene_engine", toggle=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] [a791bdabd0b] blender-v2.93-release: Versioin bump: 2.93.5-release

2021-10-05 Thread Jeroen Bakker
Commit: a791bdabd0b2cc58c8d4b738a9c1a81b669fc8c5
Author: Jeroen Bakker
Date:   Tue Oct 5 14:04:58 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rBa791bdabd0b2cc58c8d4b738a9c1a81b669fc8c5

Versioin bump: 2.93.5-release

===

M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/blender/blenkernel/BKE_blender_version.h
M   source/tools

===

diff --git a/release/datafiles/locale b/release/datafiles/locale
index e8bc1883fd4..5ab29b1331d 16
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit e8bc1883fd4de04ceb275a12736501bb37d1406a
+Subproject commit 5ab29b1331d2103dae634b987f121c4599459d7f
diff --git a/release/scripts/addons b/release/scripts/addons
index 7fd30539c69..ce25c08d472 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 7fd30539c69ce4aa3363e0d7c5e00ff4ca13886b
+Subproject commit ce25c08d472f9f7d295b1735b1b6c321a4fc2a13
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 9468c406fb5..8970953d4a8 16
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 9468c406fb554e32ff47b62bfef356b3908ec651
+Subproject commit 8970953d4a8a4ea3bf77c66370c817ed0cf1308a
diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 4c959edd11e..12d2a184a51 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -35,7 +35,7 @@ extern "C" {
 /* Blender patch version for bugfix releases. */
 #define BLENDER_VERSION_PATCH 5
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE rc
+#define BLENDER_VERSION_CYCLE release
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
diff --git a/source/tools b/source/tools
index 35dd27ded66..f99d29ae3e6 16
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 35dd27ded664b1068e773c27988ee221f3ce39d9
+Subproject commit f99d29ae3e6ad44d45d79309454c45f8088781a4

___
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] [55b8fc718a3] master: Cycles: improve detection of HIP compiler for buildbot

2021-10-05 Thread Brecht Van Lommel
Commit: 55b8fc718a378423cd4b6d93258779e201877b1d
Author: Brecht Van Lommel
Date:   Tue Oct 5 13:08:44 2021 +0200
Branches: master
https://developer.blender.org/rB55b8fc718a378423cd4b6d93258779e201877b1d

Cycles: improve detection of HIP compiler for buildbot

And fix various broken things in the HIP kernel compilation.

===

M   CMakeLists.txt
A   build_files/cmake/Modules/FindHIP.cmake
M   intern/cycles/cmake/external_libs.cmake
M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4b8bf6dcd4..16842f3134b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -406,6 +406,7 @@ mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
 set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the 
specified device types (CPU CUDA OPTIX)" )
 set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 
sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
 mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
+option(WITH_CYCLES_HIP_BINARIES "Build Cycles HIP binaries" OFF)
 unset(PLATFORM_DEFAULT)
 option(WITH_CYCLES_LOGGING  "Build Cycles with logging support" ON)
 option(WITH_CYCLES_DEBUG_NAN"Build Cycles with additional asserts for 
detecting NaNs and invalid values" OFF)
diff --git a/build_files/cmake/Modules/FindHIP.cmake 
b/build_files/cmake/Modules/FindHIP.cmake
new file mode 100644
index 000..c68d78e5796
--- /dev/null
+++ b/build_files/cmake/Modules/FindHIP.cmake
@@ -0,0 +1,79 @@
+# - Find HIP compiler
+#
+# This module defines
+#  HIP_HIPCC_EXECUTABLE, the full path to the hipcc executable
+#  HIP_VERSION, the HIP compiler version
+#
+#  HIP_FOUND, if the HIP toolkit is found.
+
+#=
+# Copyright 2021 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD 3-Clause License,
+# see accompanying file BSD-3-Clause-license.txt for details.
+#=
+
+# If HIP_ROOT_DIR was defined in the environment, use it.
+if(NOT HIP_ROOT_DIR AND NOT $ENV{HIP_ROOT_DIR} STREQUAL "")
+  set(HIP_ROOT_DIR $ENV{HIP_ROOT_DIR})
+endif()
+
+set(_hip_SEARCH_DIRS
+  ${HIP_ROOT_DIR}
+)
+
+find_program(HIP_HIPCC_EXECUTABLE
+  NAMES
+hipcc
+  HINTS
+${_hip_SEARCH_DIRS}
+)
+
+if(HIP_HIPCC_EXECUTABLE AND NOT EXISTS ${HIP_HIPCC_EXECUTABLE})
+  message(WARNING "Cached or directly specified hipcc executable does not 
exist.")
+  set(HIP_FOUND FALSE)
+elseif(HIP_HIPCC_EXECUTABLE)
+  set(HIP_FOUND TRUE)
+
+  set(HIP_VERSION_MAJOR 0)
+  set(HIP_VERSION_MINOR 0)
+  set(HIP_VERSION_PATCH 0)
+
+  # Get version from the output.
+  execute_process(COMMAND ${HIP_HIPCC_EXECUTABLE} --version
+  OUTPUT_VARIABLE HIP_VERSION_RAW
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  # Parse parts.
+  if(HIP_VERSION_RAW MATCHES "HIP version: .*")
+# Strip the HIP prefix and get list of individual version components.
+string(REGEX REPLACE
+   ".*HIP version: ([.0-9]+).*" "\\1"
+   HIP_SEMANTIC_VERSION "${HIP_VERSION_RAW}")
+string(REPLACE "." ";" HIP_VERSION_PARTS "${HIP_SEMANTIC_VERSION}")
+list(LENGTH HIP_VERSION_PARTS NUM_HIP_VERSION_PARTS)
+
+# Extract components into corresponding variables.
+if(NUM_HIP_VERSION_PARTS GREATER 0)
+  list(GET HIP_VERSION_PARTS 0 HIP_VERSION_MAJOR)
+endif()
+if(NUM_HIP_VERSION_PARTS GREATER 1)
+  list(GET HIP_VERSION_PARTS 1 HIP_VERSION_MINOR)
+endif()
+if(NUM_HIP_VERSION_PARTS GREATER 2)
+  list(GET HIP_VERSION_PARTS 2 HIP_VERSION_PATCH)
+endif()
+
+# Unset temp variables.
+unset(NUM_HIP_VERSION_PARTS)
+unset(HIP_SEMANTIC_VERSION)
+unset(HIP_VERSION_PARTS)
+  endif()
+
+  # Construct full semantic version.
+  set(HIP_VERSION 
"${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH}")
+  unset(HIP_VERSION_RAW)
+else()
+  set(HIP_FOUND FALSE)
+endif()
diff --git a/intern/cycles/cmake/external_libs.cmake 
b/intern/cycles/cmake/external_libs.cmake
index b966edd4298..c1244ab740b 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -521,7 +521,7 @@ endif()
 if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
   find_package(CUDA) # Try to auto locate CUDA toolkit
   if(CUDA_FOUND)
-message(STATUS "CUDA nvcc = ${CUDA_NVCC_EXECUTABLE}")
+message(STATUS "Found CUDA ${CUDA_NVCC_EXECUTABLE} (${CUDA_VERSION})")
   else()
 message(STATUS "CUDA compiler not found, disabling 
WITH_CYCLES_CUDA_BINARIES")
 set(WITH_CYCLES_CUDA_BINARIES OFF)
@@ -537,6 +537,16 @@ endif()
 # HIP
 ###
 
+if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP)
+  find_package(HIP)

[Bf-blender-cvs] [8dda36655ec] sculpt-dev: Sculpt: array brush fixes

2021-10-05 Thread Joseph Eagar
Commit: 8dda36655eca2e708619993ccd4bab3cf104c2e1
Author: Joseph Eagar
Date:   Tue Oct 5 03:34:15 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB8dda36655eca2e708619993ccd4bab3cf104c2e1

Sculpt: array brush fixes

===

M   source/blender/blenkernel/intern/brush_channel_define.h
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/editors/sculpt_paint/sculpt_array.c

===

diff --git a/source/blender/blenkernel/intern/brush_channel_define.h 
b/source/blender/blenkernel/intern/brush_channel_define.h
index 86ad65113f2..9df57642975 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -559,6 +559,15 @@ MAKE_BOOL(use_smoothed_rake, "Smooth Raking", "Smooth 
angles of clay strips brus
 MAKE_BOOL(use_surface_falloff,  "Use Surface Falloff",
"Propagate the falloff of the brush trough the 
surface of the mesh", false)
 
+MAKE_ENUM(array_deform_type, "Deformation", "Deformation type that is used in 
the brush", BRUSH_ARRAY_DEFORM_LINEAR, {
+  {BRUSH_ARRAY_DEFORM_LINEAR, "LINEAR", "NONE", "Linear", ""},
+  {BRUSH_ARRAY_DEFORM_RADIAL, "RADIAL", "NONE", "Radial", ""},
+  {BRUSH_ARRAY_DEFORM_PATH, "PATH", "NONE", "Path", ""},
+  {-1}
+})
+
+MAKE_INT_EX(array_count, "Count", "Number of copies", 2, 1, 1, 1, 50)
+
 //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 a6f27d4651a..64bc031b0d3 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -447,6 +447,8 @@ static BrushSettingsMap brush_settings_map[] = {
   DEF(blend, blend, INT, INT)
   DEF(elastic_deform_volume_preservation, elastic_deform_volume_preservation, 
FLOAT, FLOAT)
   DEF(smooth_deform_type, smooth_deform_type, INT, INT)
+  DEF(array_deform_type, array_deform_type, INT, INT)
+  DEF(array_count, array_count, INT, INT)
 };
 
 static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -1058,6 +1060,11 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
   break;
 case SCULPT_TOOL_ELASTIC_DEFORM:
   ADDCH(use_grab_active_vertex);
+  break;
+case SCULPT_TOOL_ARRAY:
+  ADDCH(array_deform_type);
+  ADDCH(array_count);
+
   break;
 case SCULPT_TOOL_CLAY_STRIPS:
   if (set_mappings) {
@@ -1401,6 +1408,13 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
 case SCULPT_TOOL_ELASTIC_DEFORM:
   SHOWWRK(elastic_deform_type);
   SHOWCTX(elastic_deform_type);
+  break;
+case SCULPT_TOOL_ARRAY:
+  SHOWWRK(array_deform_type);
+  SHOWCTX(array_deform_type);
+
+  SHOWALL(array_count);
+
   break;
   }
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_array.c 
b/source/blender/editors/sculpt_paint/sculpt_array.c
index 4f35d0de1f6..b837f9a0dfd 100644
--- a/source/blender/editors/sculpt_paint/sculpt_array.c
+++ b/source/blender/editors/sculpt_paint/sculpt_array.c
@@ -96,11 +96,11 @@ static void sculpt_array_datalayers_init(SculptArray 
*array, SculptSession *ss)
 
   SCULPT_temp_customlayer_ensure(
   ss, ATTR_DOMAIN_POINT, CD_PROP_INT32, array_instance_cd_name, ¶ms);
-  SCULPT_temp_customlayer_get(
-  ss, ATTR_DOMAIN_POINT, CD_PROP_INT32, array_instance_cd_name, 
array->scl_inst, ¶ms);
-
   SCULPT_temp_customlayer_ensure(
   ss, ATTR_DOMAIN_POINT, CD_PROP_INT32, array_symmetry_pass_cd_name, 
¶ms);
+
+  SCULPT_temp_customlayer_get(
+  ss, ATTR_DOMAIN_POINT, CD_PROP_INT32, array_instance_cd_name, 
array->scl_inst, ¶ms);
   SCULPT_temp_customlayer_get(
   ss, ATTR_DOMAIN_POINT, CD_PROP_INT32, array_symmetry_pass_cd_name, 
array->scl_sym, ¶ms);
 }
@@ -117,6 +117,7 @@ static void sculpt_array_datalayers_add(SculptArray *array, 
SculptSession *ss, M
 SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
 
 *(int *)SCULPT_temp_cdata_get(vertex, scl) = ARRAY_INSTANCE_ORIGINAL;
+*(int *)SCULPT_temp_cdata_get(vertex, array->scl_sym) = 0;
   }
 }
 
@@ -124,18 +125,59 @@ ATTR_NO_OPT void SCULPT_array_datalayers_free(SculptArray 
*array, Object *ob)
 {
   SculptSession *ss = ob->sculpt;
 
+#if 0
+  Mesh *mesh = BKE_object_get_original_mesh(ob);
+
+  // update cdata pointers for SCULPT_temp_customlayer_release
+  if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) {
+ss->vdata = &mesh->vdata;
+ss->edata = &mesh->edata;
+ss->ldata = &mesh->ldata;
+ss->pdata = &mesh->pdata;
+
+ss->mvert = (MVert *)CustomData_get_layer(ss->vdata, CD_MVERT);
+ss->medge = (MEdge *)CustomData_get_layer(ss->edata, CD_MEDGE);
+ss->mloop = (MLoop *)CustomDa

[Bf-blender-cvs] [22bf9507f1b] sculpt-dev: Sculpt: add call to fix ui settings to subversion 32 check.

2021-10-05 Thread Joseph Eagar
Commit: 22bf9507f1b33fa76010cf7bf7ca24a3a3833274
Author: Joseph Eagar
Date:   Tue Oct 5 02:57:21 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB22bf9507f1b33fa76010cf7bf7ca24a3a3833274

Sculpt: add call to fix ui settings
to subversion 32 check.

===

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 08a8bd0ce67..e2fed4b87a1 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1751,6 +1751,8 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 
   if (!MAIN_VERSION_ATLEAST(bmain, 300, 32)) {
 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
+  BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
+
   if (ELEM(brush->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS) 
&& brush->channels) {
 BRUSHSET_SET_BOOL(brush->channels, autosmooth_use_spacing, true);
 BRUSHSET_SET_FLOAT(brush->channels, autosmooth_spacing, 7.0f);

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


[Bf-blender-cvs] [91e70def7ef] sculpt-dev: Tweak last commit

2021-10-05 Thread Joseph Eagar
Commit: 91e70def7ef5c29d0a4f45e60677652a7d933bc2
Author: Joseph Eagar
Date:   Tue Oct 5 02:45:29 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB91e70def7ef5c29d0a4f45e60677652a7d933bc2

Tweak last commit

===

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 6486aba9642..08a8bd0ce67 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1749,7 +1749,7 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 
-  if (MAIN_VERSION_OLDER(bmain, 300, 20) && !MAIN_VERSION_ATLEAST(bmain, 300, 
32)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 300, 32)) {
 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
   if (ELEM(brush->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS) 
&& brush->channels) {
 BRUSHSET_SET_BOOL(brush->channels, autosmooth_use_spacing, 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] [73bd469fe0e] sculpt-dev: * Sculpt: fix clay defaults again

2021-10-05 Thread Joseph Eagar
Commit: 73bd469fe0edec82325319f0cfcd04b4abe5e2be
Author: Joseph Eagar
Date:   Tue Oct 5 02:43:46 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB73bd469fe0edec82325319f0cfcd04b4abe5e2be

* Sculpt: fix clay defaults again

===

M   release/scripts/startup/bl_ui/space_view3d_toolbar.py
M   source/blender/blenkernel/BKE_blender_version.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_detail.c

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 87bdddfb632..1c5c4eefa52 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1015,12 +1015,14 @@ class SCULPT_OT_set_dyntopo_mode(Operator):
 
 if not brush.channels["dyntopo_mode"].inherit and ch.inherit_if_unset:
 finalch = context.tool_settings.sculpt.channels["dyntopo_mode"]
+pass
 
 oldf = set()
 for f in finalch.flags_value:
 if f not in ["SUBDIVIDE", "COLLAPSE"]:
 oldf.add(f)
 
+print("OLDF", oldf)
 if self.mode == "SC":
 finalch.flags_value = oldf.union({"SUBDIVIDE", "COLLAPSE"})
 elif self.mode == "S":
diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index b04bbdfb187..31ce1b124e9 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 31
+#define BLENDER_FILE_SUBVERSION 32
 
 /* 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_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index 1cf4f2ab7d1..a6f27d4651a 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -881,6 +881,7 @@ void reset_clay_mappings(BrushChannelSet *chset, bool 
strips)
   CurveMap *cuma = curve->cm;
 
   if (!strips) {  //[[0,0.200], [0.354,0.200], [0.595,0.210], [0.806,0.523], 
[1,1.000]
+#if 0
 cuma->curve[0].x = 0.0f;
 cuma->curve[0].y = 0.2f;
 
@@ -889,9 +890,9 @@ void reset_clay_mappings(BrushChannelSet *chset, bool 
strips)
 BKE_curvemap_insert(cuma, 0.8f, 0.525f);
 
 BKE_curvemapping_changed(curve, true);
+#endif
   }
   else {
-#if 0  // dunno if I've interpreted the original code's math right - joeedh
 //[[0,0], [0.250,0.050], [0.500,0.125], [0.750,0.422], [1,1]
 cuma->curve[0].x = 0.0f;
 cuma->curve[0].y = 0.55f;
@@ -899,7 +900,6 @@ void reset_clay_mappings(BrushChannelSet *chset, bool 
strips)
 cuma->curve[2].x = 1.0f;
 cuma->curve[2].y = 1.0f;
 BKE_curvemapping_changed(curve, true);
-#endif
   }
 
   mp = BRUSHSET_LOOKUP(chset, strength)->mappings + BRUSH_MAPPING_PRESSURE;
diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index f26cedb3bb1..6486aba9642 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -1749,7 +1749,7 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 }
   }
 
-  if (!MAIN_VERSION_ATLEAST(bmain, 300, 27)) {
+  if (MAIN_VERSION_OLDER(bmain, 300, 20) && !MAIN_VERSION_ATLEAST(bmain, 300, 
32)) {
 LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
   if (ELEM(brush->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS) 
&& brush->channels) {
 BRUSHSET_SET_BOOL(brush->channels, autosmooth_use_spacing, true);
@@ -1761,7 +1761,10 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
 BRUSH_MAPPING_ENABLED;
 
 if (brush->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS) {
-  BRUSHSET_SET_FLOAT(brush->channels, tip_roundness, 0.18f);
+  if (BRUSHSET_GET_FLOAT(brush->channels, tip_roundness, NULL) == 
0.0f) {
+BRUSHSET_SET_FLOAT(brush->channels, tip_roundness, 0.18f);
+  }
+
   BRUSHSET_LOOKUP(brush->channels, tip_roundness)->flag |= 
BRUSH_CHANNEL_SHOW_IN_WORKSPACE;
   BRUSHSET_SET_BOOL(brush->channels, use_space_attenuation, false);
 }
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c 
b/source/blender/editors/sculpt_paint/sculpt_detail.c
index 50f2c5c882d..848215e5cea 100644
--- a/source/blender/editors/sculpt_paint/sculpt_detail.c
+++ b/source/blender/editors/sculpt_p

[Bf-blender-cvs] [71cf9f4b3f0] master: Fix T91955: Cycles crash with denoising on non-available device

2021-10-05 Thread Sergey Sharybin
Commit: 71cf9f4b3f0b750325a0037c4ef5c43fea71248f
Author: Sergey Sharybin
Date:   Tue Oct 5 10:50:40 2021 +0200
Branches: master
https://developer.blender.org/rB71cf9f4b3f0b750325a0037c4ef5c43fea71248f

Fix T91955: Cycles crash with denoising on non-available device

For example, crash when attempting to use OptiX denoiser on systems
without OptiX-capable device.

Perform check that scene update happened without errors.

Note that `et_error` makes progress to cancel, so the code was
simplified a bit.

===

M   intern/cycles/render/session.cpp

===

diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 550188b196a..4f93c3a9054 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -157,6 +157,13 @@ void Session::run_main_render_loop()
   continue;
 }
 
+/* Stop rendering if error happenned during scene update or other step of 
preparing scene
+ * for render. */
+if (device->have_error()) {
+  progress.set_error(device->error_message());
+  break;
+}
+
 {
   /* buffers mutex is locked entirely while rendering each
* sample, and released/reacquired on each iteration to allow
@@ -172,10 +179,9 @@ void Session::run_main_render_loop()
   /* update status and timing */
   update_status_time();
 
+  /* Stop rendering if error happenned during path tracing. */
   if (device->have_error()) {
-const string &error_message = device->error_message();
-progress.set_error(error_message);
-progress.set_cancel(error_message);
+progress.set_error(device->error_message());
 break;
   }
 }

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


[Bf-blender-cvs] [b6ad0735a6b] master: Fix T86379: When using "Append" not handling properly RigidBody constraints

2021-10-05 Thread Bastien Montagne
Commit: b6ad0735a6b0a84aaee20d072bf218e262e8bb89
Author: Bastien Montagne
Date:   Tue Oct 5 10:45:28 2021 +0200
Branches: master
https://developer.blender.org/rBb6ad0735a6b0a84aaee20d072bf218e262e8bb89

Fix T86379: When using "Append" not handling properly RigidBody constraints

This was simply never handled apparently.

Also fixes a regression from recent append refactor that prevented RB
objects to to properly handled too (since we instantiate loose objects
in append step now, we need to handle RigidBody ones after that
instantiation stage, otherwise nothing will happen since loose objects
won't be in any scene).

===

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

===

diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 1ea659b2d41..242bad163d8 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1473,16 +1473,51 @@ static bool rigidbody_add_object_to_scene(Main *bmain, 
Scene *scene, Object *ob)
   return true;
 }
 
-void BKE_rigidbody_ensure_local_object(Main *bmain, Object *ob)
+static bool rigidbody_add_constraint_to_scene(Main *bmain, Scene *scene, 
Object *ob)
 {
-  if (ob->rigidbody_object == NULL) {
-return;
+  /* Add rigid body world and group if they don't exist for convenience */
+  RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
+  if (rbw == NULL) {
+rbw = BKE_rigidbody_create_world(scene);
+if (rbw == NULL) {
+  return false;
+}
+
+BKE_rigidbody_validate_sim_world(scene, rbw, false);
+scene->rigidbody_world = rbw;
   }
 
-  /* Add newly local object to scene. */
-  for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-if (BKE_scene_object_find(scene, ob)) {
-  rigidbody_add_object_to_scene(bmain, scene, ob);
+  if (rbw->constraints == NULL) {
+rbw->constraints = BKE_collection_add(bmain, NULL, "RigidBodyConstraints");
+id_fake_user_set(&rbw->constraints->id);
+  }
+
+  /* Add object to rigid body group. */
+  BKE_collection_object_add(bmain, rbw->constraints, ob);
+  BKE_rigidbody_cache_reset(rbw);
+
+  DEG_relations_tag_update(bmain);
+  DEG_id_tag_update(&rbw->constraints->id, ID_RECALC_COPY_ON_WRITE);
+
+  return true;
+}
+
+void BKE_rigidbody_ensure_local_object(Main *bmain, Object *ob)
+{
+  if (ob->rigidbody_object != NULL) {
+/* Add newly local object to scene. */
+for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+  if (BKE_scene_object_find(scene, ob)) {
+rigidbody_add_object_to_scene(bmain, scene, ob);
+  }
+}
+  }
+  if (ob->rigidbody_constraint != NULL) {
+/* Add newly local object to scene. */
+for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+  if (BKE_scene_object_find(scene, ob)) {
+rigidbody_add_constraint_to_scene(bmain, scene, ob);
+  }
 }
   }
 }
diff --git a/source/blender/windowmanager/intern/wm_files_link.c 
b/source/blender/windowmanager/intern/wm_files_link.c
index a73bea31669..cf3536213d2 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -579,6 +579,16 @@ static void 
wm_append_loose_data_instantiate(WMLinkAppendData *lapp_data,
 
 id->tag &= ~LIB_TAG_DOIT;
   }
+
+  /* Finally, add rigid body objects and constraints to current RB world(s). */
+  for (itemlink = lapp_data->items.list; itemlink; itemlink = itemlink->next) {
+WMLinkAppendDataItem *item = itemlink->link;
+ID *id = wm_append_loose_data_instantiate_process_check(item);
+if (id == NULL || GS(id->name) != ID_OB) {
+  continue;
+}
+BKE_rigidbody_ensure_local_object(bmain, (Object *)id);
+  }
 }
 
 /** \} */
@@ -773,9 +783,6 @@ static void wm_append_do(WMLinkAppendData *lapp_data,
  local_appended_new_id);
   }
 
-  if (GS(local_appended_new_id->name) == ID_OB) {
-BKE_rigidbody_ensure_local_object(bmain, (Object 
*)local_appended_new_id);
-  }
   if (set_fakeuser) {
 if (!ELEM(GS(local_appended_new_id->name), ID_OB, ID_GR)) {
   /* Do not set fake user on objects nor collections (instancing). */

___
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] [9824df49c06] master: Fix memory leak when running test cases.

2021-10-05 Thread Jeroen Bakker
Commit: 9824df49c0694a67158598f232a55a80fe4ba2ce
Author: Jeroen Bakker
Date:   Tue Oct 5 10:34:05 2021 +0200
Branches: master
https://developer.blender.org/rB9824df49c0694a67158598f232a55a80fe4ba2ce

Fix memory leak when running test cases.

Issue is that test cases re-uses draw manager. The new
`DRWRegisteredDrawEngine` struct is only freed when a
valid opengl context was found. what isn't the case
when running test cases.

Also made sure that re-using draw manager would use re-inited
values.

===

M   source/blender/draw/intern/draw_manager.c

===

diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index 7a41142b177..8d8375556c7 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2928,8 +2928,27 @@ void DRW_engines_register(void)
   }
 }
 
+static void drw_registered_engines_free(void)
+{
+  DRWRegisteredDrawEngine *next;
+  for (DRWRegisteredDrawEngine *type = g_registered_engines.engines.first; 
type; type = next) {
+next = type->next;
+BLI_remlink(&R_engines, type);
+
+if (type->draw_engine->engine_free) {
+  type->draw_engine->engine_free();
+}
+MEM_freeN(type);
+  }
+
+  BLI_listbase_clear(&g_registered_engines.engines);
+  g_registered_engines.len = 0;
+}
+
 void DRW_engines_free(void)
 {
+  drw_registered_engines_free();
+
   if (DST.gl_context == NULL) {
 /* Nothing has been setup. Nothing to clear.
  * Otherwise, DRW_opengl_context_enable can
@@ -2948,17 +2967,6 @@ void DRW_engines_free(void)
   DRW_stats_free();
   DRW_globals_free();
 
-  DRWRegisteredDrawEngine *next;
-  for (DRWRegisteredDrawEngine *type = g_registered_engines.engines.first; 
type; type = next) {
-next = type->next;
-BLI_remlink(&R_engines, type);
-
-if (type->draw_engine->engine_free) {
-  type->draw_engine->engine_free();
-}
-MEM_freeN(type);
-  }
-
   DRW_UBO_FREE_SAFE(G_draw.block_ubo);
   DRW_UBO_FREE_SAFE(G_draw.view_ubo);
   DRW_TEXTURE_FREE_SAFE(G_draw.ramp);

___
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] [7df6f66ea20] master: Silenced compilation warning when compiling using ASAN.

2021-10-05 Thread Jeroen Bakker
Commit: 7df6f66ea202b93ae1abd9fe0b505bcd1b8511c2
Author: Jeroen Bakker
Date:   Tue Oct 5 10:36:10 2021 +0200
Branches: master
https://developer.blender.org/rB7df6f66ea202b93ae1abd9fe0b505bcd1b8511c2

Silenced compilation warning when compiling using ASAN.

===

M   extern/smaa_areatex/smaa_areatex.cpp

===

diff --git a/extern/smaa_areatex/smaa_areatex.cpp 
b/extern/smaa_areatex/smaa_areatex.cpp
index 7a4ff3a9831..c61543e10a0 100644
--- a/extern/smaa_areatex/smaa_areatex.cpp
+++ b/extern/smaa_areatex/smaa_areatex.cpp
@@ -574,6 +574,8 @@ Dbl2 AreaDiag::area(Dbl2 p1, Dbl2 p2, int left)
Dbl2 d = p2 - p1;
if (d.x == 0.0)
return Dbl2(0.0, 1.0);
+   if (d.y == 0.0)
+   return Dbl2(1.0, 0.0);
 
double x1 = (double)(1 + left);
double x2 = x1 + 1.0;

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


[Bf-blender-cvs] [19e4c235bab] sculpt-dev: Sculpt: fix crash

2021-10-05 Thread Joseph Eagar
Commit: 19e4c235bab80d659aed83f60accac6c64da5a72
Author: Joseph Eagar
Date:   Tue Oct 5 01:06:07 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB19e4c235bab80d659aed83f60accac6c64da5a72

Sculpt: fix crash

===

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

===

diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c 
b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index ab3f12f1aa2..008af2e8420 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -2572,7 +2572,7 @@ static void island_stack_mesh_do(SculptSession *ss,
 }
 SculptFaceSetIslands *SCULPT_face_set_islands_get(SculptSession *ss, int fset)
 {
-  if (!ss->epmap) {
+  if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH && !ss->epmap) {
 BKE_mesh_edge_poly_map_create(&ss->epmap,
   &ss->epmap_mem,
   ss->medge,

___
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] [7a66a9f22e6] master: Cleanup: remove unused parameter

2021-10-05 Thread Peter Kim
Commit: 7a66a9f22e6614b88ec262cceefa196906dd434d
Author: Peter Kim
Date:   Tue Oct 5 16:54:25 2021 +0900
Branches: master
https://developer.blender.org/rB7a66a9f22e6614b88ec262cceefa196906dd434d

Cleanup: remove unused parameter

===

M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/screen/area.c
M   source/blender/windowmanager/xr/intern/wm_xr_session.c

===

diff --git a/source/blender/editors/include/ED_screen.h 
b/source/blender/editors/include/ED_screen.h
index 0de6907e677..b6936892803 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -178,9 +178,7 @@ void ED_area_update_region_sizes(struct wmWindowManager *wm,
  struct wmWindow *win,
  struct ScrArea *area);
 bool ED_area_has_shared_border(struct ScrArea *a, struct ScrArea *b);
-ScrArea *ED_area_offscreen_create(struct wmWindowManager *wm,
-  struct wmWindow *win,
-  eSpace_Type space_type);
+ScrArea *ED_area_offscreen_create(struct wmWindow *win, eSpace_Type 
space_type);
 void ED_area_offscreen_free(struct wmWindowManager *wm,
 struct wmWindow *win,
 struct ScrArea *area);
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index d5456482d67..9967d36fd40 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2001,7 +2001,7 @@ void ED_area_init(wmWindowManager *wm, wmWindow *win, 
ScrArea *area)
   }
 }
 
-static void area_offscreen_init(wmWindowManager *wm, ScrArea *area)
+static void area_offscreen_init(ScrArea *area)
 {
   area->type = BKE_spacetype_from_id(area->spacetype);
 
@@ -2015,13 +2015,13 @@ static void area_offscreen_init(wmWindowManager *wm, 
ScrArea *area)
   }
 }
 
-ScrArea *ED_area_offscreen_create(wmWindowManager *wm, wmWindow *win, 
eSpace_Type space_type)
+ScrArea *ED_area_offscreen_create(wmWindow *win, eSpace_Type space_type)
 {
   ScrArea *area = MEM_callocN(sizeof(*area), __func__);
   area->spacetype = space_type;
 
   screen_area_spacelink_add(WM_window_get_active_scene(win), area, space_type);
-  area_offscreen_init(wm, area);
+  area_offscreen_init(area);
 
   return area;
 }
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c 
b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index 1e8cda30121..819057890fd 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -590,7 +590,7 @@ void wm_xr_session_actions_update(wmWindowManager *wm)
 if (win) {
   /* Ensure an XR area exists for events. */
   if (!xr->runtime->area) {
-xr->runtime->area = ED_area_offscreen_create(wm, win, SPACE_VIEW3D);
+xr->runtime->area = ED_area_offscreen_create(win, SPACE_VIEW3D);
   }
 
   /* Implemented in D10944. */

___
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] [7dd11f2edcf] sculpt-dev: Sculpt: fix dyntopo mode dropdown menu

2021-10-05 Thread Joseph Eagar
Commit: 7dd11f2edcf32262f32c4d159edffa51d2846113
Author: Joseph Eagar
Date:   Tue Oct 5 00:28:19 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB7dd11f2edcf32262f32c4d159edffa51d2846113

Sculpt: fix dyntopo mode dropdown menu

Menu is now more intelligent about handling
brushes that use the "combine with scene defaults"
inheritance mode.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 0911ee2162e..87bdddfb632 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1011,17 +1011,22 @@ class SCULPT_OT_set_dyntopo_mode(Operator):
 brush = context.tool_settings.sculpt.brush
 ch = UnifiedPaintPanel.get_channel(context, brush, "dyntopo_mode")
 
+finalch = ch
+
+if not brush.channels["dyntopo_mode"].inherit and ch.inherit_if_unset:
+finalch = context.tool_settings.sculpt.channels["dyntopo_mode"]
+
 oldf = set()
-for f in ch.flags_value:
+for f in finalch.flags_value:
 if f not in ["SUBDIVIDE", "COLLAPSE"]:
 oldf.add(f)
 
 if self.mode == "SC":
-ch.flags_value = oldf.union({"SUBDIVIDE", "COLLAPSE"})
+finalch.flags_value = oldf.union({"SUBDIVIDE", "COLLAPSE"})
 elif self.mode == "S":
-ch.flags_value = oldf.union({"SUBDIVIDE"})
+finalch.flags_value = oldf.union({"SUBDIVIDE"})
 elif self.mode == "C":
-ch.flags_value = oldf.union({"COLLAPSE"})
+finalch.flags_value = oldf.union({"COLLAPSE"})
 
 return {'FINISHED'}
 
@@ -1031,12 +1036,16 @@ def set_dyntopo_mode_button(layout, context):
 
 ch = brush.channels["dyntopo_mode"]
 finalch = UnifiedPaintPanel.get_channel(context, brush, "dyntopo_mode")
+val = finalch.flags_value
+
+if finalch.inherit_if_unset:
+val = 
val.union(context.tool_settings.sculpt.channels["dyntopo_mode"].flags_value)
 
-if "SUBDIVIDE" in finalch.flags_value and "COLLAPSE" in 
finalch.flags_value:
+if "SUBDIVIDE" in val and "COLLAPSE" in val:
 text = "Subdivide Collapse"
-elif "SUBDIVIDE" in finalch.flags_value:
+elif "SUBDIVIDE" in val:
 text = "Subdivide Edges"
-elif "COLLAPSE" in finalch.flags_value:
+elif "COLLAPSE" in val:
 text = "Collapse Edges"
 else:
 text = ""

___
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] [08511b1c3de] master: XR: Add runtime window area for XR events

2021-10-05 Thread Peter Kim
Commit: 08511b1c3de0338314940397083adaba4e9cf492
Author: Peter Kim
Date:   Tue Oct 5 15:55:57 2021 +0900
Branches: master
https://developer.blender.org/rB08511b1c3de0338314940397083adaba4e9cf492

XR: Add runtime window area for XR events

This adds an offscreen View3D window area for the VR view in order to
execute XR events/operators in the proper context. The area is created
as runtime data before XR events are dispatched and set as the active
area during XR event handling.

Since the area is runtime-only, it will not be saved in files and since
the area is offscreen, it will not interfere with regular window areas.
The area is removed with the rest of the XR runtime data on exit, file
read, or when stopping the VR session.

Note: This also adds internal types (EVT_DATA_XR, EVT_XR_ACTION) and
structs (wmXrActionData) for XR events.

Reviewed By: Severin

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

===

M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/screen/area.c
M   source/blender/editors/screen/screen_edit.c
M   source/blender/editors/screen/screen_intern.h
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/WM_types.h
M   source/blender/windowmanager/intern/wm_event_system.c
M   source/blender/windowmanager/wm_event_system.h
M   source/blender/windowmanager/wm_event_types.h
M   source/blender/windowmanager/xr/intern/wm_xr.c
M   source/blender/windowmanager/xr/intern/wm_xr_intern.h
M   source/blender/windowmanager/xr/intern/wm_xr_session.c

===

diff --git a/source/blender/editors/include/ED_screen.h 
b/source/blender/editors/include/ED_screen.h
index 60ef3e740c6..0de6907e677 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -178,6 +178,12 @@ void ED_area_update_region_sizes(struct wmWindowManager 
*wm,
  struct wmWindow *win,
  struct ScrArea *area);
 bool ED_area_has_shared_border(struct ScrArea *a, struct ScrArea *b);
+ScrArea *ED_area_offscreen_create(struct wmWindowManager *wm,
+  struct wmWindow *win,
+  eSpace_Type space_type);
+void ED_area_offscreen_free(struct wmWindowManager *wm,
+struct wmWindow *win,
+struct ScrArea *area);
 
 ScrArea *ED_screen_areas_iter_first(const struct wmWindow *win, const bScreen 
*screen);
 ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area);
diff --git a/source/blender/editors/screen/area.c 
b/source/blender/editors/screen/area.c
index 833c9accf95..d5456482d67 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2001,6 +2001,68 @@ void ED_area_init(wmWindowManager *wm, wmWindow *win, 
ScrArea *area)
   }
 }
 
+static void area_offscreen_init(wmWindowManager *wm, ScrArea *area)
+{
+  area->type = BKE_spacetype_from_id(area->spacetype);
+
+  if (area->type == NULL) {
+area->spacetype = SPACE_VIEW3D;
+area->type = BKE_spacetype_from_id(area->spacetype);
+  }
+
+  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
+region->type = BKE_regiontype_from_id_or_first(area->type, 
region->regiontype);
+  }
+}
+
+ScrArea *ED_area_offscreen_create(wmWindowManager *wm, wmWindow *win, 
eSpace_Type space_type)
+{
+  ScrArea *area = MEM_callocN(sizeof(*area), __func__);
+  area->spacetype = space_type;
+
+  screen_area_spacelink_add(WM_window_get_active_scene(win), area, space_type);
+  area_offscreen_init(wm, area);
+
+  return area;
+}
+
+static void area_offscreen_exit(wmWindowManager *wm, wmWindow *win, ScrArea 
*area)
+{
+  if (area->type && area->type->exit) {
+area->type->exit(wm, area);
+  }
+
+  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
+if (region->type && region->type->exit) {
+  region->type->exit(wm, region);
+}
+
+WM_event_modal_handler_region_replace(win, region, NULL);
+WM_draw_region_free(region, true);
+
+MEM_SAFE_FREE(region->headerstr);
+
+if (region->regiontimer) {
+  WM_event_remove_timer(wm, win, region->regiontimer);
+  region->regiontimer = NULL;
+}
+
+if (wm->message_bus) {
+  WM_msgbus_clear_by_owner(wm->message_bus, region);
+}
+  }
+
+  WM_event_modal_handler_area_replace(win, area, NULL);
+}
+
+void ED_area_offscreen_free(wmWindowManager *wm, wmWindow *win, ScrArea *area)
+{
+  area_offscreen_exit(wm, win, area);
+
+  BKE_screen_area_free(area);
+  MEM_freeN(area);
+}
+
 static void region_update_rect(ARegion *region)
 {
   region->winx = BLI_rcti_size_x(®ion->winrct) + 1;
diff --git a/source/blender/editors/screen/screen_edit.c 
b/source/blender/editors/screen/screen_edit.c
index 1c068fdd6e4..02b1e002d86 100644
--- a

[Bf-blender-cvs] [e557b2096ae] sculpt-dev: Sculpt: Fix topology rake updating original coordinates

2021-10-05 Thread Joseph Eagar
Commit: e557b2096ae19e07744173dc99caa2ad8a2e1de8
Author: Joseph Eagar
Date:   Tue Oct 5 00:17:15 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBe557b2096ae19e07744173dc99caa2ad8a2e1de8

Sculpt: Fix topology rake updating original coordinates

===

M   source/blender/blenkernel/intern/brush_engine.c
M   source/blender/blenkernel/intern/brush_engine_presets.c
M   source/blender/blenkernel/intern/customdata.c
M   source/blender/blenkernel/intern/dyntopo.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_intern.h
M   source/blender/editors/sculpt_paint/sculpt_smooth.c
M   source/blender/gpu/intern/gpu_buffers.c

===

diff --git a/source/blender/blenkernel/intern/brush_engine.c 
b/source/blender/blenkernel/intern/brush_engine.c
index 47e3528e690..2accea81659 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -791,6 +791,8 @@ void BKE_brush_channelset_merge(BrushChannelSet *dst,
   continue;
 }
 
+/*TODO: should inherit if unset should always apply, i.e. this block 
should be moved above the
+ * previous one?*/
 if (ch->type == BRUSH_CHANNEL_TYPE_BITMASK && (ch->flag & 
BRUSH_CHANNEL_INHERIT_IF_UNSET)) {
   mch->ivalue = ch->ivalue | pch->ivalue;
 }
@@ -1537,7 +1539,7 @@ void BKE_builtin_apply_hard_edge_mode(BrushChannelSet 
*chset, bool do_apply)
 ch->ivalue = 1;
   }
 
-  //turn off dyntopo surface smoothing
+  // turn off dyntopo surface smoothing
   ch = BRUSHSET_LOOKUP(chset, dyntopo_disable_smooth);
   if (ch) {
 ch->flag &= ~BRUSH_CHANNEL_INHERIT;
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c 
b/source/blender/blenkernel/intern/brush_engine_presets.c
index 4d1553a0e85..1cf4f2ab7d1 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -514,6 +514,7 @@ BrushFlagMap brush_flags_map[] =  {
   DEF(flag, use_plane_trim, BRUSH_PLANE_TRIM)
   DEF(flag2, use_surface_falloff, BRUSH_USE_SURFACE_FALLOFF)
   DEF(flag2, use_grab_active_vertex, BRUSH_GRAB_ACTIVE_VERTEX)
+  DEF(flag, accumulate, BRUSH_ACCUMULATE)
 };
 
 int brush_flags_map_len = ARRAY_SIZE(brush_flags_map);
@@ -1465,7 +1466,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
   BRUSHSET_SET_FLOAT(chset, strength, 0.5);
   BRUSHSET_SET_FLOAT(chset, autosmooth, 0.05);
   BRUSHSET_SET_INT(chset, topology_rake_mode, 1);  // curvature mode
-  BRUSHSET_SET_FLOAT(chset, topology_rake, 0.35);
+  BRUSHSET_SET_FLOAT(chset, topology_rake, 0.5);
 
   BrushChannel *ch = BRUSHSET_LOOKUP(chset, dyntopo_mode);
   ch->flag &= ~BRUSH_CHANNEL_INHERIT;
diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index 38090abf9fc..f6615cd9833 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1512,7 +1512,7 @@ static void layerDynTopoVert_interp(
 {
   float co[3], no[3], origmask, color[4];
   MDynTopoVert *mv = (MDynTopoVert *)dest;
-  float totweight = 0.0f;
+  // float totweight = 0.0f;
 
   if (count == 0) {
 memset(mv, 0, sizeof(*mv));
@@ -1533,28 +1533,29 @@ static void layerDynTopoVert_interp(
   mv->stroke_id = mv2->stroke_id;
 }
 
-if (sub_weights) {
-  w = sub_weights[i];
-}
-else {
-  w = 1.0f;
-}
+w = weights[i];
 
 madd_v3_v3fl(co, mv2->origco, w);
 madd_v3_v3fl(no, mv2->origno, w);
 madd_v4_v4fl(color, mv2->origcolor, w);
 origmask += mv2->origmask * w;
 
-totweight += w;
+// totweight += w;
   }
 
+  normalize_v3(no);
+
+#if 0
+  if (fabsf(totweight - 1.0) > 0.001) {
+printf("eek\n");
+  }
   float mul = 1.0f / totweight;
 
   mul_v3_fl(co, mul);
-  normalize_v3(no);
 
   mul_v4_fl(color, mul);
   origmask *= mul;
+#endif
 
   copy_v3_v3(mv->origco, co);
   copy_v3_v3(mv->origno, no);
diff --git a/source/blender/blenkernel/intern/dyntopo.c 
b/source/blender/blenkernel/intern/dyntopo.c
index 20163fe0848..834652000a7 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -1980,9 +1980,9 @@ BLI_INLINE int dyntopo_thread_rand(int seed)
   return (seed * multiplier + addend) & mask;
 }
 
- static void long_edge_queue_task_cb(void *__restrict userdata,
-const int n,
-const TaskParallelTLS 
*__restrict tls)
+static void long_edge_queue_task_cb(void *__restrict userdata,
+const int n,
+const TaskParallelTLS *__restrict tls)
 {
   EdgeQueueThreadData *tdata = ((EdgeQueueThreadData *)userdata) + n;
   PBVHNode *node = t