2.80 Cheat Sheet for updating add-ons

Oooooh.

Thank you :smile:

Hmmm. What happened to alpha mode in render settings?

bpy.data.scenes["Scene"].render.alpha_mode = "TRANSPARENT"

The line above is invalid now.

I’m not sure what happened to “alpha_mode”, but it appears “use_alpha” was removed sometime last month. I would check this commit to see if there’s a usable workaround.

Thanks for this thread, I am getting a lot of help from this

Wow, only now seeing this thread - glad to see the article linked in here has been of some use. I’m going think back about any other updates I’ve made along these lines to see if I have more to contribute, but if anyone is curious, here is a file where I implement many examples of cross compatible 2.7 (down to 2.72) and 2.8 code. This is for an addon which can be installed into both 2.7 and 2.8 without any artifacts. Note I only implement the functions I actively use in the addon, I do something similar in other repositories, so while the individual examples may already be covered by the first post in this thread, the concept of supporting 2.7 and 2.8 at the same time is less so covered I think.

Feel free to call me out on any silliness if anyone does take a look.

2 Likes

Anybody got the deets on how to create custom popovers in headers yet? Google in all it’s omniscience doesn’t seem to be bringing me any useful results, or maybe I should just go to sleep and try again tomorrow… 3am is probably the wrong time to be looking into this.

Add-on update helper script

I found I was regularly overlooking outdated code when doing add-on updates, so I made a very basic helper script to speed up the update process. This script goes through an add-on files and look for lines that might have outdated 2.7x code. If possibly outdated code is found, the code and its line number are printed in the console along with a small note on what to look at.

Please keep in mind this script will not catch everything and tends to generate a lot of false positives, but it has saved me quite a bit of time when updating add-ons for 2.8.

There is no special flags needed, just script addon_location

Examples

python update_check_280.py tests/measureit 

python update_check_280.py node_wrangler.py > lines_to_check.txt

Download link:
update_check_280.py (6.0 KB)

samp_con_out

3 Likes

I’m not sure which to use, what you suggest above, or this from another user:

dg = bpy.context.evaluated_depsgraph_get()
dg.update()

Anyone know what the replacement for bpy.ops.view3d.select_border() is? I can’t find anything referencing this gesture_mode param.

edit: I guess it’s select_box() and gesture_mode is redundant?

@nBurn I added a UI to your script. I hope it is okay. Now it runs from the Blender Text Editor:
UpdateScriptTo280Check

It can be downloaded here:
https://github.com/tin2tin/Update_Check_2.80/blob/master/update_check_280.py

6 Likes

The script ^ is now improved for better Find & Replace strings, insert un/register_class loop, and insert classes collection.
image

2 Likes

Checks for missing/changed icons added thanks to Pullusb:

2 Likes

Can you tell me where I can find a tutorial for this add-on, there are two add-ons that I want to update to blender 2.82a.
Thank you!

You can see the basics here: 2.80 Cheat Sheet for updating add-ons

Thanks!
Thanks!

  • AttributeError: ‘Material’ object has no attribute ‘texture’

I have trouble with Image texture in material.

  • mtex = mat.texture_slots.add()

problem too. How creating a texture image from scratch?

So I just ran into this problem updating Level Builder, and the answer didn’t come up in a Google search so I am updating this necro thread.

bpy.data.scenes[“Scene”].render.alpha_mode : [“SKY”, “TRANSPARENT”] is now bpy.data.scenes[“Scene”].render.film_transparent : [0, 1]

Here’s hoping Google finds this answer for the next coder.

2 Likes

Is there somewhere a cheat sheet for 2.9-3.0?

3 Likes