work
save startup blend for animation tab & whatnot
This commit is contained in:
@@ -36,7 +36,6 @@ from . import (
|
||||
utils,
|
||||
)
|
||||
|
||||
|
||||
bk_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -170,7 +169,7 @@ class FastRateMenu(Operator, ratings_utils.RatingProperties):
|
||||
else:
|
||||
if bpy.context.view_layer.objects.active is not None:
|
||||
ob = utils.get_active_model()
|
||||
ad = ob.get("asset_data")
|
||||
ad = utils.get_asset_data_from_ob(ob)
|
||||
if ad:
|
||||
self.asset_data = ad
|
||||
self.asset_id = self.asset_data["id"]
|
||||
@@ -184,8 +183,9 @@ class FastRateMenu(Operator, ratings_utils.RatingProperties):
|
||||
self.img = ui.get_large_thumbnail_image(self.asset_data)
|
||||
utils.img_to_preview(self.img, copy_original=True)
|
||||
|
||||
ratings_utils.ensure_rating(self.asset_id)
|
||||
self.prefill_ratings()
|
||||
if self.asset_type != "author":
|
||||
ratings_utils.ensure_rating(self.asset_id)
|
||||
self.prefill_ratings()
|
||||
|
||||
# Update last popup activity time to prevent shortcut interference
|
||||
from . import ui_panels
|
||||
@@ -223,6 +223,12 @@ class SetBookmark(bpy.types.Operator):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
# Authors cannot be bookmarked
|
||||
sr = search.get_search_results()
|
||||
for r in sr:
|
||||
if r.get("id") == self.asset_id and r.get("assetType") == "author":
|
||||
return {"CANCELLED"}
|
||||
|
||||
rating = ratings_utils.get_rating_local(self.asset_id)
|
||||
if rating is None:
|
||||
rating = datas.AssetRating()
|
||||
@@ -233,7 +239,7 @@ class SetBookmark(bpy.types.Operator):
|
||||
ratings_utils.store_rating_local(
|
||||
self.asset_id, rating_type="bookmarks", value=bookmark_value
|
||||
)
|
||||
client_lib.send_rating(self.asset_id, "bookmarks", str(bookmark_value))
|
||||
client_lib.send_rating(self.asset_id, "bookmarks", bookmark_value)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -323,7 +329,7 @@ class RatingStarWidget(Gizmo):
|
||||
|
||||
|
||||
def should_be_rated(ob) -> bool:
|
||||
ad = ob.get("asset_data")
|
||||
ad = utils.get_asset_data_from_ob(ob)
|
||||
if ad is None:
|
||||
return False
|
||||
rating = ratings_utils.get_rating_local(ad["id"])
|
||||
@@ -354,7 +360,8 @@ class RatingStarWidgetGroup(GizmoGroup):
|
||||
ob = utils.get_active_model()
|
||||
gz = self.gizmos.new(RatingStarWidget.bl_idname)
|
||||
props = gz.target_set_operator("wm.blenderkit_menu_rating_upload")
|
||||
props.asset_id = ob["asset_data"]["assetBaseId"]
|
||||
ad = utils.get_asset_data_from_ob(ob)
|
||||
props.asset_id = ad["assetBaseId"] if ad else ""
|
||||
gz.color = 0.5, 0.5, 0.0
|
||||
gz.alpha = 0.5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user