Is it possible to make a driver that will be keep mesh scale "static" on screen? If I zoom in/out, the mesh scale stays visually the same as before or close to it. Start point for the object is 3d cursor position.
I think I found solution, thx to Howard Trickey's addon 'Inset Straight Skeleton'. It give me a value depend on how far or close am I to the 3d cursor in 3d view.
import bpy
from math import sqrt
context = bpy.context
def calc_pixel_size(context, co):
# returns size in blender units of a pixel at 3d coord co
# see C code in ED_view3d_pixel_size and ED_view3d_update_viewmat
m = context.region_data.perspective_matrix
v1 = m[0].to_3d()
v2 = m[1].to_3d()
ll = min(v1.length_squared, v2.length_squared)
len_pz = 2.0 / sqrt(ll)
len_sz = max(context.region.width, context.region.height)
rv3dpixsize = len_pz / len_sz
proj = m[3][0] * co[0] + m[3][1] * co[1] + m[3][2] * co[2] + m[3][3]
ups = context.preferences.system.pixel_size
#print("Pixel size:", proj * rv3dpixsize * ups)
return proj * rv3dpixsize * ups
center = bpy.context.scene.cursor.location
center_pixel_size = calc_pixel_size(context, center)
print(center_pixel_size)
