Hello, is there a way to get mesh with actual vertex positions during the sculpting?
I have a script with the timer where I ray_cast the currently sculpted object, but hits
are made on original mesh, not on updated. I have tried to use depsgraph but it
does not help. this is how I use it:
def obj_ray_cast(obj, matrix):
"""Wrapper for ray casting that moves the ray into object space"""
# get the ray relative to the object
matrix_inv = matrix.inverted()
ray_origin_obj = matrix_inv @ ray_origin
ray_target_obj = matrix_inv @ ray_target
ray_direction_obj = ray_target_obj - ray_origin_obj
depsgrph = bpy.context.evaluated_depsgraph_get()
depsgrph.update()
obj = obj.evaluated_get(depsgrph)
# cast the ray
success, location, normal, face_index = obj.ray_cast(ray_origin_obj, ray_direction_obj) #, distance=math.inf, depsgraph=depsgrph)
if success:
return location, normal, face_index
else:
return None, None, None
this is called within TIMER event of my view3d modal operator
Any suggestions?