Operator Presets don't exists from Release 4.2 #8

Closed
opened 2024-07-26 12:22:08 +02:00 by sw-tya · 7 comments

Worked: 4.1
Broken: 4.2 LTS & 4.3 Alpha

With the moving of the Bolt Factory to be an Extension, rather than an addon, the operator presets are no longer present.

Blender, for a long time, up until version 4.1 used a separate folder to store the files used for "Operator Presets".
..../blender-4.1.0-linux-x64/4.1/scripts/addons/presets/operator/mesh.bolt_add/
In this folder are the files used to populate the drop down.

In version 4.2 this folder no longer exists.

This depot: https://projects.blender.org/extensions/add_mesh_BoltFactory/src/branch/main/source
does not contain the source files which were previously picked up from: https://projects.blender.org/blender/blender-addons/src/branch/main/presets/operator/mesh.bolt_add

Note, to people needing a quick fix to get their job going:
As a workaround I copied the 4.1 mesh.bolt_add folder and placed it in the 4.2 file structure at the same place and that worked: blender-4.2.0-linux-x64/4.2/scripts/presets/operator/mesh.bolt_add

Regarding a fix: the extensions really don't want to be having their presets stored in another development depot such as:
https://projects.blender.org/blender/blender/src/branch/main/scripts/addons_core

How/where should the presets from: https://projects.blender.org/blender/blender-addons/src/branch/main/presets/operator/mesh.bolt_add
reside in the new world?

Worked: 4.1 Broken: 4.2 LTS & 4.3 Alpha With the moving of the Bolt Factory to be an Extension, rather than an addon, the operator presets are no longer present. Blender, for a long time, up until version 4.1 used a separate folder to store the files used for "Operator Presets". ..../blender-4.1.0-linux-x64/4.1/scripts/addons/presets/operator/mesh.bolt_add/ In this folder are the files used to populate the drop down. In version 4.2 this folder no longer exists. This depot: https://projects.blender.org/extensions/add_mesh_BoltFactory/src/branch/main/source does not contain the source files which were previously picked up from: https://projects.blender.org/blender/blender-addons/src/branch/main/presets/operator/mesh.bolt_add > Note, to people needing a quick fix to get their job going: > As a workaround I copied the 4.1 mesh.bolt_add folder and placed it in the 4.2 file structure at the same place and that worked: blender-4.2.0-linux-x64/4.2/scripts/presets/operator/mesh.bolt_add Regarding a fix: the extensions really don't want to be having their presets stored in another development depot such as: https://projects.blender.org/blender/blender/src/branch/main/scripts/addons_core How/where should the presets from: https://projects.blender.org/blender/blender-addons/src/branch/main/presets/operator/mesh.bolt_add reside in the new world?
Author

More reading: blender/blender#119521 has the text:
"Provide guidance for where extensions should store presets (existing conventions for add-ons may not make sense)."
But I don't see anything helpful - also I don't see anything in the manual.
Using the add bold dialog box to save a preset it generates a file (on Linux) at:
/home/swatya/.config/blender/4.2/scripts/presets/operator/mesh.bolt_add/m4_test_preset.py

Landscapes is also broken without viable Presets: extensions/ant_landscape#2

More reading: https://projects.blender.org/blender/blender/issues/119521 has the text: "Provide guidance for where extensions should store presets (existing conventions for add-ons may not make sense)." But I don't see anything helpful - also I don't see anything in the manual. Using the add bold dialog box to save a preset it generates a file (on Linux) at: /home/swatya/.config/blender/4.2/scripts/presets/operator/mesh.bolt_add/m4_test_preset.py Landscapes is also broken without viable Presets: https://projects.blender.org/extensions/ant_landscape/issues/2
Author

The solution will work from 4.3. The "if" test keeps things happy on 4.2.

In Boltfactory.py
def register(): needs to have the following lines added:
import os
# Part of 4.3 may be back-ported to 4.2.
if register_preset_path := getattr(bpy.utils, "register_preset_path", None):
register_preset_path(os.path.join(os.path.dirname(__file__)))

def unregister(): needs to have the following lines added:
import os
# Part of 4.3 may be back-ported to 4.2.
if unregister_preset_path := getattr(bpy.utils, "unregister_preset_path", None):
unregister_preset_path(os.path.join(os.path.dirname(__file__)))

A nested directory needs creating in the Boltfactory mini depot:
presets\operator\mesh.bolt_add\
This directory needs then populating with the presets from the old addons depot at:
/scripts/addons/presets/operator/mesh.bolt_add

I found this solution in another extension, and have copied the work of @Campbell Barton :)
See: https://projects.blender.org/extensions/add_mesh_extra_objects/src/branch/main/source/init.py
Fixed under #124020

I hope the collation of this information helps someone update this extension.

The solution will work from 4.3. The "if" test keeps things happy on 4.2. In Boltfactory.py def register(): needs to have the following lines added: ` import os` ` # Part of 4.3 may be back-ported to 4.2.` ` if register_preset_path := getattr(bpy.utils, "register_preset_path", None):` ` register_preset_path(os.path.join(os.path.dirname(__file__)))` def unregister(): needs to have the following lines added: ` import os` ` # Part of 4.3 may be back-ported to 4.2.` ` if unregister_preset_path := getattr(bpy.utils, "unregister_preset_path", None):` ` unregister_preset_path(os.path.join(os.path.dirname(__file__)))` A nested directory needs creating in the Boltfactory mini depot: `presets\operator\mesh.bolt_add\` This directory needs then populating with the presets from the old addons depot at: `/scripts/addons/presets/operator/mesh.bolt_add` I found this solution in another extension, and have copied the work of @Campbell Barton :) See: https://projects.blender.org/extensions/add_mesh_extra_objects/src/branch/main/source/__init__.py Fixed under #124020 I hope the collation of this information helps someone update this extension.
Contributor
Correcting link: https://projects.blender.org/extensions/add_mesh_extra_objects/pulls/1
Contributor

I have a fix for the scale of the presets on the pre-4.2 code locally, but haven’t tested it yet. I haven’t looked into updating this here yet. I’ll keep you posted.

I have a fix for the scale of the presets on the pre-4.2 code locally, but haven’t tested it yet. I haven’t looked into updating this here yet. I’ll keep you posted.

Closing as its fixed and updated

Closing as its fixed and updated
Author

@nickberckley I see that you replied to the comments on: https://extensions.blender.org/add-ons/boltfactory/reviews/
While the extension has been fixed, if people try to use it in LTS 4.2.0 the path error still exists.
I've just downloaded LTS 4.2.1 and the presets work as expected.
If you have the power to edit your reply saying both the extension and the core blender need updating; that might help 25k other people who have already downloaded this extension in the past month.
Thanks to you and the rest of the team for getting this fixed.

@nickberckley I see that you replied to the comments on: https://extensions.blender.org/add-ons/boltfactory/reviews/ While the extension has been fixed, if people try to use it in LTS 4.2.0 the path error still exists. I've just downloaded LTS 4.2.1 and the presets work as expected. If you have the power to edit your reply saying both the extension and the core blender need updating; that might help 25k other people who have already downloaded this extension in the past month. Thanks to you and the rest of the team for getting this fixed.

You're right I made mistake, I should've modified minimum version to 4.2.1

You're right I made mistake, I should've modified minimum version to 4.2.1
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: extensions/add_mesh_BoltFactory#8
No description provided.