Got this def I would like to use for multiple other defs in the same file
def matrix1():
# create a location matrix
mat_loc = mathutils.Matrix.Translation((-0.0, -0.0, -0.0))
# create an identitiy matrix
mat_sca = mathutils.Matrix.Scale(0.5, 4, (0.0, 0.0, 1.0))
mat_sca1 = mathutils.Matrix.Scale(0.0, 4, (0.0, 0.0, 0.0))
# create a rotation matrix
mat_rot = mathutils.Matrix.Rotation(math.radians(90.0), 4, "Y")
# combine transformations
mat_out = mat_loc @ mat_rot @ mat_sca
mat_out1 = mat_loc @ mat_rot
How can I "import" the combined transformation (mat_out or mat_out1) into another def?
def add_mesh(self, context):
mesh = bpy.data.meshes.new("mesh")
bm = bmesh.new()
ret = bmesh.ops.create_circle(
bm,
segments=32,
radius=1,
matrix=mat_out1, #<-- this one gives error that mat_out1 is not defined
)
I also tried to import def matrix but that also did not work.
python
tag rather than here. But basically, have your first method returnmat_out1
or makemat_out1
be global to thematrix1
rather than local. $\endgroup$