[Bf-blender-cvs] [43369ca80e6] master: PyDoc: quiet warning with literalinclude including blank lines

2021-03-30 Thread Campbell Barton
Commit: 43369ca80e62aa80b951823d1c78abef58852014
Author: Campbell Barton
Date:   Wed Mar 31 17:44:16 2021 +1100
Branches: master
https://developer.blender.org/rB43369ca80e62aa80b951823d1c78abef58852014

PyDoc: quiet warning with literalinclude including blank lines

Files that only contain a doc-string still included the last blank line,
since this normally contains code examples.

There are some cases where only a docstring exists
which made sphinx report warnings.

===

M   doc/python_api/sphinx_doc_gen.py

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index e71f3b2c303..8be194a58a2 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -553,7 +553,7 @@ def example_extract_docstring(filepath):
 line_no += 1
 else:
 file.close()
-return "", 0
+return "", 0, False
 
 for line in file:
 line_no += 1
@@ -563,15 +563,17 @@ def example_extract_docstring(filepath):
 text.append(line.rstrip())
 
 line_no += 1
+line_no_has_content = False
 
 # Skip over blank lines so the Python code doesn't have blank lines at the 
top.
 for line in file:
 if line.strip():
+line_no_has_content = True
 break
 line_no += 1
 
 file.close()
-return "\n".join(text), line_no
+return "\n".join(text), line_no, line_no_has_content
 
 
 def title_string(text, heading_char, double=False):
@@ -590,16 +592,18 @@ def write_example_ref(ident, fw, example_id, ext="py"):
 filepath = os.path.join("..", "examples", "%s.%s" % (example_id, ext))
 filepath_full = os.path.join(os.path.dirname(fw.__self__.name), 
filepath)
 
-text, line_no = example_extract_docstring(filepath_full)
+text, line_no, line_no_has_content = 
example_extract_docstring(filepath_full)
 
 for line in text.split("\n"):
 fw("%s\n" % (ident + line).rstrip())
 fw("\n")
 
-fw("%s.. literalinclude:: %s\n" % (ident, filepath))
-if line_no > 0:
-fw("%s   :lines: %d-\n" % (ident, line_no))
-fw("\n")
+# Some files only contain a doc-string.
+if line_no_has_content:
+fw("%s.. literalinclude:: %s\n" % (ident, filepath))
+if line_no > 0:
+fw("%s   :lines: %d-\n" % (ident, line_no))
+fw("\n")
 EXAMPLE_SET_USED.add(example_id)
 else:
 if bpy.app.debug:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1e4c35d910e] master: PyDoc: correct sphinx syntax for gpu.state.blend_set

2021-03-30 Thread Campbell Barton
Commit: 1e4c35d910e18858c41924f9e27ef8e1070cbd0a
Author: Campbell Barton
Date:   Wed Mar 31 17:42:21 2021 +1100
Branches: master
https://developer.blender.org/rB1e4c35d910e18858c41924f9e27ef8e1070cbd0a

PyDoc: correct sphinx syntax for gpu.state.blend_set

===

M   source/blender/python/gpu/gpu_py_state.c

===

diff --git a/source/blender/python/gpu/gpu_py_state.c 
b/source/blender/python/gpu/gpu_py_state.c
index 110f5a6ff55..e99fc91ac4c 100644
--- a/source/blender/python/gpu/gpu_py_state.c
+++ b/source/blender/python/gpu/gpu_py_state.c
@@ -85,19 +85,22 @@ PyDoc_STRVAR(
 "   Defines the fixed pipeline blending equation.\n"
 "\n"
 "   :param mode: The type of blend mode.\n"
-"   * ``NONE`` No blending.\n"
-"   * ``ALPHA`` The original color channels are interpolated according to 
the alpha value.\n"
-"   * ``ALPHA_PREMULT`` The original color channels are interpolated 
according to the alpha "
-"value with the new colors pre-multiplied by this value.\n"
-"   * ``ADDITIVE`` The original color channels are added by the 
corresponding ones.\n"
-"   * ``ADDITIVE_PREMULT`` The original color channels are added by the 
corresponding ones "
+"  * ``NONE`` No blending.\n"
+"  * ``ALPHA`` The original color channels are interpolated according 
to the alpha "
+"value.\n"
+"  * ``ALPHA_PREMULT`` The original color channels are interpolated 
according to the "
+"alpha value with the new colors pre-multiplied by this value.\n"
+"  * ``ADDITIVE`` The original color channels are added by the 
corresponding ones.\n"
+"  * ``ADDITIVE_PREMULT`` The original color channels are added by the 
corresponding ones "
 "that are pre-multiplied by the alpha value.\n"
-"   * ``MULTIPLY`` The original color channels are multiplied by the 
corresponding ones.\n"
-"   * ``SUBTRACT`` The original color channels are subtracted by the 
corresponding ones.\n"
-"   * ``INVERT`` The original color channels are replaced by its 
complementary color.\n"
-//"   * ``OIT``.\n"
-//"   * ``BACKGROUND`` .\n"
-//"   * ``CUSTOM`` .\n"
+"  * ``MULTIPLY`` The original color channels are multiplied by the 
corresponding ones.\n"
+"  * ``SUBTRACT`` The original color channels are subtracted by the 
corresponding ones.\n"
+"  * ``INVERT`` The original color channels are replaced by its 
complementary color.\n"
+#if 0
+"  * ``OIT``.\n"
+"  * ``BACKGROUND`` .\n"
+"  * ``CUSTOM`` .\n"
+#endif
 "   :type mode: str\n");
 static PyObject *pygpu_state_blend_set(PyObject *UNUSED(self), PyObject *value)
 {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d5f2043ab31] master: PyDoc: fix indentation with multi-line property descriptions

2021-03-30 Thread Campbell Barton
Commit: d5f2043ab312470db38bd75762169807e9b3d84c
Author: Campbell Barton
Date:   Wed Mar 31 17:43:30 2021 +1100
Branches: master
https://developer.blender.org/rBd5f2043ab312470db38bd75762169807e9b3d84c

PyDoc: fix indentation with multi-line property descriptions

New lines were written without indentation,
causing invalid RST to be generated.

===

M   doc/python_api/sphinx_doc_gen.py

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 5c6cf24a178..e71f3b2c303 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1408,7 +1408,8 @@ def pyrna2sphinx(basepath):
 else:
 fw("   .. attribute:: %s\n\n" % prop.identifier)
 if prop.description:
-fw("  %s\n\n" % prop.description)
+write_indented_lines("  ", fw, prop.description, False)
+fw("\n")
 
 # special exception, can't use generic code here for enums
 if prop.type == "enum":

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b547ac32d94] master: Cleanup: use early return for imbuf image loader functions

2021-03-30 Thread Campbell Barton
Commit: b547ac32d94e988a5514dc1e79f2d7181a5385d5
Author: Campbell Barton
Date:   Wed Mar 31 17:05:57 2021 +1100
Branches: master
https://developer.blender.org/rBb547ac32d94e988a5514dc1e79f2d7181a5385d5

Cleanup: use early return for imbuf image loader functions

Most imbuf loaders already did this, use early exit for the remaining
loaders that didn't.

===

M   source/blender/imbuf/intern/cineon/cineon_dpx.c
M   source/blender/imbuf/intern/iris.c
M   source/blender/imbuf/intern/radiance_hdr.c
M   source/blender/imbuf/intern/tiff.c

===

diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c 
b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index de54e6dab9d..91d7b9a8b9e 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -198,10 +198,10 @@ ImBuf *imb_load_cineon(const unsigned char *mem,
int flags,
char colorspace[IM_MAX_SPACE])
 {
-  if (imb_is_a_cineon(mem, size)) {
-return imb_load_dpx_cineon(mem, size, 1, flags, colorspace);
+  if (!imb_is_a_cineon(mem, size)) {
+return NULL;
   }
-  return NULL;
+  return imb_load_dpx_cineon(mem, size, 1, flags, colorspace);
 }
 
 bool imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags)
@@ -219,8 +219,8 @@ ImBuf *imb_load_dpx(const unsigned char *mem,
 int flags,
 char colorspace[IM_MAX_SPACE])
 {
-  if (imb_is_a_dpx(mem, size)) {
-return imb_load_dpx_cineon(mem, size, 0, flags, colorspace);
+  if (!imb_is_a_dpx(mem, size)) {
+return NULL;
   }
-  return NULL;
+  return imb_load_dpx_cineon(mem, size, 0, flags, colorspace);
 }
diff --git a/source/blender/imbuf/intern/iris.c 
b/source/blender/imbuf/intern/iris.c
index 112b95bf1a1..547af472d73 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -270,11 +270,13 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, 
int flags, char colors
   ImBuf *ibuf = NULL;
   uchar dirty_flag = 0;
 
-  if (size < HEADER_SIZE) {
+  if (!imb_is_a_iris(mem, size)) {
 return NULL;
   }
 
-  if (!imb_is_a_iris(mem, size)) {
+  /* Could pe part of the magic check above,
+   * by convention this check only requests the size needed to read it's magic 
though. */
+  if (size < HEADER_SIZE) {
 return NULL;
   }
 
diff --git a/source/blender/imbuf/intern/radiance_hdr.c 
b/source/blender/imbuf/intern/radiance_hdr.c
index 285b18595f7..94b2a62aa26 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -229,87 +229,89 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem,
   const unsigned char *ptr, *mem_eof = mem + size;
   char oriY[80], oriX[80];
 
-  if (imb_is_a_hdr(mem, size)) {
-colorspace_set_default_role(colorspace, IM_MAX_SPACE, 
COLOR_ROLE_DEFAULT_FLOAT);
-
-/* find empty line, next line is resolution info */
-size_t x;
-for (x = 1; x < size; x++) {
-  if ((mem[x - 1] == '\n') && (mem[x] == '\n')) {
-found = 1;
-break;
-  }
+  if (!imb_is_a_hdr(mem, size)) {
+return NULL;
+  }
+
+  colorspace_set_default_role(colorspace, IM_MAX_SPACE, 
COLOR_ROLE_DEFAULT_FLOAT);
+
+  /* find empty line, next line is resolution info */
+  size_t x;
+  for (x = 1; x < size; x++) {
+if ((mem[x - 1] == '\n') && (mem[x] == '\n')) {
+  found = 1;
+  break;
 }
-if (found && (x < (size + 2))) {
-  if (sscanf((char *)&mem[x + 1],
- "%79s %d %79s %d",
- (char *)&oriY,
- &height,
- (char *)&oriX,
- &width) != 4) {
-return NULL;
-  }
+  }
 
-  /* find end of this line, data right behind it */
-  ptr = (unsigned char *)strchr((char *)&mem[x + 1], '\n');
-  ptr++;
+  if ((found && (x < (size + 2))) == 0) {
+/* Data not found! */
+return NULL;
+  }
 
-  if (flags & IB_test) {
-ibuf = IMB_allocImBuf(width, height, 32, 0);
-  }
-  else {
-ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect) | 
IB_rectfloat);
-  }
+  if (sscanf((const char *)&mem[x + 1],
+ "%79s %d %79s %d",
+ (char *)&oriY,
+ &height,
+ (char *)&oriX,
+ &width) != 4) {
+return NULL;
+  }
 
-  if (UNLIKELY(ibuf == NULL)) {
-return NULL;
-  }
-  ibuf->ftype = IMB_FTYPE_RADHDR;
+  /* find end of this line, data right behind it */
+  ptr = (const unsigned char *)strchr((const char *)&mem[x + 1], '\n');
+  ptr++;
 
-  if (flags & IB_alphamode_detect) {
-ibuf->flags |= IB_alphamode_premul;
-  }
+  if (flags & IB_test) {
+ibuf = IMB_allocImBuf(width, height, 32, 0);
+  }
+  else {
+ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect) | IB_rectfloat);
+

[Bf-blender-cvs] [e7f890aa59a] master: WM: use data-path utility functions for WM operators

2021-03-30 Thread Campbell Barton
Commit: e7f890aa59add3b0d83fd56c7423aa58cdd30f65
Author: Campbell Barton
Date:   Wed Mar 31 15:07:44 2021 +1100
Branches: master
https://developer.blender.org/rBe7f890aa59add3b0d83fd56c7423aa58cdd30f65

WM: use data-path utility functions for WM operators

Use utility functions to decompose data paths and resolve the
RNA property from a data-path.
Replaces in-line string manipulation and RNA access.

This allows more complex data paths to be used, where previously string
literals in a data path could break the simple data-path handling logic.

===

M   release/scripts/startup/bl_operators/wm.py

===

diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index 18e938ac9b2..35826cea860 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -95,21 +95,69 @@ def context_path_validate(context, data_path):
 return value
 
 
-def context_path_description(context, data_path):
+def context_path_to_rna_property(context, data_path):
 from bl_rna_utils.data_path import property_definition_from_data_path
 rna_prop = property_definition_from_data_path(context, "." + data_path)
 if rna_prop is not None:
-description = rna_prop.description
-if description:
-return description
+return rna_prop
 return None
 
 
+def context_path_decompose(data_path):
+# Decompose a data_path into 3 components:
+# base_path, prop_attr, prop_item, where:
+# `"foo.bar["baz"].fiz().bob.buz[10][2]"`, returns...
+# `("foo.bar["baz"].fiz().bob", "buz", "[10][2]")`
+#
+# This is useful as we often want the base and the property, ignoring any 
item access.
+# Note that item access includes function calls since these aren't 
properties.
+#
+# Note that the `.` is removed from the start of the first and second 
values,
+# this is done because `.attr` isn't convenient to use as an argument,
+# also the convention is not to include this within the data paths or the 
operator logic for `bpy.ops.wm.*`.
+from bl_rna_utils.data_path import decompose_data_path
+path_split = decompose_data_path("." + data_path)
+
+# Find the last property that isn't a function call.
+value_prev = ""
+i = len(path_split)
+while (i := i - 1) >= 0:
+value = path_split[i]
+if value.startswith("."):
+if not value_prev.startswith("("):
+break
+value_prev = value
+
+if i != -1:
+base_path = "".join(path_split[:i])
+prop_attr = path_split[i]
+prop_item = "".join(path_split[i + 1:])
+
+if base_path:
+assert(base_path.startswith("."))
+base_path= base_path[1:]
+if prop_attr:
+assert(prop_attr.startswith("."))
+prop_attr = prop_attr[1:]
+else:
+# If there are no properties, everything is an item.
+# Note that should not happen in practice with values which are added 
onto `context`,
+# include since it's correct to account for this case and not doing so 
will create a confusing exception.
+base_path = ""
+prop_attr = ""
+prop_item = "".join(path_split)
+
+return (base_path, prop_attr, prop_item)
+
+
 def description_from_data_path(base, data_path, *, prefix, value=Ellipsis):
 if context_path_validate(base, data_path) is Ellipsis:
 return None
-description = context_path_description(base, data_path)
-if description:
+
+if (
+(rna_prop := context_path_to_rna_property(base, data_path)) and
+(description := rna_prop.description)
+):
 description = "%s: %s" % (prefix, description)
 if value != Ellipsis:
 description = "%s\n%s: %s" % (description, iface_("Value"), 
str(value))
@@ -142,12 +190,9 @@ def operator_value_is_undo(value):
 
 
 def operator_path_is_undo(context, data_path):
-# note that if we have data paths that use strings this could fail
-# luckily we don't do this!
-#
-# When we can't find the data owner assume no undo is needed.
-data_path_head = data_path.rpartition(".")[0]
+data_path_head, _, _ = context_path_decompose(data_path)
 
+# When we can't find the data owner assume no undo is needed.
 if not data_path_head:
 return False
 
@@ -524,22 +569,11 @@ class WM_OT_context_cycle_enum(Operator):
 
 orig_value = value
 
-# Have to get rna enum values
-rna_struct_str, rna_prop_str = data_path.rsplit('.', 1)
-i = rna_prop_str.find('[')
-
-# just in case we get "context.foo.bar[0]"
-if i != -1:
-rna_prop_str = rna_prop_str[0:i]
-
-rna_struct = eval("context.%s.rna_type" % rna_struct_str)
-
-rna_prop = rna_struct.properties[rna_prop_str]
-
+  

[Bf-blender-cvs] [1beca76934b] master: PyAPI: add bl_rna_utils.decompose_data_path

2021-03-30 Thread Campbell Barton
Commit: 1beca76934b0557655ed86b5f7c0ead49e23130c
Author: Campbell Barton
Date:   Wed Mar 31 15:03:19 2021 +1100
Branches: master
https://developer.blender.org/rB1beca76934b0557655ed86b5f7c0ead49e23130c

PyAPI: add bl_rna_utils.decompose_data_path

Utility function for splitting an RNA path, to be used by `bpy.ops.wm.*`

===

M   release/scripts/modules/bl_rna_utils/data_path.py

===

diff --git a/release/scripts/modules/bl_rna_utils/data_path.py 
b/release/scripts/modules/bl_rna_utils/data_path.py
index 330a3b7522d..42942b7a295 100644
--- a/release/scripts/modules/bl_rna_utils/data_path.py
+++ b/release/scripts/modules/bl_rna_utils/data_path.py
@@ -20,10 +20,15 @@
 
 __all__ = (
 "property_definition_from_data_path",
+"decompose_data_path",
 )
 
 class _TokenizeDataPath:
-"""Class to split up tokens of a data-path."""
+"""
+Class to split up tokens of a data-path.
+
+Note that almost all access generates new objects with additional paths,
+with the exception of iteration which is the intended way to access the 
resulting data."""
 __slots__ = (
 "data_path",
 )
@@ -49,6 +54,14 @@ class _TokenizeDataPath:
 return iter(self.data_path)
 
 
+def decompose_data_path(data_path):
+"""
+Return the components of a data path split into a list.
+"""
+ns = {"base": _TokenizeDataPath(())}
+return list(eval("base" + data_path, ns, ns))
+
+
 def property_definition_from_data_path(base, data_path):
 """
 Return an RNA property definition from an object and a data path.
@@ -56,9 +69,7 @@ def property_definition_from_data_path(base, data_path):
 In Blender this is often used with ``context`` as the base and a
 path that it references, for example ``.space_data.lock_camera``.
 """
-base_tokenize = _TokenizeDataPath(())
-data = list(eval("base_tokenize" + data_path))
-del base_tokenize
+data = decompose_data_path(data_path)
 while data and (not data[-1].startswith(".")):
 data.pop()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c59a7f44a17] master: Fix bl_rna_utils._TokenizeDataPath function argument extraction error

2021-03-30 Thread Campbell Barton
Commit: c59a7f44a17241ac764a612f67dbc64dc5178106
Author: Campbell Barton
Date:   Wed Mar 31 15:01:44 2021 +1100
Branches: master
https://developer.blender.org/rBc59a7f44a17241ac764a612f67dbc64dc5178106

Fix bl_rna_utils._TokenizeDataPath function argument extraction error

Converting functions with single arguments to a string
added an additional comma.

===

M   release/scripts/modules/bl_rna_utils/data_path.py

===

diff --git a/release/scripts/modules/bl_rna_utils/data_path.py 
b/release/scripts/modules/bl_rna_utils/data_path.py
index 76306e379f0..330a3b7522d 100644
--- a/release/scripts/modules/bl_rna_utils/data_path.py
+++ b/release/scripts/modules/bl_rna_utils/data_path.py
@@ -40,8 +40,8 @@ class _TokenizeDataPath:
 def __call__(self, *args, **kw):
 value_str = ", ".join([
 val for val in (
-repr(args)[1:-1],
-", ".join(["%s=%r" % (key, value) for key, value in 
kw.items()])
+", ".join(repr(value) for value in args),
+", ".join(["%s=%r" % (key, value) for key, value in 
kw.items()]),
 ) if val])
 return _TokenizeDataPath(self.data_path + ('(%s)' % value_str, ))

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5678e6c2bcc] master: Cleanup: improve navigation gizmo flag use

2021-03-30 Thread Campbell Barton
Commit: 5678e6c2bcccd7ce80958f5a0bd7c92837a41e74
Author: Campbell Barton
Date:   Wed Mar 31 12:53:39 2021 +1100
Branches: master
https://developer.blender.org/rB5678e6c2bcccd7ce80958f5a0bd7c92837a41e74

Cleanup: improve navigation gizmo flag use

Flag check for V3D_LOCK_CAMERA used boolean style assignment to a char,
which worked with this flag but could fail if other flags are added
that use this convention in the future.

- Add static type checks for values so any change to DNA types
  will need to be made in the navigation gizmo too.
- Move camera lock check from `rv3d` to `v3d`,
  as this isn't stored in the region data.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c 
b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index c0fe57a4cf4..f11b8566690 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -142,11 +142,13 @@ struct NavigateWidgetGroup {
   /* Store the view state to check for changes. */
   struct {
 rcti rect_visible;
+struct {
+  int flag2;
+} v3d;
 struct {
   char is_persp;
-  char is_camera;
+  bool is_camera;
   char viewlock;
-  char cameralock;
 } rv3d;
   } state;
   int region_size[2];
@@ -227,11 +229,13 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
 
   /* Click only buttons (not modal). */
   {
-int gz_ids[] = {GZ_INDEX_PERSP,
-GZ_INDEX_ORTHO,
-GZ_INDEX_CAMERA,
-GZ_INDEX_CAMERA_LOCK,
-GZ_INDEX_CAMERA_UNLOCK};
+int gz_ids[] = {
+GZ_INDEX_PERSP,
+GZ_INDEX_ORTHO,
+GZ_INDEX_CAMERA,
+GZ_INDEX_CAMERA_LOCK,
+GZ_INDEX_CAMERA_UNLOCK,
+};
 for (int i = 0; i < ARRAY_SIZE(gz_ids); i++) {
   wmGizmo *gz = navgroup->gz_array[gz_ids[i]];
   RNA_boolean_set(gz->ptr, "show_drag", false);
@@ -280,6 +284,7 @@ static void WIDGETGROUP_navigate_draw_prepare(const 
bContext *C, wmGizmoGroup *g
   ARegion *region = CTX_wm_region(C);
   const RegionView3D *rv3d = region->regiondata;
   View3D *v3d = CTX_wm_view3d(C);
+  const int v3d_flag2_test = V3D_LOCK_CAMERA;
 
   for (int i = 0; i < 3; i++) {
 copy_v3_v3(navgroup->gz_array[GZ_INDEX_ROTATE]->matrix_offset[i], 
rv3d->viewmat[i]);
@@ -287,20 +292,24 @@ static void WIDGETGROUP_navigate_draw_prepare(const 
bContext *C, wmGizmoGroup *g
 
   const rcti *rect_visible = ED_region_visible_rect(region);
 
+  /* Ensure types match so bits are never lost on assignment. */
+  CHECK_TYPE_PAIR(navgroup->state.v3d.flag2, v3d->flag2);
+  CHECK_TYPE_PAIR(navgroup->state.rv3d.viewlock, rv3d->viewlock);
+
   if ((navgroup->state.rect_visible.xmax == rect_visible->xmax) &&
   (navgroup->state.rect_visible.ymax == rect_visible->ymax) &&
+  (navgroup->state.v3d.flag2 == (v3d->flag2 & v3d_flag2_test)) &&
   (navgroup->state.rv3d.is_persp == rv3d->is_persp) &&
-  (navgroup->state.rv3d.cameralock == (v3d->flag2 & V3D_LOCK_CAMERA)) &&
   (navgroup->state.rv3d.is_camera == (rv3d->persp == RV3D_CAMOB)) &&
   (navgroup->state.rv3d.viewlock == RV3D_LOCK_FLAGS(rv3d))) {
 return;
   }
 
   navgroup->state.rect_visible = *rect_visible;
+  navgroup->state.v3d.flag2 = v3d->flag2 & v3d_flag2_test;
   navgroup->state.rv3d.is_persp = rv3d->is_persp;
   navgroup->state.rv3d.is_camera = (rv3d->persp == RV3D_CAMOB);
   navgroup->state.rv3d.viewlock = RV3D_LOCK_FLAGS(rv3d);
-  navgroup->state.rv3d.cameralock = v3d->flag2 & V3D_LOCK_CAMERA;
 
   const bool show_navigate = (U.uiflag & USER_SHOW_GIZMO_NAVIGATE) != 0;
   const bool show_rotate_gizmo = (U.mini_axis_type == 
USER_MINI_AXIS_TYPE_GIZMO);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cfa67535181] temp_bmesh_multires: wrote a fast and inaccurate distance to triangle function for DynTopo. Profiling consistently showed it to be a bottleneck. I've now written scalar

2021-03-30 Thread Joseph Eagar
Commit: cfa6753518150a9e4174f4f5c4a1ca188e1d195d
Author: Joseph Eagar
Date:   Tue Mar 30 19:00:08 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBcfa6753518150a9e4174f4f5c4a1ca188e1d195d

wrote a fast and inaccurate distance to triangle function
for DynTopo.  Profiling consistently showed it to be a bottleneck.
I've now written scalar versions of this function four times.

For now I'm committing this inaccuration version.  I'm also committing
code for a vectorized version I found in a paper.  Still need to rejigger
the dyntopo code to use it though.

===

M   source/blender/blenkernel/CMakeLists.txt
A   source/blender/blenkernel/intern/closest_point_tri_sse.cc
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/blenlib/intern/BLI_ghash_utils.c
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
M   
source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
M   source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc

===

diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index 8fbf49b31d4..e71c48fcbbc 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -275,6 +275,7 @@ set(SRC
   intern/workspace.c
   intern/world.c
   intern/writeavi.c
+  intern/closest_point_tri_sse.cc
 
   BKE_DerivedMesh.h
   BKE_action.h
diff --git a/source/blender/blenkernel/intern/closest_point_tri_sse.cc 
b/source/blender/blenkernel/intern/closest_point_tri_sse.cc
new file mode 100644
index 000..b42cc370f6e
--- /dev/null
+++ b/source/blender/blenkernel/intern/closest_point_tri_sse.cc
@@ -0,0 +1,396 @@
+// see Fast Distance Queries for Triangles, Lines, and
+// Points using SSE Instructions
+// http://jcgt.org/published/0003/04/05/paper.pdf
+
+typedef struct DistRet {
+  float dist[4];
+} DistRet;
+
+#if defined(__SSE2__) || defined(__SSE4__)
+#  include 
+#  include 
+#  include 
+#  include 
+
+struct sseb {
+  // data
+  union {
+__m128 m128;
+uint32_t v[4];
+  };
+
+  sseb()
+  {
+  }
+
+  sseb(__m128 m)
+  {
+m128 = m;
+  }
+};
+
+struct ssef {
+  // data
+  union {
+__m128 m128;
+float v[4];
+int i[4];
+  };
+
+  ssef(float a, float b, float c, float d)
+  {
+v[0] = a;
+v[1] = b;
+v[2] = c;
+v[3] = d;
+  }
+
+  ssef()
+  {
+  }
+
+  ssef(__m128 f)
+  {
+m128 = f;
+  }
+
+  ssef(float f)
+  {
+v[0] = v[1] = v[2] = v[3] = f;
+  }
+};
+#endif
+
+#if defined(__SSE2__) && !defined(__SSE4__)
+
+__m128 my_mm_blendv_ps(__m128 a, __m128 b, __m128 mask)
+{
+  ssef fa(a);
+  ssef fb(b);
+  sseb fm(mask);
+
+  ssef ret;
+  for (int i = 0; i < 4; i++) {
+if (fm.v[i] & (1 << 31)) {
+  ret.v[i] = fb.v[i];
+}
+else {
+  ret.v[i] = fa.v[i];
+}
+  }
+}
+#  define _mm_blendv_ps my_mm_blendv_ps
+#endif
+
+#ifdef __SSE2__
+
+#  include 
+#  include 
+
+static inline struct sseb makeSSSEB(__m128 val)
+{
+  sseb r;
+  r.m128 = val;
+
+  return r;
+}
+
+// operations
+const sseb operator&(const sseb &a, const sseb &b)
+{
+  return makeSSSEB(_mm_and_ps(a.m128, b.m128));
+}
+const sseb operator|(const sseb &a, const sseb &b)
+{
+  return makeSSSEB(_mm_or_ps(a.m128, b.m128));
+}
+const sseb operator|=(const sseb &a, const sseb &b)
+{
+  return a | b;
+}
+const sseb operator^(const sseb &a, const sseb &b)
+{
+  return makeSSSEB(_mm_xor_ps(a.m128, b.m128));
+}
+bool all(const sseb &b)
+{
+  return _mm_movemask_ps(b.m128) == 0xf;
+}
+bool any(const sseb &b)
+{
+  return _mm_movemask_ps(b.m128) != 0x0;
+}
+bool none(const sseb &b)
+{
+  return _mm_movemask_ps(b.m128) == 0x0;
+}
+static inline struct ssef makeSSSEF(__m128 val)
+{
+  ssef r;
+  r.m128 = val;
+
+  return r;
+}
+
+// operations
+const ssef operator+(const ssef &a, const ssef &b)
+{
+  return makeSSSEF(_mm_add_ps(a.m128, b.m128));
+}
+const ssef operator-(const ssef &a, const ssef &b)
+{
+  return makeSSSEF(_mm_sub_ps(a.m128, b.m128));
+}
+const ssef operator*(const ssef &a, const ssef &b)
+{
+  return makeSSSEF(_mm_mul_ps(a.m128, b.m128));
+}
+const ssef operator/(const ssef &a, const ssef &b)
+{
+  return makeSSSEF(_mm_div_ps(a.m128, b.m128));
+}
+
+const sseb operator>=(const ssef &a, const ssef &b)
+{
+  __m128 r1 = _mm_cmpgt_ss(a.m128, b.m128);
+  __m128 r2 = _mm_cmpeq_ss(a.m128, b.m128);
+
+  return makeSSSEB(_mm_or_ps(r1, r2));
+}
+const sseb operator<=(const ssef &a, const ssef &b)
+{
+  __m128 r1 = _mm_cmplt_ss(a.m128, b.m128);
+  __m128 r2 = _mm_cmpeq_ss(a.m128, b.m128);
+
+  return makeSSSEB(_mm_or_ps(r1, r2));
+}
+
+const sseb operator>(const ssef &a, const ssef &b)
+{
+  return makeSSSEB(_mm_cmpgt_ss(a.m128, b.m128));
+}
+
+const

[Bf-blender-cvs] [2cf8c35578c] temp_bmesh_multires: Merge branch 'master' into temp_bmesh_multires

2021-03-30 Thread Joseph Eagar
Commit: 2cf8c35578ca9961e812b5c4d27f01da15211fc9
Author: Joseph Eagar
Date:   Tue Mar 30 00:57:43 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB2cf8c35578ca9961e812b5c4d27f01da15211fc9

Merge branch 'master' into temp_bmesh_multires

===



===

diff --cc source/blender/blenloader/intern/versioning_290.c
index 22b38d73c22,aae5a2ec190..7db92760e58
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@@ -1917,19 -1907,32 +1919,46 @@@ void blo_do_versions_290(FileData *fd, 
}
  
if (!MAIN_VERSION_ATLEAST(bmain, 293, 14)) {
 +LISTBASE_FOREACH(Scene*, scene, &bmain->scenes) {
 +  ToolSettings *ts = scene->toolsettings;
 +  if (ts && ts->sculpt) {
 +ts->sculpt->detail_range = 0.4f;
 +  }
 +}
 +
 +LISTBASE_FOREACH(Brush *, brush, &bmain->brushes) {
 +  if (brush->dyntopo.detail_range == 0.0f) {
 +Brush defbrush = *brush;
 +
 +BKE_brush_sculpt_reset(&defbrush);
 +brush->dyntopo = defbrush.dyntopo;
++}
++
+ if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "diff_fac")) {
+   LISTBASE_FOREACH (Light *, light, &bmain->lights) {
+ light->diff_fac = 1.0f;
+ light->volume_fac = 1.0f;
+   }
 -}
+ 
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+   if (ntree->type == NTREE_GEOMETRY) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+   if (node->type == GEO_NODE_ATTRIBUTE_FILL) {
+ node->custom2 = ATTR_DOMAIN_AUTO;
+   }
+ }
+   }
+ }
+   }
+ 
+   if (!MAIN_VERSION_ATLEAST(bmain, 293, 15)) {
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+   if (ntree->type == NTREE_GEOMETRY) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+   if (STREQ(node->idname, "GeometryNodeMeshPlane")) {
+ STRNCPY(node->idname, "GeometryNodeMeshGrid");
+   }
+ }
}
  }
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d09deb31471] temp-spreadsheet-row-filter: Implement basic UI and structures for row filters

2021-03-30 Thread Hans Goudey
Commit: d09deb31471d4bcdfd0507de837df8878b90c078
Author: Hans Goudey
Date:   Tue Mar 30 16:55:02 2021 -0500
Branches: temp-spreadsheet-row-filter
https://developer.blender.org/rBd09deb31471d4bcdfd0507de837df8878b90c078

Implement basic UI and structures for row filters

===

M   release/scripts/startup/bl_ui/space_spreadsheet.py
M   source/blender/blenkernel/intern/screen.c
M   source/blender/editors/include/ED_screen.h
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_spreadsheet/space_spreadsheet.cc
M   source/blender/editors/space_spreadsheet/spreadsheet_ops.cc
M   source/blender/makesdna/DNA_space_types.h
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_spreadsheet.py 
b/release/scripts/startup/bl_ui/space_spreadsheet.py
index 188eddbcce3..95e19d97cfd 100644
--- a/release/scripts/startup/bl_ui/space_spreadsheet.py
+++ b/release/scripts/startup/bl_ui/space_spreadsheet.py
@@ -18,6 +18,77 @@
 
 import bpy
 
+def draw_filter(layout, filter, index):
+box = layout.box()
+
+row = box.row(align=True)
+row.emboss = 'NONE'
+row.prop(filter, "show_expanded", text="")
+row.prop(filter, "enabled", text="")
+row.label(text=filter.column_name if len(filter.column_name) > 0 else 
"Rule")
+sub = row.row()
+sub.alignment = 'RIGHT'
+sub.emboss = 'NONE'
+sub.operator("spreadsheet.remove_rule", text="", icon='X').index = index
+
+
+if filter.show_expanded:
+box.prop(filter, "column_name", text="")
+box.prop(filter, "data_type", text="")
+box.prop(filter, "operation", text="")
+
+if filter.data_type == 'FLOAT':
+box.prop(filter, "value_float", text="Value")
+elif filter.data_type == 'INT':
+box.prop(filter, "value_int", text="Value")
+elif filter.data_type == 'FLOAT_VECTOR':
+box.prop(filter, "value_vector", text="")
+elif filter.data_type == 'FLOAT_COLOR':
+box.prop(filter, "value_color", text="")
+elif filter.data_type == 'BOOLEAN':
+box.prop(filter, "value_boolean", text="Value")
+elif filter.data_type == 'BOOLEAN':
+box.prop(filter, "value_vector_2d", text="Value")
+
+class SPREADSHEET_PT_filter_rules(bpy.types.Panel):
+bl_space_type = 'SPREADSHEET'
+bl_region_type = 'HEADER'
+bl_label = "Filters"
+bl_parent_id = 'SPREADSHEET_PT_filter'
+
+def draw_header(self, context):
+layout = self.layout
+layout.label(text="Filters")
+sub = layout.row()
+sub.alignment = 'RIGHT'
+sub.emboss = 'NONE'
+sub.operator("spreadsheet.add_rule", text="", icon='ADD')
+
+def draw(self, context):
+layout = self.layout
+space = context.space_data
+
+index = 0
+for filter in space.row_filters:
+draw_filter(layout, filter, index)
+index += 1
+
+
+class SPREADSHEET_PT_filter(bpy.types.Panel):
+bl_space_type = 'SPREADSHEET'
+bl_region_type = 'HEADER'
+bl_label = "Filter"
+
+def draw(self, context):
+layout = self.layout
+space = context.space_data
+
+pinned_id = space.pinned_id
+used_id = pinned_id if pinned_id else context.active_object
+
+if isinstance(used_id, bpy.types.Object) and used_id.mode == 'EDIT':
+layout.prop(space, "show_only_selected", text="Selected Only")
+
 
 class SPREADSHEET_HT_header(bpy.types.Header):
 bl_space_type = 'SPREADSHEET'
@@ -44,12 +115,15 @@ class SPREADSHEET_HT_header(bpy.types.Header):
 
 layout.separator_spacer()
 
-if isinstance(used_id, bpy.types.Object) and used_id.mode == 'EDIT':
-layout.prop(space, "show_only_selected", text="Selected Only")
+row = layout.row(align=True)
+row.prop(space, "use_filter", toggle=True, icon='FILTER', 
icon_only=True)
+row.popover("SPREADSHEET_PT_filter", text="")
 
 
 classes = (
 SPREADSHEET_HT_header,
+SPREADSHEET_PT_filter,
+SPREADSHEET_PT_filter_rules,
 )
 
 if __name__ == "__main__":  # Only for live edit.
diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 1766ac5b85f..89d5ed2fcd9 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -1350,6 +1350,7 @@ static void write_area(BlendWriter *writer, ScrArea *area)
 }
 else if (sl->spacetype == SPACE_SPREADSHEET) {
   BLO_write_struct(writer, SpaceSpreadsheet, sl);
+  /* TODO: Write rules. */
 }
   }
 }
@@ -1703,7 +1704,7 @@ static void direct_link_area(BlendDataReader *reader, 
ScrArea *area)
 }
 else if (sl->spacetype == SPACE_SPREADSHEET) {
   SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)sl;
-
+  /*

[Bf-blender-cvs] [87aa514611b] master: UI: Gizmo Button to Lock Camera to View

2021-03-30 Thread Harley Acheson
Commit: 87aa514611b99f75baf1d54948f773ad9ee7a6c4
Author: Harley Acheson
Date:   Tue Mar 30 14:09:26 2021 -0700
Branches: master
https://developer.blender.org/rB87aa514611b99f75baf1d54948f773ad9ee7a6c4

UI: Gizmo Button to Lock Camera to View

2D gizmo navigation button that toggles 'Lock Camera to View' while in Camera 
View.

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

Reviewed by Campbell Barton

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c 
b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index 6fa974cdb09..c0fe57a4cf4 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -67,45 +67,73 @@ enum {
   GZ_INDEX_ORTHO = 4,
   GZ_INDEX_CAMERA = 5,
 
-  GZ_INDEX_TOTAL = 6,
+  /* overlaps GZ_INDEX_ORTHO (switch between) */
+  GZ_INDEX_CAMERA_LOCK = 6,
+  GZ_INDEX_CAMERA_UNLOCK = 7,
+
+  GZ_INDEX_TOTAL = 8,
 };
 
 struct NavigateGizmoInfo {
   const char *opname;
   const char *gizmo;
   uint icon;
+  void (*op_prop_fn)(PointerRNA *ptr);
 };
 
+static void navigate_context_toggle_camera_lock_init(PointerRNA *ptr)
+{
+  RNA_string_set(ptr, "data_path", "space_data.lock_camera");
+}
+
 static struct NavigateGizmoInfo g_navigate_params[GZ_INDEX_TOTAL] = {
 {
 .opname = "VIEW3D_OT_move",
 .gizmo = "GIZMO_GT_button_2d",
-ICON_VIEW_PAN,
+.icon = ICON_VIEW_PAN,
+.op_prop_fn = NULL,
 },
 {
 .opname = "VIEW3D_OT_rotate",
 .gizmo = "VIEW3D_GT_navigate_rotate",
-0,
+.icon = ICON_NONE,
+.op_prop_fn = NULL,
 },
 {
 .opname = "VIEW3D_OT_zoom",
 .gizmo = "GIZMO_GT_button_2d",
-ICON_VIEW_ZOOM,
+.icon = ICON_VIEW_ZOOM,
+.op_prop_fn = NULL,
 },
 {
 .opname = "VIEW3D_OT_view_persportho",
 .gizmo = "GIZMO_GT_button_2d",
-ICON_VIEW_PERSPECTIVE,
+.icon = ICON_VIEW_PERSPECTIVE,
+.op_prop_fn = NULL,
 },
 {
 .opname = "VIEW3D_OT_view_persportho",
 .gizmo = "GIZMO_GT_button_2d",
-ICON_VIEW_ORTHO,
+.icon = ICON_VIEW_ORTHO,
+.op_prop_fn = NULL,
 },
 {
 .opname = "VIEW3D_OT_view_camera",
 .gizmo = "GIZMO_GT_button_2d",
-ICON_VIEW_CAMERA,
+.icon = ICON_VIEW_CAMERA,
+.op_prop_fn = NULL,
+},
+{
+.opname = "WM_OT_context_toggle", /* GZ_INDEX_CAMERA_LOCK. Lock Camera 
to View. */
+.gizmo = "GIZMO_GT_button_2d",
+.icon = ICON_UNLOCKED,
+.op_prop_fn = navigate_context_toggle_camera_lock_init,
+},
+{
+.opname = "WM_OT_context_toggle", /* GZ_INDEX_CAMERA_UNLOCK. Unlock 
Camera to View. */
+.gizmo = "GIZMO_GT_button_2d",
+.icon = ICON_LOCKED,
+.op_prop_fn = navigate_context_toggle_camera_lock_init,
 },
 };
 
@@ -118,6 +146,7 @@ struct NavigateWidgetGroup {
   char is_persp;
   char is_camera;
   char viewlock;
+  char cameralock;
 } rv3d;
   } state;
   int region_size[2];
@@ -177,7 +206,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
 
 /* may be overwritten later */
 gz->scale_basis = GIZMO_MINI_SIZE / 2.0f;
-if (info->icon != 0) {
+if (info->icon != ICON_NONE) {
   PropertyRNA *prop = RNA_struct_find_property(gz->ptr, "icon");
   RNA_property_enum_set(gz->ptr, prop, info->icon);
   RNA_enum_set(
@@ -185,7 +214,10 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
 }
 
 wmOperatorType *ot = WM_operatortype_find(info->opname, true);
-WM_gizmo_operator_set(gz, 0, ot, NULL);
+PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot, NULL);
+if (info->op_prop_fn != NULL) {
+  info->op_prop_fn(ptr);
+}
   }
 
   {
@@ -195,7 +227,11 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, 
wmGizmoGroup *gzgroup)
 
   /* Click only buttons (not modal). */
   {
-int gz_ids[] = {GZ_INDEX_PERSP, GZ_INDEX_ORTHO, GZ_INDEX_CAMERA};
+int gz_ids[] = {GZ_INDEX_PERSP,
+GZ_INDEX_ORTHO,
+GZ_INDEX_CAMERA,
+GZ_INDEX_CAMERA_LOCK,
+GZ_INDEX_CAMERA_UNLOCK};
 for (int i = 0; i < ARRAY_SIZE(gz_ids); i++) {
   wmGizmo *gz = navgroup->gz_array[gz_ids[i]];
   RNA_boolean_set(gz->ptr, "show_drag", false);
@@ -243,6 +279,7 @@ static void WIDGETGROUP_navigate_draw_prepare(const 
bContext *C, wmGizmoGroup *g
   struct NavigateWidgetGroup *navgroup = gzgroup->customdata;
   ARegion *region = CTX_wm_region(C);
   const RegionView3D *rv3d = region->regiondata;
+  View3D *v3d = CTX_wm_view3d(C);
 
   for (int i = 0; i < 3; i++) {
 c

[Bf-blender-cvs] [14254112497] master: Cleanup/Refactor: Unify functions that redraw the depth buffer

2021-03-30 Thread Germano Cavalcante
Commit: 142541124976af41f08fb5479886350c2d803710
Author: Germano Cavalcante
Date:   Tue Mar 30 16:23:58 2021 -0300
Branches: master
https://developer.blender.org/rB142541124976af41f08fb5479886350c2d803710

Cleanup/Refactor: Unify functions that redraw the depth buffer

Now `ED_view3d_backbuf_depth_validate`, `ED_view3d_draw_depth` and
`ED_view3d_draw_depth_gpencil` are unified in `ED_view3d_depth_override`.

This new function replaces `ED_view3d_autodist_init`.

Also, since `ED_view3d_depth_update` depends on the render context, and
changing the context is a slow operation, that function also was removed,
and the depth buffer cached is now updated inside the new unified drawing
function when the "bool update_cache" parameter is true.

Finally `V3D_INVALID_BACKBUF` flag has been renamed and moved to
`runtime.flag`.

Differential revision: https://developer.blender.org/D10678

===

M   source/blender/blenkernel/intern/screen.c
M   source/blender/draw/DRW_engine.h
M   source/blender/draw/intern/draw_manager.c
M   source/blender/editors/curve/editcurve_paint.c
M   source/blender/editors/gpencil/annotate_paint.c
M   source/blender/editors/gpencil/gpencil_fill.c
M   source/blender/editors/gpencil/gpencil_paint.c
M   source/blender/editors/gpencil/gpencil_primitive.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/object/object_transform.c
M   source/blender/editors/physics/particle_edit.c
M   source/blender/editors/space_view3d/view3d_draw.c
M   source/blender/editors/space_view3d/view3d_edit.c
M   source/blender/editors/space_view3d/view3d_intern.h
M   source/blender/editors/space_view3d/view3d_utils.c
M   source/blender/makesdna/DNA_view3d_types.h
M   source/blender/windowmanager/intern/wm_draw.c

===

diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 1766ac5b85f..9617ef68a7d 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -1527,9 +1527,6 @@ static void direct_link_area(BlendDataReader *reader, 
ScrArea *area)
 
 if (sl->spacetype == SPACE_VIEW3D) {
   View3D *v3d = (View3D *)sl;
-
-  v3d->flag |= V3D_INVALID_BACKBUF;
-
   if (v3d->gpd) {
 BLO_read_data_address(reader, &v3d->gpd);
 BKE_gpencil_blend_read_data(reader, v3d->gpd);
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 2d5b93f4272..8a35ab2aeb9 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -118,8 +118,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
 void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
  struct ARegion *region,
  struct View3D *v3d,
- struct GPUViewport *viewport,
- bool use_opengl_context);
+ struct GPUViewport *viewport);
 void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
  struct ARegion *region,
  struct View3D *v3d,
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index a088c27d3f3..c09b4719f3a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2601,8 +2601,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph 
*depsgraph,
 void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
  ARegion *region,
  View3D *v3d,
- GPUViewport *viewport,
- bool use_opengl_context)
+ GPUViewport *viewport)
 {
   /* Reset before using it. */
   drw_state_prepare_clean_for_draw(&DST);
@@ -2618,7 +2617,7 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
 }
   }
 
-  drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, 
use_opengl_context);
+  drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, false);
 }
 
 /**
@@ -2634,7 +2633,7 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph 
*depsgraph,
 
   use_drw_engine(&draw_engine_gpencil_type);
 
-  drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, true);
+  drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, false);
 }
 
 void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, 
const rcti *rect)
@@ -2725,7 +2724,6 @@ void DRW_draw_depth_object(
 {
   RegionView3D *rv3d = region->regiondata;
 
-  DRW_opengl_context_enable();
   GPU_matrix_projection_set(rv3d->winmat);
   GPU_matrix_set(rv3d->viewmat);
   GPU_matrix_mul(object->obmat);
@@ -2784,7 +2782,6 @@ void DRW_draw_depth_object(
   GPU_matrix_set(rv3d->viewmat);
   GPU_d

[Bf-blender-cvs] [54d7dea2833] master: Fix: buttons whose property contains an 'owner_id' ignore rna undo check

2021-03-30 Thread Germano Cavalcante
Commit: 54d7dea283360a8a4f46733feb7b3ec731eafafc
Author: Germano Cavalcante
Date:   Tue Mar 30 16:10:58 2021 -0300
Branches: master
https://developer.blender.org/rB54d7dea283360a8a4f46733feb7b3ec731eafafc

Fix: buttons whose property contains an 'owner_id' ignore rna undo check

Introduced in rBce462fa1 but harmless since curretly only `StructRNA`
without `owner_id` have the `STRUCT_UNDO` flag cleared.

So this commit does not bring any functional changes but it will be
useful for {D10695}.

===

M   source/blender/editors/interface/interface.c
M   source/blender/makesrna/RNA_types.h

===

diff --git a/source/blender/editors/interface/interface.c 
b/source/blender/editors/interface/interface.c
index 29d26359c8b..6caee42ac33 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1038,7 +1038,6 @@ static bool ui_but_is_rna_undo(const uiBut *but)
 if (ID_CHECK_UNDO(id) == false) {
   return false;
 }
-return true;
   }
   if (but->rnapoin.type && !RNA_struct_undo_check(but->rnapoin.type)) {
 return false;
diff --git a/source/blender/makesrna/RNA_types.h 
b/source/blender/makesrna/RNA_types.h
index c4f6707dad5..78192f937e6 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -619,7 +619,7 @@ typedef enum StructFlag {
   /** Indicates that this struct is an ID struct, and to use 
reference-counting. */
   STRUCT_ID = (1 << 0),
   STRUCT_ID_REFCOUNT = (1 << 1),
-  /** defaults on, clear for user preferences and similar */
+  /** defaults on, indicates when changes in members of a StructRNA should 
trigger undo steps. */
   STRUCT_UNDO = (1 << 2),
 
   /* internal flags */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [da1b002c8d2] master: UI: Skip undo steps when changing properties of the 3d cursor

2021-03-30 Thread Germano Cavalcante
Commit: da1b002c8d2f331d97458167746e5974d8556799
Author: Germano Cavalcante
Date:   Tue Mar 30 16:13:21 2021 -0300
Branches: master
https://developer.blender.org/rBda1b002c8d2f331d97458167746e5974d8556799

UI: Skip undo steps when changing properties of the 3d cursor

Differential revision: https://developer.blender.org/D10695

===

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

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 316619a30ba..65643aa92d7 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2685,6 +2685,7 @@ static void rna_def_view3d_cursor(BlenderRNA *brna)
   RNA_def_struct_path_func(srna, "rna_View3DCursor_path");
   RNA_def_struct_ui_text(srna, "3D Cursor", "");
   RNA_def_struct_ui_icon(srna, ICON_CURSOR);
+  RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 
   prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [67b40f829e2] master: Fix T87058: GPencil Cutter delete all strokes if they are selected and the layer is locked

2021-03-30 Thread Antonio Vazquez
Commit: 67b40f829e29ce7006de30ebcc75cf8ef82da269
Author: Antonio Vazquez
Date:   Tue Mar 30 19:43:45 2021 +0200
Branches: master
https://developer.blender.org/rB67b40f829e29ce7006de30ebcc75cf8ef82da269

Fix T87058: GPencil Cutter delete all strokes if they are selected and the 
layer is locked

The problem was produced because the strokes were selected, but the loop to 
clear this flag before applying cutter was using unlocked layers only, and the 
protected layer flag was not reset.

Now, the flag is reset for all layers, locked and unlocked.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 4bbd475dd2c..99c9bfa3a56 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4979,17 +4979,27 @@ static int gpencil_cutter_lasso_select(bContext *C,
   /* init space conversion stuff */
   gpencil_point_conversion_init(C, &gsc);
 
-  /* deselect all strokes first */
-  CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
-int i;
-for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
-  pt->flag &= ~GP_SPOINT_SELECT;
-}
+  /* Deselect all strokes. */
+  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
+for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
+  LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+if (gps->flag & GP_STROKE_SELECT) {
+  int i;
+  for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+pt->flag &= ~GP_SPOINT_SELECT;
+  }
 
-gps->flag &= ~GP_STROKE_SELECT;
-BKE_gpencil_stroke_select_index_reset(gps);
+  gps->flag &= ~GP_STROKE_SELECT;
+  BKE_gpencil_stroke_select_index_reset(gps);
+}
+  }
+  /* if not multiedit, exit loop. */
+  if (!is_multiedit) {
+break;
+  }
+}
   }
-  CTX_DATA_END;
 
   /* Select points */
   LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a0a0edc3994] asset-browser-poselib: Fix File Browser double-click not working while in pose mode

2021-03-30 Thread Julian Eisel
Commit: a0a0edc399424f40a9a570008452884a432319c4
Author: Julian Eisel
Date:   Tue Mar 30 18:42:39 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rBa0a0edc399424f40a9a570008452884a432319c4

Fix File Browser double-click not working while in pose mode

The pose apply operator would be invoked when double-clicking a
directory in the File Browser, while in pose mode.
The operator's poll would succeed because since 29887bbb329d, the
File/Asset Browser would just create a `AssetHandle` from the active
file received from context, without ensuring that the file actually
represents an asset.

===

M   source/blender/blenkernel/intern/context.c
M   source/blender/editors/asset/asset_edit.cc
M   source/blender/editors/space_file/space_file.c

===

diff --git a/source/blender/blenkernel/intern/context.c 
b/source/blender/blenkernel/intern/context.c
index f287a46a5cb..b55b8ee8d32 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1421,7 +1421,7 @@ AssetHandle CTX_wm_asset_handle(const bContext *C, bool 
*r_is_valid)
* require returning a non-owning pointer, which we don't have in the Asset 
Browser (yet). */
   FileDirEntry *file =
   (FileDirEntry *)CTX_data_pointer_get_type(C, "active_file", 
&RNA_FileSelectEntry).data;
-  if (file) {
+  if (file && file->asset_data) {
 *r_is_valid = true;
 return (AssetHandle){.file_data = file};
   }
diff --git a/source/blender/editors/asset/asset_edit.cc 
b/source/blender/editors/asset/asset_edit.cc
index e4c6f94ed24..48bd1188471 100644
--- a/source/blender/editors/asset/asset_edit.cc
+++ b/source/blender/editors/asset/asset_edit.cc
@@ -195,6 +195,7 @@ AssetTempIDConsumer *ED_asset_temp_id_consumer_create(const 
AssetHandle *handle)
   if (!handle) {
 return nullptr;
   }
+  BLI_assert(handle->file_data->asset_data != nullptr);
   return reinterpret_cast(
   OBJECT_GUARDED_NEW(AssetTemporaryIDConsumer, *handle));
 }
diff --git a/source/blender/editors/space_file/space_file.c 
b/source/blender/editors/space_file/space_file.c
index 6cf75a67432..210f78033ca 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -886,6 +886,9 @@ static int /*eContextResult*/ file_context(const bContext 
*C,
   }
   if (CTX_data_equals(member, "asset_library")) {
 FileAssetSelectParams *asset_params = 
ED_fileselect_get_asset_params(sfile);
+if (!asset_params) {
+  return CTX_RESULT_NO_DATA;
+}
 
 BLI_STATIC_ASSERT(offsetof(FileSelectAssetLibraryUID, type) ==
   offsetof(AssetLibraryReference, type),

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6ddd280b210] master: Nodes: Expose multi input socket in python API

2021-03-30 Thread Wannes Malfait
Commit: 6ddd280b21025cdce981f64cabae35348804b95c
Author: Wannes Malfait
Date:   Tue Mar 30 10:15:23 2021 -0500
Branches: master
https://developer.blender.org/rB6ddd280b21025cdce981f64cabae35348804b95c

Nodes: Expose multi input socket in python API

It was not possible to determine if a socket was multi input previously
with BPY. This patch exposes the flag as a read-only property of a node
socket. This is important for addons which automatically add connections
between nodes.

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

===

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

===

diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 32b75243537..277cfada44d 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9697,6 +9697,12 @@ static void rna_def_node_socket(BlenderRNA *brna)
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
 
+  prop = RNA_def_property(srna, "is_multi_input", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_MULTI_INPUT);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_ui_text(
+  prop, "Multi Input", "True if the socket can accept multiple ordered 
input links");
+
   prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
   RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6ea09db7a1e] master: Cleanup: Improve comment

2021-03-30 Thread Hans Goudey
Commit: 6ea09db7a1e62be0fad18cf2aed9976bc1f7336f
Author: Hans Goudey
Date:   Tue Mar 30 10:03:11 2021 -0500
Branches: master
https://developer.blender.org/rB6ea09db7a1e62be0fad18cf2aed9976bc1f7336f

Cleanup: Improve comment

===

M   source/blender/editors/object/object_modifier.c

===

diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index b13c2311dba..b28b7478721 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1131,13 +1131,15 @@ bool 
edit_modifier_invoke_properties_with_hover_no_active(bContext *C,
   }
 
   PointerRNA *panel_ptr = UI_region_panel_custom_data_under_cursor(C, event);
-  if ((panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
+  if (panel_ptr == NULL || RNA_pointer_is_null(panel_ptr)) {
 *r_retval = OPERATOR_CANCELLED;
 return false;
   }
 
   if (!RNA_struct_is_a(panel_ptr->type, &RNA_Modifier)) {
-/* Work around multiple operators using the same shortcut. */
+/* Work around multiple operators using the same shortcut. The operators 
for the other
+ * stacks in the property editor use the same key, and will not run after 
these return
+ * OPERATOR_CANCELLED. */
 *r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
 return false;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e5f0d176d4c] master: CMake: issue warnings when changing options

2021-03-30 Thread Ankit Meel
Commit: e5f0d176d4cfa020bfb4de78086007dcfd02e8f9
Author: Ankit Meel
Date:   Tue Mar 30 20:28:45 2021 +0530
Branches: master
https://developer.blender.org/rBe5f0d176d4cfa020bfb4de78086007dcfd02e8f9

CMake: issue warnings when changing options

Only done in top level CMakeLists, and platform_apple.

Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D10343

===

M   CMakeLists.txt
M   build_files/cmake/platform/platform_apple.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f3057bccf1..98e57bce01a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -236,9 +236,7 @@ option(WITH_SYSTEM_AUDASPACE "Build with external audaspace 
library installed on
 mark_as_advanced(WITH_AUDASPACE)
 mark_as_advanced(WITH_SYSTEM_AUDASPACE)
 
-if(NOT WITH_AUDASPACE)
-  set(WITH_SYSTEM_AUDASPACE OFF)
-endif()
+set_and_warn_dependency(WITH_AUDASPACE WITH_SYSTEM_AUDASPACE OFF)
 
 option(WITH_OPENMP"Enable OpenMP (has to be supported by the 
compiler)" ON)
 if(UNIX AND NOT APPLE)
@@ -704,13 +702,11 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
   message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be 
OFF")
 endif()
 
-if(NOT WITH_PYTHON)
-  set(WITH_CYCLES OFF)
-  set(WITH_DRACO OFF)
-endif()
+set_and_warn_dependency(WITH_PYTHON WITH_CYCLESOFF)
+set_and_warn_dependency(WITH_PYTHON WITH_DRACO OFF)
 
 if(WITH_DRACO AND NOT WITH_PYTHON_INSTALL)
-  message(STATUS "WITH_DRACO requires WITH_PYTHON_INSTALL to be ON, disabling 
WITH_DRACO for now")
+  message(WARNING "WITH_DRACO requires WITH_PYTHON_INSTALL to be ON, disabling 
WITH_DRACO for now")
   set(WITH_DRACO OFF)
 endif()
 
@@ -729,7 +725,7 @@ set_and_warn_dependency(WITH_PUGIXML WITH_OPENIMAGEIO  OFF)
 
 if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC))
-  message(STATUS "No dependencies need 'WITH_BOOST' forcing WITH_BOOST=OFF")
+  message(WARNING "No dependencies need 'WITH_BOOST' forcing WITH_BOOST=OFF")
   set(WITH_BOOST OFF)
 endif()
 
@@ -779,6 +775,7 @@ if(WITH_INSTALL_PORTABLE)
 endif()
 
 if(WITH_GHOST_SDL OR WITH_HEADLESS)
+  message(WARNING "Disabling Ghost Wayland, X11, Input IME, and OpenXR")
   set(WITH_GHOST_WAYLAND OFF)
   set(WITH_GHOST_X11 OFF)
   set(WITH_X11_XINPUTOFF)
@@ -809,7 +806,7 @@ endif()
 if(NOT WITH_CUDA_DYNLOAD)
   find_package(CUDA)
   if(NOT CUDA_FOUND)
-message("CUDA toolkit not found, using dynamic runtime loading of 
libraries instead")
+message(WARNING "CUDA toolkit not found, using dynamic runtime loading of 
libraries (WITH_CUDA_DYNLOAD) instead")
 set(WITH_CUDA_DYNLOAD ON)
   endif()
 endif()
@@ -1246,6 +1243,7 @@ if(WITH_OPENMP)
   find_library_static(OpenMP_LIBRARIES gomp 
${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
 endif()
   else()
+message(WARNING "OpenMP not found, disabling WITH_OPENMP")
 set(WITH_OPENMP OFF)
   endif()
 
@@ -1321,6 +1319,7 @@ list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU)
 if(WITH_BULLET AND WITH_SYSTEM_BULLET)
   find_package(Bullet)
   if(NOT BULLET_FOUND)
+message(WARNING "Bullet not found, disabling WITH_BULLET")
 set(WITH_BULLET OFF)
   endif()
 else()
diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index c4caff74966..0a9a41bc26f 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -56,6 +56,7 @@ list(APPEND ZLIB_LIBRARIES ${BZIP2_LIBRARIES})
 if(WITH_OPENAL)
   find_package(OpenAL)
   if(NOT OPENAL_FOUND)
+message(WARNING "OpenAL not found, disabling WITH_OPENAL")
 set(WITH_OPENAL OFF)
   endif()
 endif()
@@ -65,6 +66,7 @@ if(WITH_JACK)
 NAMES jackmp
   )
   if(NOT JACK_FRAMEWORK)
+message(WARNING "JACK not found, disabling WITH_JACK")
 set(WITH_JACK OFF)
   else()
 set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
@@ -357,7 +359,7 @@ if(WITH_CYCLES_OSL)
   if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER AND OSL_SHADER_DIR)
 set(OSL_FOUND TRUE)
   else()
-message(STATUS "OSL not found")
+message(WARNING "OSL not found, disabling WITH_CYCLES_OSL")
 set(WITH_CYCLES_OSL OFF)
   endif()
 endif()

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9f323e9bf79] master: UI: Bring back hover shortcuts for mesh modifiers

2021-03-30 Thread Hans Goudey
Commit: 9f323e9bf79fbf4157a1426fa83dde0c04747a5b
Author: Hans Goudey
Date:   Tue Mar 30 09:56:04 2021 -0500
Branches: master
https://developer.blender.org/rB9f323e9bf79fbf4157a1426fa83dde0c04747a5b

UI: Bring back hover shortcuts for mesh modifiers

Earlier last year, the shortcuts on hover were built as a way to regain
speed lost by removing the "Apply" and "Copy" buttons from the panel.
For the active modifier concept introduced for geometry nodes, the
shortcuts were changed to only affect the active modifier.

Based on feedback, this change slowed down many people's interaction
with the modifier stack so the UI team decided to return hover shortcuts
for modifier panels.

The downside of this change is that it looks like the active modifier is
"selected" and it could be confusing that the modifier shortcuts don't
apply to it. We can explore different ways to display the active status
to address this.

Ref T87012

===

M   source/blender/editors/object/object_modifier.c

===

diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 7673649c261..b13c2311dba 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1115,6 +1115,38 @@ bool edit_modifier_invoke_properties(bContext *C, 
wmOperator *op)
   return false;
 }
 
+/**
+ * If the "modifier" property is not set,fill the modifier property with the 
name of the modifier
+ * with a UI panel below the mouse cursor, without checking the context 
pointer. Used in order to
+ * apply modifier operators on hover over their panels. If this checked the 
context pointer then it
+ * would always use the active modifier, which isn't desired.
+ */
+bool edit_modifier_invoke_properties_with_hover_no_active(bContext *C,
+  wmOperator *op,
+  const wmEvent *event,
+  int *r_retval)
+{
+  if (RNA_struct_property_is_set(op->ptr, "modifier")) {
+return true;
+  }
+
+  PointerRNA *panel_ptr = UI_region_panel_custom_data_under_cursor(C, event);
+  if ((panel_ptr == NULL || RNA_pointer_is_null(panel_ptr))) {
+*r_retval = OPERATOR_CANCELLED;
+return false;
+  }
+
+  if (!RNA_struct_is_a(panel_ptr->type, &RNA_Modifier)) {
+/* Work around multiple operators using the same shortcut. */
+*r_retval = (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
+return false;
+  }
+
+  const ModifierData *md = panel_ptr->data;
+  RNA_string_set(op->ptr, "modifier", md->name);
+  return true;
+}
+
 ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
 {
   char modifier_name[MAX_NAME];
@@ -1174,14 +1206,13 @@ static int modifier_remove_exec(bContext *C, wmOperator 
*op)
   return OPERATOR_FINISHED;
 }
 
-static int modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent 
*UNUSED(event))
+static int modifier_remove_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
-  if (edit_modifier_invoke_properties(C, op)) {
+  int retval;
+  if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, 
&retval)) {
 return modifier_remove_exec(C, op);
   }
-
-  /* Work around multiple operators using the same shortcut. */
-  return (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
+  return retval;
 }
 
 void OBJECT_OT_modifier_remove(wmOperatorType *ot)
@@ -1221,13 +1252,13 @@ static int modifier_move_up_exec(bContext *C, 
wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-static int modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent 
*UNUSED(event))
+static int modifier_move_up_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
-  if (edit_modifier_invoke_properties(C, op)) {
+  int retval;
+  if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, 
&retval)) {
 return modifier_move_up_exec(C, op);
   }
-  /* Work around multiple operators using the same shortcut. */
-  return (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
+  return retval;
 }
 
 void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
@@ -1266,13 +1297,13 @@ static int modifier_move_down_exec(bContext *C, 
wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
-static int modifier_move_down_invoke(bContext *C, wmOperator *op, const 
wmEvent *UNUSED(event))
+static int modifier_move_down_invoke(bContext *C, wmOperator *op, const 
wmEvent *event)
 {
-  if (edit_modifier_invoke_properties(C, op)) {
+  int retval;
+  if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, 
&retval)) {
 return modifier_move_down_exec(C, op);
   }
-  /* Work around multiple operators using the same shortcut. */
-  return (OPERATOR_PASS_THROUGH | OPERATOR_CANCELLED);
+  return retval;
 }
 
 void OBJECT_OT_modifier_mov

[Bf-blender-cvs] [1f58a0ea3c7] master: Cleanup: use doxy sections and rearrange editmesh_knife.c

2021-03-30 Thread Germano Cavalcante
Commit: 1f58a0ea3c7a9ef0f6c3b35d254167227ffad6fb
Author: Germano Cavalcante
Date:   Tue Mar 30 11:49:58 2021 -0300
Branches: master
https://developer.blender.org/rB1f58a0ea3c7a9ef0f6c3b35d254167227ffad6fb

Cleanup: use doxy sections and rearrange editmesh_knife.c

===

M   source/blender/editors/mesh/editmesh_knife.c

===

diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index 19510712565..fb107795c2a 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -257,19 +257,263 @@ enum {
   KNF_MODAL_ADD_CUT_CLOSED,
 };
 
-static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f);
+/*  */
+/** \name Drawing
+ * \{ */
 
-static void knife_input_ray_segment(KnifeTool_OpData *kcd,
-const float mval[2],
-const float ofs,
-float r_origin[3],
-float r_origin_ofs[3]);
+static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
+{
+  float v1[3], v2[3];
+  float planes[4][4];
+
+  planes_from_projmat(
+  (const float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], 
planes[1], NULL, NULL);
+
+  /* ray-cast all planes */
+  {
+float ray_dir[3];
+float ray_hit_best[2][3] = {{UNPACK3(kcd->prev.cage)}, 
{UNPACK3(kcd->curr.cage)}};
+float lambda_best[2] = {-FLT_MAX, FLT_MAX};
+int i;
+
+/* we (sometimes) need the lines to be at the same depth before projecting 
*/
+#if 0
+sub_v3_v3v3(ray_dir, kcd->curr.cage, kcd->prev.cage);
+#else
+{
+  float curr_cage_adjust[3];
+  float co_depth[3];
+
+  copy_v3_v3(co_depth, kcd->prev.cage);
+  mul_m4_v3(kcd->ob->obmat, co_depth);
+  ED_view3d_win_to_3d(kcd->vc.v3d, kcd->region, co_depth, kcd->curr.mval, 
curr_cage_adjust);
+  mul_m4_v3(kcd->ob->imat, curr_cage_adjust);
+
+  sub_v3_v3v3(ray_dir, curr_cage_adjust, kcd->prev.cage);
+}
+#endif
+
+for (i = 0; i < 4; i++) {
+  float ray_hit[3];
+  float lambda_test;
+  if (isect_ray_plane_v3(kcd->prev.cage, ray_dir, planes[i], &lambda_test, 
false)) {
+madd_v3_v3v3fl(ray_hit, kcd->prev.cage, ray_dir, lambda_test);
+if (lambda_test < 0.0f) {
+  if (lambda_test > lambda_best[0]) {
+copy_v3_v3(ray_hit_best[0], ray_hit);
+lambda_best[0] = lambda_test;
+  }
+}
+else {
+  if (lambda_test < lambda_best[1]) {
+copy_v3_v3(ray_hit_best[1], ray_hit);
+lambda_best[1] = lambda_test;
+  }
+}
+  }
+}
+
+copy_v3_v3(v1, ray_hit_best[0]);
+copy_v3_v3(v2, ray_hit_best[1]);
+  }
+
+  uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 
3, GPU_FETCH_FLOAT);
+
+  immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
+  immUniformThemeColor3(TH_TRANSFORM);
+  GPU_line_width(2.0);
+
+  immBegin(GPU_PRIM_LINES, 2);
+  immVertex3fv(pos, v1);
+  immVertex3fv(pos, v2);
+  immEnd();
+
+  immUnbindProgram();
+}
+
+/* modal loop selection drawing callback */
+static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), 
void *arg)
+{
+  const KnifeTool_OpData *kcd = arg;
+  GPU_depth_test(GPU_DEPTH_NONE);
+
+  GPU_matrix_push_projection();
+  GPU_polygon_offset(1.0f, 1.0f);
+
+  GPU_matrix_push();
+  GPU_matrix_mul(kcd->ob->obmat);
+
+  if (kcd->mode == MODE_DRAGGING && kcd->is_angle_snapping) {
+knifetool_draw_angle_snapping(kcd);
+  }
+
+  GPUVertFormat *format = immVertexFormat();
+  uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, 
GPU_FETCH_FLOAT);
+
+  immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
+
+  if (kcd->mode == MODE_DRAGGING) {
+immUniformColor3ubv(kcd->colors.line);
+GPU_line_width(2.0);
+
+immBegin(GPU_PRIM_LINES, 2);
+immVertex3fv(pos, kcd->prev.cage);
+immVertex3fv(pos, kcd->curr.cage);
+immEnd();
+  }
+
+  if (kcd->prev.vert) {
+immUniformColor3ubv(kcd->colors.point);
+GPU_point_size(11 * UI_DPI_FAC);
+
+immBegin(GPU_PRIM_POINTS, 1);
+immVertex3fv(pos, kcd->prev.cage);
+immEnd();
+  }
+
+  if (kcd->prev.bmface || kcd->prev.edge) {
+immUniformColor3ubv(kcd->colors.curpoint);
+GPU_point_size(9 * UI_DPI_FAC);
+
+immBegin(GPU_PRIM_POINTS, 1);
+immVertex3fv(pos, kcd->prev.cage);
+immEnd();
+  }
+
+  if (kcd->curr.vert) {
+immUniformColor3ubv(kcd->colors.point);
+GPU_point_size(11 * UI_DPI_FAC);
+
+immBegin(GPU_PRIM_POINTS, 1);
+immVertex3fv(pos, kcd->curr.cage);
+immEnd();
+  }
+  else if (kcd->curr.edge) {
+immUniformColor3ubv(kcd->colors.edge);
+GPU_line_width(2.0);
+
+immBegin(GPU_PRIM_LINES, 2);
+immV

[Bf-blender-cvs] [adbd571f522] temp-gpencil-bezier-stroke-type: Merge branch 'master' into temp-gpencil-bezier-stroke-type

2021-03-30 Thread Antonio Vazquez
Commit: adbd571f522e9397e7f3fa10e7c52bb5c722d910
Author: Antonio Vazquez
Date:   Tue Mar 30 16:39:36 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rBadbd571f522e9397e7f3fa10e7c52bb5c722d910

Merge branch 'master' into temp-gpencil-bezier-stroke-type

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6e5080bd643] temp-gpencil-bezier-stroke-type: GPencil: Add Bezier support to Mirror modifier

2021-03-30 Thread Antonio Vazquez
Commit: 6e5080bd643c443f11bdbbda6fbb4d70e8e4a785
Author: Antonio Vazquez
Date:   Tue Mar 30 16:34:38 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB6e5080bd643c443f11bdbbda6fbb4d70e8e4a785

GPencil: Add Bezier support to Mirror modifier

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
index ac51f5139f5..a565fa8b88b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
@@ -39,6 +39,7 @@
 
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
+#include "BKE_gpencil_geom.h"
 #include "BKE_gpencil_modifier.h"
 #include "BKE_lib_query.h"
 #include "BKE_main.h"
@@ -79,8 +80,20 @@ static void update_mirror_local(bGPDstroke *gps, int axis)
   float factor[3] = {1.0f, 1.0f, 1.0f};
   factor[axis] = -1.0f;
 
-  for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
-mul_v3_v3(&pt->x, factor);
+  if (GPENCIL_STROKE_TYPE_BEZIER(gps)) {
+bGPDcurve *gpc = gps->editcurve;
+for (int i = 0; i < gpc->tot_curve_points; i++) {
+  bGPDcurve_point *pt = &gpc->curve_points[i];
+  BezTriple *bezt = &pt->bezt;
+  for (int j = 0; j < 3; j++) {
+mul_v3_v3(bezt->vec[j], factor);
+  }
+}
+  }
+  else {
+for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+  mul_v3_v3(&pt->x, factor);
+}
   }
 }
 
@@ -101,8 +114,20 @@ static void update_mirror_object(Object *ob,
   invert_m4_m4(itmp, tmp);
   mul_m4_series(mtx, itmp, mtx, tmp);
 
-  for (int i = 0; i < gps->totpoints; i++) {
-mul_m4_v3(mtx, &gps->points[i].x);
+  if (GPENCIL_STROKE_TYPE_BEZIER(gps)) {
+bGPDcurve *gpc = gps->editcurve;
+for (int i = 0; i < gpc->tot_curve_points; i++) {
+  bGPDcurve_point *pt = &gpc->curve_points[i];
+  BezTriple *bezt = &pt->bezt;
+  for (int j = 0; j < 3; j++) {
+mul_m4_v3(mtx, bezt->vec[j]);
+  }
+}
+  }
+  else {
+for (int i = 0; i < gps->totpoints; i++) {
+  mul_m4_v3(mtx, &gps->points[i].x);
+}
   }
 }
 
@@ -120,6 +145,7 @@ static void generate_geometry(GpencilModifierData *md, 
Object *ob, bGPDlayer *gp
 {
   MirrorGpencilModifierData *mmd = (MirrorGpencilModifierData *)md;
   bGPDstroke *gps, *gps_new = NULL;
+  bGPdata *gpd = ob->data;
   int tot_strokes;
   int i;
 
@@ -145,6 +171,10 @@ static void generate_geometry(GpencilModifierData *md, 
Object *ob, bGPDlayer *gp
mmd->flag & 
GP_MIRROR_INVERT_MATERIAL)) {
   gps_new = BKE_gpencil_stroke_duplicate(gps, true, true);
   update_position(ob, mmd, gps_new, xi);
+  if (GPENCIL_STROKE_TYPE_BEZIER(gps_new)) {
+gps_new->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
+BKE_gpencil_stroke_geometry_update(gpd, gps_new);
+  }
   BLI_addtail(&gpf->strokes, gps_new);
 }
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b1380101df5] master: Geometry Nodes: Set default grid vertices to 3 by 3

2021-03-30 Thread Hans Goudey
Commit: b1380101df5dbb5334bd747028de4e2dbcc7de24
Author: Hans Goudey
Date:   Tue Mar 30 09:33:42 2021 -0500
Branches: master
https://developer.blender.org/rBb1380101df5dbb5334bd747028de4e2dbcc7de24

Geometry Nodes: Set default grid vertices to 3 by 3

This is a relatively arbitrary value, but a good starting point-- it's
simple while also showing the possibility of the subdivisions.

Ref T86819

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
index df4fd70d2b0..1b9ec91a2f6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
@@ -29,8 +29,8 @@
 
 static bNodeSocketTemplate geo_node_mesh_primitive_grid_in[] = {
 {SOCK_FLOAT, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX, 
PROP_DISTANCE},
-{SOCK_INT, N_("Vertices X"), 10, 0.0f, 0.0f, 0.0f, 2, 1000},
-{SOCK_INT, N_("Vertices Y"), 10, 0.0f, 0.0f, 0.0f, 2, 1000},
+{SOCK_INT, N_("Vertices X"), 3, 0.0f, 0.0f, 0.0f, 2, 1000},
+{SOCK_INT, N_("Vertices Y"), 3, 0.0f, 0.0f, 0.0f, 2, 1000},
 {-1, ""},
 };

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a4b6c222fad] master: Fix unused variable warning caused by recent cleanup

2021-03-30 Thread Hans Goudey
Commit: a4b6c222fad275cea00b5beca504827db650e33c
Author: Hans Goudey
Date:   Tue Mar 30 09:18:33 2021 -0500
Branches: master
https://developer.blender.org/rBa4b6c222fad275cea00b5beca504827db650e33c

Fix unused variable warning caused by recent cleanup

Caused by a cleanup, rBd037fef3bd1dc.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform.cc 
b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
index 6213e4ff7d2..83525aa0d22 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transform.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
@@ -133,7 +133,7 @@ static void transform_volume(Volume *volume,
   Main *bmain = DEG_get_bmain(params.depsgraph());
   BKE_volume_load(volume, bmain);
 
-  const float4x4 matrix = float4x4::from_loc_eul_scale(translation, rotation, 
scale);
+  const float4x4 matrix = float4x4::from_loc_eul_scale(translation, rotation, 
limited_scale);
 
   openvdb::Mat4s vdb_matrix;
   memcpy(vdb_matrix.asPointer(), matrix, sizeof(float[4][4]));

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [60956efdd81] temp-compositor-single-threaded-operation: Revert incorrect change.

2021-03-30 Thread Jeroen Bakker
Commit: 60956efdd8102e3f43de1c08f484bd7591e2031c
Author: Jeroen Bakker
Date:   Tue Mar 30 16:15:48 2021 +0200
Branches: temp-compositor-single-threaded-operation
https://developer.blender.org/rB60956efdd8102e3f43de1c08f484bd7591e2031c

Revert incorrect change.

===

M   source/blender/compositor/intern/COM_ExecutionGroup.cc

===

diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc 
b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index f0e205eb44a..531b4df6200 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -107,6 +107,7 @@ bool ExecutionGroup::addOperation(NodeOperation *operation)
   operation->get_flags().single_threaded) {
 m_flags.complex = operation->get_flags().complex;
 m_flags.open_cl = operation->get_flags().open_cl;
+m_flags.single_threaded = operation->get_flags().single_threaded;
 m_flags.initialized = true;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [10645a93727] temp-compositor-single-threaded-operation: Compositor: Merge SingleThreadedOperation with WriteBufferOperation.

2021-03-30 Thread Jeroen Bakker
Commit: 10645a93727dc7f5c174800333f9a728bd6fc1a8
Author: Jeroen Bakker
Date:   Tue Mar 30 16:07:03 2021 +0200
Branches: temp-compositor-single-threaded-operation
https://developer.blender.org/rB10645a93727dc7f5c174800333f9a728bd6fc1a8

Compositor: Merge SingleThreadedOperation with WriteBufferOperation.

Single threaded operations always creates a buffer around and write
buffer operation would sample that buffer one pixel at a time. This
refactor would push the samples in one go to the output buffer by
merging the write buffer and single threaded operation.

Less code complexity, less needed CPU cycles and less memory would be
needed.

===

M   source/blender/compositor/intern/COM_ExecutionGroup.cc
M   source/blender/compositor/intern/COM_NodeOperationBuilder.cc
M   source/blender/compositor/intern/COM_SingleThreadedOperation.cc
M   source/blender/compositor/intern/COM_SingleThreadedOperation.h
M   source/blender/compositor/operations/COM_DenoiseOperation.cc
M   source/blender/compositor/operations/COM_DenoiseOperation.h
M   source/blender/compositor/operations/COM_GlareBaseOperation.cc
M   source/blender/compositor/operations/COM_GlareBaseOperation.h
M   source/blender/compositor/operations/COM_WriteBufferOperation.cc
M   source/blender/compositor/operations/COM_WriteBufferOperation.h

===

diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc 
b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index 87c9e6e8a69..f0e205eb44a 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -102,11 +102,11 @@ bool ExecutionGroup::addOperation(NodeOperation 
*operation)
 return false;
   }
 
-  if (!operation->get_flags().is_read_buffer_operation &&
-  !operation->get_flags().is_write_buffer_operation) {
+  if ((!operation->get_flags().is_read_buffer_operation &&
+   !operation->get_flags().is_write_buffer_operation) ||
+  operation->get_flags().single_threaded) {
 m_flags.complex = operation->get_flags().complex;
 m_flags.open_cl = operation->get_flags().open_cl;
-m_flags.single_threaded = operation->get_flags().single_threaded;
 m_flags.initialized = true;
   }
 
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc 
b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
index fdd48da3fb4..e0d24e88e10 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
@@ -490,6 +490,11 @@ void 
NodeOperationBuilder::add_output_buffers(NodeOperation *operation,
   }
 
   WriteBufferOperation *writeOperation = nullptr;
+  if (operation->get_flags().is_write_buffer_operation) {
+writeOperation = static_cast(operation);
+writeOperation->setbNodeTree(m_context->getbNodeTree());
+  }
+
   for (NodeOperationInput *target : targets) {
 /* try to find existing write buffer operation */
 if (target->getOperation().get_flags().is_write_buffer_operation) {
diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc 
b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc
index 01be6e1afed..09601bdc3c5 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc
+++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc
@@ -20,44 +20,42 @@
 
 namespace blender::compositor {
 
-SingleThreadedOperation::SingleThreadedOperation()
+SingleThreadedOperation::SingleThreadedOperation(DataType data_type)
+: WriteBufferOperation(data_type, false)
 {
-  this->m_cachedInstance = nullptr;
+  addOutputSocket(data_type);
   flags.complex = true;
   flags.single_threaded = true;
 }
 
 void SingleThreadedOperation::initExecution()
 {
+  WriteBufferOperation::initExecution();
   initMutex();
 }
 
-void SingleThreadedOperation::executePixel(float output[4], int x, int y, void 
* /*data*/)
-{
-  this->m_cachedInstance->readNoCheck(output, x, y);
-}
-
 void SingleThreadedOperation::deinitExecution()
 {
+  WriteBufferOperation::deinitExecution();
   deinitMutex();
-  if (this->m_cachedInstance) {
-delete this->m_cachedInstance;
-this->m_cachedInstance = nullptr;
-  }
 }
-void *SingleThreadedOperation::initializeTileData(rcti *rect)
+
+void SingleThreadedOperation::executeRegion(rcti *rect, unsigned int 
UNUSED(tile_number))
 {
-  if (this->m_cachedInstance) {
-return this->m_cachedInstance;
+  if (executed) {
+return;
   }
-
   lockMutex();
-  if (this->m_cachedInstance == nullptr) {
-//
-this->m_cachedInstance = createMemoryBuffer(rect);
+  if (executed) {
+return;
   }
+
+  MemoryBuffer buffer = createMemoryBuffer(rect);
+  MemoryBuffer *memory_buffer = getMemoryProxy()->getBuffer();
+  memory_buffer->fill_from(buffer);
+
   unlockMutex();
-  return this->m_

[Bf-blender-cvs] [04a92297ddf] master: Cleanup: Replace std::vector with blender::Vector.

2021-03-30 Thread Jeroen Bakker
Commit: 04a92297ddfb86b1766733461f01104bcbd5b38e
Author: Jeroen Bakker
Date:   Tue Mar 30 12:27:53 2021 +0200
Branches: master
https://developer.blender.org/rB04a92297ddfb86b1766733461f01104bcbd5b38e

Cleanup: Replace std::vector with blender::Vector.

===

M   source/blender/compositor/intern/COM_Node.cc
M   source/blender/compositor/intern/COM_Node.h
M   source/blender/compositor/intern/COM_NodeGraph.cc
M   source/blender/compositor/intern/COM_NodeGraph.h
M   source/blender/compositor/nodes/COM_CryptomatteNode.cc
M   source/blender/compositor/nodes/COM_ImageNode.cc
M   source/blender/compositor/nodes/COM_OutputFileNode.cc
M   source/blender/compositor/nodes/COM_RenderLayersNode.cc
M   source/blender/compositor/operations/COM_CryptomatteOperation.cc
M   source/blender/compositor/operations/COM_CryptomatteOperation.h
M   source/blender/compositor/operations/COM_OutputFileOperation.cc
M   source/blender/compositor/operations/COM_OutputFileOperation.h

===

diff --git a/source/blender/compositor/intern/COM_Node.cc 
b/source/blender/compositor/intern/COM_Node.cc
index 517f23f13cd..6ac48e3646c 100644
--- a/source/blender/compositor/intern/COM_Node.cc
+++ b/source/blender/compositor/intern/COM_Node.cc
@@ -76,13 +76,11 @@ Node::Node(bNode *editorNode, bool create_sockets)
 
 Node::~Node()
 {
-  while (!this->m_outputsockets.empty()) {
-delete (this->m_outputsockets.back());
-this->m_outputsockets.pop_back();
+  while (!this->outputs.is_empty()) {
+delete (this->outputs.pop_last());
   }
-  while (!this->m_inputsockets.empty()) {
-delete (this->m_inputsockets.back());
-this->m_inputsockets.pop_back();
+  while (!this->inputs.is_empty()) {
+delete (this->inputs.pop_last());
   }
 }
 
@@ -94,7 +92,7 @@ void Node::addInputSocket(DataType datatype)
 void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket)
 {
   NodeInput *socket = new NodeInput(this, bSocket, datatype);
-  this->m_inputsockets.push_back(socket);
+  this->inputs.append(socket);
 }
 
 void Node::addOutputSocket(DataType datatype)
@@ -104,19 +102,17 @@ void Node::addOutputSocket(DataType datatype)
 void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket)
 {
   NodeOutput *socket = new NodeOutput(this, bSocket, datatype);
-  this->m_outputsockets.push_back(socket);
+  outputs.append(socket);
 }
 
 NodeOutput *Node::getOutputSocket(unsigned int index) const
 {
-  BLI_assert(index < this->m_outputsockets.size());
-  return this->m_outputsockets[index];
+  return outputs[index];
 }
 
 NodeInput *Node::getInputSocket(unsigned int index) const
 {
-  BLI_assert(index < this->m_inputsockets.size());
-  return this->m_inputsockets[index];
+  return inputs[index];
 }
 
 bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
diff --git a/source/blender/compositor/intern/COM_Node.h 
b/source/blender/compositor/intern/COM_Node.h
index 5b168ef87fd..9aca1a8ff44 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -18,10 +18,12 @@
 
 #pragma once
 
+#include "BLI_vector.hh"
+
 #include "DNA_node_types.h"
+
 #include 
 #include 
-#include 
 
 /* common node includes
  * added here so node files don't have to include themselves
@@ -38,10 +40,6 @@ class NodeConverter;
  * My node documentation.
  */
 class Node {
- public:
-  typedef std::vector Inputs;
-  typedef std::vector Outputs;
-
  private:
   /**
* \brief stores the reference to the SDNA bNode struct
@@ -53,16 +51,6 @@ class Node {
*/
   bNode *m_editorNode;
 
-  /**
-   * \brief the list of actual inputsockets \see NodeInput
-   */
-  Inputs m_inputsockets;
-
-  /**
-   * \brief the list of actual outputsockets \see NodeOutput
-   */
-  Outputs m_outputsockets;
-
   /**
* \brief Is this node part of the active group
*/
@@ -75,20 +63,14 @@ class Node {
 
  protected:
   /**
-   * \brief get access to the vector of input sockets
+   * \brief the list of actual inputsockets \see NodeInput
*/
-  const Inputs &getInputSockets() const
-  {
-return this->m_inputsockets;
-  }
+  blender::Vector inputs;
 
   /**
-   * \brief get access to the vector of input sockets
+   * \brief the list of actual outputsockets \see NodeOutput
*/
-  const Outputs &getOutputSockets() const
-  {
-return this->m_outputsockets;
-  }
+  blender::Vector outputs;
 
  public:
   Node(bNode *editorNode, bool create_sockets = true);
@@ -131,19 +113,19 @@ class Node {
   }
 
   /**
-   * \brief Return the number of input sockets of this node.
+   * \brief get access to the vector of input sockets
*/
-  unsigned int getNumberOfInputSockets() const
+  const blender::Vector &getInputSockets() const
   {
-return this->m_inputsockets.size();
+return this->inputs;
   }
 
   /**
-   * \brief Return the number of output sock

[Bf-blender-cvs] [88e0ed32888] master: Cleanup: Use constexpr.

2021-03-30 Thread Jeroen Bakker
Commit: 88e0ed32888f4a87ec1192e3b54aebe8686e029c
Author: Jeroen Bakker
Date:   Tue Mar 30 14:12:41 2021 +0200
Branches: master
https://developer.blender.org/rB88e0ed32888f4a87ec1192e3b54aebe8686e029c

Cleanup: Use constexpr.

===

M   source/blender/compositor/COM_defines.h
M   source/blender/compositor/intern/COM_MemoryBuffer.cc
M   source/blender/compositor/intern/COM_compositor.cc
M   source/blender/compositor/operations/COM_BokehBlurOperation.cc
M   source/blender/compositor/operations/COM_CompositorOperation.cc
M   source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc
M   source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc
M   source/blender/compositor/operations/COM_GlareFogGlowOperation.cc
M   source/blender/compositor/operations/COM_GlareGhostOperation.cc
M   source/blender/compositor/operations/COM_InpaintOperation.cc
M   source/blender/compositor/operations/COM_SunBeamsOperation.cc
M   
source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc
M   source/blender/compositor/operations/COM_VectorBlurOperation.cc

===

diff --git a/source/blender/compositor/COM_defines.h 
b/source/blender/compositor/COM_defines.h
index 66da43eda89..7e580f40d97 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -33,6 +33,22 @@ enum class DataType {
   Color = 2,
 };
 
+/**
+ * Utility to get the number of channels of the given data type.
+ */
+constexpr int COM_data_type_num_channels(const DataType datatype)
+{
+  switch (datatype) {
+case DataType::Value:
+  return 1;
+case DataType::Vector:
+  return 3;
+case DataType::Color:
+default:
+  return 4;
+  }
+}
+
 /**
  * \brief Possible quality settings
  * \see CompositorContext.quality
@@ -63,7 +79,6 @@ enum class CompositorPriority {
 // configurable items
 
 // chunk size determination
-#define COM_PREVIEW_SIZE 140.0f
 // #define COM_DEBUG
 
 // chunk order
@@ -84,12 +99,8 @@ enum class ChunkOrdering {
   Default = ChunkOrdering::CenterOut,
 };
 
-#define COM_RULE_OF_THIRDS_DIVIDER 100.0f
-
-#define COM_NUM_CHANNELS_VALUE 1
-#define COM_NUM_CHANNELS_VECTOR 3
-#define COM_NUM_CHANNELS_COLOR 4
-
-#define COM_BLUR_BOKEH_PIXELS 512
+constexpr float COM_PREVIEW_SIZE = 140.f;
+constexpr float COM_RULE_OF_THIRDS_DIVIDER = 100.0f;
+constexpr float COM_BLUR_BOKEH_PIXELS = 512;
 
 }  // namespace blender::compositor
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc 
b/source/blender/compositor/intern/COM_MemoryBuffer.cc
index 241e0c66aeb..d9694169ab8 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cc
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc
@@ -22,24 +22,12 @@
 
 namespace blender::compositor {
 
-static unsigned int determine_num_channels(DataType datatype)
-{
-  switch (datatype) {
-case DataType::Value:
-  return COM_NUM_CHANNELS_VALUE;
-case DataType::Vector:
-  return COM_NUM_CHANNELS_VECTOR;
-case DataType::Color:
-default:
-  return COM_NUM_CHANNELS_COLOR;
-  }
-}
 
 MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, 
MemoryBufferState state)
 {
   m_rect = rect;
   this->m_memoryProxy = memoryProxy;
-  this->m_num_channels = determine_num_channels(memoryProxy->getDataType());
+  this->m_num_channels = 
COM_data_type_num_channels(memoryProxy->getDataType());
   this->m_buffer = (float *)MEM_mallocN_aligned(
   sizeof(float) * buffer_len() * this->m_num_channels, 16, 
"COM_MemoryBuffer");
   this->m_state = state;
@@ -50,7 +38,7 @@ MemoryBuffer::MemoryBuffer(DataType dataType, const rcti 
&rect)
 {
   m_rect = rect;
   this->m_memoryProxy = nullptr;
-  this->m_num_channels = determine_num_channels(dataType);
+  this->m_num_channels = COM_data_type_num_channels(dataType);
   this->m_buffer = (float *)MEM_mallocN_aligned(
   sizeof(float) * buffer_len() * this->m_num_channels, 16, 
"COM_MemoryBuffer");
   this->m_state = MemoryBufferState::Temporary;
diff --git a/source/blender/compositor/intern/COM_compositor.cc 
b/source/blender/compositor/intern/COM_compositor.cc
index 3aa711c6594..5839f53976b 100644
--- a/source/blender/compositor/intern/COM_compositor.cc
+++ b/source/blender/compositor/intern/COM_compositor.cc
@@ -46,12 +46,12 @@ static void compositor_init_node_previews(const RenderData 
*render_data, bNodeTr
1.0f;
   int preview_width, preview_height;
   if (aspect < 1.0f) {
-preview_width = COM_PREVIEW_SIZE;
-preview_height = (int)(COM_PREVIEW_SIZE * aspect);
+preview_width = blender::compositor::COM_PREVIEW_SIZE;
+preview_height = (int)(blender::compositor::COM_PREVIEW_SIZE * aspect);
   }
   else {
-preview_width = (int)(COM_PREVIEW_SIZE / aspect);
-preview_height = COM_PREVIEW_SIZE;
+preview_width

[Bf-blender-cvs] [88b5d7f5f39] master: Cleanup: remove unneeded method.

2021-03-30 Thread Jeroen Bakker
Commit: 88b5d7f5f39265af05f509b1be42277ebbdc3f7d
Author: Jeroen Bakker
Date:   Tue Mar 30 14:25:14 2021 +0200
Branches: master
https://developer.blender.org/rB88b5d7f5f39265af05f509b1be42277ebbdc3f7d

Cleanup: remove unneeded method.

size can be accessed via instance attribute.

===

M   source/blender/compositor/intern/COM_NodeOperation.cc
M   source/blender/compositor/intern/COM_NodeOperation.h

===

diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc 
b/source/blender/compositor/intern/COM_NodeOperation.cc
index cb2134ae5f1..297ef100a1b 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cc
+++ b/source/blender/compositor/intern/COM_NodeOperation.cc
@@ -131,7 +131,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti 
*input,
  ReadBufferOperation 
*readOperation,
  rcti *output)
 {
-  if (isInputOperation()) {
+  if (m_inputs.size() == 0) {
 BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
 return false;
   }
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h 
b/source/blender/compositor/intern/COM_NodeOperation.h
index 1a299160cee..f300fb092a3 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -311,14 +311,6 @@ class NodeOperation {
   NodeOperationOutput *getOutputSocket(unsigned int index = 0);
   NodeOperationInput *getInputSocket(unsigned int index);
 
-  /** Check if this is an input operation
-   * An input operation is an operation that only has output sockets and no 
input sockets
-   */
-  bool isInputOperation() const
-  {
-return m_inputs.is_empty();
-  }
-
   /**
* \brief determine the resolution of this node
* \note this method will not set the resolution, this is the responsibility 
of the caller

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e125c9329d4] master: Fix: Compile Error COM_Debug.

2021-03-30 Thread Jeroen Bakker
Commit: e125c9329d44ec096199618d7880c0212e0f8176
Author: Jeroen Bakker
Date:   Tue Mar 30 09:18:40 2021 +0200
Branches: master
https://developer.blender.org/rBe125c9329d44ec096199618d7880c0212e0f8176

Fix: Compile Error COM_Debug.

We should replace `ifdef COM_Debug` with a constexpr function.

===

M   source/blender/compositor/COM_defines.h
M   source/blender/compositor/intern/COM_Debug.cc
M   source/blender/compositor/intern/COM_Debug.h

===

diff --git a/source/blender/compositor/COM_defines.h 
b/source/blender/compositor/COM_defines.h
index 127b137a2e5..66da43eda89 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -64,7 +64,7 @@ enum class CompositorPriority {
 
 // chunk size determination
 #define COM_PREVIEW_SIZE 140.0f
-//#define COM_DEBUG
+// #define COM_DEBUG
 
 // chunk order
 /**
diff --git a/source/blender/compositor/intern/COM_Debug.cc 
b/source/blender/compositor/intern/COM_Debug.cc
index 1612072a2e8..56bc2dc947f 100644
--- a/source/blender/compositor/intern/COM_Debug.cc
+++ b/source/blender/compositor/intern/COM_Debug.cc
@@ -18,32 +18,31 @@
 
 #include "COM_Debug.h"
 
-namespace blender::compositor {
-
-#ifdef COM_DEBUG
-
-#  include 
-#  include 
-#  include 
+#include 
+#include 
+#include 
 
 extern "C" {
-#  include "BLI_fileops.h"
-#  include "BLI_path_util.h"
-#  include "BLI_string.h"
-#  include "BLI_sys_types.h"
-
-#  include "BKE_appdir.h"
-#  include "BKE_node.h"
-#  include "DNA_node_types.h"
+#include "BLI_fileops.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+#include "BLI_sys_types.h"
+
+#include "BKE_appdir.h"
+#include "BKE_node.h"
+#include "DNA_node_types.h"
 }
 
-#  include "COM_ExecutionGroup.h"
-#  include "COM_ExecutionSystem.h"
-#  include "COM_Node.h"
+#include "COM_ExecutionSystem.h"
+#include "COM_Node.h"
 
-#  include "COM_ReadBufferOperation.h"
-#  include "COM_ViewerOperation.h"
-#  include "COM_WriteBufferOperation.h"
+#include "COM_ReadBufferOperation.h"
+#include "COM_ViewerOperation.h"
+#include "COM_WriteBufferOperation.h"
+
+namespace blender::compositor {
+
+#ifdef COM_DEBUG
 
 int DebugInfo::m_file_index = 0;
 DebugInfo::NodeNameMap DebugInfo::m_node_names;
@@ -115,7 +114,7 @@ void DebugInfo::execution_group_finished(const 
ExecutionGroup *group)
 }
 
 int DebugInfo::graphviz_operation(const ExecutionSystem *system,
-  const NodeOperation *operation,
+  NodeOperation *operation,
   const ExecutionGroup *group,
   char *str,
   int maxlen)
@@ -123,7 +122,7 @@ int DebugInfo::graphviz_operation(const ExecutionSystem 
*system,
   int len = 0;
 
   std::string fillcolor = "gainsboro";
-  if (operation->isViewerOperation()) {
+  if (operation->get_flags().is_viewer_operation) {
 const ViewerOperation *viewer = (const ViewerOperation *)operation;
 if (viewer->isActiveViewerOutput()) {
   fillcolor = "lightskyblue1";
@@ -135,7 +134,7 @@ int DebugInfo::graphviz_operation(const ExecutionSystem 
*system,
   else if (operation->isOutputOperation(system->getContext().isRendering())) {
 fillcolor = "dodgerblue1";
   }
-  else if (operation->get_flags().is_set_operation()) {
+  else if (operation->get_flags().is_set_operation) {
 fillcolor = "khaki1";
   }
   else if (operation->get_flags().is_read_buffer_operation) {
@@ -383,8 +382,8 @@ bool DebugInfo::graphviz_system(const ExecutionSystem 
*system, char *str, int ma
   }
 
   for (NodeOperation *op : system->m_operations) {
-for (NodeOperationInput *to : op->m_inputs) {
-  NodeOperationOutput *from = to->getLink();
+for (NodeOperationInput &to : op->m_inputs) {
+  NodeOperationOutput *from = to.getLink();
 
   if (!from) {
 continue;
@@ -403,7 +402,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem 
*system, char *str, int ma
   break;
   }
 
-  NodeOperation *to_op = &to->getOperation();
+  NodeOperation *to_op = &to.getOperation();
   NodeOperation *from_op = &from->getOperation();
   std::vector &from_groups = op_groups[from_op];
   std::vector &to_groups = op_groups[to_op];
@@ -414,7 +413,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem 
*system, char *str, int ma
   from_op,
   from,
   to_op,
-  to);
+  &to);
   for (int k = 0; k < from_groups.size(); k++) {
 for (int l = 0; l < to_groups.size(); l++) {
   len += snprintf(str + len,
@@ -425,7 +424,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem 
*system, char *str, int ma
   from,
   to_op,
   to_groups[l].c_

[Bf-blender-cvs] [3ead9b2b360] master: Cleanup: Replace virtual methods with bitflags.

2021-03-30 Thread Jeroen Bakker
Commit: 3ead9b2b3605580554cc330d2d2525f405e9c779
Author: Jeroen Bakker
Date:   Tue Mar 30 08:23:09 2021 +0200
Branches: master
https://developer.blender.org/rB3ead9b2b3605580554cc330d2d2525f405e9c779

Cleanup: Replace virtual methods with bitflags.

===

M   source/blender/compositor/intern/COM_ExecutionGroup.cc
M   source/blender/compositor/intern/COM_NodeOperation.h
M   source/blender/compositor/intern/COM_NodeOperationBuilder.cc
M   source/blender/compositor/intern/COM_SingleThreadedOperation.cc
M   source/blender/compositor/intern/COM_SingleThreadedOperation.h
M   source/blender/compositor/operations/COM_PreviewOperation.cc
M   source/blender/compositor/operations/COM_PreviewOperation.h
M   source/blender/compositor/operations/COM_SocketProxyOperation.cc
M   source/blender/compositor/operations/COM_SocketProxyOperation.h
M   source/blender/compositor/operations/COM_ViewerOperation.cc
M   source/blender/compositor/operations/COM_ViewerOperation.h

===

diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc 
b/source/blender/compositor/intern/COM_ExecutionGroup.cc
index f44f6e952fb..87c9e6e8a69 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cc
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc
@@ -106,7 +106,7 @@ bool ExecutionGroup::addOperation(NodeOperation *operation)
   !operation->get_flags().is_write_buffer_operation) {
 m_flags.complex = operation->get_flags().complex;
 m_flags.open_cl = operation->get_flags().open_cl;
-m_flags.single_threaded = operation->isSingleThreaded();
+m_flags.single_threaded = operation->get_flags().single_threaded;
 m_flags.initialized = true;
   }
 
@@ -191,7 +191,7 @@ blender::Array 
ExecutionGroup::determine_chunk_execution_order() c
   float centerY = 0.5f;
   ChunkOrdering order_type = ChunkOrdering::Default;
 
-  if (operation->isViewerOperation()) {
+  if (operation->get_flags().is_viewer_operation) {
 ViewerOperation *viewer = (ViewerOperation *)operation;
 centerX = viewer->getCenterX();
 centerY = viewer->getCenterY();
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h 
b/source/blender/compositor/intern/COM_NodeOperation.h
index 6ad97e5eba6..1a299160cee 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -182,6 +182,8 @@ struct NodeOperationFlags {
*/
   bool open_cl : 1;
 
+  bool single_threaded : 1;
+
   /**
* Does the operation needs a viewer border.
* Basically, setting border need to happen for only operations
@@ -210,10 +212,22 @@ struct NodeOperationFlags {
   bool is_set_operation : 1;
   bool is_write_buffer_operation : 1;
   bool is_read_buffer_operation : 1;
+  bool is_proxy_operation : 1;
+  bool is_viewer_operation : 1;
+  bool is_preview_operation : 1;
+
+  /**
+   * When set additional data conversion operations are added to
+   * convert the data. SocketProxyOperation don't always need to do data 
conversions.
+   *
+   * By default data conversions are enabled.
+   */
+  bool use_datatype_conversion : 1;
 
   NodeOperationFlags()
   {
 complex = false;
+single_threaded = false;
 open_cl = false;
 use_render_border = false;
 use_viewer_border = false;
@@ -221,6 +235,10 @@ struct NodeOperationFlags {
 is_set_operation = false;
 is_read_buffer_operation = false;
 is_write_buffer_operation = false;
+is_proxy_operation = false;
+is_viewer_operation = false;
+is_preview_operation = false;
+use_datatype_conversion = true;
   }
 };
 
@@ -330,11 +348,6 @@ class NodeOperation {
 return false;
   }
 
-  virtual int isSingleThreaded()
-  {
-return false;
-  }
-
   void setbNodeTree(const bNodeTree *tree)
   {
 this->m_btree = tree;
@@ -442,24 +455,6 @@ class NodeOperation {
 return CompositorPriority::Low;
   }
 
-  virtual bool isViewerOperation() const
-  {
-return false;
-  }
-  virtual bool isPreviewOperation() const
-  {
-return false;
-  }
-  virtual bool isProxyOperation() const
-  {
-return false;
-  }
-
-  virtual bool useDatatypeConversion() const
-  {
-return true;
-  }
-
   inline bool isBraked() const
   {
 return this->m_btree->test_break(this->m_btree->tbh);
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc 
b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
index 24b72fa737a..fdd48da3fb4 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
@@ -256,7 +256,8 @@ void NodeOperationBuilder::add_datatype_conversions()
 /* proxy operations can skip data type conversion */
 NodeOperation *from_op = &link.from()->getOperation();
 NodeOperation *to_op = &link.to()->getOperation();
-

[Bf-blender-cvs] [094c950915b] master: Cleanup: clang-format.

2021-03-30 Thread Jeroen Bakker
Commit: 094c950915bcdfda7e8a554a31edbf7c87c30739
Author: Jeroen Bakker
Date:   Tue Mar 30 14:12:53 2021 +0200
Branches: master
https://developer.blender.org/rB094c950915bcdfda7e8a554a31edbf7c87c30739

Cleanup: clang-format.

===

M   source/blender/compositor/intern/COM_MemoryBuffer.cc
M   source/blender/compositor/operations/COM_SetValueOperation.h
M   source/blender/compositor/operations/COM_SocketProxyOperation.h

===

diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc 
b/source/blender/compositor/intern/COM_MemoryBuffer.cc
index d9694169ab8..68e39b19eaf 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cc
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc
@@ -22,7 +22,6 @@
 
 namespace blender::compositor {
 
-
 MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, 
MemoryBufferState state)
 {
   m_rect = rect;
diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h 
b/source/blender/compositor/operations/COM_SetValueOperation.h
index c3939ea65ea..5383f3b5fd3 100644
--- a/source/blender/compositor/operations/COM_SetValueOperation.h
+++ b/source/blender/compositor/operations/COM_SetValueOperation.h
@@ -51,7 +51,6 @@ class SetValueOperation : public NodeOperation {
   void executePixelSampled(float output[4], float x, float y, PixelSampler 
sampler) override;
   void determineResolution(unsigned int resolution[2],
unsigned int preferredResolution[2]) override;
-
 };
 
 }  // namespace blender::compositor
diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h 
b/source/blender/compositor/operations/COM_SocketProxyOperation.h
index 27fb6e0f204..1d3b76055bd 100644
--- a/source/blender/compositor/operations/COM_SocketProxyOperation.h
+++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h
@@ -27,7 +27,6 @@ class SocketProxyOperation : public NodeOperation {
   SocketProxyOperation(DataType type, bool use_conversion);
 
   std::unique_ptr getMetaData() override;
-
 };
 
 }  // namespace blender::compositor

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b48a573adb1] master: Compositor: Fix Incorrect Attaching NodeSockets.

2021-03-30 Thread Jeroen Bakker
Commit: b48a573adb1e8ba254c5b3ea58bf1bb2a013ce89
Author: Jeroen Bakker
Date:   Tue Mar 30 13:54:01 2021 +0200
Branches: master
https://developer.blender.org/rBb48a573adb1e8ba254c5b3ea58bf1bb2a013ce89

Compositor: Fix Incorrect Attaching NodeSockets.

Introduced by recent commit.

===

M   source/blender/compositor/nodes/COM_ImageNode.cc

===

diff --git a/source/blender/compositor/nodes/COM_ImageNode.cc 
b/source/blender/compositor/nodes/COM_ImageNode.cc
index 092cf836a41..f0bfda0f40e 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cc
+++ b/source/blender/compositor/nodes/COM_ImageNode.cc
@@ -88,11 +88,10 @@ void ImageNode::convertToOperations(NodeConverter 
&converter,
 if (image->rr) {
   RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, 
imageuser->layer);
   if (rl) {
-int index;
-
 is_multilayer_ok = true;
 
-for (NodeOutput *socket : getOutputSockets()) {
+for (int64_t index = 0; index < outputs.size(); index++) {
+  NodeOutput *socket = outputs[index];
   NodeOperation *operation = nullptr;
   bNodeSocket *bnodeSocket = socket->getbNodeSocket();
   NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d4e76712d4f] master: Cryptomatte: Fix When Image based Cryptomatte Aren't On The First Render Layer.

2021-03-30 Thread Jeroen Bakker
Commit: d4e76712d4fdf55815cf59df52ffa35df84ed09a
Author: Jeroen Bakker
Date:   Tue Mar 30 11:05:10 2021 +0200
Branches: master
https://developer.blender.org/rBd4e76712d4fdf55815cf59df52ffa35df84ed09a

Cryptomatte: Fix When Image based Cryptomatte Aren't On The First Render Layer.

The image user wasn't updated to reflect the correct render layer.

===

M   source/blender/compositor/nodes/COM_CryptomatteNode.cc

===

diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc 
b/source/blender/compositor/nodes/COM_CryptomatteNode.cc
index f5025285a34..89caff047b4 100644
--- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc
+++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc
@@ -178,7 +178,12 @@ void CryptomatteNode::input_operations_from_image_source(
 }
 
 const std::string prefix = prefix_from_node(node);
-LISTBASE_FOREACH (RenderLayer *, render_layer, &image->rr->layers) {
+int layer_index;
+LISTBASE_FOREACH_INDEX (RenderLayer *, render_layer, &image->rr->layers, 
layer_index) {
+  if (!blender::StringRef(prefix).startswith(blender::StringRef(
+  render_layer->name, BLI_strnlen(render_layer->name, 
sizeof(render_layer->name) {
+continue;
+  }
   LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) {
 const std::string combined_name = 
combined_layer_pass_name(render_layer, render_pass);
 if (blender::StringRef(combined_name).startswith(prefix)) {
@@ -186,10 +191,12 @@ void CryptomatteNode::input_operations_from_image_source(
   render_layer, render_pass, view);
   op->setImage(image);
   op->setImageUser(iuser);
+  iuser->layer = layer_index;
   op->setFramenumber(context.getFramenumber());
   r_input_operations.append(op);
 }
   }
+  break;
 }
   }
   BKE_image_release_ibuf(image, ibuf, nullptr);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5a6d5d20de2] master: UI: add description methods for `wm.context_*` operators

2021-03-30 Thread Campbell Barton
Commit: 5a6d5d20de2cfa43d14d67970b2f2eb24048b230
Author: Campbell Barton
Date:   Wed Mar 31 00:44:29 2021 +1100
Branches: master
https://developer.blender.org/rB5a6d5d20de2cfa43d14d67970b2f2eb24048b230

UI: add description methods for `wm.context_*` operators

Generic context operators now look-up the RNA properties to extract
their description (when it's available).

Add `bl_rna_utils.data_path.property_definition_from_data_path()`
to handle the details of accessing the RNA property definition.

===

A   release/scripts/modules/bl_rna_utils/__init__.py
A   release/scripts/modules/bl_rna_utils/data_path.py
M   release/scripts/startup/bl_operators/wm.py

===

diff --git a/release/scripts/modules/bl_rna_utils/__init__.py 
b/release/scripts/modules/bl_rna_utils/__init__.py
new file mode 100644
index 000..e69de29bb2d
diff --git a/release/scripts/modules/bl_rna_utils/data_path.py 
b/release/scripts/modules/bl_rna_utils/data_path.py
new file mode 100644
index 000..76306e379f0
--- /dev/null
+++ b/release/scripts/modules/bl_rna_utils/data_path.py
@@ -0,0 +1,80 @@
+# # BEGIN GPL LICENSE BLOCK #
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# # END GPL LICENSE BLOCK #
+
+# 
+
+__all__ = (
+"property_definition_from_data_path",
+)
+
+class _TokenizeDataPath:
+"""Class to split up tokens of a data-path."""
+__slots__ = (
+"data_path",
+)
+
+def __init__(self, attrs):
+self.data_path = attrs
+
+def __getattr__(self, attr):
+return _TokenizeDataPath(self.data_path + ((".%s" % attr),))
+
+def __getitem__(self, key):
+return _TokenizeDataPath(self.data_path + (("[%r]" % (key,)),))
+
+def __call__(self, *args, **kw):
+value_str = ", ".join([
+val for val in (
+repr(args)[1:-1],
+", ".join(["%s=%r" % (key, value) for key, value in 
kw.items()])
+) if val])
+return _TokenizeDataPath(self.data_path + ('(%s)' % value_str, ))
+
+def __iter__(self):
+return iter(self.data_path)
+
+
+def property_definition_from_data_path(base, data_path):
+"""
+Return an RNA property definition from an object and a data path.
+
+In Blender this is often used with ``context`` as the base and a
+path that it references, for example ``.space_data.lock_camera``.
+"""
+base_tokenize = _TokenizeDataPath(())
+data = list(eval("base_tokenize" + data_path))
+del base_tokenize
+while data and (not data[-1].startswith(".")):
+data.pop()
+
+if (not data) or (not data[-1].startswith(".")) or (len(data) < 2):
+return None
+
+data_path_head = "".join(data[:-1])
+data_path_tail = data[-1]
+
+value_head = eval("base" + data_path_head)
+value_head_rna = getattr(value_head, "bl_rna", None)
+if value_head_rna is None:
+return None
+
+value_tail = value_head.bl_rna.properties.get(data_path_tail[1:])
+if not value_tail:
+return None
+
+return value_tail
diff --git a/release/scripts/startup/bl_operators/wm.py 
b/release/scripts/startup/bl_operators/wm.py
index 2f97942faa4..18e938ac9b2 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -95,6 +95,28 @@ def context_path_validate(context, data_path):
 return value
 
 
+def context_path_description(context, data_path):
+from bl_rna_utils.data_path import property_definition_from_data_path
+rna_prop = property_definition_from_data_path(context, "." + data_path)
+if rna_prop is not None:
+description = rna_prop.description
+if description:
+return description
+return None
+
+
+def description_from_data_path(base, data_path, *, prefix, value=Ellipsis):
+if context_path_validate(base, data_path) is Ellipsis:
+return None
+description = context_path_description(base, data_path)
+if description:
+description = "%s: %s" % (prefix, description)
+if value != Ellipsis:
+description = "%s\n%s: %s" % (description, iface_("Value"), 
str(value))
+return description
+return None
+
+

[Bf-blender-cvs] [82c2236259b] temp-gpencil-bezier-stroke-type: GPencil: Add Bezier support to Thickness modifier

2021-03-30 Thread Antonio Vazquez
Commit: 82c2236259bd3fe5561734317d1c82dacfab
Author: Antonio Vazquez
Date:   Tue Mar 30 15:55:46 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB82c2236259bd3fe5561734317d1c82dacfab

GPencil: Add Bezier support to Thickness modifier

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
index 62f3ec892b3..33d8883dfb1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
@@ -37,6 +37,7 @@
 #include "BKE_colortools.h"
 #include "BKE_context.h"
 #include "BKE_deform.h"
+#include "BKE_gpencil_geom.h"
 #include "BKE_gpencil_modifier.h"
 #include "BKE_lib_query.h"
 #include "BKE_modifier.h"
@@ -89,6 +90,22 @@ static void copyData(const GpencilModifierData *md, 
GpencilModifierData *target)
   tgmd->curve_thickness = BKE_curvemapping_copy(gmd->curve_thickness);
 }
 
+static bool do_modifier(Object *ob, ThickGpencilModifierData *mmd, bGPDlayer 
*gpl, bGPDstroke *gps)
+{
+  return is_stroke_affected_by_modifier(ob,
+mmd->layername,
+mmd->material,
+mmd->pass_index,
+mmd->layer_pass,
+1,
+gpl,
+gps,
+mmd->flag & GP_THICK_INVERT_LAYER,
+mmd->flag & GP_THICK_INVERT_PASS,
+mmd->flag & GP_THICK_INVERT_LAYERPASS,
+mmd->flag & GP_THICK_INVERT_MATERIAL);
+}
+
 /* change stroke thickness */
 static void deformPolyline(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
@@ -100,18 +117,7 @@ static void deformPolyline(GpencilModifierData *md,
   ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
   const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
 
-  if (!is_stroke_affected_by_modifier(ob,
-  mmd->layername,
-  mmd->material,
-  mmd->pass_index,
-  mmd->layer_pass,
-  1,
-  gpl,
-  gps,
-  mmd->flag & GP_THICK_INVERT_LAYER,
-  mmd->flag & GP_THICK_INVERT_PASS,
-  mmd->flag & GP_THICK_INVERT_LAYERPASS,
-  mmd->flag & GP_THICK_INVERT_MATERIAL)) {
+  if (!do_modifier(ob, mmd, gpl, gps)) {
 return;
   }
 
@@ -150,6 +156,60 @@ static void deformPolyline(GpencilModifierData *md,
   }
 }
 
+static void deformBezier(GpencilModifierData *md,
+ Depsgraph *UNUSED(depsgraph),
+ Object *ob,
+ bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
+ bGPDstroke *gps)
+{
+  ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
+  const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
+
+  if (!do_modifier(ob, mmd, gpl, gps)) {
+return;
+  }
+  float stroke_thickness_inv = 1.0f / max_ii(gps->thickness, 1);
+
+  bGPDcurve *gpc = gps->editcurve;
+  for (int i = 0; i < gpc->tot_curve_points; i++) {
+bGPDcurve_point *pt = &gpc->curve_points[i];
+MDeformVert *dvert = gpc->dvert != NULL ? &gpc->dvert[i] : NULL;
+
+/* Verify point is part of vertex group. */
+float weight = get_modifier_point_weight(
+dvert, (mmd->flag & GP_THICK_INVERT_VGROUP) != 0, def_nr);
+if (weight < 0.0f) {
+  continue;
+}
+
+float curvef = 1.0f;
+if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->curve_thickness)) {
+  /* Normalize value to evaluate curve. */
+  float value = (float)i / (gpc->tot_curve_points - 1);
+  curvef = BKE_curvemapping_evaluateF(mmd->curve_thickness, 0, value);
+}
+
+float target;
+if (mmd->flag & GP_THICK_NORMALIZE) {
+  target = mmd->thickness * stroke_thickness_inv;
+  target *= curvef;
+}
+else {
+  target = pt->pressure * mmd->thickness_fac;
+  weight *= curvef;
+}
+
+pt->pressure = interpf(target, pt->pressure, weight);
+
+CLAMP_MIN(pt->pressure, 0.0f);
+/* Calc geometry data. */
+bGPdata *gpd = ob->data;
+gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
+BKE_gpencil_stroke_geometry_update(gpd, gps);
+  }
+}
+

[Bf-blender-cvs] [9405d3f9e38] temp-gpencil-bezier-stroke-type: GPencil: Add Bezier support to Hook modifier

2021-03-30 Thread Antonio Vazquez
Commit: 9405d3f9e38d8a0df29ac4d748d01c325925faf3
Author: Antonio Vazquez
Date:   Tue Mar 30 15:43:09 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB9405d3f9e38d8a0df29ac4d748d01c325925faf3

GPencil: Add Bezier support to Hook modifier

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
index 6791d4dda26..cda11c3ceb6 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
@@ -163,7 +163,7 @@ static float gpencil_hook_falloff(const struct 
GPHookData_cb *tData, const float
 }
 
 /* apply point deformation */
-static void gpencil_hook_co_apply(struct GPHookData_cb *tData, float weight, 
bGPDspoint *pt)
+static void gpencil_hook_co_apply(struct GPHookData_cb *tData, float weight, 
float co[3])
 {
   float fac;
 
@@ -172,11 +172,11 @@ static void gpencil_hook_co_apply(struct GPHookData_cb 
*tData, float weight, bGP
 
 if (tData->use_uniform) {
   float co_uniform[3];
-  mul_v3_m3v3(co_uniform, tData->mat_uniform, &pt->x);
+  mul_v3_m3v3(co_uniform, tData->mat_uniform, co);
   len_sq = len_squared_v3v3(tData->cent, co_uniform);
 }
 else {
-  len_sq = len_squared_v3v3(tData->cent, &pt->x);
+  len_sq = len_squared_v3v3(tData->cent, co);
 }
 
 fac = gpencil_hook_falloff(tData, len_sq);
@@ -187,62 +187,48 @@ static void gpencil_hook_co_apply(struct GPHookData_cb 
*tData, float weight, bGP
 
   if (fac) {
 float co_tmp[3];
-mul_v3_m4v3(co_tmp, tData->mat, &pt->x);
-interp_v3_v3v3(&pt->x, &pt->x, co_tmp, fac * weight);
+mul_v3_m4v3(co_tmp, tData->mat, co);
+interp_v3_v3v3(co, co, co_tmp, fac * weight);
   }
 }
 
-/* deform stroke */
-static void deformPolyline(GpencilModifierData *md,
-   Depsgraph *UNUSED(depsgraph),
-   Object *ob,
-   bGPDlayer *gpl,
-   bGPDframe *UNUSED(gpf),
-   bGPDstroke *gps)
+static bool do_modifier(Object *ob, HookGpencilModifierData *mmd, bGPDlayer 
*gpl, bGPDstroke *gps)
 {
-  HookGpencilModifierData *mmd = (HookGpencilModifierData *)md;
-  if (!mmd->object) {
-return;
-  }
-
-  const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
+  return is_stroke_affected_by_modifier(ob,
+mmd->layername,
+mmd->material,
+mmd->pass_index,
+mmd->layer_pass,
+1,
+gpl,
+gps,
+mmd->flag & GP_HOOK_INVERT_LAYER,
+mmd->flag & GP_HOOK_INVERT_PASS,
+mmd->flag & GP_HOOK_INVERT_LAYERPASS,
+mmd->flag & GP_HOOK_INVERT_MATERIAL);
+}
 
+static void calc_hook_data(HookGpencilModifierData *mmd, Object *ob, struct 
GPHookData_cb *tData)
+{
   bPoseChannel *pchan = BKE_pose_channel_find_name(mmd->object->pose, 
mmd->subtarget);
   float dmat[4][4];
-  struct GPHookData_cb tData;
-
-  if (!is_stroke_affected_by_modifier(ob,
-  mmd->layername,
-  mmd->material,
-  mmd->pass_index,
-  mmd->layer_pass,
-  1,
-  gpl,
-  gps,
-  mmd->flag & GP_HOOK_INVERT_LAYER,
-  mmd->flag & GP_HOOK_INVERT_PASS,
-  mmd->flag & GP_HOOK_INVERT_LAYERPASS,
-  mmd->flag & GP_HOOK_INVERT_MATERIAL)) {
-return;
-  }
-  bGPdata *gpd = ob->data;
 
   /* init struct */
-  tData.curfalloff = mmd->curfalloff;
-  tData.falloff_type = mmd->falloff_type;
-  tData.falloff = (mmd->falloff_type == eHook_Falloff_None) ? 0.0f : 
mmd->falloff;
-  tData.falloff_sq = square_f(tData.falloff);
-  tData.fac_orig = mmd->force;
-  tData.use_falloff = (tData.falloff_sq != 0.0f);
-  tData.use_uniform = (mmd->flag & GP_HOOK_UNIFORM_SPACE) != 0;
-
-  if (tData.use_uniform) {
-copy_m3_m4(tData.mat_uniform, mmd->parentinv);
-mul_v3_m3v3(tData.cent, tData.mat_uniform, mmd->cent);
+  tData->curfalloff = mmd->curfalloff;
+  tData->falloff_type = mmd->falloff_type;
+  tData->falloff = (mmd->falloff_type == eHook_Falloff_None) ? 0.0f : 
mmd->falloff;
+  t

[Bf-blender-cvs] [d964d0009df] temp-gpencil-bezier-stroke-type: Cleanup comments

2021-03-30 Thread Antonio Vazquez
Commit: d964d0009dfc7e815647c3a2b6011a25e0f45d67
Author: Antonio Vazquez
Date:   Tue Mar 30 15:42:52 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rBd964d0009dfc7e815647c3a2b6011a25e0f45d67

Cleanup comments

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index 41207457b26..e4fd7a80ee2 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -280,7 +280,7 @@ static void generate_geometry(GpencilModifierData *md,
   add_v3_v3(bezt->vec[j], current_offset[3]);
 }
   }
-  gps_dst->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; /* Calc geometry 
data. */
+  gps_dst->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
   BKE_gpencil_stroke_geometry_update(gpd, gps_dst);
 }
 else {
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index eb936249ef1..cec22bfb97b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -167,7 +167,7 @@ static void deformBezier(GpencilModifierData *md,
 }
   }
   /* Calc geometry data. */
-  gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; /* Calc geometry data. */
+  gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
   BKE_gpencil_stroke_geometry_update(gpd, gps);
 }
 
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
index 11b89b92013..04bb41356d2 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -171,7 +171,7 @@ static void deformBezier(GpencilModifierData *md,
   mul_m4_v3(mat, bezt->vec[j]);
 }
   }
-  gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; /* Calc geometry data. */
+  gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
 
   BKE_gpencil_stroke_geometry_update(gpd, gps);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8bcc203ed70] temp-gpencil-bezier-stroke-type: GPencil: Add Bezier support to Lattice modifier

2021-03-30 Thread Antonio Vazquez
Commit: 8bcc203ed707f6b6af008df9b7d6eac460654fca
Author: Antonio Vazquez
Date:   Tue Mar 30 15:27:16 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB8bcc203ed707f6b6af008df9b7d6eac460654fca

GPencil: Add Bezier support to Lattice modifier

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 85908152f7a..eb936249ef1 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -75,6 +75,25 @@ static void copyData(const GpencilModifierData *md, 
GpencilModifierData *target)
   BKE_gpencil_modifier_copydata_generic(md, target);
 }
 
+static bool do_modifier(Object *ob,
+LatticeGpencilModifierData *mmd,
+bGPDlayer *gpl,
+bGPDstroke *gps)
+{
+  return is_stroke_affected_by_modifier(ob,
+mmd->layername,
+mmd->material,
+mmd->pass_index,
+mmd->layer_pass,
+1,
+gpl,
+gps,
+mmd->flag & GP_LATTICE_INVERT_LAYER,
+mmd->flag & GP_LATTICE_INVERT_PASS,
+mmd->flag & 
GP_LATTICE_INVERT_LAYERPASS,
+mmd->flag & 
GP_LATTICE_INVERT_MATERIAL);
+}
+
 static void deformPolyline(GpencilModifierData *md,
Depsgraph *UNUSED(depsgraph),
Object *ob,
@@ -86,18 +105,7 @@ static void deformPolyline(GpencilModifierData *md,
   LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
   const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
 
-  if (!is_stroke_affected_by_modifier(ob,
-  mmd->layername,
-  mmd->material,
-  mmd->pass_index,
-  mmd->layer_pass,
-  1,
-  gpl,
-  gps,
-  mmd->flag & GP_LATTICE_INVERT_LAYER,
-  mmd->flag & GP_LATTICE_INVERT_PASS,
-  mmd->flag & GP_LATTICE_INVERT_LAYERPASS,
-  mmd->flag & GP_LATTICE_INVERT_MATERIAL)) 
{
+  if (!do_modifier(ob, mmd, gpl, gps)) {
 return;
   }
 
@@ -122,6 +130,47 @@ static void deformPolyline(GpencilModifierData *md,
   BKE_gpencil_stroke_geometry_update(gpd, gps);
 }
 
+static void deformBezier(GpencilModifierData *md,
+ Depsgraph *UNUSED(depsgraph),
+ Object *ob,
+ bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
+ bGPDstroke *gps)
+{
+  bGPdata *gpd = ob->data;
+  LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
+  const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
+
+  if (!do_modifier(ob, mmd, gpl, gps)) {
+return;
+  }
+
+  if (mmd->cache_data == NULL) {
+return;
+  }
+
+  bGPDcurve *gpc = gps->editcurve;
+  for (int i = 0; i < gpc->tot_curve_points; i++) {
+bGPDcurve_point *pt = &gpc->curve_points[i];
+BezTriple *bezt = &pt->bezt;
+MDeformVert *dvert = gpc->dvert != NULL ? &gpc->dvert[i] : NULL;
+
+/* verify vertex group */
+const float weight = get_modifier_point_weight(
+dvert, (mmd->flag & GP_LATTICE_INVERT_VGROUP) != 0, def_nr);
+if (weight < 0.0f) {
+  continue;
+}
+for (int j = 0; j < 3; j++) {
+  BKE_lattice_deform_data_eval_co(
+  (struct LatticeDeformData *)mmd->cache_data, bezt->vec[j], 
mmd->strength * weight);
+}
+  }
+  /* Calc geometry data. */
+  gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; /* Calc geometry data. */
+  BKE_gpencil_stroke_geometry_update(gpd, gps);
+}
+
 /* FIXME: Ideally we be doing this on a copy of the main depsgraph
  * (i.e. one where we don't have to worry about restoring state)
  */
@@ -272,7 +321,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
 /* copyData */ copyData,
 
 /* deformPolyline */ deformPolyline,
-/* deformBezier */ NULL,
+/* deformBezier */ deformBezier,
 /* generateStrokes */ NULL,
 /* bakeModifier */ bakeModifier,
 /* remapTime */ NULL,

___

[Bf-blender-cvs] [d1ce52120cd] temp-gpencil-bezier-stroke-type: GPencil: Add Bezier support to Array modifier

2021-03-30 Thread Antonio Vazquez
Commit: d1ce52120cd32ea2274387672fb9de2982f03593
Author: Antonio Vazquez
Date:   Tue Mar 30 15:13:32 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rBd1ce52120cd32ea2274387672fb9de2982f03593

GPencil: Add Bezier support to Array modifier

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index f6f726f0bf3..41207457b26 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -260,20 +260,47 @@ static void generate_geometry(GpencilModifierData *md,
 /* Duplicate stroke */
 bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(iter->gps, true, 
true);
 
-/* Move points */
-for (int i = 0; i < iter->gps->totpoints; i++) {
-  bGPDspoint *pt = &gps_dst->points[i];
-  /* Apply randomness matrix. */
-  mul_m4_v3(mat_rnd, &pt->x);
-
-  /* Apply object local transform (Rot/Scale). */
-  if ((mmd->flag & GP_ARRAY_USE_OB_OFFSET) && (mmd->object)) {
-mul_m4_v3(mat, &pt->x);
+/* Bezier type. */
+if (GPENCIL_STROKE_TYPE_BEZIER(gps_dst)) {
+  bGPDcurve *gpc = gps_dst->editcurve;
+  for (int i = 0; i < gpc->tot_curve_points; i++) {
+bGPDcurve_point *pt = &gpc->curve_points[i];
+BezTriple *bezt = &pt->bezt;
+
+for (int j = 0; j < 3; j++) {
+  /* Apply randomness matrix. */
+  mul_m4_v3(mat_rnd, bezt->vec[j]);
+  /* Apply object local transform (Rot/Scale). */
+  if ((mmd->flag & GP_ARRAY_USE_OB_OFFSET) && (mmd->object)) {
+mul_m4_v3(mat, bezt->vec[j]);
+  }
+  /* Global Rotate and scale. */
+  mul_mat3_m4_v3(current_offset, bezt->vec[j]);
+  /* Global translate. */
+  add_v3_v3(bezt->vec[j], current_offset[3]);
+}
   }
-  /* Global Rotate and scale. */
-  mul_mat3_m4_v3(current_offset, &pt->x);
-  /* Global translate. */
-  add_v3_v3(&pt->x, current_offset[3]);
+  gps_dst->flag |= GP_STROKE_NEEDS_CURVE_UPDATE; /* Calc geometry 
data. */
+  BKE_gpencil_stroke_geometry_update(gpd, gps_dst);
+}
+else {
+  /* Polygon type. */
+  for (int i = 0; i < iter->gps->totpoints; i++) {
+bGPDspoint *pt = &gps_dst->points[i];
+/* Apply randomness matrix. */
+mul_m4_v3(mat_rnd, &pt->x);
+
+/* Apply object local transform (Rot/Scale). */
+if ((mmd->flag & GP_ARRAY_USE_OB_OFFSET) && (mmd->object)) {
+  mul_m4_v3(mat, &pt->x);
+}
+/* Global Rotate and scale. */
+mul_mat3_m4_v3(current_offset, &pt->x);
+/* Global translate. */
+add_v3_v3(&pt->x, current_offset[3]);
+  }
+  /* Calc bounding box. */
+  BKE_gpencil_stroke_boundingbox_calc(gps_dst);
 }
 
 /* If replace material, use new one. */
@@ -283,8 +310,6 @@ static void generate_geometry(GpencilModifierData *md,
 
 /* Add new stroke. */
 BLI_addhead(&iter->gpf->strokes, gps_dst);
-/* Calc bounding box. */
-BKE_gpencil_stroke_boundingbox_calc(gps_dst);
   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f1fe42d912f] master: Cycles: Do not allocate tile buffers on all devices when peer memory is active and denoising is not

2021-03-30 Thread Patrick Mours
Commit: f1fe42d912f088259bbc82d597121978204e991d
Author: Patrick Mours
Date:   Tue Mar 30 12:59:03 2021 +0200
Branches: master
https://developer.blender.org/rBf1fe42d912f088259bbc82d597121978204e991d

Cycles: Do not allocate tile buffers on all devices when peer memory is active 
and denoising is not

Separate tile buffers on all devices only need to exist when denoising is 
active (so any overlap
being rendered simultaneously does not write to the same memory region).
When denoising is not active they can be distributed like all other memory when 
peer
memory support is available.

Reviewed By: brecht

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

===

M   intern/cycles/device/device_multi.cpp

===

diff --git a/intern/cycles/device/device_multi.cpp 
b/intern/cycles/device/device_multi.cpp
index b272e59f99d..35faadcbec5 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -46,10 +46,13 @@ class MultiDevice : public Device {
   list devices, denoising_devices;
   device_ptr unique_key;
   vector> peer_islands;
+  bool use_denoising;
   bool matching_rendering_and_denoising_devices;
 
   MultiDevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool 
background_)
-  : Device(info, stats, profiler, background_), unique_key(1)
+  : Device(info, stats, profiler, background_),
+unique_key(1),
+use_denoising(!info.denoising_devices.empty())
   {
 foreach (DeviceInfo &subinfo, info.multi_devices) {
   /* Always add CPU devices at the back since GPU devices can change
@@ -194,6 +197,7 @@ class MultiDevice : public Device {
   if (!sub.device->load_kernels(requested_features))
 return false;
 
+use_denoising = requested_features.use_denoising;
 if (requested_features.use_denoising) {
   /* Only need denoising feature, everything else is unused. */
   DeviceRequestedFeatures denoising_features;
@@ -400,7 +404,7 @@ class MultiDevice : public Device {
 size_t existing_size = mem.device_size;
 
 /* The tile buffers are allocated on each device (see below), so copy to 
all of them */
-if (strcmp(mem.name, "RenderBuffers") == 0) {
+if (strcmp(mem.name, "RenderBuffers") == 0 && use_denoising) {
   foreach (SubDevice &sub, devices) {
 mem.device = sub.device;
 mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
@@ -466,7 +470,7 @@ class MultiDevice : public Device {
 /* This is a hack to only allocate the tile buffers on denoising devices
  * Similarly the tile buffers also need to be allocated separately on all 
devices so any
  * overlap rendered for denoising does not interfere with each other */
-if (strcmp(mem.name, "RenderBuffers") == 0) {
+if (strcmp(mem.name, "RenderBuffers") == 0 && use_denoising) {
   vector device_pointers;
   device_pointers.reserve(devices.size());
 
@@ -518,7 +522,7 @@ class MultiDevice : public Device {
 size_t existing_size = mem.device_size;
 
 /* Free memory that was allocated for all devices (see above) on each 
device */
-if (strcmp(mem.name, "RenderBuffers") == 0 || mem.type == MEM_PIXELS) {
+if (mem.type == MEM_PIXELS || (strcmp(mem.name, "RenderBuffers") == 0 && 
use_denoising)) {
   foreach (SubDevice &sub, devices) {
 mem.device = sub.device;
 mem.device_pointer = sub.ptr_map[key];

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7fd3b07da1b] master: Build Environment: set MAKE_THREADS as per the CPU

2021-03-30 Thread Ankit Meel
Commit: 7fd3b07da1b8e4a30dcf0c1fc74b503322735749
Author: Ankit Meel
Date:   Tue Mar 30 16:42:19 2021 +0530
Branches: master
https://developer.blender.org/rB7fd3b07da1b8e4a30dcf0c1fc74b503322735749

Build Environment: set MAKE_THREADS as per the CPU

It is a better default.

Reviewed By: sebbas, sybren
Differential Revision: https://developer.blender.org/D10652

===

M   build_files/build_environment/cmake/options.cmake

===

diff --git a/build_files/build_environment/cmake/options.cmake 
b/build_files/build_environment/cmake/options.cmake
index 5091a5d9496..15ceb693ae0 100644
--- a/build_files/build_environment/cmake/options.cmake
+++ b/build_files/build_environment/cmake/options.cmake
@@ -21,7 +21,8 @@ if(WIN32)
 endif()
 option(WITH_WEBP "Enable building of oiio with webp support" OFF)
 option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
-set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
+cmake_host_system_information(RESULT NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
+set(MAKE_THREADS ${NUM_CORES} CACHE STRING "Number of threads to run make 
with")
 
 if(NOT BUILD_MODE)
   set(BUILD_MODE "Release")

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [681a7d724b1] master: PyAPI: replace repr with our own escape function in animsys_refactor

2021-03-30 Thread Campbell Barton
Commit: 681a7d724b1ab7df811adb951239ff35c9dbaa1f
Author: Campbell Barton
Date:   Tue Mar 30 21:53:52 2021 +1100
Branches: master
https://developer.blender.org/rB681a7d724b1ab7df811adb951239ff35c9dbaa1f

PyAPI: replace repr with our own escape function in animsys_refactor

Use the same string escaping logic shared by RNA path resolving code.

===

M   release/scripts/modules/animsys_refactor.py

===

diff --git a/release/scripts/modules/animsys_refactor.py 
b/release/scripts/modules/animsys_refactor.py
index 97e8a8dd144..fd4952e2a53 100644
--- a/release/scripts/modules/animsys_refactor.py
+++ b/release/scripts/modules/animsys_refactor.py
@@ -32,12 +32,6 @@ import bpy
 IS_TESTING = False
 
 
-def drepr(string):
-# is there a less crappy way to do this in python?, re.escape also escapes
-# single quotes strings so can't use it.
-return '"%s"' % repr(string)[1:-1].replace("\"", "\\\"").replace("\\'", 
"'")
-
-
 def classes_recursive(base_type, clss=None):
 if clss is None:
 clss = [base_type]
@@ -66,7 +60,7 @@ class DataPathBuilder:
 if type(key) is int:
 str_value = '[%d]' % key
 elif type(key) is str:
-str_value = '[%s]' % drepr(key)
+str_value = '["%s"]' % bpy.utils.escape_identifier(key)
 else:
 raise Exception("unsupported accessor %r of type %r (internal 
error)" % (key, type(key)))
 return DataPathBuilder(self.data_path + (str_value, ))

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5da5a1cc2da] master: Geometry Nodes: support multiple group input nodes

2021-03-30 Thread Jacques Lucke
Commit: 5da5a1cc2da885346efe47ed1ea39a82e5aa42d5
Author: Jacques Lucke
Date:   Tue Mar 30 12:34:05 2021 +0200
Branches: master
https://developer.blender.org/rB5da5a1cc2da885346efe47ed1ea39a82e5aa42d5

Geometry Nodes: support multiple group input nodes

Previously this was only supported within nested node groups.
Now it is also supported for the root node group that is referenced
by the modifier.

===

M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/intern/geometry_set.cc
M   source/blender/modifiers/intern/MOD_nodes.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
index 8cc37a3e711..4454669b59a 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -313,6 +313,8 @@ struct GeometrySet {
   friend bool operator==(const GeometrySet &a, const GeometrySet &b);
   uint64_t hash() const;
 
+  void clear();
+
   /* Utility methods for creation. */
   static GeometrySet create_with_mesh(
   Mesh *mesh, GeometryOwnershipType ownership = 
GeometryOwnershipType::Owned);
diff --git a/source/blender/blenkernel/intern/geometry_set.cc 
b/source/blender/blenkernel/intern/geometry_set.cc
index a09c3f5f3d3..9f57fcfb2ba 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -205,6 +205,12 @@ uint64_t GeometrySet::hash() const
   return reinterpret_cast(this);
 }
 
+/* Remove all geometry components from the geometry set. */
+void GeometrySet::clear()
+{
+  components_.clear();
+}
+
 /* Returns a read-only mesh or null. */
 const Mesh *GeometrySet::get_mesh_for_read() const
 {
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc 
b/source/blender/modifiers/intern/MOD_nodes.cc
index d6f7b4c8561..8f9aa5c89ad 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1057,7 +1057,7 @@ static void reset_tree_ui_storage(Span tree
  * often than necessary. It's going to be replaced soon.
  */
 static GeometrySet compute_geometry(const DerivedNodeTree &tree,
-Span 
group_input_sockets,
+Span group_input_nodes,
 const InputSocketRef &socket_to_compute,
 GeometrySet input_geometry_set,
 NodesModifierData *nmd,
@@ -1073,7 +1073,12 @@ static GeometrySet compute_geometry(const 
DerivedNodeTree &tree,
   Map group_inputs;
 
   const DTreeContext *root_context = &tree.root_context();
-  if (group_input_sockets.size() > 0) {
+  for (const NodeRef *group_input_node : group_input_nodes) {
+Span group_input_sockets = 
group_input_node->outputs().drop_back(1);
+if (group_input_sockets.is_empty()) {
+  continue;
+}
+
 Span remaining_input_sockets = 
group_input_sockets;
 
 /* If the group expects a geometry as first input, use the geometry that 
has been passed to
@@ -1081,7 +1086,7 @@ static GeometrySet compute_geometry(const DerivedNodeTree 
&tree,
 const OutputSocketRef *first_input_socket = group_input_sockets[0];
 if (first_input_socket->bsocket()->type == SOCK_GEOMETRY) {
   GeometrySet *geometry_set_in =
-  
allocator.construct(std::move(input_geometry_set)).release();
+  allocator.construct(input_geometry_set).release();
   group_inputs.add_new({root_context, first_input_socket}, 
geometry_set_in);
   remaining_input_sockets = remaining_input_sockets.drop_front(1);
 }
@@ -1095,6 +1100,9 @@ static GeometrySet compute_geometry(const DerivedNodeTree 
&tree,
 }
   }
 
+  /* Don't keep a reference to the input geometry components to avoid copies 
during evaluation. */
+  input_geometry_set.clear();
+
   Vector group_outputs;
   group_outputs.append({root_context, &socket_to_compute});
 
@@ -1183,18 +1191,10 @@ static void modifyGeometry(ModifierData *md,
   Span input_nodes = 
root_tree_ref.nodes_by_type("NodeGroupInput");
   Span output_nodes = 
root_tree_ref.nodes_by_type("NodeGroupOutput");
 
-  if (input_nodes.size() > 1) {
-return;
-  }
   if (output_nodes.size() != 1) {
 return;
   }
 
-  Span group_inputs;
-  if (input_nodes.size() == 1) {
-group_inputs = input_nodes[0]->outputs().drop_back(1);
-  }
-
   Span group_outputs = 
output_nodes[0]->inputs().drop_back(1);
 
   if (group_outputs.size() == 0) {
@@ -1211,7 +1211,7 @@ static void modifyGeometry(ModifierData *md,
   }
 
   geometry_set = compute_geometry(
-  tree, group_inputs, *group_outputs[0], std::move(geometry_set), nmd, 
ctx);
+  tree, input_nodes, *group_outputs[0], std::move(geometry_set), nmd, ctx);
 }
 
 static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh 
*mesh)

[Bf-blender-cvs] [05fa5ca337e] master: Cleanup: Typo in comment.

2021-03-30 Thread Bastien Montagne
Commit: 05fa5ca337eb786707b71a54e42db262e8640646
Author: Bastien Montagne
Date:   Tue Mar 30 12:14:59 2021 +0200
Branches: master
https://developer.blender.org/rB05fa5ca337eb786707b71a54e42db262e8640646

Cleanup: Typo in comment.

===

M   source/blender/depsgraph/intern/builder/pipeline.cc

===

diff --git a/source/blender/depsgraph/intern/builder/pipeline.cc 
b/source/blender/depsgraph/intern/builder/pipeline.cc
index f7feeea9593..b96236ba2e3 100644
--- a/source/blender/depsgraph/intern/builder/pipeline.cc
+++ b/source/blender/depsgraph/intern/builder/pipeline.cc
@@ -98,7 +98,7 @@ void AbstractBuilderPipeline::build_step_finalize()
   if (G.debug_value == 799) {
 deg_graph_transitive_reduction(deg_graph_);
   }
-  /* Store pointers to commonly used valuated datablocks. */
+  /* Store pointers to commonly used evaluated datablocks. */
   deg_graph_->scene_cow = (Scene 
*)deg_graph_->get_cow_id(°_graph_->scene->id);
   /* Flush visibility layer and re-schedule nodes for update. */
   deg_graph_build_finalize(bmain_, deg_graph_);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [74d5a93b2bf] master: Armature: Add Display Axis Offset

2021-03-30 Thread Scott Wilson
Commit: 74d5a93b2bf7806993d9baa24fd35228e52c4970
Author: Scott Wilson
Date:   Tue Mar 30 11:16:45 2021 +0200
Branches: master
https://developer.blender.org/rB74d5a93b2bf7806993d9baa24fd35228e52c4970

Armature: Add Display Axis Offset

Display the bone axes at the head (root) of the bone by default, instead
of the tail (tip), and add a slider so that it's possible to adjust this
position.

Versioning code is in place to ensure existing files behave the same
(axes shown at tail), whereas new Armatures will be using the new
default (axes shown at head).

Reviewed By: #animation_rigging, #user_interface, Severin, Sybren

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

===

M   release/scripts/startup/bl_ui/properties_data_armature.py
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/draw/engines/overlay/overlay_armature.c
M   source/blender/makesdna/DNA_armature_types.h
M   source/blender/makesrna/intern/rna_armature.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py 
b/release/scripts/startup/bl_ui/properties_data_armature.py
index 4cdcab45926..87572fcd438 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -86,12 +86,19 @@ class DATA_PT_display(ArmatureButtonsPanel, Panel):
 
 col = layout.column(heading="Show")
 col.prop(arm, "show_names", text="Names")
-col.prop(arm, "show_axes", text="Axes")
 col.prop(arm, "show_bone_custom_shapes", text="Shapes")
 col.prop(arm, "show_group_colors", text="Group Colors")
+
 if ob:
 col.prop(ob, "show_in_front", text="In Front")
 
+col = layout.column(align=False, heading="Axes")
+row = col.row(align=True)
+row.prop(arm, "show_axes", text="")
+sub = row.row(align=True)
+sub.active = arm.show_axes
+sub.prop(arm, "axes_position", text="Position")
+
 
 class DATA_MT_bone_group_context_menu(Menu):
 bl_label = "Bone Group Specials"
diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index aae5a2ec190..2449e35055e 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -27,6 +27,7 @@
 #include "BLI_utildefines.h"
 
 #include "DNA_anim_types.h"
+#include "DNA_armature_types.h"
 #include "DNA_brush_types.h"
 #include "DNA_cachefile_types.h"
 #include "DNA_collection_types.h"
@@ -1948,5 +1949,12 @@ void blo_do_versions_290(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
*/
   {
 /* Keep this block, even when empty. */
+
+if (!DNA_struct_elem_find(fd->filesdna, "bArmature", "float", 
"axes_position")) {
+  /* Convert the axes draw position to its old default (tip of bone). */
+  LISTBASE_FOREACH (struct bArmature *, arm, &bmain->armatures) {
+arm->axes_position = 1.0;
+  }
+}
   }
 }
diff --git a/source/blender/draw/engines/overlay/overlay_armature.c 
b/source/blender/draw/engines/overlay/overlay_armature.c
index 7042d095b56..54224071d23 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -1293,11 +1293,15 @@ static void draw_axes(ArmatureDrawContext *ctx,
 float length = pchan->bone->length;
 copy_m4_m4(axis_mat, pchan->custom_tx ? pchan->custom_tx->pose_mat : 
pchan->pose_mat);
 rescale_m4(axis_mat, (float[3]){length, length, length});
+translate_m4(axis_mat, 0.0, arm->axes_position - 1.0, 0.0);
 
 drw_shgroup_bone_axes(ctx, axis_mat, final_col);
   }
   else {
-drw_shgroup_bone_axes(ctx, BONE_VAR(eBone, pchan, disp_mat), final_col);
+float disp_mat[4][4];
+copy_m4_m4(disp_mat, BONE_VAR(eBone, pchan, disp_mat));
+translate_m4(disp_mat, 0.0, arm->axes_position - 1.0, 0.0);
+drw_shgroup_bone_axes(ctx, disp_mat, final_col);
   }
 }
 
diff --git a/source/blender/makesdna/DNA_armature_types.h 
b/source/blender/makesdna/DNA_armature_types.h
index 411fde13bb2..85780bc33c5 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -134,7 +134,7 @@ typedef struct bArmature {
 
   /** ID data is older than edit-mode data (TODO: move to edit-mode struct). */
   char needs_flush_to_id;
-  char _pad0[7];
+  char _pad0[3];
 
   int flag;
   int drawtype;
@@ -146,6 +146,9 @@ typedef struct bArmature {
   unsigned int layer_used;
   /** For buttons to work, both variables in this order together. */
   unsigned int layer, layer_protected;
+
+  /** Relative position of the axes on the bone, from head (0.0f) to tail 
(1.0f). */
+  float axes_position;
 } bArmature;
 
 /* armature->flag */
diff --git a/source/blender/makesrna/intern/rna_armature.c 
b/source/blender/

[Bf-blender-cvs] [39bead4d51e] master: Fix simple solidify wrong custom data on large ngons

2021-03-30 Thread Henrik Dick
Commit: 39bead4d51e5e96188feab4fb45d453fc7b1f2a6
Author: Henrik Dick
Date:   Tue Mar 30 19:10:13 2021 +1100
Branches: master
https://developer.blender.org/rB39bead4d51e5e96188feab4fb45d453fc7b1f2a6

Fix simple solidify wrong custom data on large ngons

Fixes an unreported issue that vertex data on large ngons (>255)
is messed up due to type conversion to char and back to int.

Ref D10734

===

M   source/blender/modifiers/intern/MOD_solidify_extrude.c

===

diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c 
b/source/blender/modifiers/intern/MOD_solidify_extrude.c
index 99069919120..a77a6e595ad 100644
--- a/source/blender/modifiers/intern/MOD_solidify_extrude.c
+++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c
@@ -216,7 +216,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, 
const ModifierEvalContex
   numVerts, sizeof(*old_vert_arr), "old_vert_arr in solidify");
 
   uint *edge_users = NULL;
-  char *edge_order = NULL;
+  int *edge_order = NULL;
 
   float(*vert_nors)[3] = NULL;
   float(*poly_nors)[3] = NULL;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ff2460df75c] temp-gpencil-bezier-stroke-type: Merge branch 'master' into temp-gpencil-bezier-stroke-type

2021-03-30 Thread Antonio Vazquez
Commit: ff2460df75ca01ae80518cdfe0503f09e2d94ca1
Author: Antonio Vazquez
Date:   Tue Mar 30 10:01:31 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rBff2460df75ca01ae80518cdfe0503f09e2d94ca1

Merge branch 'master' into temp-gpencil-bezier-stroke-type

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6fd6d5f4f30] greasepencil-object: Merge branch 'master' into greasepencil-object

2021-03-30 Thread Antonio Vazquez
Commit: 6fd6d5f4f30daafee7795c1840b3bd0b9c05968c
Author: Antonio Vazquez
Date:   Tue Mar 30 10:01:17 2021 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6fd6d5f4f30daafee7795c1840b3bd0b9c05968c

Merge branch 'master' into greasepencil-object

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f97b9e99bc0] eevee-gpencil: Merge branch 'master' into eevee-gpencil

2021-03-30 Thread Antonio Vazquez
Commit: f97b9e99bc0c0e4b7fc73814ca1d34bf749b509c
Author: Antonio Vazquez
Date:   Tue Mar 30 10:00:33 2021 +0200
Branches: eevee-gpencil
https://developer.blender.org/rBf97b9e99bc0c0e4b7fc73814ca1d34bf749b509c

Merge branch 'master' into eevee-gpencil

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [aa116ba5bac] temp_bmesh_multires: Added per-brush DynTopo settings which are stored in a new DynTopoSettings struct.

2021-03-30 Thread Joseph Eagar
Commit: aa116ba5bac6a8138f1f14c582fe8246ffd356e9
Author: Joseph Eagar
Date:   Tue Mar 30 00:08:09 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBaa116ba5bac6a8138f1f14c582fe8246ffd356e9

Added per-brush DynTopo settings which are stored in a new DynTopoSettings 
struct.

This system is designed to inherit settings from scene dyntopo defaults
in a highly flexible way; settings can be individually overridden via the
.inherit bitmask.

At stroke time the scene settings and brush->dyntopo are merged
and stored in brush->cached_dyntopo.

Note that brush->flag has a bit flag, DYNTOPO_DISABLED, with a few
subtlies.  It does not switch the PBVH back to PBVH_FACES mode, it
simply disbles dyntopo topology update.  It also doesn't inherit from
any default settings.  And it's the only setting
that's currently exposed in the UI.

===

M   release/scripts/startup/bl_ui/properties_paint_common.py
M   source/blender/blenkernel/BKE_brush.h
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/intern/brush.c
M   source/blender/blenkernel/intern/paint.c
M   source/blender/blenkernel/intern/pbvh_bmesh.c
M   source/blender/blenloader/intern/versioning_290.c
M   source/blender/editors/sculpt_paint/sculpt.c
M   source/blender/editors/sculpt_paint/sculpt_detail.c
M   source/blender/makesdna/DNA_brush_defaults.h
M   source/blender/makesdna/DNA_brush_enums.h
M   source/blender/makesdna/DNA_brush_types.h
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_brush.c

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 5468b6059e4..bd8cca847e5 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -574,7 +574,8 @@ def brush_settings(layout, context, brush, popover=False):
 context.sculpt_object.use_dynamic_topology_sculpting
 ):
 layout.prop(brush, "topology_rake_factor", slider=True)
-
+layout.prop(brush.dyntopo, "disabled", text="Disable Dyntopo");
+
 # normal_weight
 if capabilities.has_normal_weight:
 layout.prop(brush, "normal_weight", slider=True)
diff --git a/source/blender/blenkernel/BKE_brush.h 
b/source/blender/blenkernel/BKE_brush.h
index 452a08bc9c8..bf3d45d318c 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -36,6 +36,8 @@ struct Main;
 struct Scene;
 struct ToolSettings;
 struct UnifiedPaintSettings;
+struct DynTopoSettings;
+struct Sculpt;
 
 // enum eCurveMappingPreset;
 
@@ -151,6 +153,8 @@ void BKE_brush_scale_size(int *r_brush_size,
 /* debugging only */
 void BKE_brush_debug_print_state(struct Brush *br);
 
+void BKE_brush_get_dyntopo(struct Brush *brush, struct Sculpt *sd, struct 
DynTopoSettings *out);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/BKE_pbvh.h 
b/source/blender/blenkernel/BKE_pbvh.h
index 46076baccd3..146eb3208e9 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -349,7 +349,7 @@ int BKE_pbvh_get_grid_num_faces(const PBVH *pbvh);
 
 /* Only valid for type == PBVH_BMESH */
 struct BMesh *BKE_pbvh_get_bmesh(PBVH *pbvh);
-void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size);
+void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size, float 
detail_range);
 
 typedef enum {
   PBVH_Subdivide = 1,
diff --git a/source/blender/blenkernel/intern/brush.c 
b/source/blender/blenkernel/intern/brush.c
index 3b5b16feea8..e9bc22fd5b7 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -478,6 +478,7 @@ static void brush_defaults(Brush *brush)
   FROM_DEFAULT(stencil_dimension);
   FROM_DEFAULT(mtex);
   FROM_DEFAULT(mask_mtex);
+  FROM_DEFAULT(dyntopo);
 
 #undef FROM_DEFAULT
 #undef FROM_DEFAULT_PTR
@@ -1691,6 +1692,8 @@ void BKE_brush_sculpt_reset(Brush *br)
* assign this so logic below can remain the same. */
   br->alpha = 0.5f;
 
+  bool disable_dyntopo = false;
+
   /* Brush settings */
   switch (br->sculpt_tool) {
 case SCULPT_TOOL_DRAW_SHARP:
@@ -1702,11 +1705,16 @@ void BKE_brush_sculpt_reset(Brush *br)
   br->curve_preset = BRUSH_CURVE_SMOOTHER;
   br->spacing = 10;
   br->alpha = 1.0f;
+
+  disable_dyntopo = true;
+
   break;
 case SCULPT_TOOL_SLIDE_RELAX:
   br->spacing = 10;
   br->alpha = 1.0f;
   br->slide_deform_type = BRUSH_SLIDE_DEFORM_DRAG;
+
+  disable_dyntopo = true;
   break;
 case SCULPT_TOOL_CLAY:
   br->flag |= BRUSH_SIZE_PRESSURE;
@@ -1754,6 +1762,8 @@ void BKE_brush_sculpt_reset(Brush *br)
   break;
 case SCULPT_TOOL_ROTAT