Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-02-08 14:16:51 +0300
committerCampbell Barton <campbell@blender.org>2022-02-08 14:16:51 +0300
commit3267c91b4d5caab7da8aef071a446dd2e86f86a9 (patch)
tree5a8a35d680c6fb16df9261b321a5ae1792c209e2 /source/blender/blenkernel/BKE_armature.h
parent530be35516dd5850ee920df0b9cd8b8118ce7f8e (diff)
Fix T91253: Slow pose bone selection with many bones
Viewport cull bones during selection to avoid depth-picking reading the depth buffer for bones that aren't in the viewport. Files with thousands of bones could hang blender for seconds while selecting. The issue could still happen with overlapping bones or when zoomed out so all bones are under the cursor, however in practice this rarely happens. Now files with many bones select quickly. Related changes include: - Split `BKE_pchan_minmax` out of `BKE_pose_minmax`. - Add `mat3_to_size_max_axis` to return the length of the largest axis (used for scaling the radius). Reviewed By: sybren Maniphest Tasks: T91253 Ref D13990
Diffstat (limited to 'source/blender/blenkernel/BKE_armature.h')
-rw-r--r--source/blender/blenkernel/BKE_armature.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 12d8135ba55..ede300b19dd 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -163,6 +163,30 @@ void BKE_armature_transform(struct bArmature *arm, const float mat[4][4], bool d
/* Bounding box. */
struct BoundBox *BKE_armature_boundbox_get(struct Object *ob);
+/**
+ * Calculate the axis-aligned bounds of `pchan` in world-space,
+ * taking into account custom transform when set.
+ *
+ * `r_min` and `r_max` are expanded to fit `pchan` so the caller must initialize them
+ * (typically using #INIT_MINMAX).
+ *
+ * \note The bounds are calculated based on the head & tail of the bone
+ * or the custom object's bounds (if the bone uses a custom object).
+ * Visual elements such as the envelopes radius & bendy-bone spline segments are *not* included,
+ * making this not so useful for viewport culling.
+ */
+void BKE_pchan_minmax(const struct Object *ob,
+ const struct bPoseChannel *pchan,
+ float r_min[3],
+ float r_max[3]);
+/**
+ * Calculate the axis aligned bounds of the pose of `ob` in world-space.
+
+ * `r_min` and `r_max` are expanded to fit `ob->pose` so the caller must initialize them
+ * (typically using #INIT_MINMAX).
+ *
+ * \note This uses #BKE_pchan_minmax, see its documentation for details on bounds calculation.
+ */
bool BKE_pose_minmax(
struct Object *ob, float r_min[3], float r_max[3], bool use_hidden, bool use_select);