Nifty trick to rename Operators for compatibility with 2.8 with regex in VS code


#1

Maybe other will find this useful. In vs code right-click on you addon folder -> Find in folder. Enable Regex
Find: [ ].*(bpy.types.Operator)
replace: XY_OT_$0
This should change eg.
class MyOper (bpy.types.Operator)
to 2.8 friendly name:
class XY_OT_ MyOper (bpy.types.Operator)

One additional step b) is to remove spacebar between ‘XY_OT_ MyOper’ . For that you can just replace ‘XY_OT_ ’ (with spacebar) to ‘XY_OT_’ (without).
Similar thing can be done to convert ’ = EnumProperty’ to ‘: EnumProperty’:
find:

[=].*EnumProperty

replace:

:$0


This will replace = with :=. Next step B) is to replace := with = (can be done old way - without regex).
Maybe someone can improve above regex to get rid of the additional step b), but even with it it should save you lot of time on big addons.