-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature #29 : Add presets to addon preferences
- Loading branch information
1 parent
d2d9fe2
commit 0f8855d
Showing
3 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from bpy.types import Operator | ||
from bpy.props import IntProperty | ||
|
||
from asset_browser_utilities.core.preferences.tool import get_preferences | ||
|
||
|
||
class ABU_OT_presets_add_or_remove(Operator): | ||
bl_idname = "abu.presets_add_or_remove" | ||
bl_label = "Add Preset" | ||
index: IntProperty() | ||
|
||
def execute(self, context): | ||
presets = get_preferences(context).presets | ||
if self.index < 0: | ||
new = presets.add() | ||
new.name = "New Preset" | ||
new.asset_filter_settings.filter_selection.allow = True | ||
new.asset_filter_settings.filter_catalog_allow = True | ||
else: | ||
try: | ||
presets.remove(self.index) | ||
except IndexError: | ||
pass | ||
return {"FINISHED"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters