Thicket-Blender / thicket

Thicket: Laubwerk Plants Add-on for Blender
GNU General Public License v2.0
65 stars 9 forks source link

Update for Blender 3.0 API Changes (bpy.utils.user_resource) #52

Closed Mi-Pe closed 1 year ago

Mi-Pe commented 3 years ago

Hello, Thicket works fine in Blender 2.92, but since version 2.93 they are using Python 3.9 instead of 3.7, and that breaks some addons, including Thicket. I tested it on Blender 3.0.0 alpha. It can be installed, but cannot be enabled (ticked) in addon preferences. It throws such an error:

" Traceback (most recent call last): File "C:\Program Files\Blender Foundation\E-Cycles_X_Pro_3.0_a_20211008_win\3.0\scripts\modules\addon_utils.py", line 351, in enable mod = import(module_name) File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\thicket-0_4_0__init.py", line 70, in log_path = Path(bpy.utils.user_resource('SCRIPTS', "addons", True)) / name__ / "thicket.log" TypeError: user_resource() takes 1 positional argument but 3 were given "

Is there a chance for an update for newest Blender versions?

Best regards

dvhart commented 3 years ago

Hi @Mi-Pe , thank you for reporting and providing the traceback, this will help speed up time to a fix. This looks like it should be a fairly straight forward fix. I should have to dig into it no later than this weekend. If someone else wants to try their hand at a fix before then, the help would be welcome.

Mi-Pe commented 3 years ago

Great, thank you! I will be happy to see the update :)

dvhart commented 3 years ago

I have not been able to reproduce this on 2.93.0, which does include Python 3.9. Were you able to reproduce this issue on a Blender version prior to 3.0 ?

From the report (it's the Blender bpy.utils.user_resource() signature that changes), this is listed as a breaking change for the Blender 3.0 API:

https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Python_API

I'll work on Blender 3.0 support which likely requires more than just this fix.

dvhart commented 3 years ago

@Mi-Pe can you give this prerelease a try:

https://github.com/Thicket-Blender/thicket/releases/tag/v0_4_1_rc0

Note, I am not able to test this currently as I am on MacOS, and Issue #54 prevents me from loading the laubwerk module at all on Blender 3.0+. I'm hoping this addresses the issues for Windows users.

Mi-Pe commented 3 years ago

In 2.93 indeed, there is no such issue. It only occurs to 3.0. Maybe it's the problem of Blender itself, since it's still in alpha stage. I also experienced issue #53 in Blender 2.93 (interestingly, I didn't in Blender 2.92), but now I'm downloading the newest Laubwerk Free Kit v. 1.0.39, and will also use your new prerelease, and I'll let you know about the outcome.

dvhart commented 3 years ago

You’ll want To stick with 1.0.38 until we address #53 . I’ve got an email out to Laubwerk on that one.

Mi-Pe commented 3 years ago

All issues in Blender 3.0 are gone with Laubwerk 1.0.39 and your new release. Thicket now works flawlessly, I can import plants, I'm happy! Thank you for your time :)

dvhart commented 3 years ago

Excellent news. That suggests Issues #53 is limited to the Laubwerk MacOS libraries. I'll close this out after officially releasing Thicket 0.4.1. Thanks for testing @Mi-Pe.

dvhart commented 1 year ago

Resolved in v0_4_1