[Bf-blender-cvs] [1b8d33b18c2] blender-v2.93-release: Blender v2.93.1 release version bump.

2021-06-21 Thread Jeroen Bakker
Commit: 1b8d33b18c2f9b6763c7163418e8e9235428fc59
Author: Jeroen Bakker
Date:   Tue Jun 22 07:57:15 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB1b8d33b18c2f9b6763c7163418e8e9235428fc59

Blender v2.93.1 release version bump.

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 6e8ea10aad0..5d6d82b0871 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -35,7 +35,7 @@ extern "C" {
 /* Blender patch version for bugfix releases. */
 #define BLENDER_VERSION_PATCH 1
 /** Blender release cycle stage: alpha/beta/rc/release. */
-#define BLENDER_VERSION_CYCLE rc
+#define BLENDER_VERSION_CYCLE release
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION

___
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] [aad804bac0b] soc-2021-simulation-display: Cleanup: fixed some issues with collision display and formatted the code No functional changes

2021-06-21 Thread soumya pochiraju
Commit: aad804bac0b02a164d7479a238edea43ee16c7af
Author: soumya pochiraju
Date:   Tue Jun 22 11:13:53 2021 +0530
Branches: soc-2021-simulation-display
https://developer.blender.org/rBaad804bac0b02a164d7479a238edea43ee16c7af

Cleanup: fixed some issues with collision display and formatted the code
No functional changes

===

M   intern/rigidbody/RBI_api.h
M   intern/rigidbody/rb_bullet_api.cpp
M   source/blender/blenkernel/intern/dynamicpaint.c
M   source/blender/blenkernel/intern/effect.c
M   source/blender/blenkernel/intern/fluid.c
M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/rigidbody.c
M   source/blender/blenkernel/intern/softbody.c
M   source/blender/draw/engines/overlay/overlay_extra.c
M   source/blender/draw/engines/overlay/overlay_shader.c
M   
source/blender/draw/engines/overlay/shaders/collision_display_box_vert.glsl
M   
source/blender/draw/engines/overlay/shaders/collision_display_cylinder_vert.glsl
M   source/blender/draw/engines/overlay/shaders/vector_vert.glsl
M   source/blender/makesdna/DNA_rigidbody_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/makesrna/intern/rna_rigidbody.c
M   source/blender/sequencer/intern/render.c

===

diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index cde25ec8991..59500d1a234 100644
--- a/intern/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -22,7 +22,6 @@
  * \brief Rigid Body API for interfacing with external Physics Engines
  */
 
-
 #ifndef __RB_API_H__
 #define __RB_API_H__
 
diff --git a/intern/rigidbody/rb_bullet_api.cpp 
b/intern/rigidbody/rb_bullet_api.cpp
index 62ea7e302a2..d46b18416d3 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -205,7 +205,8 @@ void RB_dworld_set_split_impulse(rbDynamicsWorld *world, 
int split_impulse)
 }
 
 /* Get last applied impulse at contact points */
-/* TODO: this may not be the most efficient way to do it. get all forces at 
once and store in a lookup table. */
+/* TODO: this may not be the most efficient way to do it. get all forces at 
once and store in a
+ * lookup table. */
 void RB_dworld_get_impulse(rbDynamicsWorld *world,
rbRigidBody *rbo,
float timeSubStep,
@@ -215,70 +216,71 @@ void RB_dworld_get_impulse(rbDynamicsWorld *world,
int norm_flag,
int fric_flag)
 {
-int numManifolds = world->dispatcher->getNumManifolds();
-int num_norm_forces = 0;
-int num_fric_forces = 0;
-for (int i = 0; i < numManifolds; i++)
-{
-btPersistentManifold* contactManifold =  
world->dispatcher->getManifoldByIndexInternal(i);
-const void *obA = contactManifold->getBody0();
-const void *obB = contactManifold->getBody1();
-if(num_norm_forces>2)
-  break;
-if(obA != rbo->body && obB != rbo->body)
-{
-  continue;
-}
-else
-{
-  btVector3 tot_impulse = btVector3(0.0,0.0,0.0);
-  btVector3 final_loc =  btVector3(0.0,0.0,0.0);
-  btScalar tot_impulse_magnitude=0.f;
-  btVector3 tot_lat_impulse = btVector3(0.0,0.0,0.0);
-  int numContacts = contactManifold->getNumContacts();
-  int num_impulse_points = 0;
-  for (int j = 0; j < numContacts; j++)
-  {
-  /* Find points where impulse was appplied. */
-  btManifoldPoint& pt = contactManifold->getContactPoint(j);
-  if (pt.getAppliedImpulse() > 0.f)
-num_impulse_points++;
-  }
-
-  for (int j = 0; j < numContacts; j++)
-  {
-btManifoldPoint& pt = contactManifold->getContactPoint(j);
-if (pt.getAppliedImpulse() > 0.f)
-{
- const btVector3& loc = pt.getPositionWorldOnB();
- const btVector3 imp = (rbo->body == obB)? 
-pt.m_normalWorldOnB * pt.getAppliedImpulse()/timeSubStep:pt.m_normalWorldOnB * 
pt.getAppliedImpulse()/timeSubStep;
- tot_impulse_magnitude += pt.getAppliedImpulse();
- tot_impulse += imp;
- final_loc += num_impulse_points>1 ? loc * 
pt.getAppliedImpulse() : loc;
-   if (fric_flag)
-   {
-   const btVector3 lat_imp1 = (rbo->body == obB)? 
-pt.m_appliedImpulseLateral1 * pt.m_lateralFrictionDir1/timeSubStep : 
pt.m_appliedImpulseLateral1 * pt.m_lateralFrictionDir1/timeSubStep;
-   const btVector3 lat_imp2 = (rbo->body == obB)? 
-pt.m_appliedImpulseLateral2 * pt.m_lateralFrictionDir2/timeSubStep : 
pt.m_appliedImpulseLateral2 * pt.m_lateralFrictionDir2/timeSubStep;
-   tot_lat_impulse += lat_imp1 + lat_imp2;
- 

[Bf-blender-cvs] [5cb618f8287] soc-2021-simulation-display: No new features, just some cleanups to collision display code

2021-06-21 Thread soumya pochiraju
Commit: 5cb618f8287d045f2bae342b27d71bfd15c49165
Author: soumya pochiraju
Date:   Mon Jun 21 14:55:57 2021 +0530
Branches: soc-2021-simulation-display
https://developer.blender.org/rB5cb618f8287d045f2bae342b27d71bfd15c49165

No new features, just some cleanups to collision display code

===

M   source/blender/blenkernel/intern/pointcache.c
M   source/blender/blenkernel/intern/rigidbody.c
M   source/blender/draw/engines/overlay/overlay_extra.c
M   
source/blender/draw/engines/overlay/shaders/collision_display_box_vert.glsl
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_rigidbody.c

===

diff --git a/source/blender/blenkernel/intern/pointcache.c 
b/source/blender/blenkernel/intern/pointcache.c
index 6093bebddf3..38fff43cd6a 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -813,6 +813,11 @@ static void ptcache_rigidbody_read(
   if (old_data) {
 memcpy(rbo->pos, data, sizeof(float[3]));
 memcpy(rbo->orn, data + 3, sizeof(float[4]));
+memcpy(rbo->vel, data + 7, sizeof(float[3]));
+memcpy(rbo->eff_forces, data + 10, sizeof(sim_data_vec[3]));
+memcpy(rbo->norm_forces, data + 13, sizeof(sim_data_vec[3]));
+memcpy(rbo->fric_forces, data + 16, sizeof(sim_data_vec[3]));
+memcpy(rbo->vec_locations, data + 19, sizeof(sim_data_vec[3]));
   }
   else {
 PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, 0, rbo->pos);
diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 68e7ae3148e..c94224248bc 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2272,6 +2272,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, 
Scene *scene, float ctime
 float vec_locations[3][3] = {{0.0f}};
 Object *ob = rbw->objects[j];
 if(ob->rigidbody_object != NULL){
+  printf("%s\n", ob->id.name);
   rbRigidBody *rbo = 
(rbRigidBody*)(ob->rigidbody_object->shared->physics_object);
   int norm_flag = (ob->rigidbody_object->display_force_types & 
RB_SIM_NORMAL) ||
   (ob->rigidbody_object->display_force_types & 
RB_SIM_NET_FORCE) ||
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c 
b/source/blender/draw/engines/overlay/overlay_extra.c
index b7ddd98c52c..670ac55d36d 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -1665,9 +1665,6 @@ static void OVERLAY_forces_extra(OVERLAY_Data *data,
 if(!is_zero_v3(rbo->eff_forces[i].vector)){
   OVERLAY_vector_extra(data, rbo->eff_forces[i].vector, rbo->pos, 
scale, min_clamp, color1, text_flag);
 }
-else
-  /* If the force is zero, there won't be any more forces of this 
type applied, so break. */
-  break;
 }
 }
 
@@ -1676,8 +1673,6 @@ static void OVERLAY_forces_extra(OVERLAY_Data *data,
 if(!is_zero_v3(rbo->norm_forces[i].vector)){
   OVERLAY_vector_extra(data, rbo->norm_forces[i].vector, 
rbo->vec_locations[i].vector , scale, min_clamp, color1, text_flag);
 }
-else
-  break;
 }
 }
 if(rbo->display_force_types & RB_SIM_FRICTION) {
@@ -1709,8 +1704,10 @@ static void OVERLAY_forces_extra(OVERLAY_Data *data,
 OVERLAY_vector_extra(data, vel, rbo->pos, scale, min_clamp, color, 
text_flag);
 }
 
-/*static void OVERLAY_acceleration_extra(OVERLAY_Data *data,
- RigidBodyOb *rbo)
+static void OVERLAY_acceleration_extra(OVERLAY_Data *data,
+ RigidBodyOb *rbo,
+ Depsgraph *depsgraph,
+ Scene *scene)
 {
 float scale = 0.5f;
 float min_clamp = 2.0f;
@@ -1718,11 +1715,19 @@ static void OVERLAY_forces_extra(OVERLAY_Data *data,
 
 int text_flag = rbo->sim_display_options & RB_SIM_TEXT;
 
+/* Calculate timestep. */
+const float ctime = DEG_get_ctime(depsgraph);
+const float frame_diff = ctime - scene->rigidbody_world->ltime;
+const float timestep = 1.0f / (float)FPS * frame_diff * 
scene->rigidbody_world->time_scale;
+
 rbRigidBody *rb = rbo->shared->physics_object;
 float acc[3];
 RB_body_get_linear_velocity(rb, acc);
+sub_v3_v3(acc, rbo->vel);
+RB_body_get_linear_velocity(rb, rbo->vel);
+mul_v3_fl(acc, 1/timestep);
 OVERLAY_vector_extra(data, acc, rbo->pos, scale, min_clamp, color, 
text_flag);
-} */
+}
 #endif
 
  static void OVERLAY_colliding_face_on_box(OVERLAY_Data *data, float point[3], 
float mat[4][4] , float dir[3]) {
@@ -1741,7 +1746,7 @@ static void OVERLAY_forces_extra(OVERLAY_Data *data,
 
/* Triangles that 

[Bf-blender-cvs] [338be95874b] master: Fix bone select failing with end-points outside the view

2021-06-21 Thread Campbell Barton
Commit: 338be95874bddec300a863c9583652cda0ccf5de
Author: Campbell Barton
Date:   Tue Jun 22 14:04:30 2021 +1000
Branches: master
https://developer.blender.org/rB338be95874bddec300a863c9583652cda0ccf5de

Fix bone select failing with end-points outside the view

Apply the same fix for T32214 (edge-select failing) to bones
which also failed when their end-points were outside of the view.

- Add V3D_PROJ_TEST_CLIP_CONTENT support for edit & pose bone iterator
  and use for selection operators.
- Remove unnecessarily complicated checks with pose-mode lasso tagging.
- Correct error in pose-mode LassoSelectUserData.is_changed
  (currently harmless as it's not read back).

===

M   source/blender/editors/space_view3d/view3d_iterators.c
M   source/blender/editors/space_view3d/view3d_select.c

===

diff --git a/source/blender/editors/space_view3d/view3d_iterators.c 
b/source/blender/editors/space_view3d/view3d_iterators.c
index 0eb594fb3dc..5e0101e4160 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -97,6 +97,110 @@ static int content_planes_from_clip_flag(const ARegion 
*region,
   return planes_len;
 }
 
+/**
+ * Edge projection is more involved since part of the edge may be behind the 
view
+ * or extend beyond the far limits. In the case of single points, these can be 
ignored.
+ * However it just may still be visible on screen, so constrained the edge to 
planes
+ * defined by the port to ensure both ends of the edge can be projected, see 
T32214.
+ *
+ * \note This is unrelated to #V3D_PROJ_TEST_CLIP_BB which must be checked 
separately.
+ */
+static bool view3d_project_segment_to_screen_with_content_clip_planes(
+const ARegion *region,
+const float v_a[3],
+const float v_b[3],
+const eV3DProjTest clip_flag,
+const rctf *win_rect,
+const float content_planes[][4],
+const int content_planes_len,
+/* Output. */
+float r_screen_co_a[2],
+float r_screen_co_b[2])
+{
+  /* Clipping already handled, no need to check in projection. */
+  eV3DProjTest clip_flag_nowin = clip_flag & ~V3D_PROJ_TEST_CLIP_WIN;
+
+  const eV3DProjStatus status_a = ED_view3d_project_float_object(
+  region, v_a, r_screen_co_a, clip_flag_nowin);
+  const eV3DProjStatus status_b = ED_view3d_project_float_object(
+  region, v_b, r_screen_co_b, clip_flag_nowin);
+
+  if ((status_a == V3D_PROJ_RET_OK) && (status_b == V3D_PROJ_RET_OK)) {
+if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
+  if (!BLI_rctf_isect_segment(win_rect, r_screen_co_a, r_screen_co_b)) {
+return false;
+  }
+}
+  }
+  else {
+if (content_planes_len == 0) {
+  return false;
+}
+
+/* Both too near, ignore. */
+if ((status_a & V3D_PROJ_TEST_CLIP_NEAR) && (status_b & 
V3D_PROJ_TEST_CLIP_NEAR)) {
+  return false;
+}
+
+/* Both too far, ignore. */
+if ((status_a & V3D_PROJ_TEST_CLIP_FAR) && (status_b & 
V3D_PROJ_TEST_CLIP_FAR)) {
+  return false;
+}
+
+/* Simple cases have been ruled out, clip by viewport planes, then 
re-project. */
+float v_a_clip[3], v_b_clip[3];
+if (!clip_segment_v3_plane_n(
+v_a, v_b, content_planes, content_planes_len, v_a_clip, v_b_clip)) 
{
+  return false;
+}
+
+if ((ED_view3d_project_float_object(region, v_a_clip, r_screen_co_a, 
clip_flag_nowin) !=
+ V3D_PROJ_RET_OK) ||
+(ED_view3d_project_float_object(region, v_b_clip, r_screen_co_b, 
clip_flag_nowin) !=
+ V3D_PROJ_RET_OK)) {
+  return false;
+}
+
+/* No need for #V3D_PROJ_TEST_CLIP_WIN check here,
+ * clipping the segment by planes handle this. */
+  }
+
+  return true;
+}
+
+/**
+ * Project an edge, points that fail to project are tagged with #IS_CLIPPED.
+ */
+static bool view3d_project_segment_to_screen_with_clip_tag(const ARegion 
*region,
+   const float v_a[3],
+   const float v_b[3],
+   const eV3DProjTest 
clip_flag,
+   /* Output. */
+   float 
r_screen_co_a[2],
+   float 
r_screen_co_b[2])
+{
+  int count = 0;
+
+  if (ED_view3d_project_float_object(region, v_a, r_screen_co_a, clip_flag) == 
V3D_PROJ_RET_OK) {
+count++;
+  }
+  else {
+r_screen_co_a[0] = IS_CLIPPED; /* weak */
+/* screen_co_a[1]: intentionally don't set this so we get errors on misuse 
*/
+  }
+
+  if (ED_view3d_project_float_object(region, v_b, r_screen_co_b, clip_flag) == 
V3D_PROJ_RET_OK) {
+count++;
+  }
+  else {
+r_screen_co_b[0] = IS_CLIPPED; /* weak */
+/* 

[Bf-blender-cvs] [9ac56bad4c0] master: Cleanup: use early return for selection callbacks

2021-06-21 Thread Campbell Barton
Commit: 9ac56bad4c08750edfdf5ad8e98e257fb6ed4474
Author: Campbell Barton
Date:   Tue Jun 22 14:04:29 2021 +1000
Branches: master
https://developer.blender.org/rB9ac56bad4c08750edfdf5ad8e98e257fb6ed4474

Cleanup: use early return for selection callbacks

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_select.c 
b/source/blender/editors/space_view3d/view3d_select.c
index f768d7faf63..fcd735d63a2 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -520,43 +520,44 @@ static void do_lasso_select_pose__do_tag(void *userData,
  const float screen_co_b[2])
 {
   LassoSelectUserData *data = userData;
-  bArmature *arm = data->vc->obact->data;
+  const bArmature *arm = data->vc->obact->data;
+  if (!PBONE_SELECTABLE(arm, pchan->bone)) {
+return;
+  }
 
-  if (PBONE_SELECTABLE(arm, pchan->bone)) {
-bool is_point_done = false;
-int points_proj_tot = 0;
-
-/* project head location to screenspace */
-if (screen_co_a[0] != IS_CLIPPED) {
-  points_proj_tot++;
-  if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_a)) &&
-  BLI_lasso_is_point_inside(
-  data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), 
INT_MAX)) {
-is_point_done = true;
-  }
-}
+  bool is_point_done = false;
+  int points_proj_tot = 0;
 
-/* project tail location to screenspace */
-if (screen_co_b[0] != IS_CLIPPED) {
-  points_proj_tot++;
-  if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_b)) &&
-  BLI_lasso_is_point_inside(
-  data->mcoords, data->mcoords_len, UNPACK2(screen_co_b), 
INT_MAX)) {
-is_point_done = true;
-  }
+  /* project head location to screenspace */
+  if (screen_co_a[0] != IS_CLIPPED) {
+points_proj_tot++;
+if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_a)) &&
+BLI_lasso_is_point_inside(
+data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), INT_MAX)) {
+  is_point_done = true;
 }
+  }
 
-/* if one of points selected, we skip the bone itself */
-if ((is_point_done == true) || ((is_point_done == false) && 
(points_proj_tot == 2) &&
-BLI_lasso_is_edge_inside(data->mcoords,
- data->mcoords_len,
- 
UNPACK2(screen_co_a),
- 
UNPACK2(screen_co_b),
- INT_MAX))) {
-  pchan->bone->flag |= BONE_DONE;
+  /* project tail location to screenspace */
+  if (screen_co_b[0] != IS_CLIPPED) {
+points_proj_tot++;
+if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_b)) &&
+BLI_lasso_is_point_inside(
+data->mcoords, data->mcoords_len, UNPACK2(screen_co_b), INT_MAX)) {
+  is_point_done = true;
 }
-data->is_changed |= is_point_done;
   }
+
+  /* if one of points selected, we skip the bone itself */
+  if ((is_point_done == true) || ((is_point_done == false) && (points_proj_tot 
== 2) &&
+  BLI_lasso_is_edge_inside(data->mcoords,
+   data->mcoords_len,
+   
UNPACK2(screen_co_a),
+   
UNPACK2(screen_co_b),
+   INT_MAX))) {
+pchan->bone->flag |= BONE_DONE;
+  }
+  data->is_changed |= is_point_done;
 }
 static void do_lasso_tag_pose(ViewContext *vc,
   Object *ob,
@@ -1027,46 +1028,48 @@ static void do_lasso_select_armature__doSelectBone(void 
*userData,
const float screen_co_b[2])
 {
   LassoSelectUserData *data = userData;
-  bArmature *arm = data->vc->obedit->data;
-  if (EBONE_VISIBLE(arm, ebone)) {
-int is_ignore_flag = 0;
-int is_inside_flag = 0;
-
-if (screen_co_a[0] != IS_CLIPPED) {
-  if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_a)) &&
-  BLI_lasso_is_point_inside(
-  data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), 
INT_MAX)) {
-is_inside_flag |= BONESEL_ROOT;
-  }
-}
-else {
-  is_ignore_flag |= BONESEL_ROOT;
-}
+  const bArmature *arm = data->vc->obedit->data;
+  if (!EBONE_VISIBLE(arm, ebone)) {
+return;
+  }
 
-if (screen_co_b[0] != IS_CLIPPED) {
-  if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_b)) &&
-  BLI_lasso_is_point_inside(
-  data->mcoords, data->mcoords_len, UNPACK2(screen_co_b), 
INT_MAX)) {
- 

[Bf-blender-cvs] [67ee87a6e9e] master: Cleanup: spelling

2021-06-21 Thread Campbell Barton
Commit: 67ee87a6e9e5b42d2d9c1f25b1acf2cf7a573118
Author: Campbell Barton
Date:   Tue Jun 22 14:04:08 2021 +1000
Branches: master
https://developer.blender.org/rB67ee87a6e9e5b42d2d9c1f25b1acf2cf7a573118

Cleanup: spelling

===

M   intern/ghost/intern/GHOST_SystemWin32.cpp
M   intern/ghost/intern/GHOST_SystemX11.cpp
M   intern/ghost/intern/GHOST_WindowWin32.h
M   intern/ghost/intern/GHOST_Wintab.cpp
M   intern/ghost/intern/GHOST_Wintab.h
M   source/blender/editors/object/object_add.c
M   source/blender/editors/space_spreadsheet/spreadsheet_data_source.hh

===

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 09cfa30eca5..aa8dad44799 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -870,7 +870,7 @@ GHOST_EventButton 
*GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
 
   /* Move mouse to button event position. */
   if (window->getTabletData().Active != GHOST_kTabletModeNone) {
-/* Tablet should be handling inbetween mouse moves, only move to event 
position. */
+/* Tablet should be handling in between mouse moves, only move to event 
position. */
 DWORD msgPos = ::GetMessagePos();
 int msgPosX = GET_X_LPARAM(msgPos);
 int msgPosY = GET_Y_LPARAM(msgPos);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp 
b/intern/ghost/intern/GHOST_SystemX11.cpp
index df7e8ba59df..34b44fde48a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -2563,7 +2563,7 @@ static bool is_filler_char(char c)
   return isspace(c) || c == '_' || c == '-' || c == ';' || c == ':';
 }
 
-/* These C functions are copied from Wine 3.12's wintab.c */
+/* These C functions are copied from Wine 3.12's `wintab.c` */
 static bool match_token(const char *haystack, const char *needle)
 {
   const char *h, *n;
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h 
b/intern/ghost/intern/GHOST_WindowWin32.h
index 3c1f32476de..f28ba266ed1 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -273,7 +273,7 @@ class GHOST_WindowWin32 : public GHOST_Window {
   /**
* Loads Wintab context for the window.
* \param enable: True if Wintab should be enabled after loading. Wintab 
should not be enabled if
-   * the window is minimzed.
+   * the window is minimized.
*/
   void loadWintab(bool enable);
 
diff --git a/intern/ghost/intern/GHOST_Wintab.cpp 
b/intern/ghost/intern/GHOST_Wintab.cpp
index 47ef484145b..cf0309b1521 100644
--- a/intern/ghost/intern/GHOST_Wintab.cpp
+++ b/intern/ghost/intern/GHOST_Wintab.cpp
@@ -152,7 +152,7 @@ void GHOST_Wintab::modifyContext(LOGCONTEXT )
   lc.lcOptions |= CXO_CSRMESSAGES | CXO_MESSAGES;
 
   /* Tablet scaling is handled manually because some drivers don't handle 
HIDPI or multi-display
-   * correctly; reset tablet scale factors to unscaled tablet coodinates. */
+   * correctly; reset tablet scale factors to un-scaled tablet coordinates. */
   lc.lcOutOrgX = lc.lcInOrgX;
   lc.lcOutOrgY = lc.lcInOrgY;
   lc.lcOutExtX = lc.lcInExtX;
diff --git a/intern/ghost/intern/GHOST_Wintab.h 
b/intern/ghost/intern/GHOST_Wintab.h
index 7193049362d..75017aa67d9 100644
--- a/intern/ghost/intern/GHOST_Wintab.h
+++ b/intern/ghost/intern/GHOST_Wintab.h
@@ -106,7 +106,7 @@ class GHOST_Wintab {
* \param x_in: The tablet x coordinate.
* \param y_in: The tablet y coordinate.
* \param x_out: Output for the Win32 mapped x coordinate.
-   * \param y_out: Output for the Win32 mapped y coordiante.
+   * \param y_out: Output for the Win32 mapped y coordinate.
*/
   void mapWintabToSysCoordinates(int x_in, int y_in, int _out, int _out);
 
@@ -140,7 +140,7 @@ class GHOST_Wintab {
   bool trustCoordinates();
 
   /**
-   * Tests whether Wintab coordinates can be trusted by comparing Win32 and 
Wintab reported curser
+   * Tests whether Wintab coordinates can be trusted by comparing Win32 and 
Wintab reported cursor
* position.
* \param sysX: System cursor x position.
* \param sysY: System cursor y position.
@@ -148,7 +148,7 @@ class GHOST_Wintab {
* \param wtY: Wintab cursor y position.
* \return True if Win32 and Wintab cursor positions match within tolerance.
*
-   * Note: Only test coordiantes on button press, not release. This prevents 
issues when async
+   * Note: Only test coordinates on button press, not release. This prevents 
issues when async
* mismatch causes mouse movement to replay and snap back, which is only an 
issue while drawing.
*/
   bool testCoordinates(int sysX, int sysY, int wtX, int wtY);
@@ -160,7 +160,7 @@ class GHOST_Wintab {
   GHOST_TabletData getLastTabletData();
 
  private:
-  /** Wintab dll handle. */
+  /** Wintab DLL handle. */
   unique_hmodule m_handle;
   /** 

[Bf-blender-cvs] [53e1442ac21] master: Cleanup: comment use C comment-blocks for GHOST_Types.h

2021-06-21 Thread Campbell Barton
Commit: 53e1442ac21142e185f8c601d61faad49974b27f
Author: Campbell Barton
Date:   Tue Jun 22 14:04:07 2021 +1000
Branches: master
https://developer.blender.org/rB53e1442ac21142e185f8c601d61faad49974b27f

Cleanup: comment use C comment-blocks for GHOST_Types.h

Also use full sentences, and correct typos.

===

M   intern/ghost/GHOST_Types.h

===

diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index f18e6f03ede..7efbd00c2eb 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -105,8 +105,8 @@ typedef enum {
 
 typedef enum {
   GHOST_kTabletAutomatic = 0,
-  /* Show as Windows Ink to users to match "Use Windows Ink" in tablet 
utilities, but we use the
- dependent Windows Pointer API. */
+  /* Show as Windows Ink to users to match "Use Windows Ink" in tablet 
utilities,
+   * but we use the dependent Windows Pointer API. */
   GHOST_kTabletWinPointer,
   GHOST_kTabletWintab,
 } GHOST_TTabletAPI;
@@ -170,7 +170,7 @@ typedef enum {
   GHOST_kButtonMaskRight,
   GHOST_kButtonMaskButton4,
   GHOST_kButtonMaskButton5,
-  /* Trackballs and programmable buttons */
+  /* Trackballs and programmable buttons. */
   GHOST_kButtonMaskButton6,
   GHOST_kButtonMaskButton7,
   GHOST_kButtonNumMasks
@@ -179,15 +179,15 @@ typedef enum {
 typedef enum {
   GHOST_kEventUnknown = 0,
 
-  GHOST_kEventCursorMove,  /// Mouse move event
-  GHOST_kEventButtonDown,  /// Mouse button event
-  GHOST_kEventButtonUp,/// Mouse button event
-  GHOST_kEventWheel,   /// Mouse wheel event
-  GHOST_kEventTrackpad,/// Trackpad event
+  GHOST_kEventCursorMove, /* Mouse move event. */
+  GHOST_kEventButtonDown, /* Mouse button event. */
+  GHOST_kEventButtonUp,   /* Mouse button event. */
+  GHOST_kEventWheel,  /* Mouse wheel event. */
+  GHOST_kEventTrackpad,   /* Trackpad event. */
 
 #ifdef WITH_INPUT_NDOF
-  GHOST_kEventNDOFMotion,  /// N degree of freedom device motion event
-  GHOST_kEventNDOFButton,  /// N degree of freedom device button event
+  GHOST_kEventNDOFMotion, /* N degree of freedom device motion event. */
+  GHOST_kEventNDOFButton, /* N degree of freedom device button event. */
 #endif
 
   GHOST_kEventKeyDown,
@@ -209,8 +209,8 @@ typedef enum {
   GHOST_kEventDraggingExited,
   GHOST_kEventDraggingDropDone,
 
-  GHOST_kEventOpenMainFile,  // Needed for Cocoa to open double-clicked .blend 
file at startup
-  GHOST_kEventNativeResolutionChange,  // Needed for Cocoa when window moves 
to other display
+  GHOST_kEventOpenMainFile, /* Needed for Cocoa to open double-clicked .blend 
file at startup. */
+  GHOST_kEventNativeResolutionChange, /* Needed for Cocoa when window moves to 
other display. */
 
   GHOST_kEventTimer,
 
@@ -283,7 +283,7 @@ typedef enum {
   GHOST_kKeyPeriod = '.',
   GHOST_kKeySlash = '/',
 
-  // Number keys
+  /* Number keys. */
   GHOST_kKey0 = '0',
   GHOST_kKey1,
   GHOST_kKey2,
@@ -298,7 +298,7 @@ typedef enum {
   GHOST_kKeySemicolon = ';',
   GHOST_kKeyEqual = '=',
 
-  // Character keys
+  /* Character keys. */
   GHOST_kKeyA = 'A',
   GHOST_kKeyB,
   GHOST_kKeyC,
@@ -337,9 +337,9 @@ typedef enum {
   GHOST_kKeyRightControl,
   GHOST_kKeyLeftAlt,
   GHOST_kKeyRightAlt,
-  GHOST_kKeyOS,  // Command key on Apple, Windows key(s) on Windows
-  GHOST_kKeyGrLess,  // German PC only!
-  GHOST_kKeyApp, /* Also known as menu key. */
+  GHOST_kKeyOS, /* Command key on Apple, Windows key(s) on Windows. */
+  GHOST_kKeyGrLess, /* German PC only! */
+  GHOST_kKeyApp,/* Also known as menu key. */
 
   GHOST_kKeyCapsLock,
   GHOST_kKeyNumLock,
@@ -360,7 +360,7 @@ typedef enum {
   GHOST_kKeyUpPage,
   GHOST_kKeyDownPage,
 
-  // Numpad keys
+  /* Numpad keys. */
   GHOST_kKeyNumpad0,
   GHOST_kKeyNumpad1,
   GHOST_kKeyNumpad2,
@@ -378,7 +378,7 @@ typedef enum {
   GHOST_kKeyNumpadAsterisk,
   GHOST_kKeyNumpadSlash,
 
-  // Function keys
+  /* Function keys. */
   GHOST_kKeyF1,
   GHOST_kKeyF2,
   GHOST_kKeyF3,
@@ -404,7 +404,7 @@ typedef enum {
   GHOST_kKeyF23,
   GHOST_kKeyF24,
 
-  // Multimedia keypad buttons
+  /* Multimedia keypad buttons. */
   GHOST_kKeyMediaPlay,
   GHOST_kKeyMediaStop,
   GHOST_kKeyMediaFirst,
@@ -481,9 +481,9 @@ typedef struct {
 
 typedef enum {
   GHOST_kDragnDropTypeUnknown = 0,
-  GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names 
(full path) */
-  GHOST_kDragnDropTypeString,/* Unformatted text UTF-8 string */
-  GHOST_kDragnDropTypeBitmap /*Bitmap image data */
+  GHOST_kDragnDropTypeFilenames, /* Array of strings representing file names 
(full path). */
+  GHOST_kDragnDropTypeString,/* Unformatted text UTF-8 string. */
+  GHOST_kDragnDropTypeBitmap /* Bitmap image data. */
 } GHOST_TDragnDropTypes;
 
 typedef struct {
@@ -529,18 +529,23 @@ typedef enum {
 #ifdef WITH_INPUT_NDOF
 typedef struct {
   /** N-degree of freedom device data v3 

[Bf-blender-cvs] [e1d6219731f] master: Cleanup: Use "size" instead of "points_len" in spline code

2021-06-21 Thread Hans Goudey
Commit: e1d6219731fc38c40f3dc55224e8ab6cfb217dd2
Author: Hans Goudey
Date:   Mon Jun 21 23:07:26 2021 -0500
Branches: master
https://developer.blender.org/rBe1d6219731fc38c40f3dc55224e8ab6cfb217dd2

Cleanup: Use "size" instead of "points_len" in spline code

Previously this was mostly consistent, but not completely. It's helpful
to use the same name for the same meaning everywhere in this area.

===

M   source/blender/blenkernel/intern/spline_base.cc
M   source/blender/blenkernel/intern/spline_bezier.cc
M   source/blender/blenkernel/intern/spline_nurbs.cc

===

diff --git a/source/blender/blenkernel/intern/spline_base.cc 
b/source/blender/blenkernel/intern/spline_base.cc
index b3514f23784..c18f44e07b2 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -74,9 +74,9 @@ float Spline::length() const
 
 int Spline::segments_size() const
 {
-  const int points_len = this->size();
+  const int size = this->size();
 
-  return is_cyclic_ ? points_len : points_len - 1;
+  return is_cyclic_ ? size : size - 1;
 }
 
 bool Spline::is_cyclic() const
@@ -411,23 +411,23 @@ Array Spline::sample_uniform_index_factors(const 
int samples_size) const
 
 Spline::LookupResult Spline::lookup_data_from_index_factor(const float 
index_factor) const
 {
-  const int points_len = this->evaluated_points_size();
+  const int eval_size = this->evaluated_points_size();
 
   if (is_cyclic_) {
-if (index_factor < points_len) {
+if (index_factor < eval_size) {
   const int index = std::floor(index_factor);
-  const int next_index = (index < points_len - 1) ? index + 1 : 0;
+  const int next_index = (index < eval_size - 1) ? index + 1 : 0;
   return LookupResult{index, next_index, index_factor - index};
 }
-return LookupResult{points_len - 1, 0, 1.0f};
+return LookupResult{eval_size - 1, 0, 1.0f};
   }
 
-  if (index_factor < points_len - 1) {
+  if (index_factor < eval_size - 1) {
 const int index = std::floor(index_factor);
 const int next_index = index + 1;
 return LookupResult{index, next_index, index_factor - index};
   }
-  return LookupResult{points_len - 2, points_len - 1, 1.0f};
+  return LookupResult{eval_size - 2, eval_size - 1, 1.0f};
 }
 
 void Spline::bounds_min_max(float3 , float3 , const bool 
use_evaluated) const
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc 
b/source/blender/blenkernel/intern/spline_bezier.cc
index e4f26eaf466..daae03167ef 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -392,13 +392,13 @@ Span BezierSpline::control_point_offsets() const
 return offset_cache_;
   }
 
-  const int points_len = this->size();
-  offset_cache_.resize(points_len + 1);
+  const int size = this->size();
+  offset_cache_.resize(size + 1);
 
   MutableSpan offsets = offset_cache_;
 
   int offset = 0;
-  for (const int i : IndexRange(points_len)) {
+  for (const int i : IndexRange(size)) {
 offsets[i] = offset;
 offset += this->segment_is_vector(i) ? 1 : resolution_;
   }
@@ -527,23 +527,23 @@ Span BezierSpline::evaluated_positions() const
 BezierSpline::InterpolationData 
BezierSpline::interpolation_data_from_index_factor(
 const float index_factor) const
 {
-  const int points_len = this->size();
+  const int size = this->size();
 
   if (is_cyclic_) {
-if (index_factor < points_len) {
+if (index_factor < size) {
   const int index = std::floor(index_factor);
-  const int next_index = (index < points_len - 1) ? index + 1 : 0;
+  const int next_index = (index < size - 1) ? index + 1 : 0;
   return InterpolationData{index, next_index, index_factor - index};
 }
-return InterpolationData{points_len - 1, 0, 1.0f};
+return InterpolationData{size - 1, 0, 1.0f};
   }
 
-  if (index_factor < points_len - 1) {
+  if (index_factor < size - 1) {
 const int index = std::floor(index_factor);
 const int next_index = index + 1;
 return InterpolationData{index, next_index, index_factor - index};
   }
-  return InterpolationData{points_len - 2, points_len - 1, 1.0f};
+  return InterpolationData{size - 2, size - 1, 1.0f};
 }
 
 /* Use a spline argument to avoid adding this to the header. */
diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc 
b/source/blender/blenkernel/intern/spline_nurbs.cc
index 90aadb319b7..31ac23589be 100644
--- a/source/blender/blenkernel/intern/spline_nurbs.cc
+++ b/source/blender/blenkernel/intern/spline_nurbs.cc
@@ -271,18 +271,18 @@ Span NURBSpline::knots() const
 }
 
 static void calculate_basis_for_point(const float parameter,
-  const int points_len,
+  const int size,
   const int order,
   

[Bf-blender-cvs] [dc3b7602eeb] master: Cleanup: Rename variables, use shorter names

2021-06-21 Thread Hans Goudey
Commit: dc3b7602eeb08df788c6dcd1dee6860d58a5010d
Author: Hans Goudey
Date:   Mon Jun 21 23:02:00 2021 -0500
Branches: master
https://developer.blender.org/rBdc3b7602eeb08df788c6dcd1dee6860d58a5010d

Cleanup: Rename variables, use shorter names

`src` and `dst` are perfectly clear, and avoid repeating unecessary
characters when writing the variables many times, allowing more space
for everything else.

===

M   source/blender/blenkernel/BKE_spline.hh
M   source/blender/blenkernel/intern/spline_bezier.cc
M   source/blender/blenkernel/intern/spline_nurbs.cc
M   source/blender/blenkernel/intern/spline_poly.cc
M   source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc

===

diff --git a/source/blender/blenkernel/BKE_spline.hh 
b/source/blender/blenkernel/BKE_spline.hh
index b5d06da4651..38a6d41a4d3 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -196,7 +196,7 @@ class Spline {
* exceed the lifetime of the input data.
*/
   virtual blender::fn::GVArrayPtr interpolate_to_evaluated(
-  const blender::fn::GVArray _data) const = 0;
+  const blender::fn::GVArray ) const = 0;
   blender::fn::GVArrayPtr interpolate_to_evaluated(blender::fn::GSpan data) 
const;
   template
   blender::fn::GVArray_Typed interpolate_to_evaluated(blender::Span 
data) const
@@ -332,8 +332,7 @@ class BezierSpline final : public Spline {
   };
   InterpolationData interpolation_data_from_index_factor(const float 
index_factor) const;
 
-  virtual blender::fn::GVArrayPtr interpolate_to_evaluated(
-  const blender::fn::GVArray _data) const override;
+  virtual blender::fn::GVArrayPtr interpolate_to_evaluated(const 
blender::fn::GVArray ) const;
 
   void evaluate_segment(const int index,
 const int next_index,
@@ -455,13 +454,12 @@ class NURBSpline final : public Spline {
 
   blender::Span evaluated_positions() const final;
 
-  blender::fn::GVArrayPtr interpolate_to_evaluated(
-  const blender::fn::GVArray _data) const final;
+  blender::fn::GVArrayPtr interpolate_to_evaluated(const blender::fn::GVArray 
) const final;
 
  protected:
   void correct_end_tangents() const final;
   void calculate_knots() const;
-  void calculate_basis_cache() const;
+  blender::Span calculate_basis_cache() const;
 };
 
 /**
@@ -505,8 +503,7 @@ class PolySpline final : public Spline {
 
   blender::Span evaluated_positions() const final;
 
-  blender::fn::GVArrayPtr interpolate_to_evaluated(
-  const blender::fn::GVArray _data) const final;
+  blender::fn::GVArrayPtr interpolate_to_evaluated(const blender::fn::GVArray 
) const final;
 
  protected:
   void correct_end_tangents() const final;
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc 
b/source/blender/blenkernel/intern/spline_bezier.cc
index 2aacc5cf720..e4f26eaf466 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -25,6 +25,9 @@ using blender::float3;
 using blender::IndexRange;
 using blender::MutableSpan;
 using blender::Span;
+using blender::fn::GVArray;
+using blender::fn::GVArray_For_ArrayContainer;
+using blender::fn::GVArrayPtr;
 
 SplinePtr BezierSpline::copy() const
 {
@@ -546,44 +549,44 @@ BezierSpline::InterpolationData 
BezierSpline::interpolation_data_from_index_fact
 /* Use a spline argument to avoid adding this to the header. */
 template
 static void interpolate_to_evaluated_impl(const BezierSpline ,
-  const blender::VArray 
_data,
-  MutableSpan result_data)
+  const blender::VArray ,
+  MutableSpan dst)
 {
+  BLI_assert(src.size() == spline.size());
+  BLI_assert(dst.size() == spline.evaluated_points_size());
   Span mappings = spline.evaluated_mappings();
 
-  for (const int i : result_data.index_range()) {
+  for (const int i : dst.index_range()) {
 BezierSpline::InterpolationData interp = 
spline.interpolation_data_from_index_factor(
 mappings[i]);
 
-const T  = source_data[interp.control_point_index];
-const T _value = source_data[interp.next_control_point_index];
+const T  = src[interp.control_point_index];
+const T _value = src[interp.next_control_point_index];
 
-result_data[i] = blender::attribute_math::mix2(interp.factor, value, 
next_value);
+dst[i] = blender::attribute_math::mix2(interp.factor, value, next_value);
   }
 }
 
-blender::fn::GVArrayPtr BezierSpline::interpolate_to_evaluated(
-const blender::fn::GVArray _data) const
+GVArrayPtr BezierSpline::interpolate_to_evaluated(const GVArray ) const
 {
-  BLI_assert(source_data.size() == this->size());
+  BLI_assert(src.size() == this->size());
 
-  if (source_data.is_single()) {
-

[Bf-blender-cvs] [4b7eae5cd3f] temp-attribute-processor: Merge branch 'master' into temp-attribute-processor

2021-06-21 Thread Jacques Lucke
Commit: 4b7eae5cd3f01fceca7150e9837347d1e5a66ca2
Author: Jacques Lucke
Date:   Wed Jun 16 15:16:04 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rB4b7eae5cd3f01fceca7150e9837347d1e5a66ca2

Merge branch 'master' into temp-attribute-processor

===



===

diff --cc source/blender/blenkernel/BKE_node.h
index a67e7f43b6a,5c9d7881093..822bed89e33
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -1436,7 -1436,7 +1436,8 @@@ int ntreeTexExecTree(struct bNodeTree *
  #define GEO_NODE_CONVEX_HULL 1056
  #define GEO_NODE_CURVE_TO_POINTS 1057
  #define GEO_NODE_CURVE_REVERSE 1058
- #define GEO_NODE_ATTRIBUTE_PROCESSOR 1059
+ #define GEO_NODE_SEPARATE_COMPONENTS 1059
++#define GEO_NODE_ATTRIBUTE_PROCESSOR 1060
  
  /** \} */

___
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] [1172c0ae446] temp-attribute-processor: Merge branch 'master' into temp-attribute-processor

2021-06-21 Thread Jacques Lucke
Commit: 1172c0ae4463ee3e1926d7d8d8037294e37f649b
Author: Jacques Lucke
Date:   Tue Jun 15 15:22:10 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rB1172c0ae4463ee3e1926d7d8d8037294e37f649b

Merge branch 'master' into temp-attribute-processor

===



===

diff --cc source/blender/blenkernel/BKE_node.h
index 784760ac03e,dbb0786af9d..a67e7f43b6a
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -1434,7 -1434,8 +1434,9 @@@ int ntreeTexExecTree(struct bNodeTree *
  #define GEO_NODE_CURVE_LENGTH 1054
  #define GEO_NODE_SELECT_BY_MATERIAL 1055
  #define GEO_NODE_CONVEX_HULL 1056
- #define GEO_NODE_ATTRIBUTE_PROCESSOR 1057
+ #define GEO_NODE_CURVE_TO_POINTS 1057
+ #define GEO_NODE_CURVE_REVERSE 1058
++#define GEO_NODE_ATTRIBUTE_PROCESSOR 1059
  
  /** \} */
  
diff --cc source/blender/nodes/CMakeLists.txt
index db50e137bdf,9d7c50c99cd..6c4fd527555
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@@ -170,9 -163,11 +170,11 @@@ set(SR
geometry/nodes/node_geo_collection_info.cc
geometry/nodes/node_geo_common.cc
geometry/nodes/node_geo_convex_hull.cc
 -  geometry/nodes/node_geo_curve_length.cc  
 +  geometry/nodes/node_geo_curve_length.cc
geometry/nodes/node_geo_curve_to_mesh.cc
+   geometry/nodes/node_geo_curve_to_points.cc
geometry/nodes/node_geo_curve_resample.cc
+   geometry/nodes/node_geo_curve_reverse.cc
geometry/nodes/node_geo_delete_geometry.cc
geometry/nodes/node_geo_edge_split.cc
geometry/nodes/node_geo_input_material.cc
diff --cc source/blender/nodes/NOD_derived_node_tree.hh
index 4488d5ea5a6,de9e4c8c812..2dda36b40ad
--- a/source/blender/nodes/NOD_derived_node_tree.hh
+++ b/source/blender/nodes/NOD_derived_node_tree.hh
@@@ -173,8 -176,8 +176,9 @@@ class DerivedNodeTree 
Span used_node_tree_refs() const;
  
bool has_link_cycles() const;
+   bool has_undefined_nodes_or_sockets() const;
void foreach_node(FunctionRef callback) const;
 +  void foreach_node_with_type(StringRef idname, FunctionRef 
callback) const;
  
std::string to_dot() const;

___
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] [7f17d15125a] temp-attribute-processor: fix bugs

2021-06-21 Thread Jacques Lucke
Commit: 7f17d15125a8ce5147c2e80cb891a94bb6d42111
Author: Jacques Lucke
Date:   Thu Jun 10 14:56:30 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rB7f17d15125a8ce5147c2e80cb891a94bb6d42111

fix bugs

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc 
b/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
index d8b18aa393e..f3f5763b315 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
@@ -70,7 +70,7 @@ static void geo_node_attribute_processor_layout(uiLayout 
*layout, bContext *C, P
   {
 uiLayout *col = uiLayoutColumn(layout, false);
 
-bNodeSocket *interface_socket = (bNodeSocket *)group->inputs.first;
+bNodeSocket *interface_socket = (bNodeSocket *)group->outputs.first;
 AttributeProcessorOutputSettings *output_settings = 
(AttributeProcessorOutputSettings *)
 
storage->outputs_settings.first;
 for (; interface_socket && output_settings;
@@ -261,7 +261,7 @@ static void 
geo_node_attribute_processor_group_update(bNodeTree *ntree, bNode *n
   output_settings = (AttributeProcessorOutputSettings *)MEM_callocN(
   sizeof(AttributeProcessorOutputSettings), __func__);
   output_settings->identifier = BLI_strdup(interface_sock->identifier);
-  if (interface_sock->default_attribute_name[0] != '\0') {
+  if (!StringRef(interface_sock->default_attribute_name).is_empty()) {
 output_settings->output_mode = 
GEO_NODE_ATTRIBUTE_PROCESSOR_OUTPUT_MODE_DEFAULT;
   }
   BLI_addtail(>outputs_settings, output_settings);

___
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] [b33fd7e89ef] temp-attribute-processor: add Position Input/Output and Attribute Input node

2021-06-21 Thread Jacques Lucke
Commit: b33fd7e89ef7e131587dc9febb87e1f29e0328ea
Author: Jacques Lucke
Date:   Thu Jun 10 12:52:45 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rBb33fd7e89ef7e131587dc9febb87e1f29e0328ea

add Position Input/Output and Attribute Input 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_attr_attribute_input.cc
A   source/blender/nodes/geometry/nodes/node_attr_position_input.cc
A   source/blender/nodes/geometry/nodes/node_attr_position_output.cc
M   source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index ba8f3dfaca8..cbb915b8ae8 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -614,13 +614,15 @@ attribute_node_categories = [
 AttributeNodeCategory("ATTR_INPUT", "Input", items=[
 NodeItem("FunctionNodeRandomFloat"),
 NodeItem("ShaderNodeValue"),
-NodeItem("ShaderNodeAttribute"),
 NodeItem("FunctionNodeInputString"),
 NodeItem("FunctionNodeInputVector"),
 NodeItem("AttributeNodeIndex"),
+NodeItem("AttributeNodeAttributeInput"),
+NodeItem("AttributeNodePositionInput"),
 ]),
 AttributeNodeCategory("ATTR_OUTPUT", "Output", items=[
 NodeItem("AttributeNodeSetAttribute"),
+NodeItem("AttributeNodePositionOutput"),
 ]),
 AttributeNodeCategory("ATTR_UTILITIES", "Utilities", items=[
 NodeItem("ShaderNodeMapRange"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 71f25120e69..784760ac03e 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1456,6 +1456,9 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 
 #define ATTR_NODE_INDEX 1400
 #define ATTR_NODE_SET_ATTRIBUTE 1401
+#define ATTR_NODE_POSITION_INPUT 1402
+#define ATTR_NODE_POSITION_OUTPUT 1403
+#define ATTR_NODE_ATTRIBUTE_INPUT 1404
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 338be7c3560..397029ac9ec 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5129,8 +5129,11 @@ static void registerGeometryNodes()
 
   register_node_type_attr_group();
 
+  register_node_type_attr_attribute_input();
   register_node_type_attr_index();
   register_node_type_attr_set_attribute();
+  register_node_type_attr_position_input();
+  register_node_type_attr_position_output();
 }
 
 static void registerFunctionNodes()
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 59fada43bdd..6ffdad13a60 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1403,10 +1403,18 @@ typedef struct NodeGeometryAttributeProcessor {
 
 typedef struct NodeAttributeSetAttribute {
   char attribute_name[64];
+  /* eNodeSocketDatatype */
   uint8_t type;
   char _pad[7];
 } NodeAttributeSetAttribute;
 
+typedef struct NodeAttributeAttributeInput {
+  char attribute_name[64];
+  /* eNodeSocketDatatype */
+  uint8_t type;
+  char _pad[7];
+} NodeAttributeAttributeInput;
+
 /* 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 1186bcce3e2..e08885f9b18 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -10104,6 +10104,23 @@ static void def_attr_set_attribute(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 }
 
+static void def_attr_attribute_input(StructRNA *srna)
+{
+  PropertyRNA *prop;
+
+  RNA_def_struct_sdna_from(srna, "NodeAttributeAttributeInput", "storage");
+
+  prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
+  RNA_def_property_ui_text(prop, "Attribute Name", "");
+  RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_items(prop, node_socket_data_type_items);
+  RNA_def_property_enum_funcs(prop, NULL, NULL, 
"rna_AttributeNodeSetAttribute_type_itemf");
+  RNA_def_property_ui_text(prop, "Type", "");
+  RNA_def_property_update(prop, NC_NODE | 

[Bf-blender-cvs] [10b78013eb3] temp-attribute-processor: support default mode again and have separate default attribute name

2021-06-21 Thread Jacques Lucke
Commit: 10b78013eb318af046daafe5a55f9576fe13b951
Author: Jacques Lucke
Date:   Thu Jun 10 12:07:37 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rB10b78013eb318af046daafe5a55f9576fe13b951

support default mode again and have separate default attribute name

===

M   source/blender/blenkernel/intern/node.cc
M   source/blender/editors/space_node/node_buttons.c
M   source/blender/editors/space_node/node_group.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 3d146497a9c..338be7c3560 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -480,6 +480,7 @@ static void write_node_socket_interface(BlendWriter 
*writer, bNodeSocket *sock)
   }
 
   write_node_socket_default_value(writer, sock);
+  BLO_write_string(writer, sock->default_attribute_name);
 }
 
 /* this is only direct data, tree itself should have been written */
@@ -653,6 +654,7 @@ static void direct_link_node_socket(BlendDataReader 
*reader, bNodeSocket *sock)
   sock->typeinfo = nullptr;
   BLO_read_data_address(reader, >storage);
   BLO_read_data_address(reader, >default_value);
+  BLO_read_data_address(reader, >default_attribute_name);
   sock->total_inputs = 0; /* Clear runtime data set before drawing. */
   sock->cache = nullptr;
 }
@@ -2150,6 +2152,9 @@ static void node_socket_copy(bNodeSocket *sock_dst, const 
bNodeSocket *sock_src,
   socket_id_user_increment(sock_dst);
 }
   }
+  if (sock_src->default_attribute_name) {
+sock_dst->default_attribute_name = (char 
*)MEM_dupallocN(sock_src->default_attribute_name);
+  }
 
   sock_dst->stack_index = 0;
   /* XXX some compositor node (e.g. image, render layers) still store
@@ -3102,6 +3107,9 @@ static void node_socket_interface_free(bNodeTree 
*UNUSED(ntree),
 }
 MEM_freeN(sock->default_value);
   }
+  if (sock->default_attribute_name) {
+MEM_freeN(sock->default_attribute_name);
+  }
 }
 
 static void free_localized_node_groups(bNodeTree *ntree)
diff --git a/source/blender/editors/space_node/node_buttons.c 
b/source/blender/editors/space_node/node_buttons.c
index 336b0c46a81..6ab31373e32 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -165,6 +165,10 @@ static void draw_socket_list(const bContext *C,
 if (socket->typeinfo->interface_draw) {
   socket->typeinfo->interface_draw((bContext *)C, layout, _ptr);
 }
+
+if (ntree->type == NTREE_ATTRIBUTE) {
+  uiItemR(layout, _ptr, "default_attribute_name", 0, "Attribute", 
ICON_NONE);
+}
   }
 }
 
diff --git a/source/blender/editors/space_node/node_group.cc 
b/source/blender/editors/space_node/node_group.cc
index be8a30c8b54..3c87533e86e 100644
--- a/source/blender/editors/space_node/node_group.cc
+++ b/source/blender/editors/space_node/node_group.cc
@@ -1146,7 +1146,7 @@ static int node_group_interface_add_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
 {
-  return WM_operator_props_dialog_popup(C, op, 200);
+  return WM_operator_props_dialog_popup(C, op, 300);
 }
 
 static int node_group_interface_add_exec(bContext *C, wmOperator *op)
@@ -1169,7 +1169,8 @@ static int node_group_interface_add_exec(bContext *C, 
wmOperator *op)
   NODE_SOCKET_TYPES_END;
   BLI_assert(socket_idname != nullptr);
 
-  ntreeAddSocketInterface(ntree, in_out, socket_idname, name);
+  bNodeSocket *sock = ntreeAddSocketInterface(ntree, in_out, socket_idname, 
name);
+  sock->default_attribute_name = RNA_string_get_alloc(op->ptr, 
"attribute_name", nullptr, 0);
 
   if (name != nullptr) {
 MEM_freeN(name);
@@ -1207,8 +1208,11 @@ static const EnumPropertyItem 
*node_group_interface_add_type_items(bContext *C,
 static void node_group_interface_add_ui(bContext *UNUSED(C), wmOperator *op)
 {
   uiLayout *layout = op->layout;
+  uiLayoutSetPropSep(layout, true);
+  uiLayoutSetPropDecorate(layout, false);
   uiLayoutSetActivateInit(layout, true);
   uiItemR(layout, op->ptr, "name", 0, "Name", ICON_NONE);
+  uiItemR(layout, op->ptr, "attribute_name", 0, "Default Attribute", 
ICON_NONE);
   uiItemR(layout, op->ptr, "type", 0, "Type", ICON_NONE);
 }
 
@@ -1233,6 +1237,7 @@ void NODE_OT_group_interface_add(wmOperatorType *ot)
   RNA_def_enum(ot->srna, "in_out", rna_enum_node_socket_in_out_items, SOCK_IN, 
"Socket Side", "");
 
   RNA_def_string(ot->srna, "name", nullptr, MAX_NAME, "Name", "Name of the new 
interface socket");
+  RNA_def_string(ot->srna, "attribute_name", nullptr, MAX_NAME, "Attribute 
Name", 

[Bf-blender-cvs] [3d057de9763] temp-attribute-processor: Merge branch 'master' into temp-attribute-processor

2021-06-21 Thread Jacques Lucke
Commit: 3d057de976359955dbc706ac218ee716c0c1c736
Author: Jacques Lucke
Date:   Thu Jun 10 09:35:41 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rB3d057de976359955dbc706ac218ee716c0c1c736

Merge branch 'master' into temp-attribute-processor

===



===

diff --cc source/blender/blenkernel/BKE_node.h
index 3e05621b8ef,a67d7116874..71f25120e69
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -1433,7 -1433,7 +1433,8 @@@ int ntreeTexExecTree(struct bNodeTree *
  #define GEO_NODE_DELETE_GEOMETRY 1053
  #define GEO_NODE_CURVE_LENGTH 1054
  #define GEO_NODE_SELECT_BY_MATERIAL 1055
- #define GEO_NODE_ATTRIBUTE_PROCESSOR 1056
+ #define GEO_NODE_CONVEX_HULL 1056
++#define GEO_NODE_ATTRIBUTE_PROCESSOR 1057
  
  /** \} */
  
diff --cc source/blender/nodes/CMakeLists.txt
index a5bc588f2a4,025ce79ffc5..e5151cbe6c5
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@@ -166,7 -162,8 +166,8 @@@ set(SR
geometry/nodes/node_geo_bounding_box.cc
geometry/nodes/node_geo_collection_info.cc
geometry/nodes/node_geo_common.cc
+   geometry/nodes/node_geo_convex_hull.cc
 -  geometry/nodes/node_geo_curve_length.cc  
 +  geometry/nodes/node_geo_curve_length.cc
geometry/nodes/node_geo_curve_to_mesh.cc
geometry/nodes/node_geo_curve_resample.cc
geometry/nodes/node_geo_delete_geometry.cc

___
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] [3817b408e0a] temp-attribute-processor: fix crash when creating group

2021-06-21 Thread Jacques Lucke
Commit: 3817b408e0a0e255cf5330646ee47490fb6770d4
Author: Jacques Lucke
Date:   Wed Jun 9 14:01:03 2021 +0200
Branches: temp-attribute-processor
https://developer.blender.org/rB3817b408e0a0e255cf5330646ee47490fb6770d4

fix crash when creating group

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc 
b/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
index abaa85c117f..9095285ca71 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_processor.cc
@@ -590,6 +590,9 @@ static void process_attributes(GeoNodeExecParams 
_params, GeometrySet 
   }
 }
   });
+  if (used_group_outputs.is_empty()) {
+return;
+  }
 
   Vector network_outputs;
   for (const DInputSocket  : used_group_outputs) {

___
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] [d086570c7a3] master: UI: Sequencer: add refresh_all operator to all sequencer view menus

2021-06-21 Thread Aaron Carlisle
Commit: d086570c7a364f90d4d80badad30afb3ac580309
Author: Aaron Carlisle
Date:   Fri Jun 18 16:02:46 2021 -0400
Branches: master
https://developer.blender.org/rBd086570c7a364f90d4d80badad30afb3ac580309

UI: Sequencer: add refresh_all operator to all sequencer view menus

This commit piggybacks on rB3e695a27cdfad560d0b28e742cfa069d098200d6

===

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

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 07d9b0ee1f8..13a8e46e2b8 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -392,6 +392,11 @@ class SEQUENCER_MT_view(Menu):
 layout.menu("SEQUENCER_MT_proxy")
 
 layout.operator_context = 'INVOKE_DEFAULT'
+
+layout.separator()
+layout.operator_context = 'INVOKE_REGION_WIN'
+layout.operator("sequencer.refresh_all", icon='FILE_REFRESH', 
text="Refresh All")
+layout.operator_context = 'INVOKE_DEFAULT'
 
 if is_sequencer_view:
 layout.separator()
@@ -401,12 +406,6 @@ class SEQUENCER_MT_view(Menu):
 layout.menu("SEQUENCER_MT_range")
 
 layout.separator()
-layout.operator_context = 'INVOKE_REGION_WIN'
-layout.operator("sequencer.refresh_all", icon='FILE_REFRESH', 
text="Refresh All")
-
-layout.separator()
-layout.operator_context = 'INVOKE_DEFAULT'
-
 layout.prop(st, "show_locked_time")
 
 layout.separator()

___
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] [4d1d7af43cc] usd-importer-T81257-merge: USDVolumeReader improvements.

2021-06-21 Thread makowalski
Commit: 4d1d7af43ccd44ce80380871d760ce9a4de11d65
Author: makowalski
Date:   Mon Jun 21 22:01:29 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB4d1d7af43ccd44ce80380871d760ce9a4de11d65

USDVolumeReader improvements.

Fixed Volume reference counting error (incorrect
call to id_us_min()).  Fixed error reading fieldName
attribute, which was incorrectly being read as a string
rather than a token.  Avoiding use of auto and unneeded
declararions.  Logically grouping related code.  Now
invoking attribute Get() functions with the given time.

===

M   source/blender/io/usd/intern/usd_reader_volume.cc

===

diff --git a/source/blender/io/usd/intern/usd_reader_volume.cc 
b/source/blender/io/usd/intern/usd_reader_volume.cc
index 175e541927d..b69a6fc751c 100644
--- a/source/blender/io/usd/intern/usd_reader_volume.cc
+++ b/source/blender/io/usd/intern/usd_reader_volume.cc
@@ -52,12 +52,17 @@
 
 #include 
 
+namespace usdtokens {
+
+static const pxr::TfToken density("density", pxr::TfToken::Immortal);
+
+}
+
 namespace blender::io::usd {
 
 void USDVolumeReader::create_object(Main *bmain, const double /* 
motionSampleTime */)
 {
   Volume *volume = (Volume *)BKE_volume_add(bmain, name_.c_str());
-  id_us_min(>id);
 
   object_ = BKE_object_add_only_object(bmain, OB_VOLUME, name_.c_str());
   object_->data = volume;
@@ -69,54 +74,59 @@ void USDVolumeReader::read_object_data(Main *bmain, const 
double motionSampleTim
 return;
   }
 
-  pxr::UsdVolVolume::FieldMap fields = volume_.GetFieldPaths();
+  Volume *volume = static_cast(object_->data);
 
-  std::string filepath;
+  if (!volume) {
+return;
+  }
 
-  Volume *volume = static_cast(object_->data);
+  pxr::UsdVolVolume::FieldMap fields = volume_.GetFieldPaths();
 
-  for (auto it = fields.begin(); it != fields.end(); ++it) {
+  for (pxr::UsdVolVolume::FieldMap::const_iterator it = fields.begin(); it != 
fields.end(); ++it) {
 
 pxr::UsdPrim fieldPrim = prim_.GetStage()->GetPrimAtPath(it->second);
 
-if (fieldPrim.IsA()) {
-  pxr::UsdVolOpenVDBAsset fieldBase(fieldPrim);
+if (!fieldPrim.IsA()) {
+  continue;
+}
 
-  pxr::UsdAttribute filepathAttr = fieldBase.GetFilePathAttr();
-  pxr::UsdAttribute fieldNameAttr = fieldBase.GetFieldNameAttr();
+pxr::UsdVolOpenVDBAsset fieldBase(fieldPrim);
 
-  std::string fieldName = "density";
+pxr::UsdAttribute fieldNameAttr = fieldBase.GetFieldNameAttr();
 
-  if (fieldNameAttr.IsAuthored()) {
-fieldNameAttr.Get(, 0.0);
+if (fieldNameAttr.IsAuthored()) {
+  pxr::TfToken fieldName;
+  fieldNameAttr.Get(, motionSampleTime);
 
-// A Blender volume creates density by default
-if (fieldName != "density") {
-  BKE_volume_grid_add(volume, fieldName.c_str(), VOLUME_GRID_FLOAT);
-}
+  /* A Blender volume creates density by default. */
+  if (fieldName != usdtokens::density) {
+BKE_volume_grid_add(volume, fieldName.GetString().c_str(), 
VOLUME_GRID_FLOAT);
   }
+}
 
-  if (filepathAttr.IsAuthored()) {
+pxr::UsdAttribute filepathAttr = fieldBase.GetFilePathAttr();
 
-pxr::SdfAssetPath fp;
-filepathAttr.Get(, 0.0);
+if (filepathAttr.IsAuthored()) {
+  pxr::SdfAssetPath fp;
+  filepathAttr.Get(, motionSampleTime);
 
-if (filepathAttr.ValueMightBeTimeVarying()) {
-  std::vector filePathTimes;
-  filepathAttr.GetTimeSamples();
+  if (filepathAttr.ValueMightBeTimeVarying()) {
+std::vector filePathTimes;
+filepathAttr.GetTimeSamples();
 
-  int start = (int)filePathTimes.front();
-  int end = (int)filePathTimes.back();
+if (!filePathTimes.empty()) {
+  int start = static_cast(filePathTimes.front());
+  int end = static_cast(filePathTimes.back());
 
-  volume->is_sequence = (char)true;
+  volume->is_sequence = static_cast(true);
   volume->frame_start = start;
   volume->frame_duration = (end - start) + 1;
 }
+  }
 
-filepath = fp.GetResolvedPath();
+  std::string filepath = fp.GetResolvedPath();
 
-strcpy(volume->filepath, filepath.c_str());
-  }
+  strcpy(volume->filepath, filepath.c_str());
 }
   }

___
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] [f93cd1b8eb0] usd-importer-T81257-merge: USD Import: remove variant selection mask.

2021-06-21 Thread makowalski
Commit: f93cd1b8eb034a87434c5d5f62a07a20f0a59c69
Author: makowalski
Date:   Mon Jun 21 19:53:08 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rBf93cd1b8eb034a87434c5d5f62a07a20f0a59c69

USD Import: remove variant selection mask.

Removed logic to process variant selection in
Prim Path Mask, as this code needs to be
extended to handle variants specified in child prims.
This functionality can be added back once it's
fully developed.  Also, now printing warning message
if the Prim Path Mask doesn't specify a valid prim.

===

M   source/blender/io/usd/intern/usd_reader_stage.cc

===

diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc 
b/source/blender/io/usd/intern/usd_reader_stage.cc
index 420d6de970a..b7547b612a0 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.cc
+++ b/source/blender/io/usd/intern/usd_reader_stage.cc
@@ -293,18 +293,13 @@ void USDStageReader::collect_readers(Main *bmain,
   std::string prim_path_mask(params.prim_path_mask);
 
   if (!prim_path_mask.empty()) {
-pxr::SdfPath path = pxr::SdfPath(prim_path_mask);
-pxr::UsdPrim prim = 
stage_->GetPrimAtPath(path.StripAllVariantSelections());
+pxr::UsdPrim prim = stage_->GetPrimAtPath(pxr::SdfPath(prim_path_mask));
 if (prim.IsValid()) {
   root = prim;
-  if (path.ContainsPrimVariantSelection()) {
-// TODO(makowalski): This will not work properly with setting variants 
on child prims
-while (path.ContainsPrimVariantSelection()) {
-  std::pair variantSelection = 
path.GetVariantSelection();
-  
root.GetVariantSet(variantSelection.first).SetVariantSelection(variantSelection.second);
-  path = path.GetParentPath();
-}
-  }
+}
+else {
+  std::cerr << "WARNING: Prim Path Mask " << prim_path_mask
+<< " does not specify a valid prim.\n";
 }
   }

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


[Bf-blender-cvs] [ccb5bd3778b] usd-importer-T81257-merge: Rename USDStageReader prune functions.

2021-06-21 Thread makowalski
Commit: ccb5bd3778b84d6eaf12ad9abb5ca17f4ec9d05e
Author: makowalski
Date:   Mon Jun 21 14:48:05 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rBccb5bd3778b84d6eaf12ad9abb5ca17f4ec9d05e

Rename USDStageReader prune functions.

Renamed USDStageReader prune_by_visibility()
and prune_by_purpose() member functions to
include_by_visibility() and include_by_purpse(),
respectively, to reflect the current semantics.
I.e., both functions are now answering the question,
'should the prim be included in the traversal',
returning true to include and false to exclude.

===

M   source/blender/io/usd/intern/usd_reader_stage.cc
M   source/blender/io/usd/intern/usd_reader_stage.h

===

diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc 
b/source/blender/io/usd/intern/usd_reader_stage.cc
index 7b69a7e8983..420d6de970a 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.cc
+++ b/source/blender/io/usd/intern/usd_reader_stage.cc
@@ -117,7 +117,7 @@ USDPrimReader *USDStageReader::create_reader(const 
pxr::UsdPrim )
  * attribute.  Note that the prim will be trivially included
  * if it has no visibility attribute or if the visibility
  * is inherited. */
-bool USDStageReader::prune_by_visibility(const pxr::UsdGeomImageable 
) const
+bool USDStageReader::include_by_visibility(const pxr::UsdGeomImageable 
) const
 {
   if (!params_.import_visible_only) {
 /* Invisible prims are allowed. */
@@ -147,7 +147,7 @@ bool USDStageReader::prune_by_visibility(const 
pxr::UsdGeomImageable )
  * attribute. E.g., return false (to exclude the prim) if the prim
  * represents guide geometry and the 'Import Guide' option is
  * toggled off. */
-bool USDStageReader::prune_by_purpose(const pxr::UsdGeomImageable ) 
const
+bool USDStageReader::include_by_purpose(const pxr::UsdGeomImageable 
) const
 {
   if (params_.import_guide && params_.import_proxy && params_.import_render) {
 /* The options allow any purpose, so we trivially include the prim. */
@@ -220,11 +220,11 @@ USDPrimReader *USDStageReader::collect_readers(Main 
*bmain, const pxr::UsdPrim &
   if (prim.IsA()) {
 pxr::UsdGeomImageable imageable(prim);
 
-if (!prune_by_purpose(imageable)) {
+if (!include_by_purpose(imageable)) {
   return nullptr;
 }
 
-if (!prune_by_visibility(imageable)) {
+if (!include_by_visibility(imageable)) {
   return nullptr;
 }
   }
diff --git a/source/blender/io/usd/intern/usd_reader_stage.h 
b/source/blender/io/usd/intern/usd_reader_stage.h
index 2be36bec5be..34ca1fe24bc 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.h
+++ b/source/blender/io/usd/intern/usd_reader_stage.h
@@ -92,9 +92,9 @@ class USDStageReader {
  private:
   USDPrimReader *collect_readers(Main *bmain, const pxr::UsdPrim );
 
-  bool prune_by_visibility(const pxr::UsdGeomImageable ) const;
+  bool include_by_visibility(const pxr::UsdGeomImageable ) const;
 
-  bool prune_by_purpose(const pxr::UsdGeomImageable ) const;
+  bool include_by_purpose(const pxr::UsdGeomImageable ) const;
 };
 
 };  // namespace blender::io::usd

___
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] [92565019b0b] usd-importer-T81257-merge: USDStageReader::prune_by_purpose() refactor.

2021-06-21 Thread makowalski
Commit: 92565019b0b050c0195d843ff44c1ace789820f8
Author: makowalski
Date:   Mon Jun 21 14:28:02 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB92565019b0b050c0195d843ff44c1ace789820f8

USDStageReader::prune_by_purpose() refactor.

Per suggestion by Sybren in his review, flipped the samanitcs
for prune_by_purpose() to return true=include and false=exclude.
Also simplified the conditional logic to reduce nesting.

===

M   source/blender/io/usd/intern/usd_reader_stage.cc

===

diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc 
b/source/blender/io/usd/intern/usd_reader_stage.cc
index 272002498e1..7b69a7e8983 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.cc
+++ b/source/blender/io/usd/intern/usd_reader_stage.cc
@@ -142,37 +142,39 @@ bool USDStageReader::prune_by_visibility(const 
pxr::UsdGeomImageable )
   return visibility != pxr::UsdGeomTokens->invisible;
 }
 
-/* Returns true if the given prim should be excluded from the
- * traversal because it has a purpose which was not requested
- * by the user; e.g., the prim represents guide geometry and
- * the import_guide parameter is toggled off. */
+/* Returns true if the given prim should be included in the
+ * traversal based on the import options and the prim's purpose
+ * attribute. E.g., return false (to exclude the prim) if the prim
+ * represents guide geometry and the 'Import Guide' option is
+ * toggled off. */
 bool USDStageReader::prune_by_purpose(const pxr::UsdGeomImageable ) 
const
 {
-  if (!imageable) {
-return false;
+  if (params_.import_guide && params_.import_proxy && params_.import_render) {
+/* The options allow any purpose, so we trivially include the prim. */
+return true;
   }
 
-  if (params_.import_guide && params_.import_proxy && params_.import_render) {
-return false;
+  pxr::UsdAttribute purpose_attr = imageable.GetPurposeAttr();
+
+  if (!purpose_attr) {
+/* No purpose attribute, so trivially include the prim. */
+return true;
   }
 
-  if (pxr::UsdAttribute purpose_attr = imageable.GetPurposeAttr()) {
-pxr::TfToken purpose;
-if (!purpose_attr.Get()) {
-  return false;
-}
-if (purpose == pxr::UsdGeomTokens->guide && !params_.import_guide) {
-  return true;
-}
-if (purpose == pxr::UsdGeomTokens->proxy && !params_.import_proxy) {
-  return true;
-}
-if (purpose == pxr::UsdGeomTokens->render && !params_.import_render) {
-  return true;
-}
+  pxr::TfToken purpose;
+  purpose_attr.Get();
+
+  if (purpose == pxr::UsdGeomTokens->guide) {
+return params_.import_guide;
+  }
+  if (purpose == pxr::UsdGeomTokens->proxy) {
+return params_.import_proxy;
+  }
+  if (purpose == pxr::UsdGeomTokens->render) {
+return params_.import_render;
   }
 
-  return false;
+  return true;
 }
 
 /* Determine if the given reader can use the parent of the encapsulated USD 
prim
@@ -218,7 +220,7 @@ USDPrimReader *USDStageReader::collect_readers(Main *bmain, 
const pxr::UsdPrim &
   if (prim.IsA()) {
 pxr::UsdGeomImageable imageable(prim);
 
-if (prune_by_purpose(imageable)) {
+if (!prune_by_purpose(imageable)) {
   return nullptr;
 }

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


[Bf-blender-cvs] [bb2acc0a235] usd-importer-T81257-merge: USDStageReader::prune_by_visibility() refactor.

2021-06-21 Thread makowalski
Commit: bb2acc0a2350b714c7b1b8927d8af95943b81b8b
Author: makowalski
Date:   Mon Jun 21 13:11:10 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rBbb2acc0a2350b714c7b1b8927d8af95943b81b8b

USDStageReader::prune_by_visibility() refactor.

Per suggestion by Sybren in his review, flipped the samanitcs
for prune_by_visibility() to return true=include and false=exclude.
Also simplified the conditional logic to reduce nesting.

===

M   source/blender/io/usd/intern/usd_reader_stage.cc

===

diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc 
b/source/blender/io/usd/intern/usd_reader_stage.cc
index 532d38a5860..272002498e1 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.cc
+++ b/source/blender/io/usd/intern/usd_reader_stage.cc
@@ -112,25 +112,34 @@ USDPrimReader *USDStageReader::create_reader(const 
pxr::UsdPrim )
   return nullptr;
 }
 
-/* Returns true if the given prim should be excluded from the
- * traversal because it's invisible. */
+/* Returns true if the given prim should be included in the
+ * traversal based on the import options and the prim's visibility
+ * attribute.  Note that the prim will be trivially included
+ * if it has no visibility attribute or if the visibility
+ * is inherited. */
 bool USDStageReader::prune_by_visibility(const pxr::UsdGeomImageable 
) const
 {
-  if (!(imageable && params_.import_visible_only)) {
-return false;
+  if (!params_.import_visible_only) {
+/* Invisible prims are allowed. */
+return true;
   }
 
-  if (pxr::UsdAttribute visibility_attr = imageable.GetVisibilityAttr()) {
-// Prune if the prim has a non-animating visibility attribute and is
-// invisible.
-if (!visibility_attr.ValueMightBeTimeVarying()) {
-  pxr::TfToken visibility;
-  visibility_attr.Get();
-  return visibility == pxr::UsdGeomTokens->invisible;
-}
+  pxr::UsdAttribute visibility_attr = imageable.GetVisibilityAttr();
+
+  if (!visibility_attr) {
+/* No visibility attribute, so allow. */
+return true;
   }
 
-  return false;
+  /* Include if the prim has an animating visibility attribute or is not 
invisible. */
+
+  if (visibility_attr.ValueMightBeTimeVarying()) {
+return true;
+  }
+
+  pxr::TfToken visibility;
+  visibility_attr.Get();
+  return visibility != pxr::UsdGeomTokens->invisible;
 }
 
 /* Returns true if the given prim should be excluded from the
@@ -213,7 +222,7 @@ USDPrimReader *USDStageReader::collect_readers(Main *bmain, 
const pxr::UsdPrim &
   return nullptr;
 }
 
-if (prune_by_visibility(imageable)) {
+if (!prune_by_visibility(imageable)) {
   return nullptr;
 }
   }

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


[Bf-blender-cvs] [4947aa29db0] master: CMake: Improve python version mismatch error

2021-06-21 Thread Ray Molenkamp
Commit: 4947aa29db0a388b166704bd22eb416896064c61
Author: Ray Molenkamp
Date:   Mon Jun 21 18:19:07 2021 -0600
Branches: master
https://developer.blender.org/rB4947aa29db0a388b166704bd22eb416896064c61

CMake: Improve python version mismatch error

When CMake detects and incompatible Python version
it errors out with an error saying at-least python 3.9
is required, but doesn't mention the version it detected.

This makes troubleshooting the problem harder than it
needs to be.

This diff changes the error message to include the python
version CMake detected.

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

Reviewed By: Ray Molenkamp

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f315fa87236..297e32bd67e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -836,7 +836,7 @@ if(WITH_PYTHON)
   # because UNIX will search for the old Python paths which may not exist.
   # giving errors about missing paths before this case is met.
   if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.9")
-message(FATAL_ERROR "At least Python 3.9 is required to build")
+message(FATAL_ERROR "At least Python 3.9 is required to build, but found 
Python ${PYTHON_VERSION}")
   endif()
 
   file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")

___
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] [d443dcc7336] master: Build/Windows: Preliminary VS 2022 support.

2021-06-21 Thread Ray Molenkamp
Commit: d443dcc73364c55385dbd82745459f6af0af5a41
Author: Ray Molenkamp
Date:   Mon Jun 21 18:11:30 2021 -0600
Branches: master
https://developer.blender.org/rBd443dcc73364c55385dbd82745459f6af0af5a41

Build/Windows: Preliminary VS 2022 support.

This adds preliminary VS 2022 support, since
there currently is no CMake version that
supports the VS2022 IDE only ninja support
was tested.

IDE support should work without any additional
changes as soon as an updated CMake becomes
available.

As VS2022 appears to keep binary compatibility
with earlier MSVC versions, the current SVN
libraries will work for this version.

===

M   build_files/cmake/platform/platform_win32.cmake
M   build_files/windows/autodetect_msvc.cmd
M   build_files/windows/check_libraries.cmd
M   build_files/windows/configure_msbuild.cmd
A   build_files/windows/detect_msvc2022.cmd
M   build_files/windows/parse_arguments.cmd

===

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 99a2cb7966f..8b9a48fca74 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -261,8 +261,10 @@ if(NOT DEFINED LIBDIR)
   else()
 message(FATAL_ERROR "32 bit compiler detected, blender no longer provides 
pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to 
your own library folder")
   endif()
-  # Can be 1910..1912
-  if(MSVC_VERSION GREATER 1919)
+  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30130)
+message(STATUS "Visual Studio 2022 detected.")
+set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
+  elseif(MSVC_VERSION GREATER 1919)
 message(STATUS "Visual Studio 2019 detected.")
 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
   elseif(MSVC_VERSION GREATER 1909)
diff --git a/build_files/windows/autodetect_msvc.cmd 
b/build_files/windows/autodetect_msvc.cmd
index 85b3c095d1f..6cee4765b93 100644
--- a/build_files/windows/autodetect_msvc.cmd
+++ b/build_files/windows/autodetect_msvc.cmd
@@ -6,6 +6,9 @@ if %ERRORLEVEL% EQU 0 goto DetectionComplete
 call "%~dp0\detect_msvc2019.cmd"
 if %ERRORLEVEL% EQU 0 goto DetectionComplete
 
+call "%~dp0\detect_msvc2022.cmd"
+if %ERRORLEVEL% EQU 0 goto DetectionComplete
+
 echo Compiler Detection failed. Use verbose switch for more information. 
 exit /b 1
 
diff --git a/build_files/windows/check_libraries.cmd 
b/build_files/windows/check_libraries.cmd
index 8e43cda9eb7..c495ee6eee9 100644
--- a/build_files/windows/check_libraries.cmd
+++ b/build_files/windows/check_libraries.cmd
@@ -1,5 +1,6 @@
 if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc15
 if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc15
+if "%BUILD_VS_YEAR%"=="2022" set BUILD_VS_LIBDIRPOST=vc15
 
 set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
 set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
diff --git a/build_files/windows/configure_msbuild.cmd 
b/build_files/windows/configure_msbuild.cmd
index be69f99a8e8..a9267e8cfbb 100644
--- a/build_files/windows/configure_msbuild.cmd
+++ b/build_files/windows/configure_msbuild.cmd
@@ -19,10 +19,10 @@ if "%WITH_PYDEBUG%"=="1" (
set PYDEBUG_CMAKE_ARGS=-DWINDOWS_PYTHON_DEBUG=On
 )
 
-if "%BUILD_VS_YEAR%"=="2019" (
-   set BUILD_PLATFORM_SELECT=-A %MSBUILD_PLATFORM%
-) else (
+if "%BUILD_VS_YEAR%"=="2017" (
set BUILD_GENERATOR_POST=%WINDOWS_ARCH%
+) else (
+   set BUILD_PLATFORM_SELECT=-A %MSBUILD_PLATFORM%
 )
 
 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% 
%BUILD_VS_YEAR%%BUILD_GENERATOR_POST%" %BUILD_PLATFORM_SELECT% 
%TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS% %PYDEBUG_CMAKE_ARGS%
diff --git a/build_files/windows/detect_msvc2022.cmd 
b/build_files/windows/detect_msvc2022.cmd
new file mode 100644
index 000..f30210f4e38
--- /dev/null
+++ b/build_files/windows/detect_msvc2022.cmd
@@ -0,0 +1,3 @@
+set BUILD_VS_VER=17
+set BUILD_VS_YEAR=2022
+call "%~dp0\detect_msvc_vswhere.cmd"
diff --git a/build_files/windows/parse_arguments.cmd 
b/build_files/windows/parse_arguments.cmd
index 54dc41ece87..000b98c992e 100644
--- a/build_files/windows/parse_arguments.cmd
+++ b/build_files/windows/parse_arguments.cmd
@@ -66,6 +66,14 @@ if NOT "%1" == "" (
) else if "%1" == "2019b" (
set BUILD_VS_YEAR=2019
set VSWHERE_ARGS=-products 
Microsoft.VisualStudio.Product.BuildTools
+   ) else if "%1" == "2022" (
+   set BUILD_VS_YEAR=2022
+   ) else if "%1" == "2022pre" (
+   set BUILD_VS_YEAR=2022
+   set VSWHERE_ARGS=-prerelease
+   ) else if "%1" == "2022b" (
+   set BUILD_VS_YEAR=2022
+   set VSWHERE_ARGS=-products 
Microsoft.VisualStudio.Product.BuildTools
) else if "%1" == 

[Bf-blender-cvs] [6f158f834dc] master: Refactor of Wintab to use Wintab supplied mouse movement once verified against system input.

2021-06-21 Thread Nicholas Rishel
Commit: 6f158f834dcfa638639391f37afcb2ca8457cb45
Author: Nicholas Rishel
Date:   Thu Mar 4 15:48:48 2021 -0800
Branches: master
https://developer.blender.org/rB6f158f834dcfa638639391f37afcb2ca8457cb45

Refactor of Wintab to use Wintab supplied mouse movement once verified against 
system input.

Reviewed By: brecht, LazyDodo

Maniphest Tasks: T88852

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

===

M   intern/ghost/CMakeLists.txt
M   intern/ghost/GHOST_Types.h
M   intern/ghost/intern/GHOST_System.h
M   intern/ghost/intern/GHOST_SystemWin32.cpp
M   intern/ghost/intern/GHOST_SystemWin32.h
M   intern/ghost/intern/GHOST_WindowWin32.cpp
M   intern/ghost/intern/GHOST_WindowWin32.h
A   intern/ghost/intern/GHOST_Wintab.cpp
A   intern/ghost/intern/GHOST_Wintab.h
M   source/blender/windowmanager/intern/wm_window.c

===

diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 1b5cdb3cda0..40d78a22e6f 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -370,6 +370,7 @@ elseif(WIN32)
 intern/GHOST_DropTargetWin32.cpp
 intern/GHOST_SystemWin32.cpp
 intern/GHOST_WindowWin32.cpp
+intern/GHOST_Wintab.cpp
 
 intern/GHOST_ContextD3D.h
 intern/GHOST_DisplayManagerWin32.h
@@ -377,6 +378,7 @@ elseif(WIN32)
 intern/GHOST_SystemWin32.h
 intern/GHOST_TaskbarWin32.h
 intern/GHOST_WindowWin32.h
+intern/GHOST_Wintab.h
   )
 
   if(NOT WITH_GL_EGL)
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 3a8d0fbfecf..f18e6f03ede 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -105,7 +105,9 @@ typedef enum {
 
 typedef enum {
   GHOST_kTabletAutomatic = 0,
-  GHOST_kTabletNative,
+  /* Show as Windows Ink to users to match "Use Windows Ink" in tablet 
utilities, but we use the
+ dependent Windows Pointer API. */
+  GHOST_kTabletWinPointer,
   GHOST_kTabletWintab,
 } GHOST_TTabletAPI;
 
diff --git a/intern/ghost/intern/GHOST_System.h 
b/intern/ghost/intern/GHOST_System.h
index 2a7123b293e..9915520691f 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -239,7 +239,7 @@ class GHOST_System : public GHOST_ISystem {
* Set which tablet API to use. Only affects Windows, other platforms have a 
single API.
* \param api: Enum indicating which API to use.
*/
-  void setTabletAPI(GHOST_TTabletAPI api);
+  virtual void setTabletAPI(GHOST_TTabletAPI api) override;
   GHOST_TTabletAPI getTabletAPI(void);
 
 #ifdef WITH_INPUT_NDOF
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp 
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 45b9e88f884..09cfa30eca5 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -866,15 +866,151 @@ GHOST_EventButton 
*GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
 {
   GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
 
-  if (type == GHOST_kEventButtonDown) {
-window->updateMouseCapture(MousePressed);
+  GHOST_TabletData td = window->getTabletData();
+
+  /* Move mouse to button event position. */
+  if (window->getTabletData().Active != GHOST_kTabletModeNone) {
+/* Tablet should be handling inbetween mouse moves, only move to event 
position. */
+DWORD msgPos = ::GetMessagePos();
+int msgPosX = GET_X_LPARAM(msgPos);
+int msgPosY = GET_Y_LPARAM(msgPos);
+system->pushEvent(new GHOST_EventCursor(
+::GetMessageTime(), GHOST_kEventCursorMove, window, msgPosX, msgPosY, 
td));
   }
-  else if (type == GHOST_kEventButtonUp) {
-window->updateMouseCapture(MouseReleased);
+
+  window->updateMouseCapture(type == GHOST_kEventButtonDown ? MousePressed : 
MouseReleased);
+  return new GHOST_EventButton(system->getMilliSeconds(), type, window, mask, 
td);
+}
+
+void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
+{
+  GHOST_Wintab *wt = window->getWintab();
+  if (!wt) {
+return;
+  }
+
+  GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
+
+  std::vector wintabInfo;
+  wt->getInput(wintabInfo);
+
+  /* Wintab provided coordinates are untrusted until a Wintab and Win32 button 
down event match.
+   * This is checked on every button down event, and revoked if there is a 
mismatch. This can
+   * happen when Wintab incorrectly scales cursor position or is in mouse mode.
+   *
+   * If Wintab was never trusted while processing this Win32 event, a fallback 
Ghost cursor move
+   * event is created at the position of the Win32 WT_PACKET event. */
+  bool mouseMoveHandled;
+  bool useWintabPos;
+  mouseMoveHandled = useWintabPos = wt->trustCoordinates();
+
+  for (GHOST_WintabInfoWin32  : wintabInfo) {
+switch (info.type) {
+  case GHOST_kEventCursorMove: {
+if (!useWintabPos) {
+  continue;
+   

[Bf-blender-cvs] [445d506ac9b] master: Geometry Nodes: Use multithreading for the curve to mesh node

2021-06-21 Thread Hans Goudey
Commit: 445d506ac9b59c4eb9de8a475fd89ba908ecbcdf
Author: Hans Goudey
Date:   Mon Jun 21 16:17:02 2021 -0500
Branches: master
https://developer.blender.org/rB445d506ac9b59c4eb9de8a475fd89ba908ecbcdf

Geometry Nodes: Use multithreading for the curve to mesh node

This commit optimizes the node for the case where it works on many
splines by allowing it to generate mesh data from their combinations
in parallel. By itself, this made the node around twice as fast in my
test file with a result of 20 million vertices, around 600ms instead of
1.2s before.

That isn't actually a very good result; it reveals another bottleneck,
a single threaded loop over all face corners in the mesh normal
calculation code. As a simple change that might improve performance
in some situations, this commit moves normal calculation out of this
node, so at least the work isn't wasted if the mesh is changed later
on in the node tree anyway.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
index fc8558dfd2f..c0d817385e2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
@@ -16,7 +16,7 @@
 
 #include "BLI_array.hh"
 #include "BLI_float4x4.hh"
-#include "BLI_timeit.hh"
+#include "BLI_task.hh"
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -47,8 +47,8 @@ static void vert_extrude_to_mesh_data(const Spline ,
   const float3 profile_vert,
   MutableSpan r_verts,
   MutableSpan r_edges,
-  int _offset,
-  int _offset)
+  int vert_offset,
+  int edge_offset)
 {
   Span positions = spline.evaluated_positions();
 
@@ -85,10 +85,10 @@ static void spline_extrude_to_mesh_data(const Spline 
,
 MutableSpan r_edges,
 MutableSpan r_loops,
 MutableSpan r_polys,
-int _offset,
-int _offset,
-int _offset,
-int _offset)
+int vert_offset,
+int edge_offset,
+int loop_offset,
+int poly_offset)
 {
   const int spline_vert_len = spline.evaluated_points_size();
   const int spline_edge_len = spline.evaluated_edges_size();
@@ -207,63 +207,114 @@ static void spline_extrude_to_mesh_data(const Spline 
,
   }
 }
 
-static Mesh *curve_to_mesh_calculate(const CurveEval , const CurveEval 
_curve)
+static inline int spline_extrude_vert_size(const Spline , const Spline 
)
 {
-  int profile_vert_total = 0;
-  int profile_edge_total = 0;
-  for (const SplinePtr _spline : profile_curve.splines()) {
-profile_vert_total += profile_spline->evaluated_points_size();
-profile_edge_total += profile_spline->evaluated_edges_size();
-  }
+  return curve.evaluated_points_size() * profile.evaluated_points_size();
+}
 
-  int vert_total = 0;
-  int edge_total = 0;
-  int poly_total = 0;
-  for (const SplinePtr  : curve.splines()) {
-const int spline_vert_len = spline->evaluated_points_size();
-const int spline_edge_len = spline->evaluated_edges_size();
-vert_total += spline_vert_len * profile_vert_total;
-poly_total += spline_edge_len * profile_edge_total;
-
-/* Add the ring edges, with one ring for every curve vertex, and the edge 
loops
- * that run along the length of the curve, starting on the first profile. 
*/
-edge_total += profile_edge_total * spline_vert_len + profile_vert_total * 
spline_edge_len;
-  }
-  const int corner_total = poly_total * 4;
+static inline int spline_extrude_edge_size(const Spline , const Spline 
)
+{
+  /* Add the ring edges, with one ring for every curve vertex, and the edge 
loops
+   * that run along the length of the curve, starting on the first profile. */
+  return curve.evaluated_points_size() * profile.evaluated_edges_size() +
+ curve.evaluated_edges_size() * profile.evaluated_points_size();
+}
 
-  if (vert_total == 0) {
-return nullptr;
-  }
+static inline int spline_extrude_loop_size(const Spline , const Spline 
)
+{
+  return curve.evaluated_edges_size() * profile.evaluated_edges_size() * 4;
+}
 
-  Mesh *mesh = BKE_mesh_new_nomain(vert_total, edge_total, 0, corner_total, 
poly_total);
-  

[Bf-blender-cvs] [b11a463e4fc] master: Refactor: Do not keep a copy of depth buffer in RegionView3D

2021-06-21 Thread Germano Cavalcante
Commit: b11a463e4fcd98f2fff6e05a03e97e71b93b8274
Author: Germano Cavalcante
Date:   Mon Jun 21 16:25:53 2021 -0300
Branches: master
https://developer.blender.org/rBb11a463e4fcd98f2fff6e05a03e97e71b93b8274

Refactor: Do not keep a copy of depth buffer in RegionView3D

The depth cache (located in `RegionView3D::depths`) is used for quick
and simple occlusion testing in:
- particle selection,
- "Draw Curve" operator and
- "Interactive Light Track to Cursor" operator,

However, keeping a texture buffer in cache is not a recommended practice.

For displays with high resolution like 8k this represents something
around 132MB.

Also, currently, each call to `ED_view3d_depth_override` invalidates
the depth cache. So that depth is never reused in multiple calls from
an operator (this was not the case in blender 2.79).

This commit allows to create a depth cache and release it in the same
operator. Thus, the buffer is kept in cache for a short time, freeing
up space.

No functional changes.

===

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

===

diff --git a/source/blender/blenkernel/intern/screen.c 
b/source/blender/blenkernel/intern/screen.c
index 269aeaebe82..7a5892baaf6 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -1467,7 +1467,6 @@ static void direct_link_region(BlendDataReader *reader, 
ARegion *region, int spa
 BLO_read_data_address(reader, >localvd);
 BLO_read_data_address(reader, >clipbb);
 
-rv3d->depths = NULL;
 rv3d->render_engine = NULL;
 rv3d->sms = NULL;
 rv3d->smooth_timer = NULL;
diff --git a/source/blender/editors/curve/editcurve_paint.c 
b/source/blender/editors/curve/editcurve_paint.c
index 03c120df28b..94c227dfa75 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -128,6 +128,7 @@ struct CurveDrawData {
   } prev;
 
   ViewContext vc;
+  ViewDepths *depths;
   enum {
 CURVE_DRAW_IDLE = 0,
 CURVE_DRAW_PAINTING = 1,
@@ -188,7 +189,6 @@ static bool stroke_elem_project(const struct CurveDrawData 
*cdd,
 float r_normal_world[3])
 {
   ARegion *region = cdd->vc.region;
-  RegionView3D *rv3d = cdd->vc.rv3d;
 
   bool is_location_world_set = false;
 
@@ -204,7 +204,7 @@ static bool stroke_elem_project(const struct CurveDrawData 
*cdd,
 }
   }
   else {
-const ViewDepths *depths = rv3d->depths;
+const ViewDepths *depths = cdd->depths;
 if (depths && ((uint)mval_i[0] < depths->w) && ((uint)mval_i[1] < 
depths->h)) {
   float depth_fl = 1.0f;
   ED_view3d_depth_read_cached(depths, mval_i, 0, _fl);
@@ -219,7 +219,7 @@ static bool stroke_elem_project(const struct CurveDrawData 
*cdd,
   if (surface_offset != 0.0f) {
 const float offset = cdd->project.use_surface_offset_absolute ? 
1.0f : radius;
 float normal[3];
-if (ED_view3d_depth_read_cached_normal(>vc, mval_i, normal)) {
+if (ED_view3d_depth_read_cached_normal(region, depths, mval_i, 
normal)) {
   madd_v3_v3fl(r_location_world, normal, offset * surface_offset);
   if (r_normal_world) {
 copy_v3_v3(r_normal_world, normal);
@@ -528,7 +528,7 @@ static void curve_draw_event_add_first(wmOperator *op, 
const wmEvent *event)
 if (ELEM(cps->surface_plane,
  CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW,
  CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE)) {
-  if (ED_view3d_depth_read_cached_normal(>vc, event->mval, normal)) {
+  if (ED_view3d_depth_read_cached_normal(cdd->vc.region, cdd->depths, 
event->mval, normal)) {
 if (cps->surface_plane == CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW) {
   float cross_a[3], cross_b[3];
   cross_v3_v3v3(cross_a, rv3d->viewinv[2], normal);
@@ -622,6 +622,10 @@ static void 

[Bf-blender-cvs] [34c8a7accc1] temp-gpencil-camera-reproject: Merge branch 'master' into temp-gpencil-camera-reproject

2021-06-21 Thread Antonio Vazquez
Commit: 34c8a7accc1281b7affa58def54efd843cfea3da
Author: Antonio Vazquez
Date:   Mon Jun 21 19:37:40 2021 +0200
Branches: temp-gpencil-camera-reproject
https://developer.blender.org/rB34c8a7accc1281b7affa58def54efd843cfea3da

Merge branch 'master' into temp-gpencil-camera-reproject

 Conflicts:
source/blender/editors/gpencil/gpencil_utils.c

===



===

diff --cc source/blender/editors/gpencil/gpencil_utils.c
index 04287840a18,c9ef340b9d3..c409d7adedb
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@@ -1390,14 -1274,9 +1390,15 @@@ void ED_gpencil_stroke_reproject(Depsgr
/* Planar - All on same plane parallel to the view-plane. */
gpencil_point_xy_to_3d(gsc, gsc->scene, xy, >x);
  }
 +else if (mode == GP_REPROJECT_CAMERA) {
 +  /* Convert to Render 2D space. */
 +  ED_gpencil_project_point_to_render_space(gsc->scene, , persmat, 
is_ortho, xy);
 +  /* Convert to Global Camera 3D space. */
 +  gpencil_point_render_xy_to_3d(gsc, persmat, persinv, xy, >x);
 +}
  else {
/* Geometry - Snap to surfaces of visible geometry */
+   float ray_start[3];
float ray_normal[3];
/* magic value for initial depth copied from the default
 * value of Python's Scene.ray_cast function

___
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] [57a58857693] temp-gpencil-camera-reproject: GPencil: Fix merge errors

2021-06-21 Thread Antonio Vazquez
Commit: 57a58857693265c3074a9ce44e68128edc7c88c0
Author: Antonio Vazquez
Date:   Mon Jun 21 19:49:33 2021 +0200
Branches: temp-gpencil-camera-reproject
https://developer.blender.org/rB57a58857693265c3074a9ce44e68128edc7c88c0

GPencil: Fix merge errors

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_utils.c 
b/source/blender/editors/gpencil/gpencil_utils.c
index c409d7adedb..0176d8bfd28 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1017,7 +1017,7 @@ bool gpencil_point_render_xy_to_3d(const 
GP_SpaceConversion *gsc,
   V3D_PROJ_RET_OK) {
 sub_v2_v2v2(mval_f, mval_prj, mval_f);
 
-float dx = 2.0f * mval_f[0] * zfac / (scene->r.xsch * scene->r.size / 
100.0f) ;
+float dx = 2.0f * mval_f[0] * zfac / (scene->r.xsch * scene->r.size / 
100.0f);
 float dy = 2.0f * mval_f[1] * zfac / (scene->r.ysch * scene->r.size / 
100.0f);
 dvec[0] = (persinv[0][0] * dx + persinv[1][0] * dy);
 dvec[1] = (persinv[0][1] * dx + persinv[1][1] * dy);
@@ -1410,6 +1410,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
   BLI_assert(gps->flag & GP_STROKE_3DSPACE);
   BLI_assert(gsc->area && gsc->area->spacetype == SPACE_VIEW3D);
   const View3D *v3d = gsc->area->spacedata.first;
+  gpencil_point_to_xy_fl(gsc, gps_active, , [0], [1]);
   ED_view3d_win_to_ray_clipped(
   depsgraph, region, v3d, xy, _start[0], _normal[0], true);
   if (ED_transform_snap_object_project_ray(sctx,

___
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] [88762806bbd] temp-gpencil-camera-reproject: GPencil: Fix wrong enum list after merge

2021-06-21 Thread Antonio Vazquez
Commit: 88762806bbd0b0805655c1d0271b4143e7e6d835
Author: Antonio Vazquez
Date:   Mon Jun 21 20:00:43 2021 +0200
Branches: temp-gpencil-camera-reproject
https://developer.blender.org/rB88762806bbd0b0805655c1d0271b4143e7e6d835

GPencil: Fix wrong enum list after merge

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_edit.c 
b/source/blender/editors/gpencil/gpencil_edit.c
index 21fa3ad3967..a10e875ff23 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3845,29 +3845,6 @@ static int gpencil_strokes_reproject_exec(bContext *C, 
wmOperator *op)
 
 void GPENCIL_OT_reproject(wmOperatorType *ot)
 {
-  static const EnumPropertyItem reproject_type[] = {
-  {GP_REPROJECT_FRONT, "FRONT", 0, "Front", "Reproject the strokes using 
the X-Z plane"},
-  {GP_REPROJECT_SIDE, "SIDE", 0, "Side", "Reproject the strokes using the 
Y-Z plane"},
-  {GP_REPROJECT_TOP, "TOP", 0, "Top", "Reproject the strokes using the X-Y 
plane"},
-  {GP_REPROJECT_VIEW,
-   "VIEW",
-   0,
-   "View",
-   "Reproject the strokes to end up on the same plane, as if drawn from 
the current "
-   "viewpoint "
-   "using 'Cursor' Stroke Placement"},
-  {GP_REPROJECT_SURFACE,
-   "SURFACE",
-   0,
-   "Surface",
-   "Reproject the strokes on to the scene geometry, as if drawn using 
'Surface' placement"},
-  {GP_REPROJECT_CURSOR,
-   "CURSOR",
-   0,
-   "Cursor",
-   "Reproject the strokes using the orientation of 3D cursor"},
-  {0, NULL, 0, NULL, NULL},
-  };
 
   /* identifiers */
   ot->name = "Reproject Strokes";
@@ -3887,8 +3864,12 @@ void GPENCIL_OT_reproject(wmOperatorType *ot)
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
   /* properties */
-  ot->prop = RNA_def_enum(
-  ot->srna, "type", reproject_type, GP_REPROJECT_VIEW, "Projection Type", 
"");
+  ot->prop = RNA_def_enum(ot->srna,
+  "type",
+  rna_gpencil_reproject_type_items,
+  GP_REPROJECT_VIEW,
+  "Projection Type",
+  "");
 
   RNA_def_boolean(
   ot->srna,

___
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] [b665ad8621a] master: Fix T89291: Objects with rotation deltas don't rotate in correct axes

2021-06-21 Thread Germano Cavalcante
Commit: b665ad8621a0db265fd666542d26aed463025db1
Author: Germano Cavalcante
Date:   Mon Jun 21 14:24:23 2021 -0300
Branches: master
https://developer.blender.org/rBb665ad8621a0db265fd666542d26aed463025db1

Fix T89291: Objects with rotation deltas don't rotate in correct axes

Quaternion correction was not implemented and Euler values were being
incorrectly combined.

===

M   source/blender/blenlib/BLI_math_rotation.h
M   source/blender/blenlib/intern/math_rotation.c
M   source/blender/editors/transform/transform_mode.c

===

diff --git a/source/blender/blenlib/BLI_math_rotation.h 
b/source/blender/blenlib/BLI_math_rotation.h
index fe995b2e46e..ef10d02f10f 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -164,6 +164,9 @@ void compatible_eul(float eul[3], const float old[3]);
 
 void rotate_eul(float eul[3], const char axis, const float angle);
 
+void add_eul_euleul(float r_eul[3], float a[3], float b[3], const short order);
+void sub_eul_euleul(float r_eul[3], float a[3], float b[3], const short order);
+
 /** Arbitrary Order Eulers ***/
 
 /* warning: must match the eRotationModes in DNA_action_types.h
diff --git a/source/blender/blenlib/intern/math_rotation.c 
b/source/blender/blenlib/intern/math_rotation.c
index 57fe99ce019..469cd573372 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1924,6 +1924,31 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float 
eul[3], const short order
   gmat[R->axis[2]][R->axis[2]] = 1;
 }
 
+void add_eul_euleul(float r_eul[3], float a[3], float b[3], const short order)
+{
+  float quat[4], quat_b[4];
+
+  eulO_to_quat(quat, a, order);
+  eulO_to_quat(quat_b, b, order);
+
+  mul_qt_qtqt(quat, quat_b, quat);
+
+  quat_to_eulO(r_eul, order, quat);
+}
+
+void sub_eul_euleul(float r_eul[3], float a[3], float b[3], const short order)
+{
+  float quat[4], quat_b[4];
+
+  eulO_to_quat(quat, a, order);
+  eulO_to_quat(quat_b, b, order);
+
+  invert_qt_normalized(quat_b);
+  mul_qt_qtqt(quat, quat_b, quat);
+
+  quat_to_eulO(r_eul, order, quat);
+}
+
 /*** Dual Quaternions /
 
 /**
diff --git a/source/blender/editors/transform/transform_mode.c 
b/source/blender/editors/transform/transform_mode.c
index 350be247014..6a946994e06 100644
--- a/source/blender/editors/transform/transform_mode.c
+++ b/source/blender/editors/transform/transform_mode.c
@@ -734,9 +734,25 @@ void ElementRotation_ex(TransInfo *t,
 /* can be called for texture space translate for example, then opt out 
*/
 if (td->ext->quat) {
   mul_m3_series(fmat, td->smtx, mat, td->mtx);
+
+  if (!is_zero_v3(td->ext->dquat)) {
+/* Correct for delta quat */
+float tmp_mat[3][3];
+quat_to_mat3(tmp_mat, td->ext->dquat);
+mul_m3_m3m3(fmat, fmat, tmp_mat);
+  }
+
   mat3_to_quat(quat, fmat); /* Actual transform */
 
+  if (!is_zero_v4(td->ext->dquat)) {
+/* Correct back for delta quat. */
+float idquat[4];
+invert_qt_qt_normalized(idquat, td->ext->dquat);
+mul_qt_qtqt(quat, idquat, quat);
+  }
+
   mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
+
   /* this function works on end result */
   protectedQuaternionBits(td->protectflag, td->ext->quat, 
td->ext->iquat);
 }
@@ -761,21 +777,28 @@ void ElementRotation_ex(TransInfo *t,
td->ext->irotAngle);
   }
   else {
+/* Calculate the total rotation in eulers. */
 float obmat[3][3];
 
 mul_m3_m3m3(totmat, mat, td->mtx);
 mul_m3_m3m3(smat, td->smtx, totmat);
 
-/* Calculate the total rotation in eulers. */
-add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* correct for delta 
rot */
+if (!is_zero_v3(td->ext->drot)) {
+  /* Correct for delta rot */
+  add_eul_euleul(eul, td->ext->irot, td->ext->drot, td->ext->rotOrder);
+}
+else {
+  copy_v3_v3(eul, td->ext->irot);
+}
+
 eulO_to_mat3(obmat, eul, td->ext->rotOrder);
-/* mat = transform, obmat = object rotation */
 mul_m3_m3m3(fmat, smat, obmat);
-
 mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
 
-/* correct back for delta rot */
-sub_v3_v3v3(eul, eul, td->ext->drot);
+if (!is_zero_v3(td->ext->drot)) {
+  /* Correct back for delta rot. */
+  sub_eul_euleul(eul, eul, td->ext->drot, td->ext->rotOrder);
+}
 
 /* and apply */
 protectedRotateBits(td->protectflag, eul, td->ext->irot);


[Bf-blender-cvs] [41af27c582e] master: Fix deadlocks in mesh modifier evaluation and particles

2021-06-21 Thread Brecht Van Lommel
Commit: 41af27c582ec21e65ff3f835754c7b0bcf6d3be7
Author: Brecht Van Lommel
Date:   Mon Jun 21 18:44:40 2021 +0200
Branches: master
https://developer.blender.org/rB41af27c582ec21e65ff3f835754c7b0bcf6d3be7

Fix deadlocks in mesh modifier evaluation and particles

The recent task isolation changes missed two mutex locks that also need task
isolation.

Ref D11603, T89194

===

M   source/blender/blenkernel/intern/DerivedMesh.cc
M   source/blender/blenkernel/intern/particle_system.c

===

diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc 
b/source/blender/blenkernel/intern/DerivedMesh.cc
index 4cd611d2fa8..3150e096a73 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -42,6 +42,7 @@
 #include "BLI_linklist.h"
 #include "BLI_math.h"
 #include "BLI_task.h"
+#include "BLI_task.hh"
 #include "BLI_utildefines.h"
 #include "BLI_vector.hh"
 
@@ -1463,10 +1464,14 @@ static void mesh_calc_modifiers(struct Depsgraph 
*depsgraph,
   BLI_assert(runtime->eval_mutex != nullptr);
   BLI_mutex_lock((ThreadMutex *)runtime->eval_mutex);
   if (runtime->mesh_eval == nullptr) {
-mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
-mesh_calc_modifier_final_normals(mesh_input, _datamask, 
sculpt_dyntopo, mesh_final);
-mesh_calc_finalize(mesh_input, mesh_final);
-runtime->mesh_eval = mesh_final;
+/* Isolate since computing normals is multithreaded and we are holding 
a lock. */
+blender::threading::isolate_task([&] {
+  mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
+  mesh_calc_modifier_final_normals(
+  mesh_input, _datamask, sculpt_dyntopo, mesh_final);
+  mesh_calc_finalize(mesh_input, mesh_final);
+  runtime->mesh_eval = mesh_final;
+});
   }
   BLI_mutex_unlock((ThreadMutex *)runtime->eval_mutex);
 }
diff --git a/source/blender/blenkernel/intern/particle_system.c 
b/source/blender/blenkernel/intern/particle_system.c
index 149e345e501..2dc752d57e1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1320,6 +1320,14 @@ void psys_get_pointcache_start_end(Scene *scene, 
ParticleSystem *psys, int *sfra
   *efra = min_ii((int)(part->end + part->lifetime + 1.0f), 
max_ii(scene->r.pefra, scene->r.efra));
 }
 
+/* BVH tree balancing inside a mutex lock must be run in isolation. Balancing
+ * is multithreaded, and we do not want the current thread to start another 
task
+ * that may involve acquiring the same mutex lock that it is waiting for. */
+static void bvhtree_balance_isolated(void *userdata)
+{
+  BLI_bvhtree_balance((BVHTree *)userdata);
+}
+
 //
 /*  Effectors   */
 //
@@ -1356,7 +1364,8 @@ static void psys_update_particle_bvhtree(ParticleSystem 
*psys, float cfra)
   }
 }
   }
-  BLI_bvhtree_balance(psys->bvhtree);
+
+  BLI_task_isolate(bvhtree_balance_isolated, psys->bvhtree);
 
   psys->bvhtree_frame = cfra;

___
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] [cb1c6248fea] greasepencil-object: Merge branch 'master' into greasepencil-object

2021-06-21 Thread Antonio Vazquez
Commit: cb1c6248fea1f433b1065679a411d60e24545176
Author: Antonio Vazquez
Date:   Mon Jun 21 17:29:55 2021 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcb1c6248fea1f433b1065679a411d60e24545176

Merge branch 'master' into greasepencil-object

===



===



___
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] [47473bee348] master: GPencil: Disable Lights when duplicate layer

2021-06-21 Thread Antonio Vazquez
Commit: 47473bee34897347b8a11d03a29a4efe83246e02
Author: Antonio Vazquez
Date:   Mon Jun 21 16:59:09 2021 +0200
Branches: master
https://developer.blender.org/rB47473bee34897347b8a11d03a29a4efe83246e02

GPencil: Disable Lights when duplicate layer

Missing to disable default light ON when use separate operator.

===

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

===

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index f0dda488216..1321f409fce 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1126,6 +1126,9 @@ void BKE_gpencil_layer_copy_settings(const bGPDlayer 
*gpl_src, bGPDlayer *gpl_ds
   if (gpl_src->flag & GP_LAYER_USE_LIGHTS) {
 gpl_dst->flag |= GP_LAYER_USE_LIGHTS;
   }
+  else {
+gpl_dst->flag &= ~GP_LAYER_USE_LIGHTS;
+  }
 }
 
 /**

___
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] [b9ccfb89ce9] master: Performance: Flush selection to edges/faces.

2021-06-21 Thread Jeroen Bakker
Commit: b9ccfb89ce91676269811407c84fdff1dbbee94f
Author: Jeroen Bakker
Date:   Mon Jun 21 08:13:40 2021 +0200
Branches: master
https://developer.blender.org/rBb9ccfb89ce91676269811407c84fdff1dbbee94f

Performance: Flush selection to edges/faces.

This patch uses threading to flush selection from verts to edges and
from edges to faces. The solution is lockless and should scale well on
modern CPU architectures.

Master:{F10185359}
Patch:{F10185361}

End user performance went from 3.9 to 4.6 FPS (Stanford Dragon) but that
was measured on a Intel Core i7-6700 CPU and AMD RX480 Gpu. The more
cores the better improvements you get.

Reviewed By: mano-wii

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

===

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

===

diff --git a/source/blender/bmesh/intern/bmesh_marking.c 
b/source/blender/bmesh/intern/bmesh_marking.c
index 19d94613afe..190698f504c 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -324,6 +324,106 @@ void BM_mesh_select_mode_clean(BMesh *bm)
   BM_mesh_select_mode_clean_ex(bm, bm->selectmode);
 }
 
+/*  */
+/** \name Select mode flush selection
+ * \{ */
+
+typedef struct SelectionFlushChunkData {
+  int delta_selection_len;
+} SelectionFlushChunkData;
+
+static void bm_mesh_select_mode_flush_vert_to_edge_iter_fn(void 
*UNUSED(userdata),
+   MempoolIterData 
*iter,
+   const 
TaskParallelTLS *__restrict tls)
+{
+  SelectionFlushChunkData *chunk_data = tls->userdata_chunk;
+  BMEdge *e = (BMEdge *)iter;
+  const bool is_selected = BM_elem_flag_test(e, BM_ELEM_SELECT);
+  const bool is_hidden = BM_elem_flag_test(e, BM_ELEM_HIDDEN);
+  if (!is_hidden &&
+  (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, 
BM_ELEM_SELECT))) {
+BM_elem_flag_enable(e, BM_ELEM_SELECT);
+chunk_data->delta_selection_len += is_selected ? 0 : 1;
+  }
+  else {
+BM_elem_flag_disable(e, BM_ELEM_SELECT);
+chunk_data->delta_selection_len += is_selected ? -1 : 0;
+  }
+}
+
+static void bm_mesh_select_mode_flush_edge_to_face_iter_fn(void 
*UNUSED(userdata),
+   MempoolIterData 
*iter,
+   const 
TaskParallelTLS *__restrict tls)
+{
+  SelectionFlushChunkData *chunk_data = tls->userdata_chunk;
+  BMFace *f = (BMFace *)iter;
+  BMLoop *l_iter;
+  BMLoop *l_first;
+  const bool is_selected = BM_elem_flag_test(f, BM_ELEM_SELECT);
+  bool ok = true;
+  if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+do {
+  if (!BM_elem_flag_test(l_iter->e, BM_ELEM_SELECT)) {
+ok = false;
+break;
+  }
+} while ((l_iter = l_iter->next) != l_first);
+  }
+  else {
+ok = false;
+  }
+
+  BM_elem_flag_set(f, BM_ELEM_SELECT, ok);
+  if (is_selected && !ok) {
+chunk_data->delta_selection_len -= 1;
+  }
+  else if (ok && !is_selected) {
+chunk_data->delta_selection_len += 1;
+  }
+}
+
+static void bm_mesh_select_mode_flush_reduce_fn(const void *__restrict 
UNUSED(userdata),
+void *__restrict chunk_join,
+void *__restrict chunk)
+{
+  SelectionFlushChunkData *dst = chunk_join;
+  const SelectionFlushChunkData *src = chunk;
+  dst->delta_selection_len += src->delta_selection_len;
+}
+
+static void bm_mesh_select_mode_flush_vert_to_edge(BMesh *bm)
+{
+  SelectionFlushChunkData chunk_data = {0};
+
+  TaskParallelSettings settings;
+  BLI_parallel_range_settings_defaults();
+  settings.use_threading = bm->totedge >= BM_OMP_LIMIT;
+  settings.userdata_chunk = _data;
+  settings.userdata_chunk_size = sizeof(chunk_data);
+  settings.func_reduce = bm_mesh_select_mode_flush_reduce_fn;
+
+  BM_iter_parallel(
+  bm, BM_EDGES_OF_MESH, bm_mesh_select_mode_flush_vert_to_edge_iter_fn, 
NULL, );
+  bm->totedgesel += chunk_data.delta_selection_len;
+}
+
+static void bm_mesh_select_mode_flush_edge_to_face(BMesh *bm)
+{
+  SelectionFlushChunkData chunk_data = {0};
+
+  TaskParallelSettings settings;
+  BLI_parallel_range_settings_defaults();
+  settings.use_threading = bm->totface >= BM_OMP_LIMIT;
+  settings.userdata_chunk = _data;
+  settings.userdata_chunk_size = sizeof(chunk_data);
+  settings.func_reduce = bm_mesh_select_mode_flush_reduce_fn;
+
+  BM_iter_parallel(
+  bm, BM_FACES_OF_MESH, bm_mesh_select_mode_flush_edge_to_face_iter_fn, 
NULL, );
+  bm->totfacesel += chunk_data.delta_selection_len;
+}
+
 /**
  * \brief Select Mode Flush
  *
@@ -333,56 +433,12 @@ void BM_mesh_select_mode_clean(BMesh *bm)
  */
 

[Bf-blender-cvs] [5846dad216d] soc-2021-curves: Exposed 2 functions in editcurve.c and used in curve pen

2021-06-21 Thread dilithjay
Commit: 5846dad216d15049d8c4f829229c73c80035e266
Author: dilithjay
Date:   Mon Jun 21 12:14:44 2021 +0530
Branches: soc-2021-curves
https://developer.blender.org/rB5846dad216d15049d8c4f829229c73c80035e266

Exposed 2 functions in editcurve.c and used in curve pen

===

M   source/blender/editors/curve/curve_intern.h
M   source/blender/editors/curve/editcurve.c
M   source/blender/editors/curve/editcurve_pen.c

===

diff --git a/source/blender/editors/curve/curve_intern.h 
b/source/blender/editors/curve/curve_intern.h
index ebf91e145e6..659510516a1 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -141,6 +141,10 @@ void CURVE_OT_match_texture_space(struct wmOperatorType 
*ot);
 struct GHash *ED_curve_keyindex_hash_duplicate(struct GHash *keyindex);
 void ED_curve_keyindex_update_nurb(struct EditNurb *editnurb, struct Nurb *nu, 
struct Nurb *newnu);
 
+/* exported for editcurve_pen.c */
+bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb, View3D *v3d);
+int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, const 
float location_init[3]);
+
 /* helper functions */
 void ed_editnurb_translate_flag(struct ListBase *editnurb,
 uint8_t flag,
diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index 535ccaa06fd..e6c562dc210 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5109,7 +5109,7 @@ void CURVE_OT_spin(wmOperatorType *ot)
 /** \name Extrude Vertex Operator
  * \{ */
 
-static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb, View3D *v3d)
+bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb, View3D *v3d)
 {
   bool changed = false;
 
@@ -5358,10 +5358,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb 
*editnurb, View3D *v3d)
 /** \name Add Vertex Operator
  * \{ */
 
-static int ed_editcurve_addvert(Curve *cu,
-EditNurb *editnurb,
-View3D *v3d,
-const float location_init[3])
+int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, const 
float location_init[3])
 {
   float center[3];
   float temp[3];
diff --git a/source/blender/editors/curve/editcurve_pen.c 
b/source/blender/editors/curve/editcurve_pen.c
index 8eae7818c0b..f587f7d249a 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -68,396 +68,6 @@
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
-static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb, View3D *v3d)
-{
-  bool changed = false;
-
-  Nurb *cu_actnu;
-  union {
-BezTriple *bezt;
-BPoint *bp;
-void *p;
-  } cu_actvert;
-
-  if (BLI_listbase_is_empty(>nurbs)) {
-return changed;
-  }
-
-  BKE_curve_nurb_vert_active_get(cu, _actnu, _actvert.p);
-  int act_offset = 0;
-
-  LISTBASE_FOREACH (Nurb *, nu, >nurbs) {
-BLI_assert(nu->pntsu > 0);
-int i;
-int pnt_len = nu->pntsu;
-int new_points = 0;
-int offset = 0;
-bool is_prev_selected = false;
-bool duplic_first = false;
-bool duplic_last = false;
-if (nu->type == CU_BEZIER) {
-  BezTriple *bezt, *bezt_prev = NULL;
-  BezTriple bezt_stack;
-  bool is_cyclic = false;
-  if (pnt_len == 1) {
-/* Single point extrusion.
- * Keep `is_prev_selected` false to force extrude. */
-bezt_prev = >bezt[0];
-  }
-  else if (nu->flagu & CU_NURB_CYCLIC) {
-is_cyclic = true;
-bezt_prev = >bezt[pnt_len - 1];
-is_prev_selected = BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt_prev);
-  }
-  else {
-duplic_first = BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, >bezt[0]) &&
-   BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, >bezt[1]);
-
-duplic_last = BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, >bezt[pnt_len - 
2]) &&
-  BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, >bezt[pnt_len - 
1]);
-
-if (duplic_first) {
-  bezt_stack = nu->bezt[0];
-  BEZT_DESEL_ALL(_stack);
-  bezt_prev = _stack;
-}
-if (duplic_last) {
-  new_points++;
-}
-  }
-  i = pnt_len;
-  for (bezt = >bezt[0]; i--; bezt++) {
-bool is_selected = BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt);
-if (bezt_prev && is_prev_selected != is_selected) {
-  new_points++;
-}
-if (bezt == cu_actvert.bezt) {
-  act_offset = new_points;
-}
-bezt_prev = bezt;
-is_prev_selected = is_selected;
-  }
-
-  if (new_points) {
-if (pnt_len == 1) {
-  /* Single point extrusion.
-   * Set `is_prev_selected` as false to force extrude. */
-  BLI_assert(bezt_prev == >bezt[0]);
- 

[Bf-blender-cvs] [ce64cfd6edc] master: Fix T89306: GPencil selection doesn't work correctly with modifiers

2021-06-21 Thread Antonio Vazquez
Commit: ce64cfd6edc2a0ec0aabfd4daaa5f655763cc74b
Author: Antonio Vazquez
Date:   Mon Jun 21 09:52:17 2021 +0200
Branches: master
https://developer.blender.org/rBce64cfd6edc2a0ec0aabfd4daaa5f655763cc74b

Fix T89306: GPencil selection doesn't work correctly with modifiers

The problem was introduced with Bezier modification because the selection code 
was using the original stroke and not the evaluated version.

===

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

===

diff --git a/source/blender/editors/gpencil/gpencil_select.c 
b/source/blender/editors/gpencil/gpencil_select.c
index e1776988186..55521ac4d15 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -1276,7 +1276,7 @@ static bool gpencil_stroke_do_circle_sel(bGPdata *gpd,
 pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
 
 bGPDspoint pt_temp;
-gpencil_point_to_parent_space(pt_active, diff_mat, _temp);
+gpencil_point_to_parent_space(pt, diff_mat, _temp);
 gpencil_point_to_xy(gsc, gps, _temp, , );
 
 /* do boundbox check first */
@@ -1847,7 +1847,7 @@ static bool gpencil_generic_stroke_select(bContext *C,
 bGPDspoint *pt;
 int i;
 bool hit = false;
-for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) 
{
+for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
   bGPDspoint *pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
 
   /* convert point coords to screenspace */
@@ -1889,7 +1889,7 @@ static bool gpencil_generic_stroke_select(bContext *C,
   mval[0] = (box.xmax + box.xmin) / 2;
   mval[1] = (box.ymax + box.ymin) / 2;
 
-  whole = ED_gpencil_stroke_point_is_inside(gps_active, , mval, 
gpstroke_iter.diff_mat);
+  whole = ED_gpencil_stroke_point_is_inside(gps, , mval, 
gpstroke_iter.diff_mat);
 }
 
 /* if stroke mode expand selection. */
@@ -2252,7 +2252,7 @@ static int gpencil_select_exec(bContext *C, wmOperator 
*op)
   int i;
 
   /* firstly, check for hit-point */
-  for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, 
pt++) {
+  for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
 int xy[2];
 
 bGPDspoint pt2;

___
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] [2b37edebdff] soc-2021-uv-editor-improvements: Merge branch 'master' into soc-2021-uv-editor-improvements

2021-06-21 Thread Siddhartha Jejurkar
Commit: 2b37edebdfff71ec0ab10398b47da480e8fb27e6
Author: Siddhartha Jejurkar
Date:   Mon Jun 21 19:10:47 2021 +0530
Branches: soc-2021-uv-editor-improvements
https://developer.blender.org/rB2b37edebdfff71ec0ab10398b47da480e8fb27e6

Merge branch 'master' into soc-2021-uv-editor-improvements

===



===



___
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] [f7d7a5aad73] tmp-vulkan: Cleanup: Silence compilation warning.

2021-06-21 Thread Jeroen Bakker
Commit: f7d7a5aad736f3e699d762ad02b1becf23ba91fd
Author: Jeroen Bakker
Date:   Mon Jun 21 15:13:09 2021 +0200
Branches: tmp-vulkan
https://developer.blender.org/rBf7d7a5aad736f3e699d762ad02b1becf23ba91fd

Cleanup: Silence compilation warning.

===

M   source/blender/gpu/intern/gpu_context.cc

===

diff --git a/source/blender/gpu/intern/gpu_context.cc 
b/source/blender/gpu/intern/gpu_context.cc
index 21938595219..91a54b8a173 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -182,12 +182,12 @@ void GPU_backend_init(eGPUBackendType backend_type)
   BLI_assert(g_backend == nullptr);
 
   switch (backend_type) {
-#if WITH_OPENGL_BACKEND
+#ifdef WITH_OPENGL_BACKEND
 case GPU_BACKEND_OPENGL:
   g_backend = new GLBackend;
   break;
 #endif
-#if WITH_VULKAN
+#ifdef WITH_VULKAN
 case GPU_BACKEND_VULKAN:
   g_backend = new VKBackend;
   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] [ce865d3f721] cycles-x: Merge branch 'master' into cycles-x

2021-06-21 Thread Sergey Sharybin
Commit: ce865d3f721f954862ae43d5af9393f55660a6f6
Author: Sergey Sharybin
Date:   Mon Jun 21 14:59:04 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBce865d3f721f954862ae43d5af9393f55660a6f6

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] [4246898ad30] master: Cleanup: move function parameter to member

2021-06-21 Thread Manuel Castilla
Commit: 4246898ad301b2a51dae5102be53b05e8d23e362
Author: Manuel Castilla
Date:   Mon Jun 21 13:09:40 2021 +0200
Branches: master
https://developer.blender.org/rB4246898ad301b2a51dae5102be53b05e8d23e362

Cleanup: move function parameter to member

Get current pass only when needed.

===

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

===

diff --git a/source/blender/compositor/intern/COM_MultiThreadedOperation.cc 
b/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
index c54c2edccb0..b080f44d02d 100644
--- a/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
+++ b/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
@@ -6,6 +6,7 @@ namespace blender::compositor {
 MultiThreadedOperation::MultiThreadedOperation()
 {
   m_num_passes = 1;
+  current_pass_ = 0;
   flags.is_fullframe_operation = true;
 }
 
@@ -14,12 +15,12 @@ void 
MultiThreadedOperation::update_memory_buffer(MemoryBuffer *output,
   blender::Span inputs,
   ExecutionSystem _system)
 {
-  for (int current_pass = 0; current_pass < m_num_passes; current_pass++) {
-update_memory_buffer_started(output, output_area, inputs, exec_system, 
current_pass);
+  for (current_pass_ = 0; current_pass_ < m_num_passes; current_pass_++) {
+update_memory_buffer_started(output, output_area, inputs, exec_system);
 exec_system.execute_work(output_area, [=, _system](const rcti 
_rect) {
-  update_memory_buffer_partial(output, split_rect, inputs, exec_system, 
current_pass);
+  update_memory_buffer_partial(output, split_rect, inputs, exec_system);
 });
-update_memory_buffer_finished(output, output_area, inputs, exec_system, 
current_pass);
+update_memory_buffer_finished(output, output_area, inputs, exec_system);
   }
 }
 
diff --git a/source/blender/compositor/intern/COM_MultiThreadedOperation.h 
b/source/blender/compositor/intern/COM_MultiThreadedOperation.h
index 97c5fba4ead..6b8a2f273b7 100644
--- a/source/blender/compositor/intern/COM_MultiThreadedOperation.h
+++ b/source/blender/compositor/intern/COM_MultiThreadedOperation.h
@@ -28,6 +28,10 @@ class MultiThreadedOperation : public NodeOperation {
* Number of execution passes.
*/
   int m_num_passes;
+  /**
+   * Current execution pass.
+   */
+  int current_pass_;
 
  protected:
   MultiThreadedOperation();
@@ -38,8 +42,7 @@ class MultiThreadedOperation : public NodeOperation {
   virtual void update_memory_buffer_started(MemoryBuffer *UNUSED(output),
 const rcti (output_rect),
 blender::Span 
UNUSED(inputs),
-ExecutionSystem 
(exec_system),
-int UNUSED(current_pass))
+ExecutionSystem 
(exec_system))
   {
   }
 
@@ -49,8 +52,7 @@ class MultiThreadedOperation : public NodeOperation {
   virtual void update_memory_buffer_partial(MemoryBuffer *output,
 const rcti _rect,
 blender::Span 
inputs,
-ExecutionSystem _system,
-int current_pass) = 0;
+ExecutionSystem _system) = 0;
 
   /**
* Called after an update memory buffer pass is executed. Single-threaded 
calls.
@@ -58,8 +60,7 @@ class MultiThreadedOperation : public NodeOperation {
   virtual void update_memory_buffer_finished(MemoryBuffer *UNUSED(output),
  const rcti (output_rect),
  blender::Span 
UNUSED(inputs),
- ExecutionSystem 
(exec_system),
- int UNUSED(current_pass))
+ ExecutionSystem 
(exec_system))
   {
   }

___
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] [3cf39c09bfe] master: Cleanup: improve naming in Compositor

2021-06-21 Thread Manuel Castilla
Commit: 3cf39c09bfe7d95a6114dbde6e2b0d8f49ab5f29
Author: Manuel Castilla
Date:   Mon Jun 21 13:39:23 2021 +0200
Branches: master
https://developer.blender.org/rB3cf39c09bfe7d95a6114dbde6e2b0d8f49ab5f29

Cleanup: improve naming in Compositor

===

M   source/blender/compositor/intern/COM_MultiThreadedOperation.cc
M   source/blender/compositor/intern/COM_MultiThreadedOperation.h
M   source/blender/compositor/intern/COM_NodeOperation.cc
M   source/blender/compositor/intern/COM_NodeOperation.h
M   source/blender/compositor/operations/COM_SetColorOperation.cc
M   source/blender/compositor/operations/COM_SetColorOperation.h
M   source/blender/compositor/operations/COM_SetValueOperation.cc
M   source/blender/compositor/operations/COM_SetValueOperation.h

===

diff --git a/source/blender/compositor/intern/COM_MultiThreadedOperation.cc 
b/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
index b080f44d02d..aebc3d5671c 100644
--- a/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
+++ b/source/blender/compositor/intern/COM_MultiThreadedOperation.cc
@@ -5,22 +5,22 @@ namespace blender::compositor {
 
 MultiThreadedOperation::MultiThreadedOperation()
 {
-  m_num_passes = 1;
+  num_passes_ = 1;
   current_pass_ = 0;
   flags.is_fullframe_operation = true;
 }
 
 void MultiThreadedOperation::update_memory_buffer(MemoryBuffer *output,
-  const rcti _area,
-  blender::Span inputs,
+  const rcti ,
+  Span inputs,
   ExecutionSystem _system)
 {
-  for (current_pass_ = 0; current_pass_ < m_num_passes; current_pass_++) {
-update_memory_buffer_started(output, output_area, inputs, exec_system);
-exec_system.execute_work(output_area, [=, _system](const rcti 
_rect) {
+  for (current_pass_ = 0; current_pass_ < num_passes_; current_pass_++) {
+update_memory_buffer_started(output, area, inputs, exec_system);
+exec_system.execute_work(area, [=, _system](const rcti _rect) {
   update_memory_buffer_partial(output, split_rect, inputs, exec_system);
 });
-update_memory_buffer_finished(output, output_area, inputs, exec_system);
+update_memory_buffer_finished(output, area, inputs, exec_system);
   }
 }
 
diff --git a/source/blender/compositor/intern/COM_MultiThreadedOperation.h 
b/source/blender/compositor/intern/COM_MultiThreadedOperation.h
index 6b8a2f273b7..d30201a7dcf 100644
--- a/source/blender/compositor/intern/COM_MultiThreadedOperation.h
+++ b/source/blender/compositor/intern/COM_MultiThreadedOperation.h
@@ -27,7 +27,7 @@ class MultiThreadedOperation : public NodeOperation {
   /**
* Number of execution passes.
*/
-  int m_num_passes;
+  int num_passes_;
   /**
* Current execution pass.
*/
@@ -40,34 +40,34 @@ class MultiThreadedOperation : public NodeOperation {
* Called before an update memory buffer pass is executed. Single-threaded 
calls.
*/
   virtual void update_memory_buffer_started(MemoryBuffer *UNUSED(output),
-const rcti (output_rect),
-blender::Span 
UNUSED(inputs),
+const rcti (area),
+Span 
UNUSED(inputs),
 ExecutionSystem 
(exec_system))
   {
   }
 
   /**
-   * Executes operation updating output memory buffer on output_rect area. 
Multi-threaded calls.
+   * Executes operation updating a memory buffer area. Multi-threaded calls.
*/
   virtual void update_memory_buffer_partial(MemoryBuffer *output,
-const rcti _rect,
-blender::Span 
inputs,
+const rcti ,
+Span inputs,
 ExecutionSystem _system) = 0;
 
   /**
* Called after an update memory buffer pass is executed. Single-threaded 
calls.
*/
   virtual void update_memory_buffer_finished(MemoryBuffer *UNUSED(output),
- const rcti (output_rect),
- blender::Span 
UNUSED(inputs),
+ const rcti (area),
+ Span 
UNUSED(inputs),
  ExecutionSystem 
(exec_system))
   {
   }
 
  private:
   void update_memory_buffer(MemoryBuffer *output,
-const rcti _area,
-blender::Span inputs,
+   

[Bf-blender-cvs] [2851602052c] master: Add a reason for why an Addon can not be loaded. This change gives a more detailed explanation of the issue and may help the Addon Developer to identify what exa

2021-06-21 Thread Gaia Clary
Commit: 2851602052ccd03034bb0f16f71a07f2471da5ec
Author: Gaia Clary
Date:   Sun Jun 20 22:57:58 2021 +0200
Branches: master
https://developer.blender.org/rB2851602052ccd03034bb0f16f71a07f2471da5ec

Add a reason for why an Addon can not be loaded. This change gives a more 
detailed explanation of the issue and may help the Addon Developer to identify 
what exactly needs to be changed.

The current message 'addon not loaded' is a bit too sparse.

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

===

M   release/scripts/modules/addon_utils.py

===

diff --git a/release/scripts/modules/addon_utils.py 
b/release/scripts/modules/addon_utils.py
index 239dd1cf79b..73b978d7d2d 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -358,7 +358,8 @@ def enable(module_name, *, default_set=False, 
persistent=False, handle_error=Non
 except Exception as ex:
 # if the addon doesn't exist, don't print full traceback
 if type(ex) is ImportError and ex.name == module_name:
-print("addon not found:", repr(module_name))
+print("addon not loaded:", repr(module_name))
+print("cause:", str(ex))
 else:
 handle_error(ex)

___
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] [4968a0bdf9e] master: Fix T89122: crash when multi input is connected to multiple group inputs

2021-06-21 Thread Jacques Lucke
Commit: 4968a0bdf9ec16134a545678eabb922f04ed8315
Author: Jacques Lucke
Date:   Mon Jun 21 12:15:32 2021 +0200
Branches: master
https://developer.blender.org/rB4968a0bdf9ec16134a545678eabb922f04ed8315

Fix T89122: crash when multi input is connected to multiple group inputs

The early `return` was wrong when there are multiple origin sockets
that need to be loaded.

===

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

===

diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc 
b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index 01eebfea333..e8677c7ce1a 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -1041,13 +1041,14 @@ class GeometryNodesEvaluator {
 this->load_unlinked_input_value(locked_node, input_socket, 
input_state, origin_socket);
 locked_node.node_state.missing_required_inputs -= 1;
 this->schedule_node(locked_node);
-return;
   }
-  /* The value has not been computed yet, so when it will be forwarded by 
another node, this
-   * node will be triggered. */
-  will_be_triggered_by_other_node = true;
+  else {
+/* The value has not been computed yet, so when it will be forwarded 
by another node, this
+ * node will be triggered. */
+will_be_triggered_by_other_node = true;
 
-  
locked_node.delayed_required_outputs.append(DOutputSocket(origin_socket));
+
locked_node.delayed_required_outputs.append(DOutputSocket(origin_socket));
+  }
 }
 /* If this node will be triggered by another node, we don't have to 
schedule it now. */
 if (!will_be_triggered_by_other_node) {

___
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] [f383cad3299] master: Fix T89329: icosphere subdivisions can be set to 0

2021-06-21 Thread Daniel Salazar
Commit: f383cad32993c3a413d649158b9212c0363b62f9
Author: Daniel Salazar
Date:   Mon Jun 21 11:09:41 2021 +0200
Branches: master
https://developer.blender.org/rBf383cad32993c3a413d649158b9212c0363b62f9

Fix T89329: icosphere subdivisions can be set to 0

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

===

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

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc 
b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
index a3a1b72006c..f43a4bc6490 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
@@ -26,7 +26,7 @@
 
 static bNodeSocketTemplate geo_node_mesh_primitive_ico_sphere_in[] = {
 {SOCK_FLOAT, N_("Radius"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX, 
PROP_DISTANCE},
-{SOCK_INT, N_("Subdivisions"), 1, 0, 0, 0, 0, 7},
+{SOCK_INT, N_("Subdivisions"), 1, 0, 0, 0, 1, 7},
 {-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] [e87ebf96238] asset-browser-poselib: Merge branch 'master' into asset-browser-poselib

2021-06-21 Thread Julian Eisel
Commit: e87ebf96238499921c9373304ee90a0f239100f4
Author: Julian Eisel
Date:   Mon Jun 21 10:51:10 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rBe87ebf96238499921c9373304ee90a0f239100f4

Merge branch 'master' into asset-browser-poselib

===



===

diff --cc source/blender/blenloader/intern/versioning_300.c
index 60650edcea6,0fe1267b871..fd014da3d32
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@@ -30,9 -32,9 +32,11 @@@
  #include "DNA_listBase.h"
  #include "DNA_modifier_types.h"
  #include "DNA_text_types.h"
 +#include "DNA_workspace_types.h"
  
+ #include "BKE_animsys.h"
 +#include "BKE_asset.h"
+ #include "BKE_fcurve_driver.h"
  #include "BKE_lib_id.h"
  #include "BKE_main.h"
  #include "BKE_node.h"
@@@ -262,13 -365,43 +367,51 @@@ void blo_do_versions_300(FileData *fd, 
}
  }
  
+ /* Initialize length-wise scale B-Bone settings. */
+ if (!DNA_struct_elem_find(fd->filesdna, "Bone", "int", "bbone_flag")) {
+   /* Update armature data and pose channels. */
+   LISTBASE_FOREACH (bArmature *, arm, >armatures) {
+ do_version_bones_bbone_len_scale(>bonebase);
+   }
+ 
+   LISTBASE_FOREACH (Object *, ob, >objects) {
+ if (ob->pose) {
+   LISTBASE_FOREACH (bPoseChannel *, pchan, >pose->chanbase) {
+ copy_v3_fl3(pchan->scale_in, pchan->scale_in_x, 1.0f, 
pchan->scale_in_z);
+ copy_v3_fl3(pchan->scale_out, pchan->scale_out_x, 1.0f, 
pchan->scale_out_z);
+   }
+ }
+   }
+ 
+   /* Update action curves and drivers. */
+   LISTBASE_FOREACH (bAction *, act, >actions) {
+ LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, >curves) {
+   do_version_bbone_len_scale_fcurve_fix(fcu);
+ }
+   }
+ 
+   BKE_animdata_main_cb(bmain, do_version_bbone_len_scale_animdata_cb, 
NULL);
+ }
+   }
+ 
+   /**
+* Versioning code until next subversion bump goes here.
+*
+* \note Be sure to check when bumping the version:
+* - "versioning_userdef.c", #blo_do_versions_userdef
+* - "versioning_userdef.c", #do_versions_theme
+*
+* \note Keep this message at the bottom of the function.
+*/
+   {
+ /* Keep this block, even when empty. */
 +{
 +  if (!DNA_struct_elem_find(
 +  fd->filesdna, "WorkSpace", "AssetLibraryReference", 
"active_asset_library")) {
 +LISTBASE_FOREACH (WorkSpace *, workspace, >workspaces) {
 +  
BKE_asset_library_reference_init_default(>active_asset_library);
 +}
 +  }
 +}
}
  }
diff --cc source/blender/editors/space_file/filelist.c
index 0a22e5c0f65,37a32164cfc..d5e69a32574
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@@ -1555,10 -1553,8 +1555,9 @@@ static void filelist_cache_preview_free
  static void filelist_cache_preview_ensure_running(FileListEntryCache *cache)
  {
if (!cache->previews_pool) {
- cache->previews_pool = BLI_task_pool_create_background(
- cache, TASK_PRIORITY_LOW, TASK_ISOLATION_ON);
+ cache->previews_pool = BLI_task_pool_create_background(cache, 
TASK_PRIORITY_LOW);
  cache->previews_done = BLI_thread_queue_init();
 +cache->previews_todo_count = 0;
  
  IMB_thumb_locks_acquire();
}

___
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] [002d563bbbf] master: Cleanup: use doxy sections in view3d iterators

2021-06-21 Thread Campbell Barton
Commit: 002d563bbbfcbb64d08bd4df30e095383a925412
Author: Campbell Barton
Date:   Mon Jun 21 18:16:10 2021 +1000
Branches: master
https://developer.blender.org/rB002d563bbbfcbb64d08bd4df30e095383a925412

Cleanup: use doxy sections in view3d iterators

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_iterators.c 
b/source/blender/editors/space_view3d/view3d_iterators.c
index 2b9ae563b7d..0eb594fb3dc 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -99,6 +99,10 @@ static int content_planes_from_clip_flag(const ARegion 
*region,
 
 /** \} */
 
+/*  */
+/** \name Private User Data Structures
+ * \{ */
+
 typedef struct foreachScreenObjectVert_userData {
   void (*func)(void *userData, MVert *mv, const float screen_co_b[2], int 
index);
   void *userData;
@@ -148,7 +152,11 @@ typedef struct foreachScreenFace_userData {
  * use the object matrix in the usual way.
  */
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Mesh: For Each Screen Vertex
+ * \{ */
 
 static void meshobject_foreachScreenVert__mapFunc(void *userData,
   int index,
@@ -247,7 +255,11 @@ void mesh_foreachScreenVert(
   BKE_mesh_foreach_mapped_vert(me, mesh_foreachScreenVert__mapFunc, , 
MESH_FOREACH_NOP);
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Mesh: For Each Screen Mesh Edge
+ * \{ */
 
 /**
  * Edge projection is more involved since part of the edge may be behind the 
view
@@ -389,7 +401,11 @@ void mesh_foreachScreenEdge(ViewContext *vc,
   BKE_mesh_foreach_mapped_edge(me, mesh_foreachScreenEdge__mapFunc, );
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Mesh: For Each Screen Edge (Bounding Box Clipped)
+ * \{ */
 
 /**
  * Only call for bound-box clipping.
@@ -479,7 +495,11 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext 
*vc,
   }
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Mesh: For Each Screen Face Center
+ * \{ */
 
 static void mesh_foreachScreenFace__mapFunc(void *userData,
 int index,
@@ -531,7 +551,11 @@ void mesh_foreachScreenFace(
   }
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Nurbs: For Each Screen Vertex
+ * \{ */
 
 void nurbs_foreachScreenVert(ViewContext *vc,
  void (*func)(void *userData,
@@ -619,7 +643,11 @@ void nurbs_foreachScreenVert(ViewContext *vc,
   }
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Meta: For Each Screen Meta-Element
+ * \{ */
 
 /* ED_view3d_init_mats_rv3d must be called first */
 void mball_foreachScreenElem(struct ViewContext *vc,
@@ -643,7 +671,11 @@ void mball_foreachScreenElem(struct ViewContext *vc,
   }
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Lattice: For Each Screen Vertex
+ * \{ */
 
 void lattice_foreachScreenVert(ViewContext *vc,
void (*func)(void *userData, BPoint *bp, const 
float screen_co[2]),
@@ -676,7 +708,11 @@ void lattice_foreachScreenVert(ViewContext *vc,
   }
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Edit-Armature: For Each Screen Bone
+ * \{ */
 
 /* ED_view3d_init_mats_rv3d must be called first */
 void armature_foreachScreenBone(struct ViewContext *vc,
@@ -724,7 +760,11 @@ void armature_foreachScreenBone(struct ViewContext *vc,
   }
 }
 
-/*  */
+/** \} */
+
+/*  */
+/** \name Pose: For Each Screen Bone
+ * \{ */
 
 /* ED_view3d_init_mats_rv3d must be called first */
 /* almost _exact_ 

[Bf-blender-cvs] [4d91808710b] master: Cleanup: variable naming in view3d_iterators

2021-06-21 Thread Campbell Barton
Commit: 4d91808710b459a1814999b97a272d62bb503c2d
Author: Campbell Barton
Date:   Mon Jun 21 18:01:12 2021 +1000
Branches: master
https://developer.blender.org/rB4d91808710b459a1814999b97a272d62bb503c2d

Cleanup: variable naming in view3d_iterators

Consistently use a/b instead of 0/1.

===

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

===

diff --git a/source/blender/editors/space_view3d/view3d_iterators.c 
b/source/blender/editors/space_view3d/view3d_iterators.c
index 72606e472b9..2b9ae563b7d 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -258,8 +258,8 @@ void mesh_foreachScreenVert(
  * \note This is unrelated to #V3D_PROJ_TEST_CLIP_BB which must be checked 
separately.
  */
 static bool mesh_foreachScreenEdge_shared_project_and_test(const ARegion 
*region,
-   const float v0co[3],
-   const float v1co[3],
+   const float v_a[3],
+   const float v_b[3],
const eV3DProjTest 
clip_flag,
const rctf 
*win_rect,
const float 
content_planes[][4],
@@ -272,9 +272,9 @@ static bool 
mesh_foreachScreenEdge_shared_project_and_test(const ARegion *region
   eV3DProjTest clip_flag_nowin = clip_flag & ~V3D_PROJ_TEST_CLIP_WIN;
 
   const eV3DProjStatus status_a = ED_view3d_project_float_object(
-  region, v0co, r_screen_co_a, clip_flag_nowin);
+  region, v_a, r_screen_co_a, clip_flag_nowin);
   const eV3DProjStatus status_b = ED_view3d_project_float_object(
-  region, v1co, r_screen_co_b, clip_flag_nowin);
+  region, v_b, r_screen_co_b, clip_flag_nowin);
 
   if ((status_a == V3D_PROJ_RET_OK) && (status_b == V3D_PROJ_RET_OK)) {
 if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) {
@@ -299,15 +299,15 @@ static bool 
mesh_foreachScreenEdge_shared_project_and_test(const ARegion *region
 }
 
 /* Simple cases have been ruled out, clip by viewport planes, then 
re-project. */
-float v0co_clip[3], v1co_clip[3];
+float v_a_clip[3], v_b_clip[3];
 if (!clip_segment_v3_plane_n(
-v0co, v1co, content_planes, content_planes_len, v0co_clip, 
v1co_clip)) {
+v_a, v_b, content_planes, content_planes_len, v_a_clip, v_b_clip)) 
{
   return false;
 }
 
-if ((ED_view3d_project_float_object(region, v0co_clip, r_screen_co_a, 
clip_flag_nowin) !=
+if ((ED_view3d_project_float_object(region, v_a_clip, r_screen_co_a, 
clip_flag_nowin) !=
  V3D_PROJ_RET_OK) ||
-(ED_view3d_project_float_object(region, v1co_clip, r_screen_co_b, 
clip_flag_nowin) !=
+(ED_view3d_project_float_object(region, v_b_clip, r_screen_co_b, 
clip_flag_nowin) !=
  V3D_PROJ_RET_OK)) {
   return false;
 }
@@ -321,8 +321,8 @@ static bool 
mesh_foreachScreenEdge_shared_project_and_test(const ARegion *region
 
 static void mesh_foreachScreenEdge__mapFunc(void *userData,
 int index,
-const float v0co[3],
-const float v1co[3])
+const float v_a[3],
+const float v_b[3])
 {
   foreachScreenEdge_userData *data = userData;
   BMEdge *eed = BM_edge_at_index(data->vc.em->bm, index);
@@ -332,8 +332,8 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData,
 
   float screen_co_a[2], screen_co_b[2];
   if (!mesh_foreachScreenEdge_shared_project_and_test(data->vc.region,
-  v0co,
-  v1co,
+  v_a,
+  v_b,
   data->clip_flag,
   >win_rect,
   data->content_planes,
@@ -397,8 +397,8 @@ void mesh_foreachScreenEdge(ViewContext *vc,
  */
 static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *userData,
 int index,
-const float 
v0co[3],
-const float 
v1co[3])
+const float v_a[3],
+const 

[Bf-blender-cvs] [4044c29069a] master: Fix T32214: Wireframe edge select fails with verts behind the view

2021-06-21 Thread Campbell Barton
Commit: 4044c29069aa3230767fa6d1a3dec196718f80df
Author: Campbell Barton
Date:   Mon Jun 21 17:25:10 2021 +1000
Branches: master
https://developer.blender.org/rB4044c29069aa3230767fa6d1a3dec196718f80df

Fix T32214: Wireframe edge select fails with verts behind the view

This resolves a long standing bug in edge selection
(picking, circle, box & lasso).

Now when one of the edges vertices fails to project into screen space,
the edge is clipped by the viewport to calculate an on-screen location
that can be used instead.

This isn't default as it may be important for the on the screen location
not to be clipped by the viewport.

===

M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/mesh/editmesh_select.c
M   source/blender/editors/space_view3d/view3d_iterators.c
M   source/blender/editors/space_view3d/view3d_select.c

===

diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index bdaea7d8bff..d86041aa6e8 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -196,12 +196,38 @@ typedef enum {
   V3D_PROJ_TEST_CLIP_NEAR = (1 << 2),
   V3D_PROJ_TEST_CLIP_FAR = (1 << 3),
   V3D_PROJ_TEST_CLIP_ZERO = (1 << 4),
+  /**
+   * Clip the contents of the data being iterated over.
+   * Currently this is only used to edges when projecting into screen space.
+   *
+   * Clamp the edge within the viewport limits defined by
+   * #V3D_PROJ_TEST_CLIP_WIN, #V3D_PROJ_TEST_CLIP_NEAR & 
#V3D_PROJ_TEST_CLIP_FAR.
+   * This resolves the problem of a visible edge having one of it's vertices
+   * behind the viewport. See: T32214.
+   *
+   * This is not default behavior as it may be important for the screen-space 
location
+   * of an edges vertex to represent that vertices location (instead of a 
location along the edge).
+   *
+   * \note Perspective views should enable #V3D_PROJ_TEST_CLIP_WIN along with
+   * #V3D_PROJ_TEST_CLIP_NEAR as the near-plane-clipped location of a point
+   * may become very large (even infinite) when projected into screen-space.
+   * Unless the that point happens to coincide with the camera's point of view.
+   *
+   * Use #V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT instead of 
#V3D_PROJ_TEST_CLIP_CONTENT,
+   * to avoid accidentally enabling near clipping without clipping by window 
bounds.
+   */
+  V3D_PROJ_TEST_CLIP_CONTENT = (1 << 5),
 } eV3DProjTest;
 
 #define V3D_PROJ_TEST_CLIP_DEFAULT \
   (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR)
 #define V3D_PROJ_TEST_ALL \
-  (V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_FAR | 
V3D_PROJ_TEST_CLIP_ZERO)
+  (V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_FAR | 
V3D_PROJ_TEST_CLIP_ZERO | \
+   V3D_PROJ_TEST_CLIP_CONTENT)
+
+#define V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT \
+  (V3D_PROJ_TEST_CLIP_CONTENT | V3D_PROJ_TEST_CLIP_NEAR | 
V3D_PROJ_TEST_CLIP_FAR | \
+   V3D_PROJ_TEST_CLIP_WIN)
 
 /* view3d_iterators.c */
 
diff --git a/source/blender/editors/mesh/editmesh_select.c 
b/source/blender/editors/mesh/editmesh_select.c
index 6e5dd47e282..b21645a1a5d 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -547,8 +547,10 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
 
   ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
-  mesh_foreachScreenEdge(
-  vc, find_nearest_edge_center__doZBuf, , 
V3D_PROJ_TEST_CLIP_DEFAULT);
+  mesh_foreachScreenEdge(vc,
+ find_nearest_edge_center__doZBuf,
+ ,
+ V3D_PROJ_TEST_CLIP_DEFAULT | 
V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT);
 
   *r_dist_center_px_manhattan = data.dist;
 }
@@ -601,7 +603,8 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
 *dist_px_manhattan_p;
 
 ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-mesh_foreachScreenEdge(vc, find_nearest_edge__doClosest, , clip_flag);
+mesh_foreachScreenEdge(
+vc, find_nearest_edge__doClosest, , clip_flag | 
V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT);
 
 hit = (data.use_cycle && data.hit_cycle.edge) ? _cycle : 

 
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c 
b/source/blender/editors/space_view3d/view3d_iterators.c
index 190cc787eea..72606e472b9 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -50,6 +50,55 @@
 #include "ED_screen.h"
 #include "ED_view3d.h"
 
+/*  */
+/** \name Clipping Plane Utility
+ *
+ * Calculate clipping planes to use when #V3D_PROJ_TEST_CLIP_CONTENT is 
enabled.
+ * \{ */
+
+/**
+ * Calculate clip planes from the viewpoint using `clip_flag`
+ * to detect which planes should be applied (maximum 

[Bf-blender-cvs] [19df0e3cfd5] master: Cleanup: swap top/bottom args to planes_from_projmat

2021-06-21 Thread Campbell Barton
Commit: 19df0e3cfd5b9fed891ed81dd1123b2351605a7d
Author: Campbell Barton
Date:   Mon Jun 21 17:25:09 2021 +1000
Branches: master
https://developer.blender.org/rB19df0e3cfd5b9fed891ed81dd1123b2351605a7d

Cleanup: swap top/bottom args to planes_from_projmat

X & Z were ordered min/max, where as Y was max/min.

===

M   source/blender/blenlib/BLI_math_geom.h
M   source/blender/blenlib/intern/math_geom.c
M   source/blender/draw/intern/draw_manager_data.c
M   source/blender/editors/mesh/editmesh_knife.c

===

diff --git a/source/blender/blenlib/BLI_math_geom.h 
b/source/blender/blenlib/BLI_math_geom.h
index 49188964f3b..43b31d76bb0 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -677,8 +677,8 @@ void window_translate_m4(float winmat[4][4], float 
perspmat[4][4], const float x
 void planes_from_projmat(const float mat[4][4],
  float left[4],
  float right[4],
- float top[4],
  float bottom[4],
+ float top[4],
  float near[4],
  float far[4]);
 
diff --git a/source/blender/blenlib/intern/math_geom.c 
b/source/blender/blenlib/intern/math_geom.c
index 0a5dc8517d8..7de6e9f843a 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -4911,8 +4911,8 @@ void window_translate_m4(float winmat[4][4], float 
perspmat[4][4], const float x
 void planes_from_projmat(const float mat[4][4],
  float left[4],
  float right[4],
- float top[4],
  float bottom[4],
+ float top[4],
  float near[4],
  float far[4])
 {
diff --git a/source/blender/draw/intern/draw_manager_data.c 
b/source/blender/draw/intern/draw_manager_data.c
index 3b852e7f8c8..56909969dd7 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -1572,8 +1572,8 @@ static void draw_frustum_culling_planes_calc(const float 
(*persmat)[4], float (*
   planes_from_projmat(persmat,
   frustum_planes[0],
   frustum_planes[5],
-  frustum_planes[3],
   frustum_planes[1],
+  frustum_planes[3],
   frustum_planes[4],
   frustum_planes[2]);
 
diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index f7cc95af619..2ba1d30900a 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -272,8 +272,7 @@ static void knifetool_draw_angle_snapping(const 
KnifeTool_OpData *kcd)
   float v1[3], v2[3];
   float planes[4][4];
 
-  planes_from_projmat(
-  (const float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], 
planes[1], NULL, NULL);
+  planes_from_projmat(kcd->projmat, planes[2], planes[0], planes[1], 
planes[3], NULL, NULL);
 
   /* ray-cast all planes */
   {

___
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] [54d651c3445] master: Cleanup: pass objects as const arguments

2021-06-21 Thread Campbell Barton
Commit: 54d651c34459ee482490752f6d64727f15068b4e
Author: Campbell Barton
Date:   Mon Jun 21 17:25:10 2021 +1000
Branches: master
https://developer.blender.org/rB54d651c34459ee482490752f6d64727f15068b4e

Cleanup: pass objects as const arguments

===

M   source/blender/blenkernel/BKE_object.h
M   source/blender/blenkernel/intern/object.c
M   source/blender/editors/include/ED_view3d.h
M   source/blender/editors/space_view3d/space_view3d.c
M   source/blender/editors/space_view3d/view3d_project.c

===

diff --git a/source/blender/blenkernel/BKE_object.h 
b/source/blender/blenkernel/BKE_object.h
index f3a5c794de8..604bf0548c3 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -337,9 +337,9 @@ bool BKE_object_obdata_texspace_get(struct Object *ob,
 float **r_loc,
 float **r_size);
 
-struct Mesh *BKE_object_get_evaluated_mesh(struct Object *object);
-struct Mesh *BKE_object_get_pre_modified_mesh(struct Object *object);
-struct Mesh *BKE_object_get_original_mesh(struct Object *object);
+struct Mesh *BKE_object_get_evaluated_mesh(const struct Object *object);
+struct Mesh *BKE_object_get_pre_modified_mesh(const struct Object *object);
+struct Mesh *BKE_object_get_original_mesh(const struct Object *object);
 
 /* Lattice accessors.
  * These functions return either the regular lattice, or the edit-mode lattice,
diff --git a/source/blender/blenkernel/intern/object.c 
b/source/blender/blenkernel/intern/object.c
index b73f6a5b78c..52cdf35085a 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -4447,7 +4447,7 @@ bool BKE_object_obdata_texspace_get(Object *ob, short 
**r_texflag, float **r_loc
 }
 
 /** Get evaluated mesh for given object. */
-Mesh *BKE_object_get_evaluated_mesh(Object *object)
+Mesh *BKE_object_get_evaluated_mesh(const Object *object)
 {
   ID *data_eval = object->runtime.data_eval;
   return (data_eval && GS(data_eval->name) == ID_ME) ? (Mesh *)data_eval : 
NULL;
@@ -4460,7 +4460,7 @@ Mesh *BKE_object_get_evaluated_mesh(Object *object)
  * - For copied-on-write objects it will give pointer to a copied-on-write
  *   mesh which corresponds to original object's mesh.
  */
-Mesh *BKE_object_get_pre_modified_mesh(Object *object)
+Mesh *BKE_object_get_pre_modified_mesh(const Object *object)
 {
   if (object->type == OB_MESH && object->runtime.data_orig != NULL) {
 BLI_assert(object->id.tag & LIB_TAG_COPIED_ON_WRITE);
@@ -4481,7 +4481,7 @@ Mesh *BKE_object_get_pre_modified_mesh(Object *object)
  * - For evaluated objects it will be same mesh as corresponding original
  *   object uses as data.
  */
-Mesh *BKE_object_get_original_mesh(Object *object)
+Mesh *BKE_object_get_original_mesh(const Object *object)
 {
   Mesh *result = NULL;
   if (object->id.orig_id == NULL) {
diff --git a/source/blender/editors/include/ED_view3d.h 
b/source/blender/editors/include/ED_view3d.h
index 52d69d12253..bdaea7d8bff 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -404,7 +404,7 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph 
*depsgraph,
   float r_ray_end[3],
   const bool do_clip);
 void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d,
-  struct Object *ob,
+  const struct Object *ob,
   float r_pmat[4][4]);
 void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d,
  const float obmat[4][4],
@@ -578,8 +578,8 @@ bool ED_view3d_area_user_region(const struct ScrArea *area,
 struct ARegion **r_region);
 bool ED_operator_rv3d_user_region_poll(struct bContext *C);
 
-void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
-void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d);
+void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D 
*rv3d);
+void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D 
*rv3d);
 #ifdef DEBUG
 void ED_view3d_clear_mats_rv3d(struct RegionView3D *rv3d);
 void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d);
diff --git a/source/blender/editors/space_view3d/space_view3d.c 
b/source/blender/editors/space_view3d/space_view3d.c
index f17cee8056f..8c356bc1600 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -187,7 +187,7 @@ bool ED_view3d_area_user_region(const ScrArea *area, const 
View3D *v3d, ARegion
  * view3d_project_short_clip and view3d_project_short_noclip in cases where
  * 

[Bf-blender-cvs] [a5f7c7b433e] temp-vse-snapping: Fix hold offset snapping, add defauts to versioning.

2021-06-21 Thread Richard Antalik
Commit: a5f7c7b433ecd472cbefa0fefd819cf5a1ff
Author: Richard Antalik
Date:   Mon Jun 21 09:09:22 2021 +0200
Branches: temp-vse-snapping
https://developer.blender.org/rBa5f7c7b433ecd472cbefa0fefd819cf5a1ff

Fix hold offset snapping, add defauts to versioning.

===

M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/transform/transform_snap_sequencer.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/blenloader/intern/versioning_300.c 
b/source/blender/blenloader/intern/versioning_300.c
index 0fe1267b871..b2c1bc3f1c2 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -42,6 +42,8 @@
 #include "BLO_readfile.h"
 #include "readfile.h"
 
+#include "SEQ_sequencer.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "versioning_common.h"
@@ -403,5 +405,14 @@ void blo_do_versions_300(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
*/
   {
 /* Keep this block, even when empty. */
+LISTBASE_FOREACH (Scene *, scene, >scenes) {
+  SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene);
+  tool_settings->snap_flag = SEQ_SNAP_TO_STRIP_START | 
SEQ_SNAP_TO_STRIP_END |
+ SEQ_SNAP_TO_PLAYHEAD | SEQ_SNAP_TO_STRIP_HOLD 
|
+ SEQ_SNAP_IGNORE_MUTED;
+  tool_settings->snap_source = SEQ_SNAP_EACH_STRIP;
+  tool_settings->snap_side = SEQ_SNAP_SOURCE_SIDE_BOTH;
+  tool_settings->snap_threshold = 25;
+}
   }
 }
diff --git a/source/blender/editors/transform/transform_snap_sequencer.c 
b/source/blender/editors/transform/transform_snap_sequencer.c
index 8e34d11d5bb..7c2ea242850 100644
--- a/source/blender/editors/transform/transform_snap_sequencer.c
+++ b/source/blender/editors/transform/transform_snap_sequencer.c
@@ -53,18 +53,18 @@ typedef struct TransSeqSnapData {
   int *target_snap_points;
   int target_snap_point_count;
 
-  eSeqTransformFlag snap_side;
+  eSeqSnapFlag snap_side;
 } TransSeqSnapData;
 
 /*  */
 /** \name Snap sources
  * \{ */
 
-static eSeqTransformFlag seq_snap_source_side_get(TransInfo *t, SeqCollection 
*snap_sources)
+static eSeqSnapFlag seq_snap_source_side_get(TransInfo *t, SeqCollection 
*snap_sources)
 {
   SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(t->scene);
 
-  if ((tool_settings->snap_side & SEQ_SNAP_SOURCE_MOUSE) == 0) {
+  if ((tool_settings->snap_side & SEQ_SNAP_SOURCE_SIDE_MOUSE) == 0) {
 return tool_settings->snap_side;
   }
 
@@ -82,9 +82,9 @@ static eSeqTransformFlag seq_snap_source_side_get(TransInfo 
*t, SeqCollection *s
   /* Set the snap mode based on how close the mouse is at the end/start 
source_snap_points. */
   int xmouse = (int)UI_view2d_region_to_view_x((View2D *)t->view, 
t->mouse.imval[0]);
   if (abs(xmouse - boundbox_max) > abs(xmouse - boundbox_min)) {
-return SEQ_SNAP_SOURCE_LEFT;
+return SEQ_SNAP_SOURCE_SIDE_LEFT;
   }
-  return SEQ_SNAP_SOURCE_RIGHT;
+  return SEQ_SNAP_SOURCE_SIDE_RIGHT;
 }
 
 static int seq_get_snap_source_points_count(TransInfo *t,
@@ -98,7 +98,7 @@ static int seq_get_snap_source_points_count(TransInfo *t,
 count = SEQ_collection_count(snap_sources);
   }
 
-  if (snap_data->snap_side == SEQ_SNAP_SOURCE_BOTH) {
+  if (snap_data->snap_side == SEQ_SNAP_SOURCE_SIDE_BOTH) {
 count *= 2;
   }
   return count;
@@ -128,11 +128,11 @@ static void seq_snap_source_points_build_set_min_max(
 max = snap_data->source_point_max;
   }
 
-  if (snap_data->snap_side & (SEQ_SNAP_SOURCE_LEFT | SEQ_SNAP_SOURCE_BOTH)) {
+  if (snap_data->snap_side & (SEQ_SNAP_SOURCE_SIDE_LEFT | 
SEQ_SNAP_SOURCE_SIDE_BOTH)) {
 snap_data->source_snap_points[*r_i] = left;
 *r_i += 1;
   }
-  if (snap_data->snap_side & (SEQ_SNAP_SOURCE_RIGHT | SEQ_SNAP_SOURCE_BOTH)) {
+  if (snap_data->snap_side & (SEQ_SNAP_SOURCE_SIDE_RIGHT | 
SEQ_SNAP_SOURCE_SIDE_BOTH)) {
 snap_data->source_snap_points[*r_i] = right;
 *r_i += 1;
   }
@@ -191,11 +191,10 @@ static SeqCollection *query_snap_targets(const TransInfo 
*t)
 if ((seq->flag & SELECT)) {
   continue; /* Selected are being transformed. */
 }
-if ((seq->flag & SEQ_MUTE) && (tool_settings->transform_flag & 
SEQ_SNAP_IGNORE_MUTED)) {
+if ((seq->flag & SEQ_MUTE) && (tool_settings->snap_flag & 
SEQ_SNAP_IGNORE_MUTED)) {
   continue;
 }
-if (seq->type == SEQ_TYPE_SOUND_RAM &&
-(tool_settings->transform_flag & SEQ_SNAP_IGNORE_SOUND)) {
+if (seq->type == SEQ_TYPE_SOUND_RAM && (tool_settings->snap_flag & 
SEQ_SNAP_IGNORE_SOUND)) {
   continue;
 }
 SEQ_collection_append_strip(seq, collection);
@@ -210,19 +209,19 @@ static int 

[Bf-blender-cvs] [3a65f0bfef7] temp-vse-snapping: Update rebased on master, arc pulled some very weird base, and I didn't notice

2021-06-21 Thread Richard Antalik
Commit: 3a65f0bfef7a9774471e2109e6e184100bdd5e15
Author: Richard Antalik
Date:   Sat Jun 19 10:52:06 2021 +0200
Branches: temp-vse-snapping
https://developer.blender.org/rB3a65f0bfef7a9774471e2109e6e184100bdd5e15

Update rebased on master, arc pulled some very weird base, and I didn't notice

===

M   release/scripts/addons
M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/editors/transform/CMakeLists.txt
M   source/blender/editors/transform/transform_convert.h
M   source/blender/editors/transform/transform_convert_sequencer.c
M   source/blender/editors/transform/transform_mode_edge_seq_slide.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap.h
A   source/blender/editors/transform/transform_snap_sequencer.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/sequencer/SEQ_iterator.h
M   source/blender/sequencer/intern/iterator.c

===

diff --git a/release/scripts/addons b/release/scripts/addons
index ec07ed4c2e0..f86f25e6221 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit ec07ed4c2e0495bea7fbe0b546d25e35211506a9
+Subproject commit f86f25e62217264495d05f116ccb09d575fe9841
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 07d9b0ee1f8..dbaae5de233 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -162,6 +162,14 @@ class SEQUENCER_HT_header(Header):
 if tool_settings.use_proportional_edit:
 row.prop(tool_settings, "proportional_edit_falloff", 
icon_only=True)
 
+if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
+tool_settings = context.tool_settings.sequencer_tool_settings
+row = layout.row(align=True)
+row.prop(tool_settings, "use_snapping", text="")
+sub = row.row(align=True)
+sub.popover(panel="SEQUENCER_PT_snapping")
+layout.separator_spacer()
+
 row = layout.row(align=True)
 row.prop(st, "show_strip_overlay", text="", icon='OVERLAY')
 sub = row.row(align=True)
@@ -2265,6 +2273,36 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, 
PropertyPanel, Panel):
 bl_category = "Strip"
 
 
+class SEQUENCER_PT_snapping(Panel):
+bl_space_type = 'SEQUENCE_EDITOR'
+bl_region_type = 'HEADER'
+bl_label = "Snapping"
+
+def draw(self, context):
+tool_settings = context.tool_settings.sequencer_tool_settings
+
+layout = self.layout
+col = layout.column()
+col.label(text="Snap To")
+col.prop(tool_settings, "snap_to_strip_start")
+col.prop(tool_settings, "snap_to_strip_end")
+col.prop(tool_settings, "snap_to_playhead")
+col.separator()
+col.prop(tool_settings, "snap_ignore_muted")
+col.prop(tool_settings, "snap_ignore_sound")
+col.separator()
+
+col.label(text="Snap Source")
+col.prop(tool_settings, "snap_source")
+col.prop(tool_settings, "snap_side")
+col.separator()
+
+col.label(text="Snap Settings")
+col.prop(tool_settings, "snap_threshold", slider=True)
+col.prop(tool_settings, "snap_sensitivity", slider=True)
+col.separator()
+
+
 classes = (
 SEQUENCER_MT_change,
 SEQUENCER_HT_tool_header,
@@ -2334,6 +2372,8 @@ classes = (
 
 SEQUENCER_PT_annotation,
 SEQUENCER_PT_annotation_onion,
+
+SEQUENCER_PT_snapping,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/editors/transform/CMakeLists.txt 
b/source/blender/editors/transform/CMakeLists.txt
index b0bc5c6abda..ad0a330f0f4 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -102,6 +102,7 @@ set(SRC
   transform_orientations.c
   transform_snap.c
   transform_snap_object.c
+  transform_snap_sequencer.c
 
   transform.h
   transform_constraints.h
diff --git a/source/blender/editors/transform/transform_convert.h 
b/source/blender/editors/transform/transform_convert.h
index 918ce0739ed..d92c24385ae 100644
--- a/source/blender/editors/transform/transform_convert.h
+++ b/source/blender/editors/transform/transform_convert.h
@@ -32,6 +32,7 @@ struct ListBase;
 struct Object;
 struct TransData;
 struct TransDataCurveHandleFlags;
+struct TransSeqSnapData;
 struct TransInfo;
 struct bContext;
 
@@ -47,9 +48,14 @@ void clipUVData(TransInfo *t);
 /* transform_convert_mesh.c */
 void transform_convert_mesh_customdatacorrect_init(TransInfo *t);
 
+/* transform_snap_sequencer.c */
+struct TransSeqSnapData *seq_snap_data_alloc(TransInfo *t, struct ListBase 

[Bf-blender-cvs] [27d89ad6243] temp-vse-snapping: Add snap to hold offset

2021-06-21 Thread Richard Antalik
Commit: 27d89ad6243fbe986c2004a5e76f1c2b147f6850
Author: Richard Antalik
Date:   Sat Jun 19 11:06:12 2021 +0200
Branches: temp-vse-snapping
https://developer.blender.org/rB27d89ad6243fbe986c2004a5e76f1c2b147f6850

Add snap to hold offset

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/editors/transform/transform_snap_sequencer.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index dbaae5de233..37e178dc334 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -2286,6 +2286,7 @@ class SEQUENCER_PT_snapping(Panel):
 col.label(text="Snap To")
 col.prop(tool_settings, "snap_to_strip_start")
 col.prop(tool_settings, "snap_to_strip_end")
+col.prop(tool_settings, "snap_to_strip_hold_offset")
 col.prop(tool_settings, "snap_to_playhead")
 col.separator()
 col.prop(tool_settings, "snap_ignore_muted")
@@ -2299,7 +2300,7 @@ class SEQUENCER_PT_snapping(Panel):
 
 col.label(text="Snap Settings")
 col.prop(tool_settings, "snap_threshold", slider=True)
-col.prop(tool_settings, "snap_sensitivity", slider=True)
+#col.prop(tool_settings, "snap_sensitivity", slider=True)
 col.separator()
 
 
diff --git a/source/blender/editors/transform/transform_snap_sequencer.c 
b/source/blender/editors/transform/transform_snap_sequencer.c
index a956141d1b4..8e34d11d5bb 100644
--- a/source/blender/editors/transform/transform_snap_sequencer.c
+++ b/source/blender/editors/transform/transform_snap_sequencer.c
@@ -216,6 +216,9 @@ static int seq_get_snap_target_points_count(TransInfo *t,
   if (tool_settings->transform_flag & SEQ_SNAP_TO_STRIP_END) {
 count++;
   }
+  if (tool_settings->transform_flag & SEQ_SNAP_TO_STRIP_HOLD) {
+count += 2;
+  }
 
   count *= SEQ_collection_count(snap_targets);
 
@@ -260,6 +263,13 @@ static void seq_snap_target_points_build(TransInfo *t,
   snap_data->target_snap_points[i] = seq->enddisp;
   i++;
 }
+if (tool_settings->transform_flag & SEQ_SNAP_TO_STRIP_HOLD) {
+  const int content_start = min_ii(seq->enddisp, seq->start);
+  const int content_end = max_ii(seq->startdisp, seq->start + seq->len);
+  snap_data->target_snap_points[i] = content_start;
+  snap_data->target_snap_points[i + 1] = content_end;
+  i += 2;
+}
   }
   BLI_assert(i <= snap_data->target_snap_point_count);
   qsort(snap_data->target_snap_points, snap_data->target_snap_point_count, 
sizeof(int), cmp_fn);
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index 712a4521c5e..c586b064ff0 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1357,6 +1357,7 @@ typedef enum eSeqTransformFlag {
   SEQ_SNAP_TO_STRIP_START = (1 << 1),
   SEQ_SNAP_TO_STRIP_END = (1 << 2),
   SEQ_SNAP_TO_PLAYHEAD = (1 << 3),
+  SEQ_SNAP_TO_STRIP_HOLD = (1 << 12),
   SEQ_SNAP_IGNORE_MUTED = (1 << 4),
   SEQ_SNAP_IGNORE_SOUND = (1 << 5),
 
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index cd2343afca9..1dcf076691a 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3553,6 +3553,11 @@ static void rna_def_sequencer_tool_settings(BlenderRNA 
*brna)
   RNA_def_property_boolean_default(prop, true);
   RNA_def_property_ui_text(prop, "Snap to End", "Snap to end of strips");
 
+  prop = RNA_def_property(srna, "snap_to_strip_hold_offset", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", 
SEQ_SNAP_TO_STRIP_HOLD);
+  RNA_def_property_boolean_default(prop, true);
+  RNA_def_property_ui_text(prop, "Snap to Hold Offset", "Snap to strip hold 
offset");
+
   prop = RNA_def_property(srna, "snap_to_playhead", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", 
SEQ_SNAP_TO_PLAYHEAD);
   RNA_def_property_boolean_default(prop, 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] [386da134f48] temp-vse-snapping: Update copyright

2021-06-21 Thread Richard Antalik
Commit: 386da134f48981565b12bdf31846b2ed7a2b5a48
Author: Richard Antalik
Date:   Sat Jun 19 10:55:14 2021 +0200
Branches: temp-vse-snapping
https://developer.blender.org/rB386da134f48981565b12bdf31846b2ed7a2b5a48

Update copyright

===

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

===

diff --git a/source/blender/editors/transform/transform_snap_sequencer.c 
b/source/blender/editors/transform/transform_snap_sequencer.c
index 0c9c44c3ea7..a956141d1b4 100644
--- a/source/blender/editors/transform/transform_snap_sequencer.c
+++ b/source/blender/editors/transform/transform_snap_sequencer.c
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * The Original Code is Copyright (C) 2021 Blender Foundation.
  * All rights reserved.
  */

___
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] [1bed7209823] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-06-21 Thread YimingWu
Commit: 1bed7209823ad17ed3b5de7220ae4d32f02603aa
Author: YimingWu
Date:   Mon Jun 21 09:15:21 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB1bed7209823ad17ed3b5de7220ae4d32f02603aa

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

===



===



___
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