Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_operators/assets.py
| # SPDX-License-Identifier: GPL-2.0-or-later | # SPDX-License-Identifier: GPL-2.0-or-later | ||||
| from __future__ import annotations | from __future__ import annotations | ||||
| import bpy | import bpy | ||||
| from bpy.types import Operator | from bpy.types import Operator | ||||
| from bpy.app.translations import pgettext_data as data_ | |||||
| from bpy_extras.asset_utils import ( | from bpy_extras.asset_utils import ( | ||||
| SpaceAssetInfo, | SpaceAssetInfo, | ||||
| ) | ) | ||||
| class AssetBrowserMetadataOperator: | class AssetBrowserMetadataOperator: | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| Show All 13 Lines | class ASSET_OT_tag_add(AssetBrowserMetadataOperator, Operator): | ||||
| """Add a new keyword tag to the active asset""" | """Add a new keyword tag to the active asset""" | ||||
| bl_idname = "asset.tag_add" | bl_idname = "asset.tag_add" | ||||
| bl_label = "Add Asset Tag" | bl_label = "Add Asset Tag" | ||||
| bl_options = {'REGISTER', 'UNDO'} | bl_options = {'REGISTER', 'UNDO'} | ||||
| def execute(self, context): | def execute(self, context): | ||||
| active_asset = SpaceAssetInfo.get_active_asset(context) | active_asset = SpaceAssetInfo.get_active_asset(context) | ||||
| active_asset.tags.new("Tag") | active_asset.tags.new(data_("Tag")) | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| class ASSET_OT_tag_remove(AssetBrowserMetadataOperator, Operator): | class ASSET_OT_tag_remove(AssetBrowserMetadataOperator, Operator): | ||||
| """Remove an existing keyword tag from the active asset""" | """Remove an existing keyword tag from the active asset""" | ||||
| bl_idname = "asset.tag_remove" | bl_idname = "asset.tag_remove" | ||||
| ▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines | |||||