Bmesh matrix modif for 2.9?

	bmesh.ops.rotate(									# Rotate Z 180
		bm,
		verts=verts_dupe,
		cent=(0.0, 0.0, 0.0),
		matrix=matrix.Rotation(radians(180.0), 3, 'Z'))

this works fine in 2.79
but get error in 2.9 for matrix.rotation …

so looks like something was changed for 2.9

anyone knows how to correct this
so it works in 2.9

thanks
happy bl

Is it not Matrix.Rotation ? (capital M).
what is the error? Did you import mathutils?

here is test script to find errors

mind you this is first time i try this in 2.9 with matrix
so may be more then one error

tried with this one
matrix = mathutils.Matrix.Rotation(radians( 180.0 ), 3, ‘Z’))

when i call from search operator with label name

but now get error on

line 270, in execute

IndexError: BMElemSeq[index]: outdated internal index table, run ensure_lookup_table() first
not certain why in 2.9
this seem to work ok in 2.79

z-test-matrix1.blend (145.2 KB)

thanks
happy bl

this error has nothing to do with Matrix.Rotation, it has to do with your lookup table being out of date due to a previous operation. the error even tells you how to solve the problem, just run bm.verts.ensure_lookup_table() after you use bmesh.ops.rotate().

looks like delete has been change
did not see it in release notes API

bmesh.ops.delete(bm, geom=v5, context=1)

context has to be some string

happy bl

Correct. instead of an int for the enumerator it’s now using a string. If you’re trying to port a 2.79 addon to 2.80+ you should really keep the API documentation open and anytime you run into an error check there first.

1 Like

i have it and search
only problem API is a formal description
not a tutorial

so difficult to understand the how to!

thanks for feedback
happy bl

Well you don’t really need a tutorial- the documentation is more than sufficient for it. You get an error saying the operator expected a string and not an int- so you pull up the docs and see this:

bmesh.ops. delete (bm , geom , context )
Delete Geometry.

Utility operator to delete geometry.

Parameters

The documentation tells you that context is an enumerator, and it even gives you the strings it will accept without error. No tutorial necessary. Just repeat this process for every error you run into and that will get you 98% of the way there with minimal effort. The last 2% would be solving any API changes that are architectural in nature (such as depsgraph, layers vs collections, GL Drawing, app handler related changes, etc).