1

I've got this code:

            object.location.x += self.parameters.pos_x
            object.location.y += self.parameters.pos_y
            object.location.z += self.parameters.pos_z
            object.rotation_euler = (self.parameters.rot_x, self.parameters.rot_y, self.parameters.rot_z)
            object.select_set(True)
            # Optimization opportunity here
            bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
            object.select_set(False)

I would like to replace the call to:

bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)

I figured I would have to use the bmesh module in some way, but I cannot figure out how to do this. I want to apply rotation to all objects in a list.

DrewTNBD
  • 98
  • 10
  • You may want to take a look at Bmesh and the mathutils. – Robert Gützkow Jun 30 '21 at 09:36
  • Someone closed this as a duplicate, but the proposed solution didn't work for me, which is why I asked the question.

    In the end I rewrote my code to avoid using rotation_euler. Instead I used bmesh and rotation matrices to perform my rotation directly upon the mesh.

    I think the question was closed prematurely though.

    – DrewTNBD Jun 30 '21 at 11:07
  • @scurest closed as a dupe of https://blender.stackexchange.com/questions/159538/how-to-apply-all-transformations-to-an-object-at-low-levelt As it turns out answer required correcting, . Re-opened this one. – batFINGER Jun 30 '21 at 13:40

0 Answers0