[Bf-blender-cvs] [128ca8c7f65] master: Fix T90551: Dopesheet displays keyframes differently.

2021-08-09 Thread Jeroen Bakker
Commit: 128ca8c7f6508648d1ae33bb1d1a31e0e3e10e3b
Author: Jeroen Bakker
Date:   Tue Aug 10 08:42:06 2021 +0200
Branches: master
https://developer.blender.org/rB128ca8c7f6508648d1ae33bb1d1a31e0e3e10e3b

Fix T90551: Dopesheet displays keyframes differently.

Regression introduced by {rB73b047bcd431}. Missing a check when
converting the file to use LISTBASE_FOREACH.

===

M   source/blender/editors/animation/keyframes_keylist.cc

===

diff --git a/source/blender/editors/animation/keyframes_keylist.cc 
b/source/blender/editors/animation/keyframes_keylist.cc
index 916d7de0635..f6ade11a517 100644
--- a/source/blender/editors/animation/keyframes_keylist.cc
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -821,6 +821,9 @@ void agroup_to_keylist(AnimData *adt,
   if (agrp) {
 /* loop through F-Curves */
 LISTBASE_FOREACH (FCurve *, fcu, &agrp->channels) {
+  if (fcu->grp != agrp) {
+break;
+  }
   fcurve_to_keylist(adt, fcu, keylist, saction_flag);
 }
   }

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


[Bf-blender-cvs] [00ecf29ec4a] temp-geometry-nodes-fields-prototype: fix curve parameter type

2021-08-09 Thread Jacques Lucke
Commit: 00ecf29ec4aeb02d756b6b5f22bdbaea1db83028
Author: Jacques Lucke
Date:   Tue Aug 10 08:25:33 2021 +0200
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB00ecf29ec4aeb02d756b6b5f22bdbaea1db83028

fix curve parameter type

===

M   source/blender/blenkernel/BKE_field.hh

===

diff --git a/source/blender/blenkernel/BKE_field.hh 
b/source/blender/blenkernel/BKE_field.hh
index 9ec7077e0f7..0c675ec9a89 100644
--- a/source/blender/blenkernel/BKE_field.hh
+++ b/source/blender/blenkernel/BKE_field.hh
@@ -97,7 +97,7 @@ class CurveParameterFieldInputKey : public FieldInputKey {
 
   const CPPType &type() const override
   {
-return CPPType::get();
+return CPPType::get();
   }
 
  private:

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


[Bf-blender-cvs] [692e926b187] master: Silensed compilation warning in gpu test case.

2021-08-09 Thread Jeroen Bakker
Commit: 692e926b1876aeb0aa789f5fa21caf525da1690e
Author: Jeroen Bakker
Date:   Tue Aug 10 07:57:41 2021 +0200
Branches: master
https://developer.blender.org/rB692e926b1876aeb0aa789f5fa21caf525da1690e

Silensed compilation warning in gpu test case.

===

M   source/blender/gpu/tests/gpu_shader_test.cc

===

diff --git a/source/blender/gpu/tests/gpu_shader_test.cc 
b/source/blender/gpu/tests/gpu_shader_test.cc
index 43ff86ebbd8..561858f421e 100644
--- a/source/blender/gpu/tests/gpu_shader_test.cc
+++ b/source/blender/gpu/tests/gpu_shader_test.cc
@@ -108,7 +108,7 @@ void main() {
   EXPECT_NE(shader, nullptr);
 
   /* Construct Texture. */
-  GPUTexture *texture = GPU_texture_create_1d("gpu_shader_compute_1d", SIZE, 
0, GPU_RGBA32F, NULL);
+  GPUTexture *texture = GPU_texture_create_1d("gpu_shader_compute_1d", SIZE, 
0, GPU_RGBA32F, nullptr);
   EXPECT_NE(texture, nullptr);
 
   GPU_shader_bind(shader);

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


[Bf-blender-cvs] [49ea8e4fea6] master: Edit Mesh: multi-object edit-mode support for knife project

2021-08-09 Thread Campbell Barton
Commit: 49ea8e4fea61bd8e7c205e5edc8d0e06e6d4049e
Author: Campbell Barton
Date:   Tue Aug 10 15:01:43 2021 +1000
Branches: master
https://developer.blender.org/rB49ea8e4fea61bd8e7c205e5edc8d0e06e6d4049e

Edit Mesh: multi-object edit-mode support for knife project

===

M   source/blender/editors/mesh/editmesh_knife.c
M   source/blender/editors/mesh/editmesh_knife_project.c
M   source/blender/editors/mesh/mesh_intern.h

===

diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index 73f6a3f3238..3e3593d18fd 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2630,24 +2630,24 @@ static void knife_init_colors(KnifeColors *colors)
 }
 
 /* called when modal loop selection gets set up... */
-static void knifetool_init(bContext *C,
+static void knifetool_init(ViewContext *vc,
KnifeTool_OpData *kcd,
const bool only_select,
const bool cut_through,
const bool is_interactive)
 {
-  Scene *scene = CTX_data_scene(C);
-  Object *obedit = CTX_data_edit_object(C);
+  kcd->vc = *vc;
+
+  Scene *scene = vc->scene;
+  Object *obedit = vc->obedit;
 
   /* assign the drawing handle for drawing preview line... */
   kcd->scene = scene;
   kcd->ob = obedit;
-  kcd->region = CTX_wm_region(C);
+  kcd->region = vc->region;
 
   invert_m4_m4_safe_ortho(kcd->ob_imat, kcd->ob->obmat);
 
-  em_setup_viewcontext(C, &kcd->vc);
-
   kcd->em = BKE_editmesh_from_object(kcd->ob);
 
   /* cut all the way through the mesh if use_occlude_geometry button not 
pushed */
@@ -2694,14 +2694,14 @@ static void knifetool_init(bContext *C,
 }
 
 /* called when modal loop selection is done... */
-static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd)
+static void knifetool_exit_ex(KnifeTool_OpData *kcd)
 {
   if (!kcd) {
 return;
   }
 
   if (kcd->is_interactive) {
-WM_cursor_modal_restore(CTX_wm_window(C));
+WM_cursor_modal_restore(kcd->vc.win);
 
 /* deactivate the extra drawing stuff in 3D-View */
 ED_region_draw_cb_exit(kcd->region->type, kcd->draw_handle);
@@ -2735,10 +2735,10 @@ static void knifetool_exit_ex(bContext *C, 
KnifeTool_OpData *kcd)
   /* destroy kcd itself */
   MEM_freeN(kcd);
 }
-static void knifetool_exit(bContext *C, wmOperator *op)
+static void knifetool_exit(wmOperator *op)
 {
   KnifeTool_OpData *kcd = op->customdata;
-  knifetool_exit_ex(C, kcd);
+  knifetool_exit_ex(kcd);
   op->customdata = NULL;
 }
 
@@ -2827,10 +2827,10 @@ static void knifetool_finish(wmOperator *op)
 /** \name Operator (#MESH_OT_knife_tool)
  * \{ */
 
-static void knifetool_cancel(bContext *C, wmOperator *op)
+static void knifetool_cancel(bContext *UNUSED(C), wmOperator *op)
 {
   /* this is just a wrapper around exit() */
-  knifetool_exit(C, op);
+  knifetool_exit(op);
 }
 
 wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf)
@@ -2872,7 +2872,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
   bool do_refresh = false;
 
   if (!obedit || obedit->type != OB_MESH || BKE_editmesh_from_object(obedit) 
!= kcd->em) {
-knifetool_exit(C, op);
+knifetool_exit(op);
 ED_workspace_status_text(C, NULL);
 return OPERATOR_FINISHED;
   }
@@ -2893,7 +2893,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 /* finish */
 ED_region_tag_redraw(kcd->region);
 
-knifetool_exit(C, op);
+knifetool_exit(op);
 ED_workspace_status_text(C, NULL);
 
 return OPERATOR_CANCELLED;
@@ -2902,7 +2902,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, 
const wmEvent *event)
 ED_region_tag_redraw(kcd->region);
 
 knifetool_finish(op);
-knifetool_exit(C, op);
+knifetool_exit(op);
 ED_workspace_status_text(C, NULL);
 
 return OPERATOR_FINISHED;
@@ -3066,8 +3066,11 @@ static int knifetool_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   const bool cut_through = !RNA_boolean_get(op->ptr, "use_occlude_geometry");
   const bool wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input");
 
+  ViewContext vc;
   KnifeTool_OpData *kcd;
 
+  em_setup_viewcontext(C, &vc);
+
   if (only_select) {
 Object *obedit = CTX_data_edit_object(C);
 BMEditMesh *em = BKE_editmesh_from_object(obedit);
@@ -3080,7 +3083,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, 
const wmEvent *event)
   /* alloc new customdata */
   kcd = op->customdata = MEM_callocN(sizeof(KnifeTool_OpData), __func__);
 
-  knifetool_init(C, kcd, only_select, cut_through, true);
+  knifetool_init(&vc, kcd, only_select, cut_through, true);
 
   op->flag |= OP_IS_MODAL_CURSOR_REGION;
 
@@ -3165,7 +3168,7 @@ static bool edbm_mesh_

[Bf-blender-cvs] [b83ee724a41] master: Fix T90418: macOS codesign fails with dylib next to executable

2021-08-09 Thread Ankit Meel
Commit: b83ee724a418bee98f4e81e0c6854d03bc2e1fa6
Author: Ankit Meel
Date:   Tue Aug 10 10:30:55 2021 +0530
Branches: master
https://developer.blender.org/rBb83ee724a418bee98f4e81e0c6854d03bc2e1fa6

Fix T90418: macOS codesign fails with dylib next to executable

Change the dylib folder relative to `Blender` executable to be
the same as before rB652fbc200500497a67bd11d18b786587ba34e3d9 and same
as bpy.so : `@loader_path/../Resources/${BLENDER_VERSION}/lib`

===

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

===

diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index a130d265dff..dceafb236de 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -500,17 +500,10 @@ endif()
 # makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
 # CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next 
to each binary.
 #
-# For the installed Blender executable, CMAKE_INSTALL_RPATH will be used
-# to locate the dylibs at @executable_path, next to the Blender executable.
-#
-# For the installed Python module, CMAKE_INSTALL_RPATH is modified to find the
-# dylib in an adjacent folder.
+# For the installed Python module and installed Blender executable, 
CMAKE_INSTALL_RPATH
+# is modified to find the dylib in an adjacent folder. Install step puts the 
libraries there.
 set(CMAKE_SKIP_BUILD_RPATH FALSE)
 list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
 
 set(CMAKE_SKIP_INSTALL_RPATH FALSE)
-list(APPEND CMAKE_INSTALL_RPATH "@executable_path")
-
-if(WITH_PYTHON_MODULE)
-  list(APPEND CMAKE_INSTALL_RPATH 
"@loader_path/../Resources/${BLENDER_VERSION}/lib")
-endif()
+list(APPEND CMAKE_INSTALL_RPATH 
"@loader_path/../Resources/${BLENDER_VERSION}/lib")
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index e928be571a2..47fb2642da1 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -345,13 +345,10 @@ elseif(APPLE)
   set(TARGETDIR_VER "${PYTHON_LIBPATH}/Resources/${BLENDER_VERSION}")
   set(INSTALL_BPY_TO_SITE_PACKAGES ON)
 endif()
-# Dylibs folder for bpy.so.
-set(MAC_BLENDER_TARGET_DYLIBS_DIR "${TARGETDIR_VER}/lib")
   else()
 set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})
-# Dylibs folder for Blender executable. @executable_path is an rpath.
-set(MAC_BLENDER_TARGET_DYLIBS_DIR "$")
   endif()
+  set(MAC_BLENDER_TARGET_DYLIBS_DIR "${TARGETDIR_VER}/lib")
   # Skip relinking on cpack / install
   set_target_properties(blender PROPERTIES BUILD_WITH_INSTALL_RPATH true)
 endif()

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


[Bf-blender-cvs] [4ca19c71531] master: Fix T90493: Undo a knife-project operation crashes

2021-08-09 Thread Campbell Barton
Commit: 4ca19c715314b4db12af8963750ab1a0e9fdbf1d
Author: Campbell Barton
Date:   Tue Aug 10 14:37:39 2021 +1000
Branches: master
https://developer.blender.org/rB4ca19c715314b4db12af8963750ab1a0e9fdbf1d

Fix T90493: Undo a knife-project operation crashes

The crash occurred calling because mesh_get_eval_final in edit-mode
freed all derived mesh data without tagging the object for updating.

However meshes in edit-mode weren't meant to be used as knife-project
source-data, adding support for multi object edit-mode  caused this.

===

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

===

diff --git a/source/blender/editors/mesh/editmesh_knife_project.c 
b/source/blender/editors/mesh/editmesh_knife_project.c
index 09b17acf56d..54c35c071d4 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -131,9 +131,11 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
   LinkNode *polys = NULL;
 
   CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
-if (ob != obedit) {
-  polys = knifeproject_poly_from_object(C, scene, ob, polys);
+if (BKE_object_is_in_editmode(ob)) {
+  continue;
 }
+BLI_assert(ob != obedit);
+polys = knifeproject_poly_from_object(C, scene, ob, polys);
   }
   CTX_DATA_END;

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


[Bf-blender-cvs] [888c0e55665] tmp_codesign_T90418: Fix install location

2021-08-09 Thread Ankit Meel
Commit: 888c0e55665a0f96725480ca96ceae14ce84fd53
Author: Ankit Meel
Date:   Tue Aug 10 09:12:18 2021 +0530
Branches: tmp_codesign_T90418
https://developer.blender.org/rB888c0e55665a0f96725480ca96ceae14ce84fd53

Fix install location

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 78de85307cb..a1cef1d61af 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -342,11 +342,11 @@ elseif(APPLE)
   # Keep the `BLENDER_VERSION` folder and bpy.so in the build folder.
   set(INSTALL_BPY_TO_SITE_PACKAGES OFF)
 else()
-  set(TARGETDIR_VER "${PYTHON_LIBPATH}/Resources/${BLENDER_VERSION}")
+  set(TARGETDIR_VER 
"${PYTHON_LIBPATH}/site-packages/Resources/${BLENDER_VERSION}")
   set(INSTALL_BPY_TO_SITE_PACKAGES ON)
 endif()
   else()
-set(TARGETDIR_VER 
$/../Resources/${BLENDER_VERSION})
+set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})
   endif()
   set(MAC_BLENDER_TARGET_DYLIBS_DIR "${TARGETDIR_VER}/lib")
   # Skip relinking on cpack / install

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


[Bf-blender-cvs] [7f8a99a96a6] lineart-shadow: Merge branch 'temp-lineart-contained' into lineart-shadow

2021-08-09 Thread YimingWu
Commit: 7f8a99a96a61aad5a76c664f6cdab9e743a88076
Author: YimingWu
Date:   Tue Aug 10 10:59:10 2021 +0800
Branches: lineart-shadow
https://developer.blender.org/rB7f8a99a96a61aad5a76c664f6cdab9e743a88076

Merge branch 'temp-lineart-contained' into lineart-shadow

===



===

diff --cc source/blender/blenloader/intern/versioning_300.c
index c694be2b7f6,badebb1791f..c560bbddced
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@@ -704,18 -718,41 +718,51 @@@ void blo_do_versions_300(FileData *fd, 
  }
}
  }
 +LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
 +  LISTBASE_FOREACH (GpencilModifierData *, gpd, 
&ob->greasepencil_modifiers) {
 +if (gpd->type == eGpencilModifierType_Lineart) {
 +  LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)gpd;
 +  lmd->shadow_camera_near = 0.1f;
 +  lmd->shadow_camera_far = 200.0f;
 +  lmd->shadow_camera_size = 200.0f;
 +}
 +  }
 +}
}
  
+   /* Font names were copied directly into ID names, see: T90417. */
+   if (!MAIN_VERSION_ATLEAST(bmain, 300, 16)) {
+ ListBase *lb = which_libbase(bmain, ID_VF);
+ BKE_main_id_repair_duplicate_names_listbase(lb);
+   }
+ 
+   if (!MAIN_VERSION_ATLEAST(bmain, 300, 17)) {
+ if (!DNA_struct_elem_find(
+ fd->filesdna, "View3DOverlay", "float", 
"normals_constant_screen_size")) {
+   LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+   LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+   View3D *v3d = (View3D *)sl;
+   v3d->overlay.normals_constant_screen_size = 7.0f;
+ }
+   }
+ }
+   }
+ }
+ 
+ /* Fix SplineIK constraint's inconsistency between binding points array 
and its stored size. */
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+   /* NOTE: Objects should never have SplineIK constraint, so no need to 
apply this fix on
+* their constraints. */
+   if (ob->pose) {
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
+   
do_version_constraints_spline_ik_joint_bindings(&pchan->constraints);
+ }
+   }
+ }
+   }
+ 
/**
 * Versioning code until next subversion bump goes here.
 *

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


[Bf-blender-cvs] [e40d221b067] tmp_codesign_T90418: Change dylib install location to fix codesign issue

2021-08-09 Thread Ankit Meel
Commit: e40d221b067d0d18f365ff7dcb1fc4df12828f22
Author: Ankit Meel
Date:   Tue Aug 10 08:09:01 2021 +0530
Branches: tmp_codesign_T90418
https://developer.blender.org/rBe40d221b067d0d18f365ff7dcb1fc4df12828f22

Change dylib install location to fix codesign issue

===

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

===

diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index a130d265dff..1702c9478a2 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -500,17 +500,13 @@ endif()
 # makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
 # CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next 
to each binary.
 #
-# For the installed Blender executable, CMAKE_INSTALL_RPATH will be used
-# to locate the dylibs at @executable_path, next to the Blender executable.
-#
-# For the installed Python module, CMAKE_INSTALL_RPATH is modified to find the
-# dylib in an adjacent folder.
+# For the installed Python module and installed Blender executable, 
CMAKE_INSTALL_RPATH
+# is modified to find the dylib in an adjacent folder. Install step puts the 
libraries there.
 set(CMAKE_SKIP_BUILD_RPATH FALSE)
-list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
+if(WITH_OPENMP)
+  list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
+endif()
 
 set(CMAKE_SKIP_INSTALL_RPATH FALSE)
-list(APPEND CMAKE_INSTALL_RPATH "@executable_path")
+list(APPEND CMAKE_INSTALL_RPATH 
"@loader_path/../Resources/${BLENDER_VERSION}/lib")
 
-if(WITH_PYTHON_MODULE)
-  list(APPEND CMAKE_INSTALL_RPATH 
"@loader_path/../Resources/${BLENDER_VERSION}/lib")
-endif()
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index e928be571a2..78de85307cb 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -345,13 +345,10 @@ elseif(APPLE)
   set(TARGETDIR_VER "${PYTHON_LIBPATH}/Resources/${BLENDER_VERSION}")
   set(INSTALL_BPY_TO_SITE_PACKAGES ON)
 endif()
-# Dylibs folder for bpy.so.
-set(MAC_BLENDER_TARGET_DYLIBS_DIR "${TARGETDIR_VER}/lib")
   else()
-set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})
-# Dylibs folder for Blender executable. @executable_path is an rpath.
-set(MAC_BLENDER_TARGET_DYLIBS_DIR "$")
+set(TARGETDIR_VER 
$/../Resources/${BLENDER_VERSION})
   endif()
+  set(MAC_BLENDER_TARGET_DYLIBS_DIR "${TARGETDIR_VER}/lib")
   # Skip relinking on cpack / install
   set_target_properties(blender PROPERTIES BUILD_WITH_INSTALL_RPATH true)
 endif()

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


[Bf-blender-cvs] [3335f852a12] master: Cleanup: mixing enum/non-enum type warning in conditional expression

2021-08-09 Thread Campbell Barton
Commit: 3335f852a12973d4cb462d1f73a5cd734a313494
Author: Campbell Barton
Date:   Tue Aug 10 12:04:17 2021 +1000
Branches: master
https://developer.blender.org/rB3335f852a12973d4cb462d1f73a5cd734a313494

Cleanup: mixing enum/non-enum type warning in conditional expression

===

M   source/blender/editors/animation/keyframes_keylist.cc

===

diff --git a/source/blender/editors/animation/keyframes_keylist.cc 
b/source/blender/editors/animation/keyframes_keylist.cc
index 85036efc983..916d7de0635 100644
--- a/source/blender/editors/animation/keyframes_keylist.cc
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -294,7 +294,7 @@ static void nupdate_ak_bezt(void *node, void *data)
   }
 
   /* For interpolation type, select the highest value (enum is sorted). */
-  ak->handle_type = MAX2(ak->handle_type, bezt_handle_type(bezt));
+  ak->handle_type = MAX2((eKeyframeHandleDrawOpts)ak->handle_type, 
bezt_handle_type(bezt));
 
   /* For extremes, detect when combining different states. */
   const char new_extreme = bezt_extreme_type(chain);

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


[Bf-blender-cvs] [26fea4de635] master: Cleanup: unused function warning

2021-08-09 Thread Campbell Barton
Commit: 26fea4de635f28d91cb81a54cf18382c839861cb
Author: Campbell Barton
Date:   Tue Aug 10 11:57:33 2021 +1000
Branches: master
https://developer.blender.org/rB26fea4de635f28d91cb81a54cf18382c839861cb

Cleanup: unused function warning

===

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

===

diff --git a/source/blender/makesrna/intern/rna_sequencer.c 
b/source/blender/makesrna/intern/rna_sequencer.c
index e7f074efb01..dad77b4aad5 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -148,9 +148,9 @@ static void 
rna_Sequence_invalidate_preprocessed_update(Main *UNUSED(bmain),
   }
 }
 
-static void rna_Sequence_invalidate_composite_update(Main *UNUSED(bmain),
- Scene *UNUSED(scene),
- PointerRNA *ptr)
+static void UNUSED_FUNCTION(rna_Sequence_invalidate_composite_update)(Main 
*UNUSED(bmain),
+  Scene 
*UNUSED(scene),
+  
PointerRNA *ptr)
 {
   Scene *scene = (Scene *)ptr->owner_id;
   Editing *ed = SEQ_editing_get(scene, false);

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


[Bf-blender-cvs] [d9930cddfd6] master: Fix invalid string comparison in cd692c6954629e977250ec7c12509ffd3f9

2021-08-09 Thread Campbell Barton
Commit: d9930cddfd6214221f930c1dc3f4de649781ac31
Author: Campbell Barton
Date:   Tue Aug 10 11:46:10 2021 +1000
Branches: master
https://developer.blender.org/rBd9930cddfd6214221f930c1dc3f4de649781ac31

Fix invalid string comparison in cd692c6954629e977250ec7c12509ffd3f9

===

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

===

diff --git a/source/blender/editors/space_node/drawnode.cc 
b/source/blender/editors/space_node/drawnode.cc
index b5acdede81b..0f7a911e3ce 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -3596,7 +3596,7 @@ static void std_node_socket_draw(
   break;
 }
 case SOCK_TEXTURE: {
-  if (text == "") {
+  if (text[0] == '\0') {
 uiTemplateID(layout,
  C,
  ptr,

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


[Bf-blender-cvs] [f56338490a0] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-08-09 Thread YimingWu
Commit: f56338490a0957fde9f822cee1ec6fc4166abbd2
Author: YimingWu
Date:   Tue Aug 10 09:41:48 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBf56338490a0957fde9f822cee1ec6fc4166abbd2

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===

diff --cc source/blender/editors/animation/keyframes_keylist.cc
index 98aedb9cd0c,85036efc983..26b1d7bc49d
--- a/source/blender/editors/animation/keyframes_keylist.cc
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@@ -782,8 -792,12 +792,10 @@@ void fcurve_to_keylist(AnimData *adt, F
  
/* Neighbor keys, accounting for being cyclic. */
if (do_extremes) {
- chain.prev = (v > 0) ? &fcu->bezt[v - 1] : is_cyclic ? 
&fcu->bezt[fcu->totvert - 2] : NULL;
- chain.next = (v + 1 < fcu->totvert) ? &fcu->bezt[v + 1] : is_cyclic ? 
&fcu->bezt[1] : NULL;
 -chain.prev = (v > 0)   ? &fcu->bezt[v - 1] :
 - is_cyclic ? &fcu->bezt[fcu->totvert - 2] :
 - nullptr;
++chain.prev = (v > 0) ? &fcu->bezt[v - 1] :
++   is_cyclic ? &fcu->bezt[fcu->totvert - 2] : 
nullptr;
+ chain.next = (v + 1 < fcu->totvert) ? &fcu->bezt[v + 1] :
 - is_cyclic  ? &fcu->bezt[1] :
 -  nullptr;
++  is_cyclic ? &fcu->bezt[1] : 
nullptr;
}
  
add_bezt_to_keycolumns_list(keylist, &chain);

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


[Bf-blender-cvs] [cb7b4064d6c] master: VSE: Fix cache invalidation

2021-08-09 Thread Richard Antalik
Commit: cb7b4064d6c7baba7269df94329422e307aa3880
Author: Richard Antalik
Date:   Tue Aug 10 01:24:06 2021 +0200
Branches: master
https://developer.blender.org/rBcb7b4064d6c7baba7269df94329422e307aa3880

VSE: Fix cache invalidation

Blend mode replace is done in preprocessing stage, but property update
function invalidated composite cache.

===

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

===

diff --git a/source/blender/makesrna/intern/rna_sequencer.c 
b/source/blender/makesrna/intern/rna_sequencer.c
index 74fe2a26505..e7f074efb01 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1900,7 +1900,7 @@ static void rna_def_sequence(BlenderRNA *brna)
   /* stupid 0-100 -> 0-1 */
   RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", 
"rna_Sequence_opacity_set", NULL);
   RNA_def_property_update(
-  prop, NC_SCENE | ND_SEQUENCER, 
"rna_Sequence_invalidate_composite_update");
+  prop, NC_SCENE | ND_SEQUENCER, 
"rna_Sequence_invalidate_preprocessed_update");
 
   prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_FACTOR);
   RNA_def_property_range(prop, 0.0f, 1.0f);

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


[Bf-blender-cvs] [cd692c69546] master: Geometry Nodes: Add labels for switch node texture sockets

2021-08-09 Thread Wannes Malfait
Commit: cd692c6954629e977250ec7c12509ffd3f90bd07
Author: Wannes Malfait
Date:   Mon Aug 9 17:30:44 2021 -0500
Branches: master
https://developer.blender.org/rBcd692c6954629e977250ec7c12509ffd3f90bd07

Geometry Nodes: Add labels for switch node texture sockets

This makes texture sockets have a label by default. This can be changed
by adding the SOCK_HIDE_LABEL flag to the socket. With this change the
switch node now shows the labels "True" and "False" like for the other
types of sockets.

===

M   source/blender/editors/space_node/drawnode.cc
M   source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc

===

diff --git a/source/blender/editors/space_node/drawnode.cc 
b/source/blender/editors/space_node/drawnode.cc
index 95eb1ccc025..b5acdede81b 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -3596,8 +3596,26 @@ static void std_node_socket_draw(
   break;
 }
 case SOCK_TEXTURE: {
-  uiTemplateID(
-  layout, C, ptr, "default_value", "texture.new", nullptr, nullptr, 0, 
ICON_NONE, nullptr);
+  if (text == "") {
+uiTemplateID(layout,
+ C,
+ ptr,
+ "default_value",
+ "texture.new",
+ nullptr,
+ nullptr,
+ 0,
+ ICON_NONE,
+ nullptr);
+  }
+  else {
+/* 0.3 split ratio is inconsistent, but use it here because the "New" 
button is large. */
+uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
+uiItemL(row, text, 0);
+uiTemplateID(
+row, C, ptr, "default_value", "texture.new", nullptr, nullptr, 0, 
ICON_NONE, nullptr);
+  }
+
   break;
 }
 case SOCK_MATERIAL: {
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc 
b/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc
index e0a3f5ad334..5f02061da97 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc
@@ -30,7 +30,7 @@
 
 static bNodeSocketTemplate geo_node_attribute_sample_texture_in[] = {
 {SOCK_GEOMETRY, N_("Geometry")},
-{SOCK_TEXTURE, N_("Texture")},
+{SOCK_TEXTURE, N_("Texture"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 
PROP_NONE, SOCK_HIDE_LABEL},
 {SOCK_STRING, N_("Mapping")},
 {SOCK_STRING, N_("Result")},
 {-1, ""},

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


[Bf-blender-cvs] [172e713cc69] temp-geometry-nodes-fields-prototype: Add curve parameter node

2021-08-09 Thread Hans Goudey
Commit: 172e713cc69a26b1cbfa4f58fe1d093885ab6eab
Author: Hans Goudey
Date:   Mon Aug 9 17:12:19 2021 -0500
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB172e713cc69a26b1cbfa4f58fe1d093885ab6eab

Add curve parameter node

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_field.hh
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/spline_base.cc
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
M   source/blender/nodes/geometry/node_geometry_util.cc
A   source/blender/nodes/geometry/nodes/node_geo_curve_parameter.cc
M   source/blender/nodes/geometry/nodes/node_geo_normal.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 2fc5b386d07..407db589779 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -536,6 +536,7 @@ geometry_node_categories = [
 NodeItem("GeometryNodeAttribute"),
 NodeItem("GeometryNodeIndex"),
 NodeItem("GeometryNodeNormal"),
+NodeItem("GeometryNodeCurveParameter"),
 ]),
 GeometryNodeCategory("GEO_MATERIAL", "Material", items=[
 NodeItem("GeometryNodeMaterialAssign"),
@@ -560,7 +561,6 @@ geometry_node_categories = [
 NodeItem("GeometryNodeMeshLine"),
 NodeItem("GeometryNodeMeshUVSphere"),
 ]),
-
 GeometryNodeCategory("GEO_POINT", "Point", items=[
 NodeItem("GeometryNodePointDistribute"),
 NodeItem("GeometryNodePointInstance"),
diff --git a/source/blender/blenkernel/BKE_field.hh 
b/source/blender/blenkernel/BKE_field.hh
index 1fceeeadf08..9ec7077e0f7 100644
--- a/source/blender/blenkernel/BKE_field.hh
+++ b/source/blender/blenkernel/BKE_field.hh
@@ -87,6 +87,26 @@ class IndexFieldInputKey : public FieldInputKey {
   }
 };
 
+class CurveParameterFieldInputKey : public FieldInputKey {
+ public:
+  uint64_t hash() const override
+  {
+/* Arbitrary number. */
+return 928347504059;
+  }
+
+  const CPPType &type() const override
+  {
+return CPPType::get();
+  }
+
+ private:
+  bool is_same_as(const FieldInputKey &other) const override
+  {
+return dynamic_cast(&other) != 
nullptr;
+  }
+};
+
 class AnonymousAttributeFieldInputKey : public FieldInputKey {
  private:
   AnonymousCustomDataLayerID *layer_id_;
@@ -429,6 +449,8 @@ class AnonymousAttributeField : public 
GVArrayInputField {
 };
+class CurveParameterField : public 
GVArrayInputField {
+};
 
 class FieldRefBase {
  protected:
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index b0bce26f1c9..8604698b69a 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1483,6 +1483,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_ATTRIBUTE_STORE_ANONYMOUS 1078
 #define GEO_NODE_ATTRIBUTE_EXTRACT 1079
 #define GEO_NODE_NORMAL 1080
+#define GEO_NODE_CURVE_PARAMETER 1081
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 04103565245..c653835eef1 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5142,6 +5142,7 @@ static void registerGeometryNodes()
   register_node_type_geo_convex_hull();
   register_node_type_geo_curve_endpoints();
   register_node_type_geo_curve_length();
+  register_node_type_geo_curve_parameter();
   register_node_type_geo_curve_primitive_bezier_segment();
   register_node_type_geo_curve_primitive_circle();
   register_node_type_geo_curve_primitive_line();
diff --git a/source/blender/blenkernel/intern/spline_base.cc 
b/source/blender/blenkernel/intern/spline_base.cc
index dda7abea0fc..732fabc6582 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -123,7 +123,7 @@ int Spline::evaluated_edges_size() const
 float Spline::length() const
 {
   Span lengths = this->evaluated_lengths();
-  return (lengths.size() == 0) ? 0 : this->evaluated_lengths().last();
+  return lengths.is_empty() ? 0.0f : this->evaluated_lengths().last();
 }
 
 int Spline::segments_size() const
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index 979b215500e..58d0122d261 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -171,6 +171,7 @@ set(SRC
   geometry/nodes/node_geo_convex_hull.cc
   geometry/nodes/node_geo_curve_endpoints.cc
   geometry/nodes/node_geo_curve_length.cc
+  geometry/nodes/node_geo_curve_parameter.cc
   geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
   g

[Bf-blender-cvs] [5c32227025c] temp-geometry-nodes-fields-prototype: Merge branch 'master' into temp-geometry-nodes-fields-prototype

2021-08-09 Thread Hans Goudey
Commit: 5c32227025c17f1c0ee1d350eff8ce89d2936d35
Author: Hans Goudey
Date:   Mon Aug 9 15:35:06 2021 -0500
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB5c32227025c17f1c0ee1d350eff8ce89d2936d35

Merge branch 'master' into temp-geometry-nodes-fields-prototype

===



===



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


[Bf-blender-cvs] [3b87fd376ad] master: Cleanup: Remove unecessary RNA get and set functions

2021-08-09 Thread Hans Goudey
Commit: 3b87fd376adb599877740ca52ee8098622ba56fb
Author: Hans Goudey
Date:   Mon Aug 9 15:25:05 2021 -0500
Branches: master
https://developer.blender.org/rB3b87fd376adb599877740ca52ee8098622ba56fb

Cleanup: Remove unecessary RNA get and set functions

===

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

===

diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index fe43237963d..5ab13e7b44e 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2477,18 +2477,6 @@ static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr,
   ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
 }
 
-static void rna_SpaceClipEditor_cursor_location_get(PointerRNA *ptr, float 
*values)
-{
-  SpaceClip *sc = (SpaceClip *)(ptr->data);
-  copy_v2_v2(values, sc->cursor);
-}
-
-static void rna_SpaceClipEditor_cursor_location_set(PointerRNA *ptr, const 
float *values)
-{
-  SpaceClip *sc = (SpaceClip *)(ptr->data);
-  copy_v2_v2(sc->cursor, values);
-}
-
 static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain),
  Scene *UNUSED(scene),
  PointerRNA *ptr)
@@ -7344,11 +7332,8 @@ static void rna_def_space_clip(BlenderRNA *brna)
 
   /* transform */
   prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+  RNA_def_property_float_sdna(prop, NULL, "cursor");
   RNA_def_property_array(prop, 2);
-  RNA_def_property_float_funcs(prop,
-   "rna_SpaceClipEditor_cursor_location_get",
-   "rna_SpaceClipEditor_cursor_location_set",
-   NULL);
   RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for 
this view");
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);

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


[Bf-blender-cvs] [aad18a00502] refactor-idprop-ui-data: End comments with period

2021-08-09 Thread Hans Goudey
Commit: aad18a005026cfaa19c45f2477318c6e06303eae
Author: Hans Goudey
Date:   Mon Aug 9 15:08:59 2021 -0500
Branches: refactor-idprop-ui-data
https://developer.blender.org/rBaad18a005026cfaa19c45f2477318c6e06303eae

End comments with period

===

M   tests/python/bl_pyapi_idprop.py

===

diff --git a/tests/python/bl_pyapi_idprop.py b/tests/python/bl_pyapi_idprop.py
index abc7780f554..bdf625c1c2e 100644
--- a/tests/python/bl_pyapi_idprop.py
+++ b/tests/python/bl_pyapi_idprop.py
@@ -252,7 +252,7 @@ class TestRNAData(TestHelper, unittest.TestCase):
 bpy.data.objects.new("test", None)
 test_object = bpy.data.objects["test"]
 
-# Access default RNA data values
+# Access default RNA data values.
 test_object.id_properties_clear()
 test_object["test_prop"] = 0.5
 ui_data_test_prop = test_object.id_properties_ui("test_prop")
@@ -263,14 +263,14 @@ class TestRNAData(TestHelper, unittest.TestCase):
 self.assertEqual(rna_data["subtype"], "NONE")
 self.assertGreater(rna_data["soft_max"], 1.0)
 
-# Change RNA data values
+# Change RNA data values.
 ui_data_test_prop.update(subtype="TEMPERATURE", min=0, soft_min=0.1)
 rna_data = ui_data_test_prop.as_dict()
 self.assertEqual(rna_data["min"], 0)
 self.assertEqual(rna_data["soft_min"], 0.1)
 self.assertEqual(rna_data["subtype"], "TEMPERATURE")
 
-# Copy RNA data values from one property to another
+# Copy RNA data values from one property to another.
 test_object["test_prop_2"] = 11.7
 ui_data_test_prop_2 = test_object.id_properties_ui("test_prop_2")
 ui_data_test_prop_2.update_from(ui_data_test_prop)
@@ -280,7 +280,7 @@ class TestRNAData(TestHelper, unittest.TestCase):
 self.assertEqual(rna_data["subtype"], "TEMPERATURE")
 self.assertGreater(rna_data["soft_max"], 1.0)
 
-# Copy RNA data values to another object's property
+# Copy RNA data values to another object's property.
 bpy.data.objects.new("test_2", None)
 test_object_2 = bpy.data.objects["test_2"]
 test_object_2["test_prop_3"] = 20.1
@@ -292,7 +292,7 @@ class TestRNAData(TestHelper, unittest.TestCase):
 self.assertEqual(rna_data["subtype"], "TEMPERATURE")
 self.assertGreater(rna_data["soft_max"], 1.0)
 
-# Test RNA data for string property
+# Test RNA data for string property.
 test_object.id_properties_clear()
 test_object["test_string_prop"] = "Hello there!"
 ui_data_test_prop_string = 
test_object.id_properties_ui("test_string_prop")
@@ -300,7 +300,7 @@ class TestRNAData(TestHelper, unittest.TestCase):
 rna_data = ui_data_test_prop_string.as_dict()
 self.assertEqual(rna_data["default"], "Goodbye where?")
 
-# Test RNA data for array property
+# Test RNA data for array property.
 test_object.id_properties_clear()
 test_object["test_array_prop"] = [1, 2, 3]
 ui_data_test_prop_array = 
test_object.id_properties_ui("test_array_prop")

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


[Bf-blender-cvs] [414ad257ec1] refactor-idprop-ui-data: Merge branch 'master' into refactor-idprop-ui-data

2021-08-09 Thread Hans Goudey
Commit: 414ad257ec11387ff7453109477bc267f127c08f
Author: Hans Goudey
Date:   Mon Aug 9 15:06:35 2021 -0500
Branches: refactor-idprop-ui-data
https://developer.blender.org/rB414ad257ec11387ff7453109477bc267f127c08f

Merge branch 'master' into refactor-idprop-ui-data

===



===



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


[Bf-blender-cvs] [8a9d7645441] refactor-idprop-ui-data: Remove trailing whitespace

2021-08-09 Thread Hans Goudey
Commit: 8a9d764544107e14a34910146a159a53edf85a4b
Author: Hans Goudey
Date:   Mon Aug 9 15:08:29 2021 -0500
Branches: refactor-idprop-ui-data
https://developer.blender.org/rB8a9d764544107e14a34910146a159a53edf85a4b

Remove trailing whitespace

===

M   release/scripts/modules/rna_prop_ui.py

===

diff --git a/release/scripts/modules/rna_prop_ui.py 
b/release/scripts/modules/rna_prop_ui.py
index 4b72a00f590..26a2f9ad89b 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -115,13 +115,13 @@ def rna_idprop_ui_create(
 
 rna_idprop_ui_prop_update(item, prop)
 
-# Update the UI settings
+# Update the UI settings.
 ui_data = item.id_properties_ui(prop)
 ui_data.update(
-subtype=subtype, 
-min=min, 
-max=max, 
-soft_min=soft_min, 
+subtype=subtype,
+min=min,
+max=max,
+soft_min=soft_min,
 soft_max=soft_max,
 description=description,
 default=default,

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


[Bf-blender-cvs] [e07b6774047] x11-egl: GHOST/X11: link libGL for EGL to resolve OpenGL symbols

2021-08-09 Thread Christian Rauch
Commit: e07b67740471c2422c9166bee83f619a16fb8fb4
Author: Christian Rauch
Date:   Mon Aug 9 20:52:23 2021 +0100
Branches: x11-egl
https://developer.blender.org/rBe07b67740471c2422c9166bee83f619a16fb8fb4

GHOST/X11: link libGL for EGL to resolve OpenGL symbols

This links libGL, since libOpenGL is not installed by default on some
distributions. This is a workaround to resolve OpenGL symbols, that are
otherwise resolved via GLVND.

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

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae2d4b1c8cb..49266c02a16 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1189,7 +1189,11 @@ endif()
 
 if(WITH_GL_EGL)
   find_package(OpenGL REQUIRED EGL)
-  list(APPEND BLENDER_GL_LIBRARIES OpenGL::EGL)
+  list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_egl_LIBRARY})
+
+  # TODO: This links libGL, since libOpenGL is not installed by default on some
+  # distributions. This should be removed once GLVND is properly supported.
+  list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_gl_LIBRARY})
 
   list(APPEND GL_DEFINITIONS -DWITH_GL_EGL -DGLEW_EGL -DGLEW_INC_EGL)

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


[Bf-blender-cvs] [605f08c043d] x11-egl: GHOST/X11: don't link GLX when using EGL

2021-08-09 Thread Christian Rauch
Commit: 605f08c043da94c99e1bf2ec4f00a79dd4498b92
Author: Christian Rauch
Date:   Sun Aug 8 18:34:34 2021 +0100
Branches: x11-egl
https://developer.blender.org/rB605f08c043da94c99e1bf2ec4f00a79dd4498b92

GHOST/X11: don't link GLX when using EGL

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

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac5c80cb0d8..ae2d4b1c8cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1179,11 +1179,11 @@ if(WITH_GL_PROFILE_ES20)
 
   endif()
 
-else()
+elseif(NOT WITH_GL_EGL)
   if(OpenGL_GL_PREFERENCE STREQUAL "LEGACY" AND OPENGL_gl_LIBRARY)
 list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_gl_LIBRARY})
   else()
-list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_opengl_LIBRARY} 
${OPENGL_glx_LIBRARY})
+list(APPEND BLENDER_GL_LIBRARIES OpenGL::OpenGL OpenGL::GLX)
   endif()
 endif()

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


[Bf-blender-cvs] [d95fe3c8533] x11-egl: GHOST/X11: remove duplicated EGL linking

2021-08-09 Thread Christian Rauch
Commit: d95fe3c85333032e0cf8d70b8ed2cf8b96f739e4
Author: Christian Rauch
Date:   Sun Aug 8 18:42:37 2021 +0100
Branches: x11-egl
https://developer.blender.org/rBd95fe3c85333032e0cf8d70b8ed2cf8b96f739e4

GHOST/X11: remove duplicated EGL linking

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

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db42f957ee2..ac5c80cb0d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1201,8 +1201,6 @@ if(WITH_GL_EGL)
   )
 endif()
 
-list(APPEND BLENDER_GL_LIBRARIES ${OPENGLES_EGL_LIBRARY})
-
   else()
 set(OPENGLES_EGL_LIBRARY "" CACHE FILEPATH "EGL library file")
 mark_as_advanced(OPENGLES_EGL_LIBRARY)

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


[Bf-blender-cvs] [96a1be78e28] x11-egl: GHOST/X11: enable EGL

2021-08-09 Thread Christian Rauch
Commit: 96a1be78e2824d4372507d19beda8d678b661813
Author: Christian Rauch
Date:   Mon Jul 26 21:55:43 2021 +0100
Branches: x11-egl
https://developer.blender.org/rB96a1be78e2824d4372507d19beda8d678b661813

GHOST/X11: enable EGL

This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

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

===

M   CMakeLists.txt
M   build_files/build_environment/install_deps.sh
M   build_files/cmake/platform/platform_unix.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2868324bf46..db42f957ee2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -255,16 +255,6 @@ if(WITH_GHOST_X11)
   option(WITH_X11_ALPHA "Enable X11 transparent background"
 ON)
 endif()
 
-if(UNIX AND NOT APPLE)
-  option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the 
operating system" OFF)
-  option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating 
system"   ON)
-else()
-  # not an option for other OS's
-  set(WITH_SYSTEM_GLEW OFF)
-  set(WITH_SYSTEM_GLES OFF)
-endif()
-
-
 if(UNIX AND NOT APPLE)
   option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
 endif()
@@ -493,15 +483,32 @@ endif()
 
 # OpenGL
 
+if(UNIX AND NOT APPLE)
+  # GLEW can only built with either GLX or EGL support and most binary
+  # distributions are built with GLX support. So we always compile GLEW
+  # with EGL support manually, and the options are no longer available.
+  set(WITH_SYSTEM_GLEW OFF)
+  set(WITH_SYSTEM_GLES ON)
+
+  # Always use EGL instead of GLX, for X11, Wayland and headless.
+  set(WITH_GL_EGL ON)
+else()
+  # System GLEW and GLES were never an option on other platforms.
+  set(WITH_SYSTEM_GLEW OFF)
+  set(WITH_SYSTEM_GLES OFF)
+
+  # Experimental EGL option.
+  option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the 
platform specific OpenGL system library (CGL or WGL)" OFF)
+  mark_as_advanced(WITH_GL_EGL)
+endif()
+
 option(WITH_OPENGL  "When off limits visibility of the opengl 
headers to just bf_gpu and gawain (temporary option for development purposes)" 
ON)
 option(WITH_GLEW_ES "Switches to experimental copy of GLEW that 
has support for OpenGL ES. (temporary option for development purposes)" OFF)
-option(WITH_GL_EGL  "Use the EGL OpenGL system library instead of 
the platform specific OpenGL system library (CGL, glX, or WGL)"   OFF)
 option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either 
EGL or the AGL/WGL/XGL 'es20' profile)"   OFF)
 
 mark_as_advanced(
   WITH_OPENGL
   WITH_GLEW_ES
-  WITH_GL_EGL
   WITH_GL_PROFILE_ES20
 )
 
diff --git a/build_files/build_environment/install_deps.sh 
b/build_files/build_environment/install_deps.sh
index ff4aad79bb6..cee8109ba32 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -603,9 +603,6 @@ MP3LAME_DEV=""
 OPENJPEG_USE=false
 OPENJPEG_DEV=""
 
-# Whether to use system GLEW or not (OpenSubDiv needs recent glew to work).
-NO_SYSTEM_GLEW=false
-
 # Switch to english language, else some things (like check_package_DEB()) 
won't work!
 LANG_BACK=$LANG
 LANG=""
@@ -4008,13 +4005,9 @@ install_DEB() {
 version_ge $_glew "1.7.0"
 if [ $? -eq 1 ]; then
   WARNING "OpenSubdiv disabled because GLEW-$_glew is not enough"
-  WARNING "Blender will not use system GLEW library"
   OSD_SKIP=true
-  NO_SYSTEM_GLEW=true
 else
   WARNING "OpenSubdiv will compile with GLEW-$_glew but with limited 
capability"
-  WARNING "Blender will not use system GLEW library"
-  NO_SYSTEM_GLEW=true
 fi
   fi
 
@@ -5985,12 +5978,6 @@ print_info() {
 fi
   fi
 
-  if [ "$NO_SYSTEM_GLEW" = true ]; then
-_1="-D WITH_SYSTEM_GLEW=OFF"
-PRINT "  $_1"
-_buildargs="$_buildargs $_1"
-  fi
-
   if [ "$FFMPEG_SKIP" = false ]; then
 _1="-D WITH_CODEC_FFMPEG=ON"
 _2="-D 
FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index 7f62399ac4f..ffdbbc3f8c5 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -581,8 +581,6 @@ if(WITH_GHOST_WAYLAND)
   pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
   pkg_check_modules(dbus REQUIRED dbus-1)
 
-  set(WITH_GL_EGL ON)
-
   list(APPEND PLATFORM_LINKLIBS
 ${wayland-client_LINK_LIBRARIES}
 ${wayland-egl_LINK_LIBRARIES}

___

[Bf-blender-cvs] [8e3dea27ecf] master: Docs: Blend-File: Fix typo

2021-08-09 Thread Rob Ranieri
Commit: 8e3dea27ecfbfb374a244195e2938cec6157b982
Author: Rob Ranieri
Date:   Mon Aug 9 15:36:06 2021 -0400
Branches: master
https://developer.blender.org/rB8e3dea27ecfbfb374a244195e2938cec6157b982

Docs: Blend-File: Fix typo

Reviewed By: Blendify

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

===

M   doc/blender_file_format/BlendFileReader.py

===

diff --git a/doc/blender_file_format/BlendFileReader.py 
b/doc/blender_file_format/BlendFileReader.py
index a2f214bc4fc..1e66fc55ab0 100644
--- a/doc/blender_file_format/BlendFileReader.py
+++ b/doc/blender_file_format/BlendFileReader.py
@@ -123,7 +123,7 @@ def Align(handle):
 class BlendFile:
 '''
 Reads a blendfile and store the header, all the fileblocks, and catalogue
-structs foound in the DNA fileblock
+structs found in the DNA fileblock
 
 - BlendFile.Header  (BlendFileHeader instance)
 - BlendFile.Blocks  (list of BlendFileBlock instances)

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


[Bf-blender-cvs] [ce95a2b148e] master: UI: Clip Editor: Move Annotation Panel to new View tab

2021-08-09 Thread Aaron Carlisle
Commit: ce95a2b148ed498a7e8ac7fb6565d7e5f21fca6f
Author: Aaron Carlisle
Date:   Mon Aug 9 15:25:27 2021 -0400
Branches: master
https://developer.blender.org/rBce95a2b148ed498a7e8ac7fb6565d7e5f21fca6f

UI: Clip Editor: Move Annotation Panel to new View tab

To be consistent with all other editors the annotation
layers pannel should be placed in a "View Tab".
In my next commit, this tab will be expanded to include other options.

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index ae106f893d3..7bac0556fb9 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1239,7 +1239,7 @@ class CLIP_PT_tools_scenesetup(Panel):
 class CLIP_PT_annotation(AnnotationDataPanel, CLIP_PT_clip_view_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
-bl_category = "Annotation"
+bl_category = "View"
 bl_options = set()
 
 # NOTE: this is just a wrapper around the generic GP Panel

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


[Bf-blender-cvs] [2d867426b1b] master: UI: Clip Editor: Expose 2D Cursor Location to RNA and UI

2021-08-09 Thread Aaron Carlisle
Commit: 2d867426b1b7e28b58bf0c84119679c73f08175f
Author: Aaron Carlisle
Date:   Mon Aug 9 15:30:55 2021 -0400
Branches: master
https://developer.blender.org/rB2d867426b1b7e28b58bf0c84119679c73f08175f

UI: Clip Editor: Expose 2D Cursor Location to RNA and UI

To be consistent with the image editors and 3D viewport
the cursor location can be changed from the sidebar.
This was missing from the clip editor, but support has been added in this 
commit.
Previously, the only way to precisely set the cursor was
to call the set cursor operator then use the redo panel to adjust the value.

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/makesrna/intern/rna_space.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index 7bac0556fb9..a1e5b509295 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1075,6 +1075,31 @@ class 
CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel):
 layout.prop(stab, "filter_type")
 
 
+class CLIP_PT_2d_cursor(Panel):
+bl_space_type = 'CLIP_EDITOR'
+bl_region_type = 'UI'
+bl_category = "View"
+bl_label = "2D Cursor"
+
+@classmethod
+def poll(cls, context):
+sc = context.space_data
+
+if CLIP_PT_clip_view_panel.poll(context):
+return sc.pivot_point == 'CURSOR' or sc.mode == 'MASK'
+
+def draw(self, context):
+layout = self.layout
+
+sc = context.space_data
+
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+col = layout.column()
+col.prop(sc, "cursor_location", text="Location")
+
+
 class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
 bl_space_type = 'CLIP_EDITOR'
 bl_region_type = 'UI'
@@ -1862,6 +1887,7 @@ classes = (
 CLIP_PT_proxy,
 CLIP_PT_footage,
 CLIP_PT_stabilization,
+CLIP_PT_2d_cursor,
 CLIP_PT_mask,
 CLIP_PT_mask_layers,
 CLIP_PT_mask_display,
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 8c62484f229..fe43237963d 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2477,6 +2477,18 @@ static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr,
   ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
 }
 
+static void rna_SpaceClipEditor_cursor_location_get(PointerRNA *ptr, float 
*values)
+{
+  SpaceClip *sc = (SpaceClip *)(ptr->data);
+  copy_v2_v2(values, sc->cursor);
+}
+
+static void rna_SpaceClipEditor_cursor_location_set(PointerRNA *ptr, const 
float *values)
+{
+  SpaceClip *sc = (SpaceClip *)(ptr->data);
+  copy_v2_v2(sc->cursor, values);
+}
+
 static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain),
  Scene *UNUSED(scene),
  PointerRNA *ptr)
@@ -7330,6 +7342,16 @@ static void rna_def_space_clip(BlenderRNA *brna)
   RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP);
   RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
+  /* transform */
+  prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+  RNA_def_property_array(prop, 2);
+  RNA_def_property_float_funcs(prop,
+   "rna_SpaceClipEditor_cursor_location_get",
+   "rna_SpaceClipEditor_cursor_location_set",
+   NULL);
+  RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for 
this view");
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
   /* pivot point */
   prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_sdna(prop, NULL, "around");

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


[Bf-blender-cvs] [b04997cca45] master: Fix T90547: Add node errors when compiled without OpenVDB or Bullet

2021-08-09 Thread Hans Goudey
Commit: b04997cca45882526ff8eb3c65579046e618d9bd
Author: Hans Goudey
Date:   Mon Aug 9 13:42:19 2021 -0500
Branches: master
https://developer.blender.org/rBb04997cca45882526ff8eb3c65579046e618d9bd

Fix T90547: Add node errors when compiled without OpenVDB or Bullet

These were added in other places but were overlooked here.

===

M   source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
M   source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc 
b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
index 91d569282c3..91e08db 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
@@ -304,6 +304,8 @@ static void geo_node_convex_hull_exec(GeoNodeExecParams 
params)
   }
   params.set_output("Convex Hull", GeometrySet::create_with_mesh(mesh));
 #else
+  params.error_message_add(NodeWarningType::Error,
+   TIP_("Disabled, Blender was compiled without 
Bullet"));
   params.set_output("Convex Hull", geometry_set);
 #endif /* WITH_BULLET */
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
index 403f4906d07..4c1151bf6c2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
@@ -149,6 +149,9 @@ static void geo_node_volume_to_mesh_exec(GeoNodeExecParams 
params)
 
 #ifdef WITH_OPENVDB
   create_mesh_from_volume(geometry_set_in, geometry_set_out, params);
+#else
+  params.error_message_add(NodeWarningType::Error,
+   TIP_("Disabled, Blender was compiled without 
OpenVDB"));
 #endif
 
   params.set_output("Geometry", geometry_set_out);

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


[Bf-blender-cvs] [15f33b0439f] soc-2021-vse-strip-thumbnails: Add toggle button in overlay menu for thumbnail drawing toggle

2021-08-09 Thread Aditya Y Jeppu
Commit: 15f33b0439f28a0b4ebb3b36bce55a1a7cd348df
Author: Aditya Y Jeppu
Date:   Tue Aug 10 00:06:49 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB15f33b0439f28a0b4ebb3b36bce55a1a7cd348df

Add toggle button in overlay menu for thumbnail drawing toggle

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenloader/intern/versioning_defaults.c
M   source/blender/editors/space_sequencer/sequencer_draw.c
M   source/blender/editors/space_sequencer/space_sequencer.c
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_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 20fb39e8c1f..6887d3ef8a4 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -254,7 +254,8 @@ class SEQUENCER_PT_sequencer_overlay(Panel):
 layout.prop(st, "show_strip_offset", text="Offsets")
 layout.prop(st, "show_fcurves", text="F-Curves")
 layout.prop(st, "show_grid", text="Grid")
-
+layout.prop(st, "show_thumbnails", text="Thumbnails")
+
 layout.separator()
 
 layout.prop_menu_enum(st, "waveform_display_type")
diff --git a/source/blender/blenloader/intern/versioning_defaults.c 
b/source/blender/blenloader/intern/versioning_defaults.c
index 82c577d11a0..ac5696b7ef0 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -157,7 +157,7 @@ static void blo_update_defaults_screen(bScreen *screen,
   SpaceSeq *seq = area->spacedata.first;
   seq->flag |= SEQ_SHOW_MARKERS | SEQ_SHOW_FCURVES | SEQ_ZOOM_TO_FIT | 
SEQ_SHOW_STRIP_OVERLAY |
SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_NAME | 
SEQ_SHOW_STRIP_DURATION |
-   SEQ_SHOW_GRID;
+   SEQ_SHOW_GRID | SEQ_SHOW_THUMBNAILS;
 
   seq->render_size = SEQ_RENDER_SIZE_PROXY_100;
   seq->flag |= SEQ_USE_PROXIES;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 0ff02e61d1d..a1818a44de6 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1497,7 +1497,8 @@ static void draw_seq_strip(const bContext *C,
 drawmeta_contents(scene, seq, x1, y1, x2, y2);
   }
 
-  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
+  if ((sseq->flag & SEQ_SHOW_THUMBNAILS) && seq->type == SEQ_TYPE_MOVIE ||
+  seq->type == SEQ_TYPE_IMAGE) {
 draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
   }
 
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c 
b/source/blender/editors/space_sequencer/space_sequencer.c
index 9e9b578e608..94895ac1954 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -100,7 +100,9 @@ static SpaceLink *sequencer_create(const ScrArea 
*UNUSED(area), const Scene *sce
   sseq->mainb = SEQ_DRAW_IMG_IMBUF;
   sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS | 
SEQ_SHOW_FCURVES |
SEQ_ZOOM_TO_FIT | SEQ_SHOW_STRIP_OVERLAY | SEQ_SHOW_STRIP_NAME |
-   SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID;
+   SEQ_SHOW_STRIP_SOURCE | SEQ_SHOW_STRIP_DURATION | SEQ_SHOW_GRID 
|
+   SEQ_SHOW_THUMBNAILS;
+
   struct rctf temp = {0, 0, 0, 0};
   sseq->check_view_area = temp;
   /* Tool header. */
diff --git a/source/blender/makesdna/DNA_space_types.h 
b/source/blender/makesdna/DNA_space_types.h
index da71e145f8f..76965a4eecd 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -659,6 +659,7 @@ typedef enum eSpaceSeq_Flag {
   SEQ_SHOW_STRIP_DURATION = (1 << 16),
   SEQ_USE_PROXIES = (1 << 17),
   SEQ_SHOW_GRID = (1 << 18),
+  SEQ_SHOW_THUMBNAILS = (1<<19),
 } eSpaceSeq_Flag;
 
 /* SpaceSeq.view */
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 8c62484f229..fe43a8f878f 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -5556,6 +5556,11 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
   RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GRID);
   RNA_def_property_ui_text(prop, "Show Grid", "Show vertical grid lines");
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+  prop = RNA_def_property(srna, "show_thumbnails", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_THUMBNAILS);
+  RNA_def_property_ui_text(

[Bf-blender-cvs] [fa9d1cb2a99] temp-geometry-nodes-fields-prototype: properly adapt selection domain

2021-08-09 Thread Jacques Lucke
Commit: fa9d1cb2a9977980c697c0595cd6dd87007f000d
Author: Jacques Lucke
Date:   Mon Aug 9 19:31:32 2021 +0200
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rBfa9d1cb2a9977980c697c0595cd6dd87007f000d

properly adapt selection domain

===

M   source/blender/blenkernel/BKE_geometry_set.hh
M   source/blender/blenkernel/intern/geometry_component_mesh.cc
M   source/blender/functions/FN_generic_virtual_array.hh
M   source/blender/nodes/geometry/node_geometry_util.cc
M   source/blender/nodes/geometry/nodes/node_geo_extrude.cc

===

diff --git a/source/blender/blenkernel/BKE_geometry_set.hh 
b/source/blender/blenkernel/BKE_geometry_set.hh
index 4118a1013d4..55a239f6a5c 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -396,6 +396,10 @@ class MeshComponent : public GeometryComponent {
   const AttributeDomain from_domain,
   const AttributeDomain to_domain) const final;
 
+  blender::VArrayPtr adapt_selection(blender::VArrayPtr selection,
+   AttributeDomain from_domain,
+   AttributeDomain to_domain) const;
+
   bool is_empty() const final;
 
   bool owns_direct_data() const override;
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc 
b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index ef93a3f9b3f..d694cdc634d 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -651,6 +651,207 @@ blender::fn::GVArrayPtr 
MeshComponent::attribute_try_adapt_domain(
   return {};
 }
 
+namespace blender::bke::adapt_selection_domain {
+static VArrayPtr varray_from_array(Array array)
+{
+  return 
std::make_unique>>(std::move(array));
+}
+
+static VArrayPtr adapt_selection_point_to_face(const Mesh &mesh, 
VArrayPtr selection)
+{
+  Array new_selection(mesh.totpoly);
+  for (const int poly_index : IndexRange(mesh.totpoly)) {
+const MPoly &poly = mesh.mpoly[poly_index];
+bool poly_is_selected = true;
+for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
+  const MLoop &loop = mesh.mloop[loop_index];
+  if (!selection->get(loop.v)) {
+poly_is_selected = false;
+break;
+  }
+}
+new_selection[poly_index] = poly_is_selected;
+  }
+  return varray_from_array(std::move(new_selection));
+}
+
+static VArrayPtr adapt_selection_point_to_corner(const Mesh &mesh, 
VArrayPtr selection)
+{
+  Array new_selection(mesh.totloop);
+  for (const int loop_index : IndexRange(mesh.totloop)) {
+const MLoop &loop = mesh.mloop[loop_index];
+new_selection[loop_index] = selection->get(loop.v);
+  }
+  return varray_from_array(std::move(new_selection));
+}
+
+static VArrayPtr adapt_selection_point_to_edge(const Mesh &mesh, 
VArrayPtr selection)
+{
+  Array new_selection(mesh.totedge);
+  for (const int edge_index : IndexRange(mesh.totedge)) {
+const MEdge &edge = mesh.medge[edge_index];
+const bool edge_is_selected = selection->get(edge.v1) && 
selection->get(edge.v2);
+new_selection[edge_index] = edge_is_selected;
+  }
+  return varray_from_array(std::move(new_selection));
+}
+
+static VArrayPtr adapt_selection_edge_to_point(const Mesh &mesh, 
VArrayPtr selection)
+{
+  Array new_selection(mesh.totvert, false);
+  for (const int edge_index : IndexRange(mesh.totedge)) {
+if (selection->get(edge_index)) {
+  const MEdge &edge = mesh.medge[edge_index];
+  new_selection[edge.v1] = true;
+  new_selection[edge.v2] = true;
+}
+  }
+  return varray_from_array(std::move(new_selection));
+}
+
+static VArrayPtr adapt_selection_edge_to_face(const Mesh &mesh, 
VArrayPtr selection)
+{
+  Array new_selection(mesh.totpoly);
+  for (const int poly_index : IndexRange(mesh.totpoly)) {
+const MPoly &poly = mesh.mpoly[poly_index];
+bool poly_is_selected = true;
+for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
+  const MLoop &loop = mesh.mloop[loop_index];
+  if (!selection->get(loop.e)) {
+poly_is_selected = false;
+break;
+  }
+}
+new_selection[poly_index] = poly_is_selected;
+  }
+  return varray_from_array(std::move(new_selection));
+}
+
+static VArrayPtr adapt_selection_face_to_point(const Mesh &mesh, 
VArrayPtr selection)
+{
+  Array new_selection(mesh.totvert, false);
+  for (const int poly_index : IndexRange(mesh.totpoly)) {
+const MPoly &poly = mesh.mpoly[poly_index];
+if (selection->get(poly_index)) {
+  for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
+const MLoop &loop = mesh.mloop[loop_index];
+BLI_assert(loop.v < mesh.totvert);
+new_selection[loop.v] = true;
+  }
+}
+  }
+  return

[Bf-blender-cvs] [fddd5eb6927] master: UI: Image Editor: Fix missing 2D cursor in mask edit mode

2021-08-09 Thread Aaron Carlisle
Commit: fddd5eb6927cb348a6a0e2098908e641ee7f83a4
Author: Aaron Carlisle
Date:   Mon Aug 9 11:52:51 2021 -0400
Branches: master
https://developer.blender.org/rBfddd5eb6927cb348a6a0e2098908e641ee7f83a4

UI: Image Editor: Fix missing 2D cursor in  mask edit mode

The 2D cursor should be visible in both mask and uv edit modes.

This was likely and oversight when splitting the image editor
into the UV and Image editors

===

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

===

diff --git a/source/blender/draw/intern/draw_view.c 
b/source/blender/draw/intern/draw_view.c
index ae2c66881ff..90bb3762473 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -211,8 +211,17 @@ static bool is_cursor_visible_2d(const DRWContextState 
*draw_ctx)
 return false;
   }
   SpaceImage *sima = (SpaceImage *)space_data;
-  if (sima->mode != SI_MODE_UV) {
-return false;
+  switch (sima->mode) {
+case SI_MODE_VIEW:
+  return false;
+  break;
+case SI_MODE_PAINT:
+  return false;
+  break;
+case SI_MODE_MASK:
+  break;
+case SI_MODE_UV:
+  break;
   }
   return (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS) != 0;
 }

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


[Bf-blender-cvs] [ff594715b83] master: Build: macOS library upgrade fixes

2021-08-09 Thread Brecht Van Lommel
Commit: ff594715b8347e8d5d6a9f60e48ec7b170661962
Author: Brecht Van Lommel
Date:   Mon Aug 9 16:46:57 2021 +0200
Branches: master
https://developer.blender.org/rBff594715b8347e8d5d6a9f60e48ec7b170661962

Build: macOS library upgrade fixes

* Revert back to OpenMP 9.0.1 due to bug causing cloth physics test to fail.
* Skip flex build on macOS to avoid link error, only reason we build this is
  due to old flex version on Linux CentOS 7.
* Fix PNG cmake argument that expects lowercase on instead of ON.

 Ref T90507, T88438

===

M   build_files/build_environment/CMakeLists.txt
M   build_files/build_environment/cmake/ispc.cmake
M   build_files/build_environment/cmake/openmp.cmake
M   build_files/build_environment/cmake/osl.cmake
M   build_files/build_environment/cmake/png.cmake
M   build_files/build_environment/cmake/versions.cmake
A   build_files/build_environment/patches/openmp.diff

===

diff --git a/build_files/build_environment/CMakeLists.txt 
b/build_files/build_environment/CMakeLists.txt
index 3a9574b4b2a..af1653de59a 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -84,7 +84,7 @@ include(cmake/openimageio.cmake)
 include(cmake/tiff.cmake)
 if(WIN32)
   include(cmake/flexbison.cmake)
-else()
+elseif(UNIX AND NOT APPLE)
   include(cmake/flex.cmake)
 endif()
 include(cmake/osl.cmake)
diff --git a/build_files/build_environment/cmake/ispc.cmake 
b/build_files/build_environment/cmake/ispc.cmake
index 93fc9dc4846..b1cd2cea0c7 100644
--- a/build_files/build_environment/cmake/ispc.cmake
+++ b/build_files/build_environment/cmake/ispc.cmake
@@ -29,13 +29,13 @@ elseif(APPLE)
   if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
 set(ISPC_EXTRA_ARGS_APPLE
   -DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison
-  -DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
+  -DFLEX_EXECUTABLE=/opt/homebrew/opt/flex/bin/flex
   -DARM_ENABLED=On
 )
   else()
 set(ISPC_EXTRA_ARGS_APPLE
   -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-  -DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
+  -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
   -DARM_ENABLED=Off
 )
   endif()
@@ -84,7 +84,7 @@ if(WIN32)
 external_ispc
 external_flexbison
   )
-else()
+elseif(UNIX AND NOT APPLE)
   add_dependencies(
 external_ispc
 external_flex
diff --git a/build_files/build_environment/cmake/openmp.cmake 
b/build_files/build_environment/cmake/openmp.cmake
index 0e5323ca513..d4d5e69a5ad 100644
--- a/build_files/build_environment/cmake/openmp.cmake
+++ b/build_files/build_environment/cmake/openmp.cmake
@@ -16,12 +16,18 @@
 #
 # * END GPL LICENSE BLOCK *
 
+if(APPLE)
+  set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d 
${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)
+else()
+  set(OPENMP_PATCH_COMMAND)
+endif()
 
 ExternalProject_Add(external_openmp
   URL file://${PACKAGE_DIR}/${OPENMP_FILE}
   DOWNLOAD_DIR ${DOWNLOAD_DIR}
   URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
   PREFIX ${BUILD_DIR}/openmp
+  PATCH_COMMAND ${OPENMP_PATCH_COMMAND}
   CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
   INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && 
install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make 
install
   INSTALL_DIR ${LIBDIR}/openmp
diff --git a/build_files/build_environment/cmake/osl.cmake 
b/build_files/build_environment/cmake/osl.cmake
index 05aedb1f085..c20bf68c0ef 100644
--- a/build_files/build_environment/cmake/osl.cmake
+++ b/build_files/build_environment/cmake/osl.cmake
@@ -96,7 +96,7 @@ if(WIN32)
 external_osl
 external_flexbison
   )
-else()
+elseif(UNIX AND NOT APPLE)
   add_dependencies(
 external_osl
 external_flex
diff --git a/build_files/build_environment/cmake/png.cmake 
b/build_files/build_environment/cmake/png.cmake
index 458d3a1fd98..3fc53b238c2 100644
--- a/build_files/build_environment/cmake/png.cmake
+++ b/build_files/build_environment/cmake/png.cmake
@@ -23,7 +23,7 @@ set(PNG_EXTRA_ARGS
 )
 
 if(BLENDER_PLATFORM_ARM)
-  set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON 
-DPNG_ARM_NEON=ON -DCMAKE_SYSTEM_PROCESSOR="aarch64")
+  set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON 
-DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64")
 endif()
 
 ExternalProject_Add(external_png
diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index bc220c596c1..d1675bdddfd 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -158,10 +158,18 @@ set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
 set(LLVM_HASH_TYPE MD5)
 set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
 
-set(OPENMP_URI 
https://githu

[Bf-blender-cvs] [a7338751ab3] asset-greasepencil: Merge branch 'master' into asset-greasepencil

2021-08-09 Thread Antonio Vazquez
Commit: a7338751ab3a3f02f0f4b46a7fc86ab05b1a7885
Author: Antonio Vazquez
Date:   Mon Aug 9 15:29:49 2021 +0200
Branches: asset-greasepencil
https://developer.blender.org/rBa7338751ab3a3f02f0f4b46a7fc86ab05b1a7885

Merge branch 'master' into asset-greasepencil

===



===



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


[Bf-blender-cvs] [71e2c366f7d] master: Cleanup: Fix compiler warning

2021-08-09 Thread Antonio Vazquez
Commit: 71e2c366f7d19d8fe4f160a60597e63692fdc7ca
Author: Antonio Vazquez
Date:   Mon Aug 9 15:28:12 2021 +0200
Branches: master
https://developer.blender.org/rB71e2c366f7d19d8fe4f160a60597e63692fdc7ca

Cleanup: Fix compiler warning

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index aaea1c0ddaf..9e96c40b2db 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -997,7 +997,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
   gps->uv_scale = 1.0f;
 
   /* Set stroke caps. */
-  gps->caps[0] = gps->caps[1] = brush->gpencil_settings->caps_type;
+  gps->caps[0] = gps->caps[1] = (short)brush->gpencil_settings->caps_type;
 
   /* allocate enough memory for a continuous array for storage points */
   const int subdivide = brush->gpencil_settings->draw_subdivide;

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


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

2021-08-09 Thread Campbell Barton
Commit: 6deb37474eb082400ccd9d0cac0459116f24aacf
Author: Campbell Barton
Date:   Mon Aug 9 22:55:12 2021 +1000
Branches: master
https://developer.blender.org/rB6deb37474eb082400ccd9d0cac0459116f24aacf

Cleanup: spelling in comments

===

M   source/blender/blenkernel/BKE_bvhutils.h
M   source/blender/editors/interface/interface_layout.c
M   source/blender/editors/space_outliner/outliner_tools.c
M   source/blender/python/intern/bpy_interface.c
M   source/blender/python/intern/bpy_rna_id_collection.c
M   source/blender/python/mathutils/mathutils_Vector.c
M   source/blender/python/mathutils/mathutils_geometry.c

===

diff --git a/source/blender/blenkernel/BKE_bvhutils.h 
b/source/blender/blenkernel/BKE_bvhutils.h
index 8be2fcbdb83..06be8ec80fc 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -69,7 +69,7 @@ typedef struct BVHTreeFromMesh {
   BVHTree_NearestPointCallback nearest_callback;
   BVHTree_RayCastCallback raycast_callback;
 
-  /* Vertex array, so that callbacks have instante access to data */
+  /* Vertex array, so that callbacks have instant access to data. */
   const struct MVert *vert;
   const struct MEdge *edge; /* only used for BVHTreeFromMeshEdges */
   const struct MFace *face;
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index 03c67e9b046..ec5a30f7793 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -282,7 +282,7 @@ static int ui_layout_vary_direction(uiLayout *layout)
 
 static bool ui_layout_variable_size(uiLayout *layout)
 {
-  /* Note that this code is probably a bit flakey, we'd probably want to know 
whether it's
+  /* Note that this code is probably a bit flaky, we'd probably want to know 
whether it's
* variable in X and/or Y, etc. But for now it mimics previous one,
* with addition of variable flag set for children of grid-flow layouts. */
   return ui_layout_vary_direction(layout) == UI_ITEM_VARY_X || 
layout->variable_size;
diff --git a/source/blender/editors/space_outliner/outliner_tools.c 
b/source/blender/editors/space_outliner/outliner_tools.c
index e3aec572bd3..a994368a0ec 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -845,7 +845,7 @@ static void id_override_library_create_fn(bContext *C,
 if (!ID_IS_LINKED(te->store_elem->id)) {
   break;
 }
-/* If we'd need to override that arent ID, but it is not overridable, 
abort. */
+/* If we'd need to override that aren't ID, but it is not overridable, 
abort. */
 if (!ID_IS_OVERRIDABLE_LIBRARY(te->store_elem->id)) {
   BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
   BKE_reportf(reports,
diff --git a/source/blender/python/intern/bpy_interface.c 
b/source/blender/python/intern/bpy_interface.c
index f91ba4d362c..35450e3eaad 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -155,7 +155,7 @@ void bpy_context_clear(bContext *UNUSED(C), const 
PyGILState_STATE *gilstate)
   }
   else if (py_call_level == 0) {
 /* XXX: Calling classes currently won't store the context :\,
- * can't set NULL because of this. but this is very flakey still. */
+ * can't set NULL because of this. but this is very flaky still. */
 #if 0
 BPY_context_set(NULL);
 #endif
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c 
b/source/blender/python/intern/bpy_rna_id_collection.c
index 1bb68babc3c..7bdb0e30410 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -227,7 +227,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), 
PyObject *args, PyObject *
   }
 
   if (!data_cb.is_subset &&
-  /* We do not want to pre-add keys of flitered out types. */
+  /* We do not want to pre-add keys of filtered out types. */
   (key_types_bitmap == NULL || id_check_type(id, key_types_bitmap)) &&
   /* We do not want to pre-add keys when we have filter on value types,
* but not on key types. */
diff --git a/source/blender/python/mathutils/mathutils_Vector.c 
b/source/blender/python/mathutils/mathutils_Vector.c
index c2223b023ad..efcaa9b6a51 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1926,7 +1926,7 @@ static PyObject *Vector_imatmul(PyObject *v1, PyObject 
*v2)
   return NULL;
 }
 
-/* divid: obj / obj */
+/* divide: obj / obj */
 static PyObject *Vector_div(PyObject *v1, PyObject *v2)
 {
   float *vec = NULL, scalar;
@@ -2939,7 +2939,7 @@ static int row_vector_mult

[Bf-blender-cvs] [6fe00939b0a] master: PyAPI: resolve build error with Python 3.10

2021-08-09 Thread Campbell Barton
Commit: 6fe00939b0a471cc149ea5b3c63ca57b049b4a37
Author: Campbell Barton
Date:   Mon Aug 9 22:55:41 2021 +1000
Branches: master
https://developer.blender.org/rB6fe00939b0a471cc149ea5b3c63ca57b049b4a37

PyAPI: resolve build error with Python 3.10

Resolves T89931

===

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

===

diff --git a/source/blender/python/mathutils/mathutils.c 
b/source/blender/python/mathutils/mathutils.c
index 5beca7bd71a..be7dae6871b 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -95,7 +95,11 @@ Py_hash_t mathutils_array_hash(const float *array, size_t 
array_len)
   x = 0x345678UL;
   i = 0;
   while (--len >= 0) {
+#if PY_VERSION_HEX >= 0x30a /* Version: 3.10. */
+y = _Py_HashDouble(NULL, (double)(array[i++]));
+#else
 y = _Py_HashDouble((double)(array[i++]));
+#endif
 if (y == -1) {
   return -1;
 }

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


[Bf-blender-cvs] [e2a411570e5] master: Cleanup/fixes in UI messages.

2021-08-09 Thread Bastien Montagne
Commit: e2a411570e5597eb5d84743a2b658b75fe1c37e9
Author: Bastien Montagne
Date:   Mon Aug 9 14:41:30 2021 +0200
Branches: master
https://developer.blender.org/rBe2a411570e5597eb5d84743a2b658b75fe1c37e9

Cleanup/fixes in UI messages.

===

M   release/scripts/modules/bl_i18n_utils/utils_spell_check.py
M   release/scripts/startup/bl_operators/assets.py
M   release/scripts/startup/bl_ui/space_spreadsheet.py
M   source/blender/blenkernel/intern/lib_override.c
M   source/blender/blenkernel/intern/object.c
M   source/blender/editors/armature/pose_lib_2.c
M   source/blender/editors/object/object_modes.c
M   source/blender/editors/object/object_relations.c
M   source/blender/editors/screen/screen_ops.c
M   source/blender/editors/space_sequencer/sequencer_add.c
M   source/blender/makesrna/intern/rna_asset.c
M   source/blender/makesrna/intern/rna_gpencil.c
M   source/blender/makesrna/intern/rna_userdef.c
M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py 
b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
index c310eee0b14..14fc81821c4 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
@@ -48,6 +48,7 @@ class SpellChecker:
 "equi",  # equi-angular, etc.
 "fader",
 "globbing",
+"haptics",
 "hasn",  # hasn't
 "hetero",
 "hoc",  # ad-hoc
@@ -188,7 +189,7 @@ class SpellChecker:
 "reprojection", "reproject", "reprojecting",
 "resize",
 "restpose",
-"resync",
+"resync", "resynced",
 "retarget", "retargets", "retargeting", "retargeted",
 "retiming",
 "rigidbody",
@@ -227,6 +228,7 @@ class SpellChecker:
 "un",
 "unassociate", "unassociated",
 "unbake",
+"uncheck",
 "unclosed",
 "uncomment",
 "unculled",
@@ -381,6 +383,7 @@ class SpellChecker:
 "albedo",
 "anamorphic",
 "anisotropic", "anisotropy",
+"bimanual",  # OpenXR?
 "bitangent",
 "boid", "boids",
 "ceil",
@@ -430,6 +433,7 @@ class SpellChecker:
 "spacebar",
 "subtractive",
 "superellipse",
+"thumbstick",
 "tooltip", "tooltips",
 "trackpad",
 "tuple",
@@ -493,7 +497,7 @@ class SpellChecker:
 "pinlight",
 "qi",
 "radiosity",
-"raycasting",
+"raycast", "raycasting",
 "raytrace", "raytracing", "raytraced",
 "refractions",
 "remesher", "remeshing", "remesh",
@@ -698,6 +702,7 @@ class SpellChecker:
 "msgid", "msgids",
 "mux",
 "ndof",
+"pbr",  # Physically Based Rendering
 "ppc",
 "precisa",
 "px",
diff --git a/release/scripts/startup/bl_operators/assets.py 
b/release/scripts/startup/bl_operators/assets.py
index c782cd0646e..8c76018b7a1 100644
--- a/release/scripts/startup/bl_operators/assets.py
+++ b/release/scripts/startup/bl_operators/assets.py
@@ -130,7 +130,7 @@ class ASSET_OT_open_containing_blend_file(Operator):
 return {'RUNNING_MODAL'}
 
 if returncode:
-self.report({'WARNING'}, "Blender subprocess exited with error 
code %d" % returncode)
+self.report({'WARNING'}, "Blender sub-process exited with error 
code %d" % returncode)
 
 # TODO(Sybren): Replace this with a generic "reload assets" operator
 # that can run outside of the Asset Browser context.
diff --git a/release/scripts/startup/bl_ui/space_spreadsheet.py 
b/release/scripts/startup/bl_ui/space_spreadsheet.py
index afdbfea5091..51f8841419b 100644
--- a/release/scripts/startup/bl_ui/space_spreadsheet.py
+++ b/release/scripts/startup/bl_ui/space_spreadsheet.py
@@ -55,7 +55,7 @@ class SPREADSHEET_HT_header(bpy.types.Header):
 layout.operator("spreadsheet.toggle_pin", text="", icon=pin_icon, 
emboss=False)
 
 if space.object_eval_state == 'VIEWER_NODE' and len(context_path) < 3:
-layout.label(text="No active viewer node.", icon='INFO')
+layout.label(text="No active viewer node", icon='INFO')
 
 layout.separator_spacer()
 
diff --git a/source/blender/blenkernel/intern/lib_override.c 
b/source/blender/blenkernel/intern/lib_override.c
index 67ed7d1b394..bebc49e090d 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -1020,7 +1020,7 @@ bool BKE_lib_override_library_resync(Main *bmain,
   if (id_root_reference->tag & LIB_TAG_MISSING) {
 BKE_reportf(reports != NULL ? reports->reports : NULL,
 RPT_ERROR,
-"impossible to resync data-block %s and its dependencies,

[Bf-blender-cvs] [9b08f523ec2] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-09 Thread Aditya Y Jeppu
Commit: 9b08f523ec20e58bee625b05e6ac5612886c48ab
Author: Aditya Y Jeppu
Date:   Mon Aug 9 18:11:06 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB9b08f523ec20e58bee625b05e6ac5612886c48ab

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



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


[Bf-blender-cvs] [f9367f9399d] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-08-09 Thread Aditya Y Jeppu
Commit: f9367f9399da24a741ff37c468bd30030874ee8d
Author: Aditya Y Jeppu
Date:   Fri Aug 6 16:02:14 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBf9367f9399da24a741ff37c468bd30030874ee8d

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



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


[Bf-blender-cvs] [3886ab05b44] master: Cleanup: Spelling and typos in comment

2021-08-09 Thread Sergey Sharybin
Commit: 3886ab05b449979959dfbb4950fea9ec473ecb83
Author: Sergey Sharybin
Date:   Mon Aug 9 14:31:56 2021 +0200
Branches: master
https://developer.blender.org/rB3886ab05b449979959dfbb4950fea9ec473ecb83

Cleanup: Spelling and typos in comment

===

M   source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h

===

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h 
b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
index 255ea840088..d0bb841caab 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h
@@ -68,11 +68,11 @@ ID *deg_expand_copy_on_write_datablock(const struct 
Depsgraph *depsgraph,
 ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph, 
const IDNode *id_node);
 ID *deg_update_copy_on_write_datablock(const struct Depsgraph *depsgraph, 
struct ID *id_orig);
 
-/* Helper function which frees memory used by copy-on-written databnlock. */
+/* Helper function which frees memory used by copy-on-written data-block. */
 void deg_free_copy_on_write_datablock(struct ID *id_cow);
 
 /* Callback function for depsgraph operation node which ensures copy-on-write
- * datablock is ready for use by further evaluation routines.
+ * data-block is ready for use by further evaluation routines.
  */
 void deg_evaluate_copy_on_write(struct ::Depsgraph *depsgraph, const struct 
IDNode *id_node);
 
@@ -80,16 +80,16 @@ void deg_evaluate_copy_on_write(struct ::Depsgraph 
*depsgraph, const struct IDNo
  * copies inside. */
 bool deg_validate_copy_on_write_datablock(ID *id_cow);
 
-/* Tag given ID block as being copy-on-wtritten. */
+/* Tag given ID block as being copy-on-written. */
 void deg_tag_copy_on_write_id(struct ID *id_cow, const struct ID *id_orig);
 
-/* Check whether ID datablock is expanded.
+/* Check whether ID data-block is expanded.
  *
  * TODO(sergey): Make it an inline function or a macro.
  */
 bool deg_copy_on_write_is_expanded(const struct ID *id_cow);
 
-/* Check whether copy-on-write datablock is needed for given ID.
+/* Check whether copy-on-write data-block is needed for given ID.
  *
  * There are some exceptions on data-blocks which are covered by dependency 
graph
  * but which we don't want to start duplicating.

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


[Bf-blender-cvs] [73b047bcd43] master: Cleanup: Changed keyframe_keylist to CPP.

2021-08-09 Thread Jeroen Bakker
Commit: 73b047bcd431c57687bc0c501dea97f44bd28b22
Author: Jeroen Bakker
Date:   Mon Aug 9 12:59:28 2021 +0200
Branches: master
https://developer.blender.org/rB73b047bcd431c57687bc0c501dea97f44bd28b22

Cleanup: Changed keyframe_keylist to CPP.

Just a straight-forward change. Not utilizing CPP features.

===

M   source/blender/editors/animation/CMakeLists.txt
R081source/blender/editors/animation/keyframes_keylist.c
source/blender/editors/animation/keyframes_keylist.cc

===

diff --git a/source/blender/editors/animation/CMakeLists.txt 
b/source/blender/editors/animation/CMakeLists.txt
index 7a53b54b5a4..d9f52d90766 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -47,7 +47,7 @@ set(SRC
   keyframes_draw.c
   keyframes_edit.c
   keyframes_general.c
-  keyframes_keylist.c
+  keyframes_keylist.cc
   keyframing.c
   keyingsets.c
   time_scrub_ui.c
diff --git a/source/blender/editors/animation/keyframes_keylist.c 
b/source/blender/editors/animation/keyframes_keylist.cc
similarity index 81%
rename from source/blender/editors/animation/keyframes_keylist.c
rename to source/blender/editors/animation/keyframes_keylist.cc
index 98aedb9cd0c..85036efc983 100644
--- a/source/blender/editors/animation/keyframes_keylist.c
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -23,10 +23,10 @@
 
 /* System includes - */
 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "MEM_guardedalloc.h"
 
@@ -47,11 +47,12 @@
 #include "ED_anim_api.h"
 #include "ED_keyframes_keylist.h"
 
+extern "C" {
 /* *** Keyframe Processing *** 
*/
 
-typedef struct AnimKeylist {
+struct AnimKeylist {
   DLRBT_Tree keys;
-} AnimKeylist;
+};
 
 static void ED_keylist_init(AnimKeylist *keylist)
 {
@@ -60,7 +61,7 @@ static void ED_keylist_init(AnimKeylist *keylist)
 
 AnimKeylist *ED_keylist_create(void)
 {
-  AnimKeylist *keylist = MEM_callocN(sizeof(AnimKeylist), __func__);
+  AnimKeylist *keylist = static_cast(MEM_callocN(sizeof(AnimKeylist), __func__));
   ED_keylist_init(keylist);
   return keylist;
 }
@@ -93,18 +94,19 @@ const ActKeyColumn *ED_keylist_find_prev(const AnimKeylist 
*keylist, float cfra)
 const ActKeyColumn *ED_keylist_find_any_between(const AnimKeylist *keylist,
 const Range2f frame_range)
 {
-  for (const ActKeyColumn *ak = keylist->keys.root; ak;
-   ak = (ak->cfra < frame_range.min) ? ak->right : ak->left) {
+  for (const ActKeyColumn *ak = static_cast(keylist->keys.root); ak;
+   ak = static_cast((ak->cfra < frame_range.min) ? 
ak->right :
+ 
ak->left)) {
 if (range2f_in_range(&frame_range, ak->cfra)) {
   return ak;
 }
   }
-  return NULL;
+  return nullptr;
 }
 
 bool ED_keylist_is_empty(const struct AnimKeylist *keylist)
 {
-  return keylist->keys.root == NULL;
+  return keylist->keys.root == nullptr;
 }
 
 const struct ListBase *ED_keylist_listbase(const AnimKeylist *keylist)
@@ -145,7 +147,7 @@ BLI_INLINE bool is_cfra_lt(const float a, const float b)
 short compare_ak_cfraPtr(void *node, void *data)
 {
   ActKeyColumn *ak = (ActKeyColumn *)node;
-  const float *cframe = data;
+  const float *cframe = static_cast(data);
   const float val = *cframe;
 
   if (is_cfra_eq(val, ak->cfra)) {
@@ -161,13 +163,13 @@ short compare_ak_cfraPtr(void *node, void *data)
 /* --- */
 
 /* Set of references to three logically adjacent keys. */
-typedef struct BezTripleChain {
+struct BezTripleChain {
   /* Current keyframe. */
   BezTriple *cur;
 
-  /* Logical neighbors. May be NULL. */
+  /* Logical neighbors. May be nullptr. */
   BezTriple *prev, *next;
-} BezTripleChain;
+};
 
 /* Categorize the interpolation & handle type of the keyframe. */
 static eKeyframeHandleDrawOpts bezt_handle_type(const BezTriple *bezt)
@@ -192,7 +194,7 @@ static eKeyframeHandleDrawOpts bezt_handle_type(const 
BezTriple *bezt)
  */
 static eKeyframeExtremeDrawOpts bezt_extreme_type(const BezTripleChain *chain)
 {
-  if (chain->prev == NULL && chain->next == NULL) {
+  if (chain->prev == nullptr && chain->next == nullptr) {
 return KEYFRAME_EXTREME_NONE;
   }
 
@@ -227,13 +229,15 @@ static eKeyframeExtremeDrawOpts bezt_extreme_type(const 
BezTripleChain *chain)
   if (prev_y < cur_y || next_y < cur_y) {
 const bool is_overshoot = (handle_l > cur_y || handle_r > cur_y);
 
-return KEYFRAME_EXTREME_MAX | (is_overshoot ? KEYFRAME_EXTREME_MIXED : 0);
+return static_cast(KEYFRAME_EXTREME_MAX |
+ (is_overshoot ? 
KEYFRAME_EXTREME_MIXED : 0));
   }
 
   if (prev_y > cur_y || next_y > cur_y) {

[Bf-blender-cvs] [71e3f18b4ae] temp-geometry-nodes-expandable-geometry-socket-prototype: add Store Local Attribute node

2021-08-09 Thread Jacques Lucke
Commit: 71e3f18b4ae76ee958cf20f2ac2e10172ce8aa3b
Author: Jacques Lucke
Date:   Mon Aug 9 12:54:02 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rB71e3f18b4ae76ee958cf20f2ac2e10172ce8aa3b

add Store Local Attribute node

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/editors/space_node/node_edit.cc
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   source/blender/nodes/geometry/nodes/node_geo_attribute_store_local.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index acb50b460e4..a303532b792 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -493,6 +493,7 @@ geometry_node_categories = [
 NodeItem("GeometryNodeAttributeRemove"),
 NodeItem("GeometryNodeAttributeMapRange"),
 NodeItem("GeometryNodeAttributeTransfer"),
+NodeItem("GeometryNodeAttributeStoreLocal"),
 ]),
 GeometryNodeCategory("GEO_COLOR", "Color", items=[
 NodeItem("ShaderNodeRGBCurve"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index d80feec94ef..8a9cb9bd6e0 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1491,6 +1491,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_CURVE_SELECT_HANDLES 1074
 #define GEO_NODE_GEOMETRY_EXPANDER 1075
 #define GEO_NODE_EXTRUDE 1076
+#define GEO_NODE_ATTRIBUTE_STORE_LOCAL 1077
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 93d40ec70aa..7098ecc812e 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -3935,6 +3935,9 @@ static std::string expander_output_to_name(const 
GeometryExpanderOutput &expande
 {
   switch (expander_output.type) {
 case GEOMETRY_EXPANDER_OUTPUT_TYPE_LOCAL: {
+  if (expander_output.local_socket_identifier[0] == '\0') {
+return expander_output.local_node_name;
+  }
   return expander_output.local_node_name + StringRef(" â–¶ ") +
  expander_output.local_socket_identifier;
 }
@@ -5177,6 +5180,7 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_randomize();
   register_node_type_geo_attribute_remove();
   register_node_type_geo_attribute_separate_xyz();
+  register_node_type_geo_attribute_store_local();
   register_node_type_geo_attribute_transfer();
   register_node_type_geo_attribute_vector_math();
   register_node_type_geo_attribute_vector_rotate();
diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index c71805bddf9..8e8ec9fd51c 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -2990,6 +2990,25 @@ void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot)
 
 /* ** Geometry Expander Add Output  *** */
 
+static eNodeSocketDatatype custom_data_type_to_socket_type(const 
CustomDataType type)
+{
+  switch (type) {
+case CD_PROP_FLOAT:
+  return SOCK_FLOAT;
+case CD_PROP_FLOAT2:
+case CD_PROP_FLOAT3:
+  return SOCK_VECTOR;
+case CD_PROP_COLOR:
+  return SOCK_RGBA;
+case CD_PROP_INT32:
+  return SOCK_INT;
+case CD_PROP_BOOL:
+  return SOCK_BOOLEAN;
+default:
+  return SOCK_FLOAT;
+  }
+}
+
 static void foreach_available_attribute(
 bNodeTree *ntree,
 bNode *UNUSED(current_node),
@@ -3018,6 +3037,15 @@ static void foreach_available_attribute(
 callback(attribute);
   }
 }
+if (node->type == GEO_NODE_ATTRIBUTE_STORE_LOCAL) {
+  GeometryExpanderOutput attribute;
+  attribute.type = GEOMETRY_EXPANDER_OUTPUT_TYPE_LOCAL;
+  attribute.socket_type = 
custom_data_type_to_socket_type((CustomDataType)node->custom1);
+  attribute.array_source = GEOMETRY_EXPANDER_ARRAY_SOURCE_MESH_VERTICES;
+  STRNCPY(attribute.local_node_name, node->name);
+  STRNCPY(attribute.local_socket_identifier, "");
+  callback(attribute);
+}
   }
   {
 GeometryExpanderOutput attribute;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index ab9fa208229..359e88f182f 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9187,6 +9187,26 @@ static void def_geo_attribute_fill(StructRNA *srna)
   RNA_def_property_update(prop, NC_NO

[Bf-blender-cvs] [92b8d2f7e41] temp-geometry-nodes-expandable-geometry-socket-prototype: support accessing index and normal

2021-08-09 Thread Jacques Lucke
Commit: 92b8d2f7e4167905013c5bac78f3ff524eaee96b
Author: Jacques Lucke
Date:   Mon Aug 9 12:17:19 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rB92b8d2f7e4167905013c5bac78f3ff524eaee96b

support accessing index and normal

===

M   source/blender/blenkernel/intern/node.cc
M   source/blender/editors/space_node/node_edit.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 4a5fb2e4e47..93d40ec70aa 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -3949,6 +3949,9 @@ static std::string expander_output_to_name(const 
GeometryExpanderOutput &expande
 case GEOMETRY_EXPANDER_OUTPUT_TYPE_BUILTIN: {
   return StringRef("Built-in â–¶ ") + expander_output.builtin_identifier;
 }
+case GEOMETRY_EXPANDER_OUTPUT_TYPE_DERIVED: {
+  return StringRef("Derived â–¶ ") + expander_output.derived_identifier;
+}
   }
   return "";
 }
diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index 66047aa76bb..c71805bddf9 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -3035,6 +3035,22 @@ static void foreach_available_attribute(
 STRNCPY(attribute.builtin_identifier, "material_index");
 callback(attribute);
   }
+  {
+GeometryExpanderOutput attribute;
+attribute.type = GEOMETRY_EXPANDER_OUTPUT_TYPE_DERIVED;
+attribute.socket_type = SOCK_VECTOR;
+attribute.array_source = GEOMETRY_EXPANDER_ARRAY_SOURCE_MESH_VERTICES;
+STRNCPY(attribute.derived_identifier, "normal");
+callback(attribute);
+  }
+  {
+GeometryExpanderOutput attribute;
+attribute.type = GEOMETRY_EXPANDER_OUTPUT_TYPE_DERIVED;
+attribute.socket_type = SOCK_INT;
+attribute.array_source = GEOMETRY_EXPANDER_ARRAY_SOURCE_MESH_VERTICES;
+STRNCPY(attribute.derived_identifier, "index");
+callback(attribute);
+  }
 }
 
 static MutableSpan 
get_updated_cached_available_attributes(
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 99072e48081..b0b222f5b4c 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1440,6 +1440,7 @@ typedef enum eGeometryExpanderOutputType {
   GEOMETRY_EXPANDER_OUTPUT_TYPE_LOCAL,
   GEOMETRY_EXPANDER_OUTPUT_TYPE_INPUT,
   GEOMETRY_EXPANDER_OUTPUT_TYPE_BUILTIN,
+  GEOMETRY_EXPANDER_OUTPUT_TYPE_DERIVED,
 } eGeometryExpanderOutputType;
 
 typedef enum eGeometryExpanderArraySource {
@@ -1481,6 +1482,9 @@ typedef struct GeometryExpanderOutput {
 
   /* Builtin attribute data. */
   char builtin_identifier[64];
+
+  /* Derived data. */
+  char derived_identifier[64];
 } GeometryExpanderOutput;
 
 typedef struct NodeGeometryGeometryExpander {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc 
b/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
index deaebb31bff..eca47d6981e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_geometry_expander.cc
@@ -200,6 +200,32 @@ static void 
geo_node_geometry_expander_exec(GeoNodeExecParams params)
   }
   break;
 }
+case GEOMETRY_EXPANDER_OUTPUT_TYPE_DERIVED: {
+  const StringRef identifier = expander_output->derived_identifier;
+  if (identifier == "index") {
+array_cpp_type->array_construct_uninitialized(buffer, domain_size);
+MutableSpan indices = 
array_cpp_type->array_span(buffer).typed();
+for (int i : indices.index_range()) {
+  indices[i] = i;
+}
+  }
+  else if (identifier == "normal") {
+if (component->attribute_exists("normal")) {
+  GVArray_Typed normals = 
component->attribute_get_for_read(
+  "normal", domain, {0, 0, 0});
+  array_cpp_type->array_construct_uninitialized(buffer, 
domain_size);
+  normals->materialize_to_uninitialized(
+  array_cpp_type->array_span(buffer).typed());
+}
+else {
+  array_cpp_type->default_construct(buffer);
+}
+  }
+  else {
+array_cpp_type->default_construct(buffer);
+  }
+  break;
+}
   }
 }

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


[Bf-blender-cvs] [0e4a250279f] master: Fix invalid helps and description of session UUID verification

2021-08-09 Thread Sergey Sharybin
Commit: 0e4a250279ffc95636643a08462cca04b6dd17de
Author: Sergey Sharybin
Date:   Mon Aug 9 12:05:11 2021 +0200
Branches: master
https://developer.blender.org/rB0e4a250279ffc95636643a08462cca04b6dd17de

Fix invalid helps and description of session UUID verification

A copy-paste error.

===

M   source/blender/blenkernel/BKE_global.h
M   source/creator/creator_args.c

===

diff --git a/source/blender/blenkernel/BKE_global.h 
b/source/blender/blenkernel/BKE_global.h
index 31928b5e80a..89713e9ad0a 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -145,7 +145,8 @@ enum {
   G_DEBUG_DEPSGRAPH_TIME = (1 << 11),   /* depsgraph timing statistics and 
messages */
   G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 12), /* single threaded depsgraph */
   G_DEBUG_DEPSGRAPH_PRETTY = (1 << 13), /* use pretty colors in depsgraph 
messages */
-  G_DEBUG_DEPSGRAPH_UUID = (1 << 14),   /* use pretty colors in depsgraph 
messages */
+  G_DEBUG_DEPSGRAPH_UUID = (1 << 14),   /* Verify validness of 
session-wide identifiers
+ * assigned to ID datablocks */
   G_DEBUG_DEPSGRAPH = (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_EVAL | 
G_DEBUG_DEPSGRAPH_TAG |
G_DEBUG_DEPSGRAPH_TIME | G_DEBUG_DEPSGRAPH_UUID),
   G_DEBUG_SIMDATA = (1 << 15),   /* sim debug data display */
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 0f450624691..85ba4eca307 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -994,6 +994,9 @@ static const char 
arg_handle_debug_mode_generic_set_doc_depsgraph_no_threads[] =
 static const char arg_handle_debug_mode_generic_set_doc_depsgraph_pretty[] =
 "\n\t"
 "Enable colors for dependency graph debug messages.";
+static const char arg_handle_debug_mode_generic_set_doc_depsgraph_uuid[] =
+"\n\t"
+"Verify validness of session-wide identifiers assigned to ID datablocks.";
 static const char 
arg_handle_debug_mode_generic_set_doc_gpu_force_workarounds[] =
 "\n\t"
 "Enable workarounds for typical GPU issues and disable all GPU 
extensions.";
@@ -2197,7 +2200,7 @@ void main_args_setup(bContext *C, bArgs *ba)
   BLI_args_add(ba,
NULL,
"--debug-depsgraph-uuid",
-   CB_EX(arg_handle_debug_mode_generic_set, depsgraph_build),
+   CB_EX(arg_handle_debug_mode_generic_set, depsgraph_uuid),
(void *)G_DEBUG_DEPSGRAPH_UUID);
   BLI_args_add(ba,
NULL,

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


[Bf-blender-cvs] [7ea577eef3e] master: Fix depsgraph check for tag during evaluation

2021-08-09 Thread Sergey Sharybin
Commit: 7ea577eef3e51799efe9fc286847f32b3611373e
Author: Sergey Sharybin
Date:   Mon Aug 9 12:04:12 2021 +0200
Branches: master
https://developer.blender.org/rB7ea577eef3e51799efe9fc286847f32b3611373e

Fix depsgraph check for tag during evaluation

- Only do print when asked for tags debugging.
- Add missing newline to the message.

===

M   source/blender/depsgraph/intern/depsgraph_tag.cc

===

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc 
b/source/blender/depsgraph/intern/depsgraph_tag.cc
index ab93464d09a..dd96c5a3b2b 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -646,8 +646,8 @@ void graph_id_tag_update(
 {
   const int debug_flags = (graph != nullptr) ? 
DEG_debug_flags_get((::Depsgraph *)graph) : G.debug;
   if (graph != nullptr && graph->is_evaluating) {
-if (debug_flags & G_DEBUG_DEPSGRAPH) {
-  printf("ID tagged for update during dependency graph evaluation.");
+if (debug_flags & G_DEBUG_DEPSGRAPH_TAG) {
+  printf("ID tagged for update during dependency graph evaluation.\n");
 }
 return;
   }

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


[Bf-blender-cvs] [d6f162dfa94] master: Fix T90540: NoneType object error with entering grease pencil draw mode

2021-08-09 Thread Antonio Vazquez
Commit: d6f162dfa946e8745276ba594c29ce48b299a760
Author: Antonio Vazquez
Date:   Mon Aug 9 12:07:59 2021 +0200
Branches: master
https://developer.blender.org/rBd6f162dfa946e8745276ba594c29ce48b299a760

Fix T90540: NoneType object error with entering grease pencil draw mode

The preview was not ready when the panel was displayed.

Just need to check if None.

===

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

===

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 97a0c5abf24..ad963396022 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1141,7 +1141,7 @@ def brush_basic__draw_color_selector(context, layout, 
brush, gp_settings, props)
 if not gp_settings.use_material_pin:
 ma = context.object.active_material
 icon_id = 0
-if ma:
+if ma and ma.id_data.preview:
 icon_id = ma.id_data.preview.icon_id
 txt_ma = ma.name
 maxw = 25

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


[Bf-blender-cvs] [d4223da817c] temp-geometry-nodes-expandable-geometry-socket-prototype: support list input in Point Separate node

2021-08-09 Thread Jacques Lucke
Commit: d4223da817c6f7db14ccf37546a263aa04304756
Author: Jacques Lucke
Date:   Mon Aug 9 11:50:30 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rBd4223da817c6f7db14ccf37546a263aa04304756

support list input in Point Separate node

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc 
b/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
index fc04d1e275f..94fdbe431af 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
@@ -25,7 +25,7 @@
 
 static bNodeSocketTemplate geo_node_point_instance_in[] = {
 {SOCK_GEOMETRY, N_("Geometry")},
-{SOCK_STRING, N_("Mask")},
+{SOCK_BOOLEAN, N_("Mask"), 1, 0, 0, 0, 0, 1, PROP_NONE, SOCK_HIDE_VALUE},
 {-1, ""},
 };
 
@@ -99,17 +99,16 @@ static void create_component_points(GeometryComponent 
&component, const int tota
 
 static void separate_points_from_component(const GeometryComponent 
&in_component,
GeometryComponent &out_component,
-   const StringRef mask_name,
+   const Span mask,
const bool invert)
 {
   if (!in_component.attribute_domain_supported(ATTR_DOMAIN_POINT) ||
   in_component.attribute_domain_size(ATTR_DOMAIN_POINT) == 0) {
 return;
   }
-
-  const GVArray_Typed mask_attribute = 
in_component.attribute_get_for_read(
-  mask_name, ATTR_DOMAIN_POINT, false);
-  VArray_Span masks{mask_attribute};
+  const int tot_in_point = 
in_component.attribute_domain_size(ATTR_DOMAIN_POINT);
+  fn::GVArray_For_RepeatedGSpan mask_repeated{tot_in_point, mask};
+  GVArray_Span masks{mask_repeated};
 
   const int total = masks.count(!invert);
   if (total == 0) {
@@ -122,7 +121,7 @@ static void separate_points_from_component(const 
GeometryComponent &in_component
 }
 
 static GeometrySet separate_geometry_set(const GeometrySet &set_in,
- const StringRef mask_name,
+ const Span mask,
  const bool invert)
 {
   GeometrySet set_out;
@@ -132,7 +131,7 @@ static GeometrySet separate_geometry_set(const GeometrySet 
&set_in,
   continue;
 }
 GeometryComponent &out_component = 
set_out.get_component_for_write(component->type());
-separate_points_from_component(*component, out_component, mask_name, 
invert);
+separate_points_from_component(*component, out_component, mask, invert);
   }
   return set_out;
 }
@@ -145,7 +144,7 @@ static void geo_node_point_separate_exec(GeoNodeExecParams 
params)
   if (wait_for_inputs) {
 return;
   }
-  const std::string mask_attribute_name = 
params.get_input("Mask");
+  const Array mask = params.get_input>("Mask");
   GeometrySet geometry_set = params.get_input("Geometry");
 
   /* TODO: This is not necessary-- the input geometry set can be read only,
@@ -153,12 +152,10 @@ static void 
geo_node_point_separate_exec(GeoNodeExecParams params)
   geometry_set = geometry_set_realize_instances(geometry_set);
 
   if (params.lazy_output_is_required("Geometry 1")) {
-params.set_output("Geometry 1",
-  separate_geometry_set(geometry_set, mask_attribute_name, 
true));
+params.set_output("Geometry 1", separate_geometry_set(geometry_set, mask, 
true));
   }
   if (params.lazy_output_is_required("Geometry 2")) {
-params.set_output("Geometry 2",
-  separate_geometry_set(geometry_set, mask_attribute_name, 
false));
+params.set_output("Geometry 2", separate_geometry_set(geometry_set, mask, 
false));
   }
 }

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


[Bf-blender-cvs] [1ee857b4e75] temp-geometry-nodes-expandable-geometry-socket-prototype: Merge branch 'master' into temp-geometry-nodes-expandable-geometry-socket-prototype

2021-08-09 Thread Jacques Lucke
Commit: 1ee857b4e755c664eb20254ad0981490f41d6502
Author: Jacques Lucke
Date:   Mon Aug 9 11:31:24 2021 +0200
Branches: temp-geometry-nodes-expandable-geometry-socket-prototype
https://developer.blender.org/rB1ee857b4e755c664eb20254ad0981490f41d6502

Merge branch 'master' into 
temp-geometry-nodes-expandable-geometry-socket-prototype

===



===



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


[Bf-blender-cvs] [577a12f840d] temp-geometry-nodes-fields-prototype: add Normal node

2021-08-09 Thread Jacques Lucke
Commit: 577a12f840d4618e1f4ef69b54105c71e820ddbb
Author: Jacques Lucke
Date:   Mon Aug 9 11:29:04 2021 +0200
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB577a12f840d4618e1f4ef69b54105c71e820ddbb

add Normal node

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   source/blender/nodes/geometry/nodes/node_geo_normal.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index a5316c14896..2fc5b386d07 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -535,6 +535,7 @@ geometry_node_categories = [
 NodeItem("GeometryNodeIsViewport"),
 NodeItem("GeometryNodeAttribute"),
 NodeItem("GeometryNodeIndex"),
+NodeItem("GeometryNodeNormal"),
 ]),
 GeometryNodeCategory("GEO_MATERIAL", "Material", items=[
 NodeItem("GeometryNodeMaterialAssign"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 3a8b228e04b..b0bce26f1c9 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1482,6 +1482,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_EXTRUDE 1077
 #define GEO_NODE_ATTRIBUTE_STORE_ANONYMOUS 1078
 #define GEO_NODE_ATTRIBUTE_EXTRACT 1079
+#define GEO_NODE_NORMAL 1080
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index c4d8aa50fa8..04103565245 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5175,6 +5175,7 @@ static void registerGeometryNodes()
   register_node_type_geo_mesh_primitive_uv_sphere();
   register_node_type_geo_mesh_subdivide();
   register_node_type_geo_mesh_to_curve();
+  register_node_type_geo_normal();
   register_node_type_geo_object_info();
   register_node_type_geo_point_distribute();
   register_node_type_geo_point_instance();
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index 28058285f31..979b215500e 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -205,6 +205,7 @@ set(SRC
   geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
   geometry/nodes/node_geo_mesh_subdivide.cc
   geometry/nodes/node_geo_mesh_to_curve.cc
+  geometry/nodes/node_geo_normal.cc
   geometry/nodes/node_geo_object_info.cc
   geometry/nodes/node_geo_point_distribute.cc
   geometry/nodes/node_geo_point_instance.cc
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blender/nodes/NOD_geometry.h
index 997868b6de5..53043bc0d4f 100644
--- a/source/blender/nodes/NOD_geometry.h
+++ b/source/blender/nodes/NOD_geometry.h
@@ -89,6 +89,7 @@ void register_node_type_geo_mesh_primitive_ico_sphere(void);
 void register_node_type_geo_mesh_primitive_line(void);
 void register_node_type_geo_mesh_primitive_uv_sphere(void);
 void register_node_type_geo_mesh_subdivide(void);
+void register_node_type_geo_normal(void);
 void register_node_type_geo_mesh_to_curve(void);
 void register_node_type_geo_object_info(void);
 void register_node_type_geo_point_distribute(void);
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index cfb54c254a9..fd45bca5ab4 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -332,6 +332,7 @@ DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_LINE, 
def_geo_mesh_line, "MESH_PRI
 DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_UV_SPHERE, 0, 
"MESH_PRIMITIVE_UV_SPHERE", MeshUVSphere, "UV Sphere", "")
 DefNode(GeometryNode, GEO_NODE_MESH_SUBDIVIDE, 0, "MESH_SUBDIVIDE", 
MeshSubdivide, "Mesh Subdivide", "")
 DefNode(GeometryNode, GEO_NODE_MESH_TO_CURVE, 0, "MESH_TO_CURVE", MeshToCurve, 
"Mesh to Curve", "")
+DefNode(GeometryNode, GEO_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "")
 DefNode(GeometryNode, GEO_NODE_OBJECT_INFO, def_geo_object_info, 
"OBJECT_INFO", ObjectInfo, "Object Info", "")
 DefNode(GeometryNode, GEO_NODE_POINT_DISTRIBUTE, def_geo_point_distribute, 
"POINT_DISTRIBUTE", PointDistribute, "Point Distribute", "")
 DefNode(GeometryNode, GEO_NODE_POINT_INSTANCE, def_geo_point_instance, 
"POINT_INSTANCE", PointInstance, "Point Instance", "")
diff --git a/source/blender/nodes/geometry/nodes/node_geo_normal.cc 
b/source/blender/nodes/geometry/nodes/node_geo_normal.cc
new file mode 100644
index 000..65bb052c125
--- /dev/null
+++ b/source/blender/nodes/geometry/nodes/node_geo_normal.cc
@@ -0,0 +1,45 @@
+/*
+ * This program is free software; you can 

[Bf-blender-cvs] [7519d400911] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: collapse edges: initial steps

2021-08-09 Thread ishbosamiya
Commit: 7519d40091189845433986e243b7efb47def9167
Author: ishbosamiya
Date:   Sun Aug 8 18:09:22 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB7519d40091189845433986e243b7efb47def9167

adaptive_cloth: AdaptiveMesh: collapse edges: initial steps

There are todos but the code roughly works.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index a5787126efc..5faf2e92193 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define SHOULD_REMESH_DUMP_FILE 1
 
@@ -291,6 +292,8 @@ template using AdaptiveNode = Node>;
 using AdaptiveVert = Vert;
 using AdaptiveEdge = Edge;
 using AdaptiveFace = Face;
+template
+using AdaptiveMeshDiff = MeshDiff, VertData, EdgeData, 
internal::EmptyExtraData>;
 
 template
 class AdaptiveMesh : public Mesh, VertData, EdgeData, 
internal::EmptyExtraData> {
@@ -437,6 +440,72 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 } while (splittable_edges_set.size() != 0);
   }
 
+  /**
+   * Collapses edges whose "size" is less than (1.0 - small value)
+   *
+   * Based on [1]
+   *
+   * Here "size" is determined by `Sizing` stores in `Vert`s of the
+   * `Edge`, using the function `Sizing::get_edge_size_sq()`.
+   */
+  void collapse_edges()
+  {
+blender::Set active_faces;
+for (const auto &face : this->get_faces()) {
+  active_faces.add_new(face.get_self_index());
+}
+
+do {
+  /* It is not possible to iterate over active_faces and also
+   * modify at the same time so store the new active faces in a
+   * new set */
+  blender::Set new_active_faces;
+
+  for (const auto &face_index : active_faces) {
+const auto &op_face = this->get_faces().get(face_index);
+if (op_face == std::nullopt) {
+  /* A previous edge collapse might have modified the this
+   * face, so just continue onto the next one */
+  continue;
+}
+const auto &face = this->get_checked_face(face_index);
+const auto edge_indices = this->get_edge_indices_of_face(face);
+
+for (const auto &edge_index : edge_indices) {
+  const auto &op_edge = this->get_edges().get(edge_index);
+  if (op_edge == std::nullopt) {
+break;
+  }
+  const auto &edge = this->get_checked_edge(edge_index);
+
+  std::optional> op_mesh_diff = std::nullopt;
+  if (this->is_edge_collapseable_adaptivemesh(edge, false)) {
+op_mesh_diff = 
this->collapse_edge_triangulate(edge.get_self_index(), false, true);
+  }
+  else if (this->is_edge_collapseable_adaptivemesh(edge, true)) {
+op_mesh_diff = 
this->collapse_edge_triangulate(edge.get_self_index(), true, true);
+  }
+
+  if (op_mesh_diff) {
+#if SHOULD_REMESH_DUMP_FILE
+auto after_flip_msgpack = this->serialize();
+auto after_flip_filename = 
static_remesh_name_gen.get_curr("after_collapse");
+static_remesh_name_gen.gen_next();
+dump_file(after_flip_filename, after_flip_msgpack);
+#endif
+const auto mesh_diff = op_mesh_diff.value();
+/* TODO(ish): flip edges on newly added faces */
+for (const auto &added_face : mesh_diff.get_added_faces()) {
+  new_active_faces.add_new(added_face);
+}
+  }
+}
+  }
+
+  active_faces = std::move(new_active_faces);
+} while (active_faces.size() != 0);
+  }
+
   void static_remesh(const Sizing &sizing)
   {
 #if SHOULD_REMESH_DUMP_FILE
@@ -463,6 +532,7 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 this->split_edges();
 
 /* Collapse the edges */
+this->collapse_edges();
 
 #if SHOULD_REMESH_DUMP_FILE
 auto static_remesh_end_msgpack = this->serialize();
@@ -687,6 +757,27 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
 return flippable_edge_indices;
   }
+
+  bool is_edge_collapseable_adaptivemesh(const AdaptiveEdge &edge, bool 
verts_swapped) const
+  {
+if (this->is_edge_collapseable(edge.get_self_index(), verts_swapped, true) 
== false) {
+  return false;
+}
+
+const auto [v1, v2] = this->get_checked_verts_of_edge(edge, verts_swapped);
+
+/* If v1 is on a seam or boundary, v2 should also be on a seam or boundary 
*/
+if (this->is_vert_on_seam_or_boundary(v1) == true &&
+this->is_vert_on_seam_or_boundary(v2) == false) {
+  /* This will modify the panel boundaries which isn't acceptable */
+  return false;
+}
+
+/* TODO(ish): aspect ratio test */
+/* TODO(ish): 

[Bf-blender-cvs] [e57f77f6bfd] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: collapse edges: edge size criterion

2021-08-09 Thread ishbosamiya
Commit: e57f77f6bfde4ea8c27c21d6ea33735cdafc05ad
Author: ishbosamiya
Date:   Sun Aug 8 19:07:26 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBe57f77f6bfde4ea8c27c21d6ea33735cdafc05ad

adaptive_cloth: AdaptiveMesh: collapse edges: edge size criterion

If the edge were to be collapsed, the newly formed edges shouldn't
exceed the edge size criterion (1.0 - small_value).

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index 12b77a40198..eb38620dc57 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -769,6 +769,9 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
   bool is_edge_collapseable_adaptivemesh(const AdaptiveEdge &edge, bool 
verts_swapped) const
   {
+/* TODO(ish): expose small_value to gui */
+const auto small_value = 0.2;
+
 if (this->is_edge_collapseable(edge.get_self_index(), verts_swapped, true) 
== false) {
   return false;
 }
@@ -782,9 +785,56 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
   return false;
 }
 
+/* Newly formed edges shouldn't exceed the edge size criterion */
+{
+  const auto [v1_a, v2_a] = this->get_checked_verts_of_edge(edge, 
verts_swapped);
+  const auto &n1_a = this->get_checked_node_of_vert(v1_a);
+  const auto &n2_a = this->get_checked_node_of_vert(v2_a);
+  const auto n1_index = n1_a.get_self_index();
+  auto get_v1_v2_indices = [this, &n1_index, &verts_swapped](const 
AdaptiveEdge &e) {
+auto [v1, v2] = this->get_checked_verts_of_edge(e, verts_swapped);
+auto v1_index = v1.get_self_index();
+auto v2_index = v2.get_self_index();
+/* Need to swap the verts if v1 does not point to n1 */
+if (v1.get_node().value() != n1_index) {
+  std::swap(v1_index, v2_index);
+}
+BLI_assert(this->get_checked_vert(v1_index).get_node().value() == 
n1_index);
+return std::make_tuple(v1_index, v2_index);
+  };
+
+  /* Get all 3D edges */
+  const auto edge_indices = this->get_connecting_edge_indices(n1_a, n2_a);
+
+  for (const auto &edge_index : edge_indices) {
+/* Get v1 of the 3D edge in correct order */
+const auto &e = this->get_checked_edge(edge_index);
+const auto [v1_index, v2_index] = get_v1_v2_indices(e);
+const auto &v1 = this->get_checked_vert(v1_index);
+const auto &v2 = this->get_checked_vert(v2_index);
+
+/* For edge adjacent to v1, check if the edge size is
+ * exceeded if v1 is swapped for v2 */
+for (const auto &v1_edge_index : v1.get_edges()) {
+  const auto &v1_edge = this->get_checked_edge(v1_edge_index);
+
+  const auto v1_edge_verts = v1_edge.get_verts().value();
+
+  const auto ov_index = std::get<0>(v1_edge_verts) == v1_index ?
+std::get<1>(v1_edge_verts) :
+std::get<0>(v1_edge_verts);
+
+  const auto &ov = this->get_checked_vert(ov_index);
+  const auto edge_size = this->compute_edge_size(v2, ov);
+
+  if (edge_size > (1.0 - small_value)) {
+return false;
+  }
+}
+  }
+}
+
 /* TODO(ish): aspect ratio test */
-/* TODO(ish): the newly created edges' size should not be larger
- * than 1.0 - (small value) */
 return true;
   }
 };

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


[Bf-blender-cvs] [c73bc92e06b] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: collapse edges: run flip edges

2021-08-09 Thread ishbosamiya
Commit: c73bc92e06ba25bea1f2b35392e9c78b3417b9c4
Author: ishbosamiya
Date:   Sun Aug 8 18:28:04 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBc73bc92e06ba25bea1f2b35392e9c78b3417b9c4

adaptive_cloth: AdaptiveMesh: collapse edges: run flip edges

It is important that the total update to faces of the mesh (collapse
followed by flip edges) is added to the new_active_faces.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index 5faf2e92193..12b77a40198 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -346,9 +346,9 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
   /**
* Flip edges of the `active_faces` if needed.
*
-   * Might make sense to take `active_faces` by move semantics later.
+   * Updates the active_faces in place
*/
-  void flip_edges(blender::Vector active_faces)
+  void flip_edges(blender::Vector &active_faces)
   {
 auto max_loop_cycles = active_faces.size() * 3;
 auto loop_cycles_until_now = 0;
@@ -433,7 +433,8 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
 /* Flip edges of those faces that were created during the
  * split edge operation */
-this->flip_edges(mesh_diff.get_added_faces());
+auto added_faces = mesh_diff.get_added_faces();
+this->flip_edges(added_faces);
   }
 
   splittable_edges_set = this->get_splittable_edge_indices_set();
@@ -494,9 +495,17 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 dump_file(after_flip_filename, after_flip_msgpack);
 #endif
 const auto mesh_diff = op_mesh_diff.value();
-/* TODO(ish): flip edges on newly added faces */
-for (const auto &added_face : mesh_diff.get_added_faces()) {
-  new_active_faces.add_new(added_face);
+
+/* Must run flip edges on the newly added faces and
+ * together the newly added faces must be added to
+ * new_active_faces */
+{
+  auto active_faces_from_flip_edges = mesh_diff.get_added_faces();
+  this->flip_edges(active_faces_from_flip_edges);
+
+  for (const auto &added_face : active_faces_from_flip_edges) {
+new_active_faces.add_new(added_face);
+  }
 }
   }
 }

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


[Bf-blender-cvs] [c7a231c75d0] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: flippability: consider abs of 2 terms

2021-08-09 Thread ishbosamiya
Commit: c7a231c75d014d53e7892565837150a30227775d
Author: ishbosamiya
Date:   Sat Aug 7 11:59:15 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBc7a231c75d014d53e7892565837150a30227775d

adaptive_cloth: AdaptiveMesh: flippability: consider abs of 2 terms

Consider the absolute value of the cross_2d values generated because
they are just calculating the area and the assumption is that the
orientation of the triangles shouldn't matter for this test.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index f08f981c902..a5787126efc 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -37,6 +37,7 @@
 #include "BKE_cloth_remesh.hh"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -555,8 +556,7 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
*
* Reference [1] and [3]
*
-   * In this case considering [3] to be higher priority since both are
-   * contradicting each other.
+   * In this case considering [3] to be higher priority with a small change.
*/
   bool is_edge_flippable_anisotropic_aware(const AdaptiveEdge &edge) const
   {
@@ -622,11 +622,13 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
 /* Based on [1], should be flippable if res < 0.
  *
- * Based on [3], should be flippable if res >= 0 but then there is
- * another part that mentions that flippable if res falls some
- * calculated value. So taking that route as of now.
+ * Based on [3], flippable if res falls some calculated value. So
+ * taking that route as of now. But here, consider the absolute
+ * value of the cross_2d values generated because they are just
+ * calculating the area and the assumption is that the orientation
+ * of the triangles shouldn't matter for this test.
  */
-const auto rhs = -alpha * (cross_2d(u_jk, u_ik) + cross_2d(u_il, u_jl));
+const auto rhs = -alpha * (std::fabs(cross_2d(u_jk, u_ik)) + 
std::fabs(cross_2d(u_il, u_jl)));
 
 return lhs < rhs;
   }

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


[Bf-blender-cvs] [ba262669974] soc-2021-adaptive-cloth: adaptive_cloth: mesh: is vert on seam or boundary

2021-08-09 Thread ishbosamiya
Commit: ba262669974a53261e7ceb9cdba75dcfa121fca4
Author: ishbosamiya
Date:   Sun Aug 8 18:08:44 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBba262669974a53261e7ceb9cdba75dcfa121fca4

adaptive_cloth: mesh: is vert on seam or boundary

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 7cd5e645e93..feec93f7381 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2084,6 +2084,78 @@ template class Mesh {
 std::move(deleted_faces));
   }
 
+  /**
+   * Seam is the edge in UV space that has only one face.
+   */
+  bool is_vert_on_seam(const Vert &vert) const
+  {
+/* The vert is on a seam if any of it's adjacent edges is on a
+ * seam */
+
+for (const auto &edge_index : vert.get_edges()) {
+  if (this->is_edge_on_seam(edge_index)) {
+return true;
+  }
+}
+
+return false;
+  }
+
+  /**
+   * Easy call when only `vert_index` is available.
+   */
+  bool is_vert_on_seam(VertIndex vert_index) const
+  {
+const auto &vert = this->get_checked_vert(vert_index);
+return is_vert_on_seam(vert);
+  }
+
+  /**
+   * Boundary is the set of "3D edges" that have only a single
+   * face. Not all meshes will have a boundary.
+   */
+  bool is_vert_on_boundary(const Vert &vert) const
+  {
+/* The vert is on a seam if any of it's adjacent edges is on a
+ * boundary */
+
+/* TODO(ish): a simpler check might be to see
+ * vert.get_edges().size() != vert.get_faces().size() */
+
+for (const auto &edge_index : vert.get_edges()) {
+  if (this->is_edge_on_boundary(edge_index)) {
+return true;
+  }
+}
+
+return false;
+  }
+
+  /**
+   * Easy call when only `vert_index` is available.
+   */
+  bool is_vert_on_boundary(VertIndex vert_index) const
+  {
+const auto &vert = this->get_checked_vert(vert_index);
+return is_vert_on_boundary(vert);
+  }
+
+  /**
+   * Check both conditions at once
+   */
+  bool is_vert_on_seam_or_boundary(const Vert &vert) const
+  {
+return this->is_vert_on_seam(vert) || this->is_vert_on_boundary(vert);
+  }
+
+  /**
+   * Easy call when only `vert_index` is available.
+   */
+  bool is_vert_on_seam_or_boundary(VertIndex vert) const
+  {
+return this->is_vert_on_seam(vert) || this->is_vert_on_boundary(vert);
+  }
+
   /**
* An edge is loose when it doesn't have any faces.
*/

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


[Bf-blender-cvs] [2f60cb83c5d] soc-2021-adaptive-cloth: adaptive_cloth: mesh: is edge collapseable: make function const

2021-08-09 Thread ishbosamiya
Commit: 2f60cb83c5d08f61589b3eff2990ba3a658b0d84
Author: ishbosamiya
Date:   Sun Aug 8 18:07:42 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB2f60cb83c5d08f61589b3eff2990ba3a658b0d84

adaptive_cloth: mesh: is edge collapseable: make function const

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 99c577b7a9e..7cd5e645e93 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1803,26 +1803,26 @@ template class Mesh {
 std::move(deleted_faces));
   }
 
-  bool is_edge_collapseable(EdgeIndex edge_index, bool verts_swapped, bool 
across_seams)
+  bool is_edge_collapseable(EdgeIndex edge_index, bool verts_swapped, bool 
across_seams) const
   {
 /* The edge is always collapseable if across seams is false */
 if (across_seams == false) {
   return true;
 }
 
-auto &e_a = this->get_checked_edge(edge_index);
-auto [v1_a, v2_a] = this->get_checked_verts_of_edge(e_a, verts_swapped);
-auto &n1_a = this->get_checked_node_of_vert(v1_a);
-auto &n2_a = this->get_checked_node_of_vert(v2_a);
-auto n1_index = n1_a.self_index;
-auto edge_indices = this->get_connecting_edge_indices(n1_a, n2_a);
+const auto &e_a = this->get_checked_edge(edge_index);
+const auto [v1_a, v2_a] = this->get_checked_verts_of_edge(e_a, 
verts_swapped);
+const auto &n1_a = this->get_checked_node_of_vert(v1_a);
+const auto &n2_a = this->get_checked_node_of_vert(v2_a);
+const auto n1_index = n1_a.self_index;
+const auto edge_indices = this->get_connecting_edge_indices(n1_a, n2_a);
 
 /* The collapse edge function doesn't support collapsing one v1 into
  * multiple v2 as of right now, so if we find such a case tell
  * user that edge is not collapseable */
 {
   auto get_v1_v2_indices = [this, &n1_index, &verts_swapped](const 
Edge &e) {
-auto [v1, v2] = this->get_checked_verts_of_edge(e, verts_swapped);
+const auto [v1, v2] = this->get_checked_verts_of_edge(e, 
verts_swapped);
 auto v1_index = v1.self_index;
 auto v2_index = v2.self_index;
 /* Need to swap the verts if v1 does not point to n1 */
@@ -1835,8 +1835,8 @@ template class Mesh {
 
   blender::Vector v1_list;
   for (const auto &edge_index : edge_indices) {
-auto &e = this->get_checked_edge(edge_index);
-auto [v1_index, v2_index] = get_v1_v2_indices(e);
+const auto &e = this->get_checked_edge(edge_index);
+const auto [v1_index, v2_index] = get_v1_v2_indices(e);
 
 if (v1_list.contains(v1_index)) {
   return false;

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


[Bf-blender-cvs] [b19335d5f3a] soc-2021-adaptive-cloth: adaptive_cloth: mesh: const version of get checked node of vert

2021-08-09 Thread ishbosamiya
Commit: b19335d5f3ad17494ea595821ab085d8162ef5c8
Author: ishbosamiya
Date:   Sun Aug 8 18:07:06 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBb19335d5f3ad17494ea595821ab085d8162ef5c8

adaptive_cloth: mesh: const version of get checked node of vert

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 90c5a94c0b8..99c577b7a9e 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2600,6 +2600,12 @@ template class Mesh {
 return this->get_checked_node(vert.node.value());
   }
 
+  inline const Node &get_checked_node_of_vert(const Vert &vert) const
+  {
+BLI_assert(vert.node);
+return this->get_checked_node(vert.node.value());
+  }
+
   /**
* Gives first vert index of a triangulated face that is not part of edge.
*

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


[Bf-blender-cvs] [78c1afa8fd6] soc-2021-adaptive-cloth: adaptive_cloth: should remesh dump file macro

2021-08-09 Thread ishbosamiya
Commit: 78c1afa8fd61a82e515522d01c30024c09088efc
Author: ishbosamiya
Date:   Sat Aug 7 11:33:45 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB78c1afa8fd61a82e515522d01c30024c09088efc

adaptive_cloth: should remesh dump file macro

This helps turn off dumping of the serialized mesh easily.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index a829bac563f..f08f981c902 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -41,6 +41,8 @@
 #include 
 #include 
 
+#define SHOULD_REMESH_DUMP_FILE 1
+
 namespace blender::bke::internal {
 static FilenameGen static_remesh_name_gen("/tmp/static_remesh/remesh", 
".mesh");
 
@@ -363,10 +365,12 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
   this->edge_set_size(edge);
 }
 
+#if SHOULD_REMESH_DUMP_FILE
 auto after_flip_msgpack = this->serialize();
 auto after_flip_filename = 
static_remesh_name_gen.get_curr("after_flip");
 static_remesh_name_gen.gen_next();
 dump_file(after_flip_filename, after_flip_msgpack);
+#endif
 
 /* Update `active_faces` */
 {
@@ -410,10 +414,12 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 auto &edge = this->get_checked_edge(edge_index);
 auto mesh_diff = this->split_edge_triangulate(edge.get_self_index(), 
true);
 
+#if SHOULD_REMESH_DUMP_FILE
 auto after_split_msgpack = this->serialize();
 auto after_split_filename = 
static_remesh_name_gen.get_curr("after_split");
 static_remesh_name_gen.gen_next();
 dump_file(after_split_filename, after_split_msgpack);
+#endif
 
 /* For each new edge added, set it's sizing */
 for (const auto &edge_index : mesh_diff.get_added_edges()) {
@@ -432,10 +438,12 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
   void static_remesh(const Sizing &sizing)
   {
+#if SHOULD_REMESH_DUMP_FILE
 auto static_remesh_start_msgpack = this->serialize();
 auto static_remesh_start_filename = 
static_remesh_name_gen.get_curr("static_remesh_start");
 static_remesh_name_gen.gen_next();
 dump_file(static_remesh_start_filename, static_remesh_start_msgpack);
+#endif
 /* Set sizing for all verts */
 for (auto &vert : this->get_verts_mut()) {
   auto &op_vert_data = vert.get_extra_data_mut();
@@ -455,10 +463,12 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
 /* Collapse the edges */
 
+#if SHOULD_REMESH_DUMP_FILE
 auto static_remesh_end_msgpack = this->serialize();
 auto static_remesh_end_filename = 
static_remesh_name_gen.get_curr("static_remesh_end");
 static_remesh_name_gen.gen_next();
 dump_file(static_remesh_end_filename, static_remesh_end_msgpack);
+#endif
   }
 
  private:

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


[Bf-blender-cvs] [9de42e70305] soc-2021-adaptive-cloth: adaptive_cloth: mesh: split edge: correct orientation for new face

2021-08-09 Thread ishbosamiya
Commit: 9de42e703056dc290bde1b79bbf7e4fcddf59dc4
Author: ishbosamiya
Date:   Fri Aug 6 18:51:13 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB9de42e703056dc290bde1b79bbf7e4fcddf59dc4

adaptive_cloth: mesh: split edge: correct orientation for new face

Set the correct orientation for the new faces formed during the split
edge operation.

By swapping the unwanted vert for the new vert, the orientation is
preserved.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index fbe346570eb..90c5a94c0b8 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1734,7 +1734,6 @@ template class Mesh {
 auto &edge_c = this->get_checked_edge(edge_index);
 auto &other_vert = this->get_checked_other_vert(edge_c, face);
 
-/* TODO(ish): Ordering of the verts and nodes needs to be found 
correctly */
 /* Handle new face and new edge creation */
 {
   /* Handle new edge creation between new_vert and other_vert */
@@ -1744,9 +1743,10 @@ template class Mesh {
   this->add_edge_ref_to_verts(new_edge);
 
   auto &new_face_1 = this->add_empty_face(face.normal);
-  new_face_1.verts.append(edge_vert_1_b.self_index);
-  new_face_1.verts.append(other_vert.self_index);
-  new_face_1.verts.append(new_vert.self_index);
+  /* Set correct orientation by swapping ev2 for nv */
+  new_face_1.verts = face.verts;
+  
new_face_1.verts[new_face_1.verts.first_index_of(edge_vert_2_b.self_index)] =
+  new_vert.self_index;
   added_faces.append(new_face_1.self_index);
 
   /* link edges with new_face_1 */
@@ -1765,9 +1765,10 @@ template class Mesh {
* for loop owns `face` */
 
   auto &new_face_2 = this->add_empty_face(face.normal);
-  new_face_2.verts.append(other_vert.self_index);
-  new_face_2.verts.append(edge_vert_2_b.self_index);
-  new_face_2.verts.append(new_vert.self_index);
+  /* Set correct orientation by swapping ev1 for nv */
+  new_face_2.verts = face.verts;
+  
new_face_2.verts[new_face_2.verts.first_index_of(edge_vert_1_b.self_index)] =
+  new_vert.self_index;
   added_faces.append(new_face_2.self_index);
 
   /* link edges with new_face_2 */

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


[Bf-blender-cvs] [5bef741e589] soc-2021-adaptive-cloth: adaptive_cloth: Mesh: edge flippable: no connecting edge ov1, ov2

2021-08-09 Thread ishbosamiya
Commit: 5bef741e589fc5a42e9fdf7a177b9f3f75159e0a
Author: ishbosamiya
Date:   Fri Aug 6 11:13:01 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB5bef741e589fc5a42e9fdf7a177b9f3f75159e0a

adaptive_cloth: Mesh: edge flippable: no connecting edge ov1, ov2

Ensure that the edge when flipped does not already have a connecting
edge. This leads to a variety of problems like overlapping duplicate
faces or deletion of faces if no duplication is a requirement. Edge
flips should only change the orientation of the edge which is only
through connectivity change, not actually change the number of
edges/faces.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index ff41883a14e..fbe346570eb 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2195,7 +2195,7 @@ template class Mesh {
   }
 }
   }
-  /* ensure only 2 faces exist for the "3D edge" */
+  /* Ensure only 2 faces exist for the "3D edge" */
   if (num_faces != 2) {
 return false;
   }
@@ -2208,7 +2208,7 @@ template class Mesh {
   return false;
 }
 
-/* ensure triangulation */
+/* Ensure triangulation */
 for (const auto &face_index : edge.faces) {
   const auto &face = this->get_checked_face(face_index);
   if (face.verts.size() != 3) {
@@ -2216,6 +2216,18 @@ template class Mesh {
   }
 }
 
+/* Make sure there is no connecting edge between ov1 and ov2 */
+{
+  const auto &f1 = this->get_checked_face(edge.faces[0]);
+  const auto &f2 = this->get_checked_face(edge.faces[1]);
+  const auto &ov1 = this->get_checked_other_vert(edge, f1);
+  const auto &ov2 = this->get_checked_other_vert(edge, f2);
+
+  if (this->get_connecting_edge_index(ov1.self_index, ov2.self_index)) {
+return false;
+  }
+}
+
 return true;
   }
 
@@ -2248,7 +2260,7 @@ template class Mesh {
  * when across_seams is true:
  *
  * when across_seams is false:
- * 2 faces, might add 1 edge if no existing edge exists
+ * 2 faces, 1 edge
  */
 
 /* Let `e` be the edge of `edge_index`
@@ -2291,14 +2303,13 @@ template class Mesh {
   auto ov1_index = ov1.self_index;
   auto ov2_index = ov2.self_index;
 
-  /* Create the new edge only if there isn't already an edge
-   * between ov1 and ov2 */
-  if (!this->get_connecting_edge_index(ov1_index, ov2_index)) {
-auto &new_e = this->add_empty_edge();
-new_e.verts = {ov1_index, ov2_index};
-this->add_edge_ref_to_verts(new_e);
-added_edges.append(new_e.self_index);
-  }
+  /* Create the new edge only, `is_edge_flippable()` should have
+   * already prevented the case of there being an edge between
+   * ov1 and ov2 */
+  auto &new_e = this->add_empty_edge();
+  new_e.verts = {ov1_index, ov2_index};
+  this->add_edge_ref_to_verts(new_e);
+  added_edges.append(new_e.self_index);
 
   auto &new_f1 = this->add_empty_face(f1.normal);
   new_f1.verts = {v1_index, ov2_index, ov1_index};
@@ -2328,7 +2339,7 @@ template class Mesh {
 
 BLI_assert(added_nodes.size() == 0);
 BLI_assert(added_verts.size() == 0);
-BLI_assert(added_edges.size() == 0 || added_edges.size() == 1);
+BLI_assert(added_edges.size() == 1);
 BLI_assert(added_faces.size() == 2);
 
 BLI_assert(deleted_nodes.size() == 0);
@@ -2614,6 +2625,29 @@ template class Mesh {
 return this->get_checked_vert(vert_3_index);
   }
 
+  /**
+   * A const version of above
+   */
+  inline const Vert &get_checked_other_vert(const Edge &edge,
+ const Face &face) const
+  {
+BLI_assert(face.verts.size() == 3);
+BLI_assert(face.has_edge(edge));
+
+const auto vert_1_index = face.verts[0];
+const auto vert_2_index = face.verts[1];
+const auto vert_3_index = face.verts[2];
+
+if (edge.has_vert(vert_1_index) == false) {
+  return this->get_checked_vert(vert_1_index);
+}
+if (edge.has_vert(vert_2_index) == false) {
+  return this->get_checked_vert(vert_2_index);
+}
+
+return this->get_checked_vert(vert_3_index);
+  }
+
   /**
* Get the edge indices of the `Face`
*/

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


[Bf-blender-cvs] [fb67bf49412] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: edge flip test: only if edge size is ok

2021-08-09 Thread ishbosamiya
Commit: fb67bf49412ba5766a871f2b3a62226e67dc2113
Author: ishbosamiya
Date:   Fri Aug 6 16:42:52 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBfb67bf49412ba5766a871f2b3a62226e67dc2113

adaptive_cloth: AdaptiveMesh: edge flip test: only if edge size is ok

Allow the edge flip only if the flipped edges doesn't exceed the edge
size requirement.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index ce798583dda..a829bac563f 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -292,15 +292,27 @@ using AdaptiveFace = Face;
 template
 class AdaptiveMesh : public Mesh, VertData, EdgeData, 
internal::EmptyExtraData> {
  public:
-  void edge_set_size(AdaptiveEdge &edge)
+  float compute_edge_size(const AdaptiveVert &v1, const AdaptiveVert &v2) const
   {
-const auto [v1, v2] = this->get_checked_verts_of_edge(edge, false);
 const auto &v1_uv = v1.get_uv();
 const auto &v2_uv = v2.get_uv();
 const auto v1_sizing = v1.get_checked_extra_data().get_sizing();
 const auto v2_sizing = v2.get_checked_extra_data().get_sizing();
 
-auto edge_size = v1_sizing.get_edge_size_sq(v2_sizing, v1_uv, v2_uv);
+return v1_sizing.get_edge_size_sq(v2_sizing, v1_uv, v2_uv);
+  }
+
+  float compute_edge_size(const AdaptiveEdge &edge) const
+  {
+const auto [v1, v2] = this->get_checked_verts_of_edge(edge, false);
+
+return this->compute_edge_size(v1, v2);
+  }
+
+  void edge_set_size(AdaptiveEdge &edge)
+  {
+const auto edge_size = this->compute_edge_size(edge);
+
 auto op_edge_data = edge.get_extra_data_mut();
 if (op_edge_data) {
   auto &edge_data = edge.get_checked_extra_data_mut();
@@ -548,6 +560,26 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
   return false;
 }
 
+/* Flipping the edge should not cause the edge size metric to
+ * fail.
+ *
+ * This condition is not part of reference [1] but it is important
+ * so that the edges don't flip prematurely.
+ */
+{
+  const auto &ov1_index = 
this->get_checked_other_vert_index(edge.get_self_index(),
+ 
edge.get_faces()[0]);
+  const auto &ov2_index = 
this->get_checked_other_vert_index(edge.get_self_index(),
+ 
edge.get_faces()[1]);
+
+  const auto &ov1 = this->get_checked_vert(ov1_index);
+  const auto &ov2 = this->get_checked_vert(ov2_index);
+
+  if (this->compute_edge_size(ov1, ov2) > 1.0) {
+return false;
+  }
+}
+
 const auto cross_2d = [](const float2 &a, const float2 &b) { return a.x * 
b.y - a.y * b.x; };
 
 /* Now the actual anisotropic aware critereon */

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


[Bf-blender-cvs] [e3947dfd103] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: splittable edges indices set changes

2021-08-09 Thread ishbosamiya
Commit: e3947dfd103404a37527139054973d58f3a53db6
Author: ishbosamiya
Date:   Thu Aug 5 15:05:06 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBe3947dfd103404a37527139054973d58f3a53db6

adaptive_cloth: AdaptiveMesh: splittable edges indices set changes

Earlier, an edge wouldn't be tested for if one of it's verts was
already selected (for another edge). This would seems almost correct
but leads to non symmetrical remeshing. So it makes sense to get all
the splittable edges, sort them based on their size and then split the
edge only if it still exists in the mesh.

So changes added:
Give the entire set of splittable edges instead of maximally
independent.
Sort the set based on the edge size.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index e79e5b058b9..348bd31b3b5 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -36,6 +36,7 @@
 #include "BKE_cloth.h"
 #include "BKE_cloth_remesh.hh"
 
+#include 
 #include 
 #include 
 #include 
@@ -377,6 +378,10 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 auto splittable_edges_set = this->get_splittable_edge_indices_set();
 do {
   for (const auto &edge_index : splittable_edges_set) {
+auto op_edge = this->get_edges().get(edge_index);
+if (!op_edge) {
+  continue;
+}
 auto &edge = this->get_checked_edge(edge_index);
 auto mesh_diff = this->split_edge_triangulate(edge.get_self_index(), 
true);
 
@@ -440,22 +445,45 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
*/
   blender::Vector get_splittable_edge_indices_set()
   {
+/* TODO(ish): Reference [1] says that the splittable edges should
+ * be a set so this is done by checking if the verts are already
+ * selected or not.
+ *
+ * This can lead to non symmetrical remeshing which wouldn't be
+ * valid. So don't consider this at least for now. Will check
+ * later again to see if it makes sense.
+ *
+ * An example of why selected verts may not work.
+ * v1__v2
+ *  |  /
+ *  | /
+ *  |/
+ * /|v3
+ */ |
+ *   /__|
+ *  v5   v4
+ *
+ * Splitting (v1, v3) (v3, v4) can be done without it affecting
+ * each other but one of the edges wouldn't be selected because v3
+ * was already selected. This can lead to non symmetrical
+ * splitting of the edges.
+ */
 /* Deselect all verts */
-for (auto &vert : this->get_verts_mut()) {
-  auto &vert_data = vert.get_checked_extra_data_mut();
-  auto &flag = vert_data.get_flag_mut();
-  flag &= ~VERT_SELECTED_FOR_SPLIT;
-}
+/* for (auto &vert : this->get_verts_mut()) { */
+/*   auto &vert_data = vert.get_checked_extra_data_mut(); */
+/*   auto &flag = vert_data.get_flag_mut(); */
+/*   flag &= ~VERT_SELECTED_FOR_SPLIT; */
+/* } */
 
 blender::Vector splittable_edge_indices;
 /* It is assumed that the edges sizes have been computed earlier
  * and stored in the extra data of the edges */
 for (const auto &edge : this->get_edges()) {
   auto [v1, v2] = this->get_checked_verts_of_edge(edge, false);
-  if (v1.get_checked_extra_data().get_flag() & VERT_SELECTED_FOR_SPLIT ||
-  v2.get_checked_extra_data().get_flag() & VERT_SELECTED_FOR_SPLIT) {
-continue;
-  }
+  /* if (v1.get_checked_extra_data().get_flag() & VERT_SELECTED_FOR_SPLIT 
|| */
+  /* v2.get_checked_extra_data().get_flag() & VERT_SELECTED_FOR_SPLIT) 
{ */
+  /*   continue; */
+  /* } */
   const auto &edge_data = edge.get_checked_extra_data();
   auto edge_size = edge_data.get_size();
   if (edge_size > 1.0) {
@@ -469,6 +497,18 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
   }
 }
 
+/* Sort all the splittable edges based on their edge size,
+ * largest to smallest. */
+std::sort(splittable_edge_indices.begin(),
+  splittable_edge_indices.end(),
+  [this](const auto &edge_index_1, const auto &edge_index_2) {
+const auto &edge_1 = this->get_checked_edge(edge_index_1);
+const auto &edge_2 = this->get_checked_edge(edge_index_2);
+
+return edge_1.get_checked_extra_data().get_size() >
+   edge_2.get_checked_extra_data().get_size();
+  });
+
 return splittable_edge_indices;
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe

[Bf-blender-cvs] [acaf87d88c7] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: flip edges: set edge size

2021-08-09 Thread ishbosamiya
Commit: acaf87d88c71c0b385cc03a92552fad014f1f01a
Author: ishbosamiya
Date:   Fri Aug 6 10:35:20 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBacaf87d88c71c0b385cc03a92552fad014f1f01a

adaptive_cloth: AdaptiveMesh: flip edges: set edge size

It is important to set the edge size for all the newly created edges.

Limit the number of loops, it can easily become an infinite
loop. There should be a better solution for this but cannot think of
one as of right now.

Always check if the edge is still flippable or not. Again, this
couldn't be solved with a different flip edge algorithm where the new
edge is always added, but right now, that isn't possible.

===

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

===

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index 348bd31b3b5..ce798583dda 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -332,13 +332,25 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
*/
   void flip_edges(blender::Vector active_faces)
   {
+auto max_loop_cycles = active_faces.size() * 3;
+auto loop_cycles_until_now = 0;
 auto flippable_edge_indices_set = 
this->get_flippable_edge_indices_set(active_faces);
 do {
   for (const auto &edge_index : flippable_edge_indices_set) {
 auto &edge = this->get_checked_edge(edge_index);
 
+if (!this->is_edge_flippable_anisotropic_aware(edge)) {
+  continue;
+}
+
 auto mesh_diff = this->flip_edge_triangulate(edge.get_self_index(), 
false);
 
+/* For each new edge added, set it's sizing */
+for (const auto &edge_index : mesh_diff.get_added_edges()) {
+  auto &edge = this->get_checked_edge(edge_index);
+  this->edge_set_size(edge);
+}
+
 auto after_flip_msgpack = this->serialize();
 auto after_flip_filename = 
static_remesh_name_gen.get_curr("after_flip");
 static_remesh_name_gen.gen_next();
@@ -362,7 +374,8 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
   }
 
   flippable_edge_indices_set = 
this->get_flippable_edge_indices_set(active_faces);
-} while (flippable_edge_indices_set.size() != 0);
+  loop_cycles_until_now++;
+} while (flippable_edge_indices_set.size() != 0 && loop_cycles_until_now 
!= max_loop_cycles);
   }
 
   /**

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


[Bf-blender-cvs] [84562e2eac6] soc-2021-adaptive-cloth: adaptive_cloth: fix: AdaptiveMesh: anisotropic flip check

2021-08-09 Thread ishbosamiya
Commit: 84562e2eac6e62515b13d7491ddd382e5fc0fbb2
Author: ishbosamiya
Date:   Thu Aug 5 12:38:43 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB84562e2eac6e62515b13d7491ddd382e5fc0fbb2

adaptive_cloth: fix: AdaptiveMesh: anisotropic flip check

Based on the next paper by the same authors, "Folding and Crumpling
Adaptive Sheets". The edge flip criterion is different. So using this
now.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh
M   source/blender/blenkernel/intern/cloth_remesh.cc

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index b2c36698dd2..ff41883a14e 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -23,7 +23,7 @@
  * \ingroup bke
  */
 
-/**
+/*
  * references
  *
  * [1] "Adaptive Anisotropic Remeshing for Cloth Simulation" by Rahul
@@ -34,7 +34,13 @@
  * efficient and fast management of multiresolution meshes" by
  * Frutuoso G. M. Silva and Abel J. P. Gomes (GRAPHITE '03)
  * https://doi.org/10.1145/604471.604503
- * /
+ *
+ * [3] "Folding and Crumpling Adaptive Sheets" by Rahul Narain, Tobias
+ * Pfaff, James F.O'Brien (SIGGRAPH 2013).
+ * https://dl.acm.org/doi/10.1145/2461912.2462010
+ * 
http://graphics.berkeley.edu/papers/Narain-FCA-2013-07/Narain-FCA-2013-07.pdf
+ *
+ * 
*/
 
 #include "BKE_mesh.h"
 #include "BLI_assert.h"
diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc 
b/source/blender/blenkernel/intern/cloth_remesh.cc
index 6cebc346095..e79e5b058b9 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -478,10 +478,16 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
* Note: this is not the same as `Mesh::is_edge_flippable`, this is
* specific to `AdaptiveMesh`.
*
-   * Reference [1]
+   * Reference [1] and [3]
+   *
+   * In this case considering [3] to be higher priority since both are
+   * contradicting each other.
*/
   bool is_edge_flippable_anisotropic_aware(const AdaptiveEdge &edge) const
   {
+/* TODO(ish): expose alpha to the user */
+auto alpha = 0.1;
+
 if (this->is_edge_loose_or_on_seam_or_boundary(edge)) {
   return false;
 }
@@ -516,9 +522,18 @@ class AdaptiveMesh : public Mesh, VertData, 
EdgeData, internal::Em
 
 const auto m_avg = (m_i + m_j + m_k + m_l) * 0.25;
 
-return cross_2d(u_jk, u_ik) * float2::dot(u_il, m_avg * u_jl) +
-   float2::dot(u_jk, m_avg * u_ik) * cross_2d(u_il, u_jl) <
-   0.0;
+const auto lhs = cross_2d(u_jk, u_ik) * float2::dot(u_il, m_avg * u_jl) +
+ float2::dot(u_jk, m_avg * u_ik) * cross_2d(u_il, u_jl);
+
+/* Based on [1], should be flippable if res < 0.
+ *
+ * Based on [3], should be flippable if res >= 0 but then there is
+ * another part that mentions that flippable if res falls some
+ * calculated value. So taking that route as of now.
+ */
+const auto rhs = -alpha * (cross_2d(u_jk, u_ik) + cross_2d(u_il, u_jl));
+
+return lhs < rhs;
   }
 
   /**

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


[Bf-blender-cvs] [4e2a10352da] soc-2021-adaptive-cloth: adaptive_cloth: fix: mesh: flip edge: edge might already exist

2021-08-09 Thread ishbosamiya
Commit: 4e2a10352dad5c66fc638bb4d84c80954c5d011c
Author: ishbosamiya
Date:   Thu Aug 5 11:14:30 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB4e2a10352dad5c66fc638bb4d84c80954c5d011c

adaptive_cloth: fix: mesh: flip edge: edge might already exist

It is possible that there might already be an edge between ov1 and ov2
so it is best to not create a new edge between those because edges
between verts should always be unique for all the algorithms to work
correctly.

It is a case that shouldn't show up too often but when it does, it
will be interesting to see what happens in the static remeshing
part. The number of faces remains the same but number of edges can
change (reduce only).

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index e6b1c469037..b2c36698dd2 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2242,7 +2242,7 @@ template class Mesh {
  * when across_seams is true:
  *
  * when across_seams is false:
- * 2 faces, 1 edge
+ * 2 faces, might add 1 edge if no existing edge exists
  */
 
 /* Let `e` be the edge of `edge_index`
@@ -2285,24 +2285,30 @@ template class Mesh {
   auto ov1_index = ov1.self_index;
   auto ov2_index = ov2.self_index;
 
-  auto &new_e = this->add_empty_edge();
-  new_e.verts = {ov1_index, ov2_index};
-  this->add_edge_ref_to_verts(new_e);
+  /* Create the new edge only if there isn't already an edge
+   * between ov1 and ov2 */
+  if (!this->get_connecting_edge_index(ov1_index, ov2_index)) {
+auto &new_e = this->add_empty_edge();
+new_e.verts = {ov1_index, ov2_index};
+this->add_edge_ref_to_verts(new_e);
+added_edges.append(new_e.self_index);
+  }
 
   auto &new_f1 = this->add_empty_face(f1.normal);
   new_f1.verts = {v1_index, ov2_index, ov1_index};
   added_faces.append(new_f1.self_index);
   this->add_face_ref_to_edges(new_f1);
+  BLI_assert(this->is_face_edges_linked(new_f1));
 
   auto &new_f2 = this->add_empty_face(f2.normal);
   new_f2.verts = {v2_index, ov1_index, ov2_index};
   added_faces.append(new_f2.self_index);
   this->add_face_ref_to_edges(new_f2);
+  BLI_assert(this->is_face_edges_linked(new_f2));
 
   deleted_edges.append(std::move(e));
   deleted_faces.append(std::move(f1));
   deleted_faces.append(std::move(f2));
-  added_edges.append(new_e.self_index);
 }
 else {
   /* Do more expensive operation only if needed */
@@ -2314,6 +2320,15 @@ template class Mesh {
* seam or boundary */
 }
 
+BLI_assert(added_nodes.size() == 0);
+BLI_assert(added_verts.size() == 0);
+BLI_assert(added_edges.size() == 0 || added_edges.size() == 1);
+BLI_assert(added_faces.size() == 2);
+
+BLI_assert(deleted_nodes.size() == 0);
+BLI_assert(deleted_verts.size() == 0);
+BLI_assert(deleted_edges.size() == 1);
+BLI_assert(deleted_faces.size() == 2);
 return MeshDiff(std::move(added_nodes),
 std::move(added_verts),
 std::move(added_edges),

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


[Bf-blender-cvs] [44c82975ec0] soc-2021-adaptive-cloth: adaptive_cloth: mesh: collapse edges: remove dump file statements

2021-08-09 Thread ishbosamiya
Commit: 44c82975ec0b65aa850310ef7bfb64a1ec385332
Author: ishbosamiya
Date:   Wed Aug 4 12:28:25 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB44c82975ec0b65aa850310ef7bfb64a1ec385332

adaptive_cloth: mesh: collapse edges: remove dump file statements

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 5a2c3ff1fef..e6b1c469037 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1888,9 +1888,6 @@ template class Mesh {
  * None
  */
 
-FilenameGen filename_gen(
-"/tmp/adaptive_cloth/" + 
std::to_string(std::get<0>(edge_index.get_raw())), ".mesh");
-
 BLI_assert(this->is_edge_collapseable(edge_index, verts_swapped, 
across_seams));
 
 blender::Vector added_nodes;
@@ -1927,7 +1924,6 @@ template class Mesh {
 };
 
 for (const auto &edge_index : edge_indices) {
-  dump_file(filename_gen.gen_next("edge_indices"), this->serialize());
   auto &e = this->get_checked_edge(edge_index);
   auto [v1_index, v2_index] = get_v1_v2_indices(e);
 
@@ -1991,8 +1987,6 @@ template class Mesh {
   }
 }
 
-dump_file(filename_gen.gen_next("done_with_edge_indices"), 
this->serialize());
-
 /* There can be multiple v2, so cannot delete the all edges or
  * faces around v1 in the previous loop */
 {
@@ -2040,8 +2034,6 @@ template class Mesh {
   }
 }
 
-dump_file(filename_gen.gen_next("done_deleting_faces_edges_of_v1_and_v1"), 
this->serialize());
-
 /* delete the Node n1 */
 {
   auto &n1 = this->get_checked_node(n1_index);
@@ -2054,7 +2046,6 @@ template class Mesh {
   if (across_seams) {
 const auto n1_verts = n1.get_verts();
 for (const auto &v1_index : n1_verts) {
-  dump_file(filename_gen.gen_next("extra_v1_processing"), 
this->serialize());
 
   /* TODO(ish): might want to delete the faces and recreate
* them so MeshDiff gets updated */

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


[Bf-blender-cvs] [cb9424b99c0] soc-2021-adaptive-cloth: modifier: adaptive_remesh: collapse edge only if collapseable

2021-08-09 Thread ishbosamiya
Commit: cb9424b99c0cd6802ea19e331580292833eb5777
Author: ishbosamiya
Date:   Wed Aug 4 12:29:19 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBcb9424b99c0cd6802ea19e331580292833eb5777

modifier: adaptive_remesh: collapse edge only if collapseable

===

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

===

diff --git a/source/blender/modifiers/intern/MOD_adaptive_remesh.cc 
b/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
index 707dd43f09a..f9b1c09e1bd 100644
--- a/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
+++ b/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
@@ -113,17 +113,20 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *UNUSED(ctx)
   internal::dump_file(post_split_filename, post_split_msgpack);
 }
 else if (mode == ADAPTIVE_REMESH_COLLAPSE_EDGE) {
-  auto pre_collapse_msgpack = internal_mesh.serialize();
-  auto pre_collapse_filename = 
collapse_edge_name_gen.get_curr(filename_pre_suffix + "_pre");
+  if (collapseable) {
+auto pre_collapse_msgpack = internal_mesh.serialize();
+auto pre_collapse_filename = 
collapse_edge_name_gen.get_curr(filename_pre_suffix + "_pre");
 
-  internal_mesh.collapse_edge_triangulate(edge_index, verts_swapped, 
across_seams);
+internal_mesh.collapse_edge_triangulate(edge_index, verts_swapped, 
across_seams);
 
-  auto post_collapse_msgpack = internal_mesh.serialize();
-  auto post_collapse_filename = 
collapse_edge_name_gen.get_curr(filename_pre_suffix + "_post");
-  /* collapse_edge_name_gen.gen_next(); */
+auto post_collapse_msgpack = internal_mesh.serialize();
+auto post_collapse_filename = 
collapse_edge_name_gen.get_curr(filename_pre_suffix +
+  "_post");
+/* collapse_edge_name_gen.gen_next(); */
 
-  internal::dump_file(pre_collapse_filename, pre_collapse_msgpack);
-  internal::dump_file(post_collapse_filename, post_collapse_msgpack);
+internal::dump_file(pre_collapse_filename, pre_collapse_msgpack);
+internal::dump_file(post_collapse_filename, post_collapse_msgpack);
+  }
 }
 else if (mode == ADAPTIVE_REMESH_FLIP_EDGE) {
   if (flippable) {

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


[Bf-blender-cvs] [cae9f4dd954] soc-2021-adaptive-cloth: adaptive_cloth: mesh: is_edge_collapseable()

2021-08-09 Thread ishbosamiya
Commit: cae9f4dd9549cc188c59db9dbac4d531ec0b6f00
Author: ishbosamiya
Date:   Wed Aug 4 11:27:33 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBcae9f4dd9549cc188c59db9dbac4d531ec0b6f00

adaptive_cloth: mesh: is_edge_collapseable()

The collapse edge operation doesn't support one type of edge
collapse. When the collapse is across seams, it is possible for one
vert v1 to be asked to collapsed into multiple verts v2. Now deciding
which v2 to consider is a difficult task, so not handling it right now.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh
M   source/blender/modifiers/intern/MOD_adaptive_remesh.cc

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index e34db56d413..5a2c3ff1fef 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1796,6 +1796,52 @@ template class Mesh {
 std::move(deleted_faces));
   }
 
+  bool is_edge_collapseable(EdgeIndex edge_index, bool verts_swapped, bool 
across_seams)
+  {
+/* The edge is always collapseable if across seams is false */
+if (across_seams == false) {
+  return true;
+}
+
+auto &e_a = this->get_checked_edge(edge_index);
+auto [v1_a, v2_a] = this->get_checked_verts_of_edge(e_a, verts_swapped);
+auto &n1_a = this->get_checked_node_of_vert(v1_a);
+auto &n2_a = this->get_checked_node_of_vert(v2_a);
+auto n1_index = n1_a.self_index;
+auto edge_indices = this->get_connecting_edge_indices(n1_a, n2_a);
+
+/* The collapse edge function doesn't support collapsing one v1 into
+ * multiple v2 as of right now, so if we find such a case tell
+ * user that edge is not collapseable */
+{
+  auto get_v1_v2_indices = [this, &n1_index, &verts_swapped](const 
Edge &e) {
+auto [v1, v2] = this->get_checked_verts_of_edge(e, verts_swapped);
+auto v1_index = v1.self_index;
+auto v2_index = v2.self_index;
+/* Need to swap the verts if v1 does not point to n1 */
+if (v1.node.value() != n1_index) {
+  std::swap(v1_index, v2_index);
+}
+BLI_assert(this->get_checked_vert(v1_index).node.value() == n1_index);
+return std::make_tuple(v1_index, v2_index);
+  };
+
+  blender::Vector v1_list;
+  for (const auto &edge_index : edge_indices) {
+auto &e = this->get_checked_edge(edge_index);
+auto [v1_index, v2_index] = get_v1_v2_indices(e);
+
+if (v1_list.contains(v1_index)) {
+  return false;
+}
+
+v1_list.append(v1_index);
+  }
+}
+
+return true;
+  }
+
   /**
* Collapses the edge from edge v1 to v2 unless `verts_swapped` is set
* to true and keeps the triangulation of the Mesh
@@ -1813,6 +1859,8 @@ template class Mesh {
* Note, the caller must ensure the adjacent faces to the edge are
* triangulated. In debug mode, it will assert, in release mode, it
* is undefined behaviour.
+   *
+   * Caller must ensure that the edge is collapseable by calling 
`is_edge_collapseable()`
**/
   MeshDiff collapse_edge_triangulate(EdgeIndex edge_index,
  bool verts_swapped,
@@ -1843,6 +1891,8 @@ template class Mesh {
 FilenameGen filename_gen(
 "/tmp/adaptive_cloth/" + 
std::to_string(std::get<0>(edge_index.get_raw())), ".mesh");
 
+BLI_assert(this->is_edge_collapseable(edge_index, verts_swapped, 
across_seams));
+
 blender::Vector added_nodes;
 blender::Vector added_verts;
 blender::Vector added_edges;
diff --git a/source/blender/modifiers/intern/MOD_adaptive_remesh.cc 
b/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
index 09d5b8c27db..707dd43f09a 100644
--- a/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
+++ b/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
@@ -96,6 +96,9 @@ static Mesh *modifyMesh(ModifierData *md, const 
ModifierEvalContext *UNUSED(ctx)
 std::cout << "is_on_boundary: " << is_on_boundary << std::endl;
 auto flippable = internal_mesh.is_edge_flippable(edge_index, across_seams);
 std::cout << "flippable: " << flippable << std::endl;
+auto collapseable = internal_mesh.is_edge_collapseable(
+edge_index, verts_swapped, across_seams);
+std::cout << "collapseable: " << collapseable << std::endl;
 if (mode == ADAPTIVE_REMESH_SPLIT_EDGE) {
   auto pre_split_msgpack = internal_mesh.serialize();
   auto pre_split_filename = 
split_edge_name_gen.get_curr(filename_pre_suffix + "_pre");

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


[Bf-blender-cvs] [fdda6f3f63e] soc-2021-adaptive-cloth: adaptive_cloth: mesh: collapse edge: tackle edge case

2021-08-09 Thread ishbosamiya
Commit: fdda6f3f63e6e3896a7bfb2dca53c6ca36c0f0a9
Author: ishbosamiya
Date:   Wed Aug 4 10:42:32 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBfdda6f3f63e6e3896a7bfb2dca53c6ca36c0f0a9

adaptive_cloth: mesh: collapse edge: tackle edge case

During an across seams collapse edge, it is possible that n1 might
still have v1 attached to it. Take the example of a icosphere's bottom
most vert collapsed into some other neighbouring vert.

For this, make v1.node point to n1 so essentially, v1 has been
converted to v2 instead of removing it.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 921ed6d5688..e34db56d413 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1857,6 +1857,7 @@ template class Mesh {
 auto &n1_a = this->get_checked_node_of_vert(v1_a);
 auto &n2_a = this->get_checked_node_of_vert(v2_a);
 auto n1_index = n1_a.self_index;
+auto n2_index = n2_a.self_index;
 
 blender::Vector edge_indices = {edge_index};
 if (across_seams) {
@@ -1940,6 +1941,8 @@ template class Mesh {
   }
 }
 
+dump_file(filename_gen.gen_next("done_with_edge_indices"), 
this->serialize());
+
 /* There can be multiple v2, so cannot delete the all edges or
  * faces around v1 in the previous loop */
 {
@@ -1987,9 +1990,31 @@ template class Mesh {
   }
 }
 
+dump_file(filename_gen.gen_next("done_deleting_faces_edges_of_v1_and_v1"), 
this->serialize());
+
 /* delete the Node n1 */
 {
-  const auto &n1 = this->get_checked_node(n1_index);
+  auto &n1 = this->get_checked_node(n1_index);
+
+  /* It is possible to have v1 which doesn't have a
+   * corresponding v2 for this 3d edge but v1 should be entirely
+   * removed if across seams is active, so make v1 as v2 by
+   * making v1.node refer to n2 and removing the reference to v1
+   * in n1 */
+  if (across_seams) {
+const auto n1_verts = n1.get_verts();
+for (const auto &v1_index : n1_verts) {
+  dump_file(filename_gen.gen_next("extra_v1_processing"), 
this->serialize());
+
+  /* TODO(ish): might want to delete the faces and recreate
+   * them so MeshDiff gets updated */
+
+  auto &v1 = this->get_checked_vert(v1_index);
+  v1.node = n2_index;
+
+  n1.verts.remove_first_occurrence_and_reorder(v1_index);
+}
+  }
 
   if (n1.get_verts().is_empty()) {
 const auto n1 = this->delete_node(n1_index);

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


[Bf-blender-cvs] [29c73ddd2ec] soc-2021-adaptive-cloth: adaptive_cloth: mesh: face edge linkage checks improvement

2021-08-09 Thread ishbosamiya
Commit: 29c73ddd2ec63175e87b40c0f83d6e17a5213580
Author: ishbosamiya
Date:   Wed Aug 4 10:16:41 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB29c73ddd2ec63175e87b40c0f83d6e17a5213580

adaptive_cloth: mesh: face edge linkage checks improvement

It is not necessary for the face to have it's verts available, because
delete_edge() can remove the verts from the face. So this check
ensures that there is no out of bounds access.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 416fcb5d4eb..921ed6d5688 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2859,6 +2859,11 @@ template class Mesh {
 
   bool is_face_edges_linked(const Face &face) const
   {
+if (face.verts.size() == 0) {
+  /* No verts available, so no links possible */
+  return false;
+}
+
 auto vert_1_index = face.verts[0];
 auto vert_2_index = face.verts[0];
 for (auto i = 1; i <= face.verts.size(); i++) {
@@ -2900,6 +2905,13 @@ template class Mesh {
   {
 auto &face = this->get_checked_face(face_index);
 
+/* An earlier call to delete_edge and now this call can lead to
+ * problems, so early exit if the verts were already removed from
+ * the face. */
+if (face.verts.size() == 0) {
+  return;
+}
+
 /* Would want to use `get_edges_of_face()` but that can lead to 2
  * loops, so duplicating that code here. (note: this needs to be
  * benchmarked to see if this duplication is necessary) */

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


[Bf-blender-cvs] [dc1144f59f6] soc-2021-adaptive-cloth: adaptive_cloth: mesh: collapse edge across seams

2021-08-09 Thread ishbosamiya
Commit: dc1144f59f67f7e1817b2451794043a74d761e02
Author: ishbosamiya
Date:   Wed Aug 4 09:25:23 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBdc1144f59f67f7e1817b2451794043a74d761e02

adaptive_cloth: mesh: collapse edge across seams

It works for most cases. There is one case that is difficult to do
for, when v1 has two v2 to collapse into. Will add a check to make
sure the edge is collapsed only if collapse-able.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 6c89a00a9f6..416fcb5d4eb 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1840,6 +1840,9 @@ template class Mesh {
  * None
  */
 
+FilenameGen filename_gen(
+"/tmp/adaptive_cloth/" + 
std::to_string(std::get<0>(edge_index.get_raw())), ".mesh");
+
 blender::Vector added_nodes;
 blender::Vector added_verts;
 blender::Vector added_edges;
@@ -1849,109 +1852,153 @@ template class Mesh {
 blender::Vector> deleted_edges;
 blender::Vector> deleted_faces;
 
-/* TODO(ish): add support for across seams */
-BLI_assert(across_seams == false);
-
-auto &e = this->get_checked_edge(edge_index);
-auto [v1, v2] = this->get_checked_verts_of_edge(e, verts_swapped);
-auto v1_index = v1.self_index;
-auto v2_index = v2.self_index;
-auto &n1 = this->get_checked_node_of_vert(v1);
-auto &n2 = this->get_checked_node_of_vert(v2);
-auto n1_index = n1.self_index;
-auto n2_index = n2.self_index;
+auto &e_a = this->get_checked_edge(edge_index);
+auto [v1_a, v2_a] = this->get_checked_verts_of_edge(e_a, verts_swapped);
+auto &n1_a = this->get_checked_node_of_vert(v1_a);
+auto &n2_a = this->get_checked_node_of_vert(v2_a);
+auto n1_index = n1_a.self_index;
 
-auto v1_face_indices = this->get_checked_face_indices_of_vert(v1);
+blender::Vector edge_indices = {edge_index};
+if (across_seams) {
+  edge_indices = this->get_connecting_edge_indices(n1_a, n2_a);
+}
 
-/* Create the new faces by swapping v1 with v2 */
-{
-  for (const auto &face_index : v1_face_indices) {
-auto &f = this->get_checked_face(face_index);
+auto get_v1_v2_indices = [this, &n1_index, &verts_swapped](const Edge 
&e) {
+  auto [v1, v2] = this->get_checked_verts_of_edge(e, verts_swapped);
+  auto v1_index = v1.self_index;
+  auto v2_index = v2.self_index;
+  /* Need to swap the verts if v1 does not point to n1 */
+  if (v1.node.value() != n1_index) {
+std::swap(v1_index, v2_index);
+  }
+  BLI_assert(this->get_checked_vert(v1_index).node.value() == n1_index);
+  return std::make_tuple(v1_index, v2_index);
+};
 
-/* Cannot create face between v2, v2, ov */
-if (f.has_vert_index(v2_index)) {
-  continue;
-}
+for (const auto &edge_index : edge_indices) {
+  dump_file(filename_gen.gen_next("edge_indices"), this->serialize());
+  auto &e = this->get_checked_edge(edge_index);
+  auto [v1_index, v2_index] = get_v1_v2_indices(e);
 
-BLI_assert(f.get_verts().size() == 3);
+  auto v1_face_indices = this->get_checked_face_indices_of_vert(v1_index);
 
-blender::Array vert_indices(f.get_verts().as_span());
+  /* Create the new faces by swapping v1 with v2 */
+  {
+for (const auto &face_index : v1_face_indices) {
+  auto &f = this->get_checked_face(face_index);
 
-bool v2_exists = false;
-for (auto &vert_index : vert_indices) {
-  if (vert_index == v2_index) {
-v2_exists = true;
-break;
-  }
-  if (vert_index == v1_index) {
-vert_index = v2_index;
-break;
+  /* Cannot create face between v2, v2, ov */
+  if (f.has_vert_index(v2_index)) {
+continue;
   }
-}
 
-if (v2_exists) {
-  continue;
-}
+  BLI_assert(f.get_verts().size() == 3);
 
-// Create the edges between v2 and the other verts
-{
-  for (const auto &vert_index : vert_indices) {
+  blender::Array vert_indices(f.get_verts().as_span());
+
+  bool v2_exists = false;
+  for (auto &vert_index : vert_indices) {
 if (vert_index == v2_index) {
-  continue;
+  v2_exists = true;
+  break;
 }
-/* It is possible to have a connecting edge between
- * vert_index and v2_index, in case of this, don't create
- * a new edge */
-if (this->get_connecting_edge_index(vert_index, v2_index)) {
-  continue;
+if (vert_index == v1_index) {

[Bf-blender-cvs] [bffe7c58d9f] soc-2021-adaptive-cloth: adaptive_cloth: mesh: collapse edge rewrite to fix bugs

2021-08-09 Thread ishbosamiya
Commit: bffe7c58d9fa83a28bd3bbb3056a994d3a302721
Author: ishbosamiya
Date:   Tue Aug 3 22:15:59 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBbffe7c58d9fa83a28bd3bbb3056a994d3a302721

adaptive_cloth: mesh: collapse edge rewrite to fix bugs

Found a lot of bugs in collapse edge routine using the debug
tool so needed a rewrite of this function.

Need to still add across seams support.

===

M   source/blender/blenkernel/BKE_cloth_remesh.hh

===

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh 
b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 1e46df2c0d3..6c89a00a9f6 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -77,6 +77,7 @@ Mesh *BKE_cloth_remesh(struct Object *ob, struct 
ClothModifierData *clmd, struct
 #  include "msgpack.hpp"
 #  include "msgpack/adaptor/define_decl.hpp"
 
+#  include "BLI_array.hh"
 #  include "BLI_float2.hh"
 #  include "BLI_float2_msgpack.hh"
 #  include "BLI_float3.hh"
@@ -85,6 +86,7 @@ Mesh *BKE_cloth_remesh(struct Object *ob, struct 
ClothModifierData *clmd, struct
 #  include "BLI_generational_arena_msgpack.hh"
 #  include "BLI_map.hh"
 #  include "BLI_map_msgpack.hh"
+#  include "BLI_set.hh"
 #  include "BLI_vector.hh"
 #  include "BLI_vector_msgpack.hh"
 
@@ -1816,6 +1818,7 @@ template class Mesh {
  bool verts_swapped,
  bool across_seams)
   {
+/* TODO(ish): write the below thing */
 /* Let the vert remove be `v1`, node to remove be `n1`, the other
  * vert, node be `v2`, `n2`.
  *
@@ -1846,114 +1849,108 @@ template class Mesh {
 blender::Vector> deleted_edges;
 blender::Vector> deleted_faces;
 
+/* TODO(ish): add support for across seams */
+BLI_assert(across_seams == false);
+
 auto &e = this->get_checked_edge(edge_index);
-auto [v1_a, v2_a] = this->get_checked_verts_of_edge(e, verts_swapped);
-auto &n1 = this->get_checked_node_of_vert(v1_a);
-auto &n2 = this->get_checked_node_of_vert(v2_a);
+auto [v1, v2] = this->get_checked_verts_of_edge(e, verts_swapped);
+auto v1_index = v1.self_index;
+auto v2_index = v2.self_index;
+auto &n1 = this->get_checked_node_of_vert(v1);
+auto &n2 = this->get_checked_node_of_vert(v2);
 auto n1_index = n1.self_index;
 auto n2_index = n2.self_index;
 
-blender::Vector edge_indices = {edge_index};
-if (across_seams) {
-  edge_indices = this->get_connecting_edge_indices(n1, n2);
-}
-
-for (const auto &edge_index : edge_indices) {
-  auto &e = this->get_checked_edge(edge_index);
-  auto [v1_b, v2_b] = this->get_checked_verts_of_edge(e, verts_swapped);
-  auto v1_index = v1_b.self_index;
-  auto v2_index = v2_b.self_index;
-  /* Need to swap the verts if v1 does not point to n1 */
-  if (v1_b.node.value() != n1_index) {
-std::swap(v1_index, v2_index);
-  }
-  BLI_assert(this->get_checked_vert(v1_index).node.value() == n1_index);
+auto v1_face_indices = this->get_checked_face_indices_of_vert(v1);
 
-  /* delete all the faces that `e` refers to */
-  auto e_faces = e.faces;
-  for (const auto &face_index : e_faces) {
-auto &e = this->get_checked_edge(edge_index);
-this->delink_face_edges(face_index);
-auto face = this->delete_face(face_index);
-
-auto &ov = this->get_checked_other_vert(e, face);
+/* Create the new faces by swapping v1 with v2 */
+{
+  for (const auto &face_index : v1_face_indices) {
+auto &f = this->get_checked_face(face_index);
 
-auto op_v1_ov_edge_index = this->get_connecting_edge_index(v1_index, 
ov.self_index);
-BLI_assert(op_v1_ov_edge_index);
-auto v1_ov_edge = this->get_checked_edge(op_v1_ov_edge_index.value());
-/* delete `v1_ov_edge` only if it doesn't have any faces */
-if (v1_ov_edge.faces.is_empty()) {
-  auto v1_ov_edge = this->delete_edge(op_v1_ov_edge_index.value());
-  deleted_edges.append(std::move(v1_ov_edge));
+/* Cannot create face between v2, v2, ov */
+if (f.has_vert_index(v2_index)) {
+  continue;
 }
-deleted_faces.append(std::move(face));
-  }
 
-  auto &v1_c = this->get_checked_vert(v1_index);
-  auto v1_edge_indices = v1_c.edges;
+BLI_assert(f.get_verts().size() == 3);
 
-  /* edges should have verts (v2, vx) instead of (v1, vx) and the
-   * face should have (v2, vx, vy) instead of (v1, vx, vy) */
-  for (const auto &v1_vx_edge_index : v1_edge_indices) {
-Edge &v1_vx_edge = this->get_checked_edge(v1_vx_edge_index);
+blender::Array vert_indices(f.get_verts().as_span());
 
-BLI_assert(v1_vx_edge.verts);
-  

[Bf-blender-cvs] [8dad29d0eac] temp-geometry-nodes-fields-prototype: new Attribute Extract node

2021-08-09 Thread Jacques Lucke
Commit: 8dad29d0eac64c7c73bb954885c77071e442b2d1
Author: Jacques Lucke
Date:   Mon Aug 9 11:10:57 2021 +0200
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB8dad29d0eac64c7c73bb954885c77071e442b2d1

new Attribute Extract node

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   source/blender/nodes/geometry/nodes/node_geo_attribute_extract.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 4933f28151c..a5316c14896 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -482,6 +482,7 @@ geometry_node_categories = [
 NodeItem("GeometryNodeAttributeRemove"),
 NodeItem("GeometryNodeAttributeMapRange"),
 NodeItem("GeometryNodeAttributeTransfer"),
+NodeItem("GeometryNodeAttributeExtract"),
 NodeItem("GeometryNodeAttributeStore"),
 ]),
 GeometryNodeCategory("GEO_COLOR", "Color", items=[
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index ae78ec7bb55..3a8b228e04b 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1481,6 +1481,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_INDEX 1076
 #define GEO_NODE_EXTRUDE 1077
 #define GEO_NODE_ATTRIBUTE_STORE_ANONYMOUS 1078
+#define GEO_NODE_ATTRIBUTE_EXTRACT 1079
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index d53548a918f..c4d8aa50fa8 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5124,6 +5124,7 @@ static void registerGeometryNodes()
   register_node_type_geo_attribute_compare();
   register_node_type_geo_attribute_convert();
   register_node_type_geo_attribute_curve_map();
+  register_node_type_geo_attribute_extract();
   register_node_type_geo_attribute_fill();
   register_node_type_geo_attribute_map_range();
   register_node_type_geo_attribute_math();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index fa4bd8bfed1..3c2c0d5d33d 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1435,6 +1435,13 @@ typedef struct NodeGeometryAttribute {
   int8_t output_type;
 } NodeGeometryAttribute;
 
+typedef struct NodeGeometryAttributeExtract {
+  /* CustomDataType. */
+  int8_t data_type;
+  /* Boolean that indicates whether the persistent attribute should be 
removed. */
+  uint8_t delete_persistent;
+} NodeGeometryAttributeExtract;
+
 /* script node mode */
 #define NODE_SCRIPT_INTERNAL 0
 #define NODE_SCRIPT_EXTERNAL 1
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index f2481d50d1c..3daa2adedcd 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9156,6 +9156,26 @@ static void def_geo_attribute_fill(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_geo_attribute_extract(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  RNA_def_struct_sdna_from(srna, "NodeGeometryAttributeExtract", "storage");
+
+  prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "data_type");
+  RNA_def_property_enum_items(prop, rna_enum_attribute_type_items);
+  RNA_def_property_enum_funcs(prop, NULL, NULL, 
"rna_GeometryNodeAttributeFill_type_itemf");
+  RNA_def_property_enum_default(prop, CD_PROP_FLOAT);
+  RNA_def_property_ui_text(prop, "Data Type", "Type of data stored in 
attribute");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, 
"rna_GeometryNode_socket_update");
+
+  prop = RNA_def_property(srna, "delete_persistent", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(
+  prop, "Delete Persistent", "Delete the persistent attribute with the 
given name");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
 static void def_geo_attribute_store_anonymous(StructRNA *srna)
 {
   PropertyRNA *prop;
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index 1417d3cc8e1..28058285f31 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -151,6 +151,7 @@ set(SRC
   geometry/nodes/node_geo_attribute_compare.cc
   geometry/nodes/node_geo_attribute_convert.

[Bf-blender-cvs] [909e0819ae9] master: Fix T90532: Crash editing meshes with auto-smooth

2021-08-09 Thread Campbell Barton
Commit: 909e0819ae939a8054bea2c9dcf389232744f3ae
Author: Campbell Barton
Date:   Mon Aug 9 18:32:53 2021 +1000
Branches: master
https://developer.blender.org/rB909e0819ae939a8054bea2c9dcf389232744f3ae

Fix T90532: Crash editing meshes with auto-smooth

Caused by fix for T90256 and a misunderstanding in D11928.

Don't skip tagging edges when the auto-smooth angle is 180 degrees
since this skips topology checks which are needed for properly
calculating edge loop normals.

===

M   source/blender/bmesh/intern/bmesh_mesh_normals.c

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c 
b/source/blender/bmesh/intern/bmesh_mesh_normals.c
index 8eda38046a1..a5e41b74ee1 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c
@@ -1116,8 +1116,6 @@ static void 
bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
   BMIter fiter;
   BMFace *f_curr;
   const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
-  const bool check_angle = (split_angle < (float)M_PI);
-  const float split_angle_cos = check_angle ? cosf(split_angle) : -1.0f;
 
   MLoopNorSpaceArray _lnors_spacearr = {NULL};
 
@@ -1152,16 +1150,13 @@ static void 
bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
 do {
   BM_elem_index_set(l_curr, index_loop++); /* set_inline */
   BM_elem_flag_disable(l_curr, BM_ELEM_TAG);
-  /* Needed for when #bm_mesh_edges_sharp_tag doesn't run.
-   * Mark smooth if there is no smoothing angle. */
-  BM_elem_flag_enable(l_curr->e, BM_ELEM_TAG);
 } while ((l_curr = l_curr->next) != l_first);
   }
   bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP);
 
-  if (split_angle_cos != -1.0f) {
-bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, 
false);
-  }
+  /* Always tag edges based on winding & sharp edge flag
+   * (even when the auto-smooth angle doesn't need to be calculated). */
+  bm_mesh_edges_sharp_tag(bm, fnos, has_clnors ? (float)M_PI : split_angle, 
false);
 
   /* We now know edges that can be smoothed (they are tagged),
* and edges that will be hard (they aren't).

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


[Bf-blender-cvs] [30fe9b4fc86] cycles-x: Merge branch 'master' into cycles-x

2021-08-09 Thread Sergey Sharybin
Commit: 30fe9b4fc86973e6dbe5465f5d86b9645eb70ed0
Author: Sergey Sharybin
Date:   Mon Aug 9 10:35:35 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB30fe9b4fc86973e6dbe5465f5d86b9645eb70ed0

Merge branch 'master' into cycles-x

===



===



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


[Bf-blender-cvs] [52c349cfcd2] master: Fix T90511: Cycles preview does not update once preview is done

2021-08-09 Thread Sergey Sharybin
Commit: 52c349cfcd28f402e6e73450831078fbd3fbbf08
Author: Sergey Sharybin
Date:   Mon Aug 9 10:26:58 2021 +0200
Branches: master
https://developer.blender.org/rB52c349cfcd28f402e6e73450831078fbd3fbbf08

Fix T90511: Cycles preview does not update once preview is done

Caused by 4f64fa4f8628.

Was a bad backport from the Cycles X branch: the fact that CPU and GPU
has different reset code paths was not taken into account.

===

M   intern/cycles/render/session.cpp

===

diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 1a08d8f52d6..1b91c49f0ea 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -185,6 +185,8 @@ void Session::reset_gpu(BufferParams &buffer_params, int 
samples)
   gpu_need_display_buffer_update_ = false;
   gpu_need_display_buffer_update_cond_.notify_all();
 
+  new_work_added_ = true;
+
   pause_cond_.notify_all();
 }

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


[Bf-blender-cvs] [4eda4fd49ab] temp-geometry-nodes-fields-prototype: support field in point separate node

2021-08-09 Thread Jacques Lucke
Commit: 4eda4fd49ab75eb1c73b83a28393fb3cb2d0c3a0
Author: Jacques Lucke
Date:   Mon Aug 9 09:49:53 2021 +0200
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB4eda4fd49ab75eb1c73b83a28393fb3cb2d0c3a0

support field in point separate node

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc 
b/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
index fc04d1e275f..64a31454053 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc
@@ -25,7 +25,7 @@
 
 static bNodeSocketTemplate geo_node_point_instance_in[] = {
 {SOCK_GEOMETRY, N_("Geometry")},
-{SOCK_STRING, N_("Mask")},
+{SOCK_BOOLEAN, N_("Mask"), 1, 0, 0, 0, 0, 0, PROP_NONE, SOCK_HIDE_VALUE | 
SOCK_FIELD},
 {-1, ""},
 };
 
@@ -99,17 +99,20 @@ static void create_component_points(GeometryComponent 
&component, const int tota
 
 static void separate_points_from_component(const GeometryComponent 
&in_component,
GeometryComponent &out_component,
-   const StringRef mask_name,
+   const bke::FieldRef 
mask_field,
const bool invert)
 {
   if (!in_component.attribute_domain_supported(ATTR_DOMAIN_POINT) ||
   in_component.attribute_domain_size(ATTR_DOMAIN_POINT) == 0) {
 return;
   }
+  const int tot_in_points = 
in_component.attribute_domain_size(ATTR_DOMAIN_POINT);
 
-  const GVArray_Typed mask_attribute = 
in_component.attribute_get_for_read(
-  mask_name, ATTR_DOMAIN_POINT, false);
-  VArray_Span masks{mask_attribute};
+  bke::FieldInputs field_inputs = mask_field->prepare_inputs();
+  Vector> field_input_values;
+  prepare_field_inputs(field_inputs, in_component, ATTR_DOMAIN_POINT, 
field_input_values);
+  bke::FieldOutput field_output = 
mask_field->evaluate(IndexRange(tot_in_points), field_inputs);
+  GVArray_Span masks{field_output.varray_ref()};
 
   const int total = masks.count(!invert);
   if (total == 0) {
@@ -122,7 +125,7 @@ static void separate_points_from_component(const 
GeometryComponent &in_component
 }
 
 static GeometrySet separate_geometry_set(const GeometrySet &set_in,
- const StringRef mask_name,
+ const bke::FieldRef mask_field,
  const bool invert)
 {
   GeometrySet set_out;
@@ -132,7 +135,7 @@ static GeometrySet separate_geometry_set(const GeometrySet 
&set_in,
   continue;
 }
 GeometryComponent &out_component = 
set_out.get_component_for_write(component->type());
-separate_points_from_component(*component, out_component, mask_name, 
invert);
+separate_points_from_component(*component, out_component, mask_field, 
invert);
   }
   return set_out;
 }
@@ -145,7 +148,7 @@ static void geo_node_point_separate_exec(GeoNodeExecParams 
params)
   if (wait_for_inputs) {
 return;
   }
-  const std::string mask_attribute_name = 
params.get_input("Mask");
+  bke::FieldRef mask_field = params.get_input_field("Mask");
   GeometrySet geometry_set = params.get_input("Geometry");
 
   /* TODO: This is not necessary-- the input geometry set can be read only,
@@ -153,12 +156,10 @@ static void 
geo_node_point_separate_exec(GeoNodeExecParams params)
   geometry_set = geometry_set_realize_instances(geometry_set);
 
   if (params.lazy_output_is_required("Geometry 1")) {
-params.set_output("Geometry 1",
-  separate_geometry_set(geometry_set, mask_attribute_name, 
true));
+params.set_output("Geometry 1", separate_geometry_set(geometry_set, 
mask_field, true));
   }
   if (params.lazy_output_is_required("Geometry 2")) {
-params.set_output("Geometry 2",
-  separate_geometry_set(geometry_set, mask_attribute_name, 
false));
+params.set_output("Geometry 2", separate_geometry_set(geometry_set, 
mask_field, false));
   }
 }

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


[Bf-blender-cvs] [1db53a89236] temp-geometry-nodes-fields-prototype: Merge branch 'master' into temp-geometry-nodes-fields-prototype

2021-08-09 Thread Jacques Lucke
Commit: 1db53a89236e8349462c1fdff2a5f58ac68f7b8b
Author: Jacques Lucke
Date:   Mon Aug 9 09:12:48 2021 +0200
Branches: temp-geometry-nodes-fields-prototype
https://developer.blender.org/rB1db53a89236e8349462c1fdff2a5f58ac68f7b8b

Merge branch 'master' into temp-geometry-nodes-fields-prototype

===



===



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