BlenderKit: fix upload
changes on is_free were not reflected in upload properly. Fix too long requests from search similar Adding more special characters to exclude when creating a file path.
This commit is contained in:
parent
ba9a1dbe27
commit
8823548db7
|
@ -1517,7 +1517,7 @@ class BlenderKitSceneSearchProps(PropertyGroup, BlenderKitCommonSearchProps):
|
|||
)
|
||||
search_engine_other: StringProperty(
|
||||
name="Engine",
|
||||
description="engine not specified by addon",
|
||||
description="Engine not specified by addon",
|
||||
default="",
|
||||
update=search.search_update
|
||||
)
|
||||
|
@ -1655,7 +1655,7 @@ class BlenderKitAddonPreferences(AddonPreferences):
|
|||
default="BOTH",
|
||||
)
|
||||
thumbnail_use_gpu: BoolProperty(
|
||||
name="Use GPU for Thumbnails Rendering",
|
||||
name="Use GPU for Thumbnails Rendering (For assets upload)",
|
||||
description="By default this is off so you can continue your work without any lag",
|
||||
default=False
|
||||
)
|
||||
|
@ -1749,13 +1749,14 @@ class BlenderKitAddonPreferences(AddonPreferences):
|
|||
layout.prop(self, "project_subdir")
|
||||
# layout.prop(self, "temp_dir")
|
||||
layout.prop(self, "directory_behaviour")
|
||||
layout.prop(self, "thumbnail_use_gpu")
|
||||
# layout.prop(self, "allow_proximity")
|
||||
# layout.prop(self, "panel_behaviour")
|
||||
layout.prop(self, "thumb_size")
|
||||
layout.prop(self, "max_assetbar_rows")
|
||||
layout.prop(self, "tips_on_start")
|
||||
layout.prop(self, "search_in_header")
|
||||
layout.prop(self, "thumbnail_use_gpu")
|
||||
|
||||
if bpy.context.preferences.view.show_developer_ui:
|
||||
layout.prop(self, "use_timers")
|
||||
layout.prop(self, "experimental_features")
|
||||
|
|
|
@ -126,7 +126,8 @@ def bg_update():
|
|||
tcom.lasttext = tcom.outtext
|
||||
if tcom.outtext != '':
|
||||
tcom.outtext = ''
|
||||
estring = tcom.eval_path_state + ' = tcom.lasttext'
|
||||
text =tcom.lasttext.replace("'","")
|
||||
estring = tcom.eval_path_state + ' = text'
|
||||
|
||||
exec(estring)
|
||||
# print(tcom.lasttext)
|
||||
|
|
|
@ -169,7 +169,7 @@ def slugify(slug):
|
|||
import unicodedata, re
|
||||
slug = slug.lower()
|
||||
|
||||
characters = '<>:"/\\|?*., ()'
|
||||
characters = '<>:"/\\|?*., ()#'
|
||||
for ch in characters:
|
||||
slug = slug.replace(ch, '_')
|
||||
# import re
|
||||
|
|
|
@ -1530,6 +1530,10 @@ class SearchOperator(Operator):
|
|||
sprops.search_keywords = ''
|
||||
if self.keywords != '':
|
||||
sprops.search_keywords = self.keywords
|
||||
#crop long searches
|
||||
if len(self.keywords) > 150:
|
||||
idx = self.keywords.find(' ', 142)
|
||||
self.keywords = self.keywords[:idx]
|
||||
|
||||
search(category=self.category, get_next=self.get_next, author_id=self.author_id)
|
||||
# bpy.ops.view3d.blenderkit_asset_bar()
|
||||
|
|
|
@ -1160,9 +1160,10 @@ def draw_asset_context_menu(layout, context, asset_data, from_panel=False):
|
|||
# build search string from description and tags:
|
||||
op.keywords = asset_data['name']
|
||||
if asset_data.get('description'):
|
||||
op.keywords += ' ' + asset_data.get('description')
|
||||
op.keywords += ' ' + asset_data.get('description')+' '
|
||||
op.keywords += ' '.join(asset_data.get('tags'))
|
||||
|
||||
|
||||
if asset_data.get('canDownload') != 0:
|
||||
if len(bpy.context.selected_objects) > 0 and ui_props.asset_type == 'MODEL':
|
||||
aob = bpy.context.active_object
|
||||
|
|
|
@ -509,7 +509,7 @@ def get_upload_data(caller=None, context=None, asset_type=None):
|
|||
upload_data["category"] = props.subcategory1
|
||||
|
||||
upload_data["license"] = props.license
|
||||
upload_data["isFree"] = props.is_free
|
||||
upload_data["isFree"] = props.is_free == 'FREE'
|
||||
upload_data["isPrivate"] = props.is_private == 'PRIVATE'
|
||||
upload_data["token"] = user_preferences.api_key
|
||||
|
||||
|
@ -857,7 +857,8 @@ class Uploader(threading.Thread):
|
|||
return self._stop_event.is_set()
|
||||
|
||||
def send_message(self, message):
|
||||
message = str(message)
|
||||
message = str(message).replace("'","")
|
||||
|
||||
# this adds a UI report but also writes above the upload panel fields.
|
||||
tasks_queue.add_task((ui.add_report, (message,)))
|
||||
estring = f"{self.export_data['eval_path_state']} = '{message}'"
|
||||
|
@ -1124,7 +1125,7 @@ class UploadOperator(Operator):
|
|||
bl_description = "Upload or re-upload asset + thumbnail + metadata"
|
||||
|
||||
bl_label = "BlenderKit asset upload"
|
||||
bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}
|
||||
bl_options = {'REGISTER', 'INTERNAL'}
|
||||
|
||||
# type of upload - model, material, textures, e.t.c.
|
||||
asset_type: EnumProperty(
|
||||
|
@ -1214,11 +1215,24 @@ class UploadOperator(Operator):
|
|||
layout.label(text="For updates of thumbnail or model use reupload.")
|
||||
|
||||
if props.is_private == 'PUBLIC':
|
||||
utils.label_multiline(layout, text='public assets are validated several hours'
|
||||
' or days after upload. Remember always to '
|
||||
'test download your asset to a clean file'
|
||||
' to see if it uploaded correctly.'
|
||||
, width=300)
|
||||
if self.asset_type == 'MODEL':
|
||||
utils.label_multiline(layout, text='You marked the asset as public.\n'
|
||||
'This means it will be validated by our team.\n\n'
|
||||
'Please test your upload after it finishes:\n'
|
||||
'- Open a new file\n'
|
||||
'- Find the asset and download it\n'
|
||||
'- Check if it snaps correctly to surfaces\n'
|
||||
'- Check if it has all textures and renders as expected\n'
|
||||
'- Check if it has correct size in world units (for models)'
|
||||
, width=400)
|
||||
else:
|
||||
utils.label_multiline(layout, text='You marked the asset as public.\n'
|
||||
'This means it will be validated by our team.\n\n'
|
||||
'Please test your upload after it finishes:\n'
|
||||
'- Open a new file\n'
|
||||
'- Find the asset and download it\n'
|
||||
'- Check if it works as expected\n'
|
||||
, width=400)
|
||||
|
||||
def invoke(self, context, event):
|
||||
props = utils.get_upload_props()
|
||||
|
|
Loading…
Reference in New Issue