Skip to content
Snippets Groups Projects
Commit f0d3bf13 authored by Vilém Duha's avatar Vilém Duha
Browse files

BlenderKit: fix T66833

don't attempt to render thumbnail if file wasn't saved (it would fail on the end.)
parent 05ed8f54
No related branches found
No related tags found
No related merge requests found
...@@ -256,6 +256,7 @@ class GenerateThumbnailOperator(bpy.types.Operator): ...@@ -256,6 +256,7 @@ class GenerateThumbnailOperator(bpy.types.Operator):
"""Generate Cycles thumbnail for model assets""" """Generate Cycles thumbnail for model assets"""
bl_idname = "object.blenderkit_generate_thumbnail" bl_idname = "object.blenderkit_generate_thumbnail"
bl_label = "BlenderKit Thumbnail Generator" bl_label = "BlenderKit Thumbnail Generator"
bl_options = {'REGISTER', 'INTERNAL'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
...@@ -281,6 +282,16 @@ class GenerateThumbnailOperator(bpy.types.Operator): ...@@ -281,6 +282,16 @@ class GenerateThumbnailOperator(bpy.types.Operator):
def invoke(self, context, event): def invoke(self, context, event):
wm = context.window_manager wm = context.window_manager
if bpy.data.filepath == '':
title = "Can't render thumbnail"
message = "please save your file first"
def draw_message(self, context):
self.layout.label(text = message)
bpy.context.window_manager.popup_menu(draw_message, title=title, icon='INFO')
return {'FINISHED'}
return wm.invoke_props_dialog(self) return wm.invoke_props_dialog(self)
...@@ -288,6 +299,7 @@ class GenerateMaterialThumbnailOperator(bpy.types.Operator): ...@@ -288,6 +299,7 @@ class GenerateMaterialThumbnailOperator(bpy.types.Operator):
"""Tooltip""" """Tooltip"""
bl_idname = "object.blenderkit_material_thumbnail" bl_idname = "object.blenderkit_material_thumbnail"
bl_label = "BlenderKit Material Thumbnail Generator" bl_label = "BlenderKit Material Thumbnail Generator"
bl_options = {'REGISTER', 'INTERNAL'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment