Page MenuHome

Cursor centering is wrong when the selected vertices distribution is not uniform
Closed, ArchivedPublic


System Information
Operating system: Win 10
Graphics card: Intel

Blender Version
Broken: version: 2.80 (sub 74), branch: blender2.7, commit date: 2019-06-06 00:27, hash: 8b2b79c2108b, type: Release


I feel like Cursor to Selected is not making good desicions when centering the cursor. Please see the .blend file and the image for how the issue looks like

  • Open the blend file
  • Tab to edit mode
  • The current selection is there
  • Press "Shift+S" for cursor menu, then choose "Cursor to selection"

As you see in the image(just after cursor to selection) the cursor is wrongly centered on Y axis



Event Timeline

kursad k (kursadk) updated the task description. (Show Details)
kursad k (kursadk) added a comment.EditedJun 7 2019, 8:24 PM

I just tested this with Python API, and the issue seems to be the result of the center being calculated by averaging the vert locations. Using bounding box of the selected vertices produces much better middle positioning.

Here is a relevant test code to see the issue. If you use c (averaged locations, enable in the code) for the cursor location, it will be the same as the internal cursor to selection which produces the wrong results when the vertices are not uniformly distributed.

Using Bbox to locate the center seems to be better for these situations.

import bpy
import numpy as np
import bmesh
from mathutils import Vector



verts=np.array([ for v in bm.verts if])


#print(v_np[:,0].mean(), v_np[:,1].mean(),v_np[:,2].mean() )

x_min = verts[:,0].min()
y_min = verts[:,1].min()
z_min = verts[:,2].min()

x_max = verts[:,0].max()
y_max = verts[:,1].max()
z_max = verts[:,2].max()

c=np.array( [verts[:,0].sum()/l, verts[:,1].sum()/l, verts[:,2].sum()/l] )


bpy.context.scene.cursor.location=Vector( ( (x_min+x_max)/2,
                                        (z_min+z_max)/2 )
kursad k (kursadk) renamed this task from Wrong cursor centering on Y axis to Cursor centering is wrong when the selected vertices distribution is not uniform.Jun 8 2019, 6:45 PM
Sebastian Parborg (zeddb) closed this task as Archived.
Sebastian Parborg (zeddb) claimed this task.

This is not a but. This is how it is programmed to work. So this is a feature request and should go to: