Hi all,
Under 2.90.1, is anybody know why object.transform_apply is not working after an object origin change.
I suppose my context correct with this context filtering:
for ecran in bpy.context.window.screen.areas:
if ecran.type == 'VIEW_3D':
Then i browse my objects selection under object mode to get GC coordinates and the Zmax.
s = list(bpy.context.selected_objects)
...
while i < len(s):
bpy.context.view_layer.objects.active = s[i]
bpy.ops.object.mode_set(mode='OBJECT')
try:
bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS')
bpy.ops.view3d.snap_cursor_to_active()
object_CG_x = round(bpy.context.scene.cursor.location.x, 3)
object_CG_y = round(bpy.context.scene.cursor.location.y, 3)
object_CG_z = round(bpy.context.scene.cursor.location.z, 3)
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
object_Zmax = round(max([j.co.z for j in obj.data.vertices]), 3)
My problem is that the object_Zmax value stored isn’t correct.
On the other hand, when i apply transformations object by object from the python console, the value of object_Zmax is correct.
It’s like the transform_apply is not taking effect or my context not correct.
Is anyone has an idea?