[Python] Force matrix_world to be recalculated in Blender

Discussão em 'Python' iniciado por Stack, Março 13, 2025.

  1. Stack

    Stack Membro Participativo

    I'm designing an add-on for blender, that changes the location of certain vertices of an object. Every object in blender has a matrix_world atribute, that holds a matrix that transposes the coordinates of the vertices from the object to the world frame.

    print(object.matrix_world) # unit matrix (as expected)
    object.location += mathutils.Vector((5,0,0))
    object.rotation_quaternion *= mathutils.Quaternion((0.0, 1.0, 0.0), math.radians(45))
    print(object.matrix_world) # Also unit matrix!?!


    The above snippet shows that after the translation, you still have the same matrix_world. How can I force blender to recalculate the matrix_world?

    Continue reading...

Compartilhe esta Página