Blender Asked by egtwobits on August 30, 2020
Transform orientations in Blender 2.80 are marked as read-only. What is the proper way to provide a custom matrix as a transform orientation in 2.80?
It looks like this call is needed to create a new orientation, which has a .matrix attribute which is NOT read only. Is this the intended usage? The user interface and docs for this don’t make it clear.
Here's a working solution/snippet, with a description below:
orthonormal_basis_matrix = mathutils.Matrix(
[
[vcross[0], vnorm[0], vdest[0]],
[vcross[1], vnorm[1], vdest[1]],
[vcross[2], vnorm[2], vdest[2]]
]
)
bpy.ops.transform.create_orientation(
name='MAPlus',
use=active_item.apl_use_custom_orientation,
overwrite=True
)
orient_slot = [
slot for slot in
bpy.context.scene.transform_orientation_slots
if slot.custom_orientation
and slot.custom_orientation.name == 'MAPlus'
]
if orient_slot:
orient_slot[0].custom_orientation.matrix = orthonormal_basis_matrix
else:
print('Error: Could not find MAPlus transform orientation...')
Answered by egtwobits on August 30, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP