diff --git a/blenderkit/asset_bar_op.py b/blenderkit/asset_bar_op.py index 98b89f148952589c2b12d2fc66a5f21666199cc5..3afb37e970b4a3330b4b085297fafdf03608cab7 100644 --- a/blenderkit/asset_bar_op.py +++ b/blenderkit/asset_bar_op.py @@ -444,6 +444,7 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): def update_layout(self, context, event): # restarting asset_bar completely since the widgets are too hard to get working with updates. + self.scroll_update() self.position_and_hide_buttons() @@ -468,7 +469,7 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): self.tooltip_height - self.author_text_size - self.margin) # to hide arrows accordingly - self.scroll_update() + def asset_button_init(self, asset_x, asset_y, button_idx): ui_scale = bpy.context.preferences.view.ui_scale @@ -796,7 +797,11 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): self.tooltip_image.set_image(img.filepath) get_tooltip_data(asset_data) - self.asset_name.text = asset_data['name'] + an = asset_data['name'] + max_name_length = 30 + if len(an)>max_name_length+3: + an = an[:30]+'...' + self.asset_name.text = an self.authors_name.text = asset_data['tooltip_data']['author_text'] self.quality_label.text = asset_data['tooltip_data']['quality'] # print(asset_data['tooltip_data']['quality']) @@ -893,7 +898,9 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): for asset_button in self.asset_buttons: if asset_button.visible: asset_button.asset_index = asset_button.button_index + self.scroll_offset + # print(asset_button.asset_index, len(sr)) if asset_button.asset_index < len(sr): + asset_button.visible = True asset_data = sr[asset_button.asset_index] @@ -920,10 +927,18 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): asset_button.red_alert.visible = False elif utils.profile_is_validator(): asset_button.red_alert.visible = False +<<<<<<< HEAD else: asset_button.validation_icon.visible = False if utils.profile_is_validator(): asset_button.red_alert.visible = False +======= + else: + asset_button.visible = False + asset_button.validation_icon.visible = False + if utils.profile_is_validator(): + asset_button.red_alert.visible = False +>>>>>>> blender-v3.0-release def scroll_update(self): sr = bpy.context.window_manager.get('search results') @@ -937,6 +952,10 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): self.scroll_offset = min(self.scroll_offset, len(sr) - (self.wcount * self.hcount)) self.scroll_offset = max(self.scroll_offset, 0) self.update_images() +<<<<<<< HEAD +======= + +>>>>>>> blender-v3.0-release # print(sro) if sro['count'] > len(sr) and len(sr) - self.scroll_offset < (self.wcount * self.hcount) + 15: self.search_more() @@ -959,7 +978,7 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): sprops = utils.get_search_props() sprops.search_keywords = '' sprops.search_verification_status = 'ALL' - utils.p('author:', a) + # utils.p('author:', a) search.search(author_id=a) return True diff --git a/blenderkit/autothumb.py b/blenderkit/autothumb.py index 2d3768529a9aebe4caeb2356496993cb04e59640..330d31a2f3dafb83d7f75392520352cdbbcdf1d0 100644 --- a/blenderkit/autothumb.py +++ b/blenderkit/autothumb.py @@ -481,13 +481,16 @@ class GenerateMaterialThumbnailOperator(bpy.types.Operator): bpy.ops.wm.save_as_mainfile(filepath=filepath, compress=False, copy=True) thumb_dir = os.path.dirname(bpy.data.filepath) - thumb_path = os.path.join(thumb_dir, asset.name) - rel_thumb_path = os.path.join('//', asset.name) + an_slug = paths.slugify(asset.name) + + thumb_path = os.path.join(thumb_dir, an_slug) + rel_thumb_path = os.path.join('//', an_slug) + # auto increase number of the generated thumbnail. i = 0 while os.path.isfile(thumb_path + '.png'): - thumb_path = os.path.join(thumb_dir, asset.name + '_' + str(i).zfill(4)) - rel_thumb_path = os.path.join('//', asset.name + '_' + str(i).zfill(4)) + thumb_path = os.path.join(thumb_dir, an_slug + '_' + str(i).zfill(4)) + rel_thumb_path = os.path.join('//', an_slug + '_' + str(i).zfill(4)) i += 1 asset.blenderkit.thumbnail = rel_thumb_path + '.png' @@ -606,10 +609,11 @@ class ReGenerateMaterialThumbnailOperator(bpy.types.Operator): # either get the data from search results sr = bpy.context.window_manager['search results'] asset_data = sr[self.asset_index].to_dict() + an_slug = paths.slugify(asset_data['name']) tempdir = tempfile.mkdtemp() - thumb_path = os.path.join(tempdir, asset_data['name']) + thumb_path = os.path.join(tempdir,an_slug) args_dict = { "type": "material", diff --git a/blenderkit/comments_utils.py b/blenderkit/comments_utils.py index 4be80bd88d20a9100c6565b4733343066b2025fa..654bbb54f8574da652ad7842e05cfe2cbe30c9d3 100644 --- a/blenderkit/comments_utils.py +++ b/blenderkit/comments_utils.py @@ -50,9 +50,9 @@ def upload_comment_thread(url, comment='', api_key=None): # try: r = rerequests.put(url, data=data, verify=True, headers=headers) - print(r) + # print(r) # print(dir(r)) - print(r.text) + # print(r.text) # except requests.exceptions.RequestException as e: # print('ratings upload failed: %s' % str(e)) @@ -72,7 +72,7 @@ def upload_comment_flag_thread( asset_id = '', comment_id='', flag='like', api_k # try: r = rerequests.post(url, data=data, verify=True, headers=headers) - print(r.text) + # print(r.text) #here it's important we read back, so likes are updated accordingly: get_comments(asset_id, api_key) @@ -129,7 +129,7 @@ def get_comments(asset_id, api_key): r = rerequests.get(url, params=params, verify=True, headers=headers) if r is None: return - print(r.status_code) + # print(r.status_code) if r.status_code == 200: rj = r.json() # store comments - send them to task queue diff --git a/blenderkit/paths.py b/blenderkit/paths.py index 889aa2865049af8b76c9bb3fbf956854cb59160e..0170ae7b56f7f557794406038ed33218f98895dd 100644 --- a/blenderkit/paths.py +++ b/blenderkit/paths.py @@ -187,7 +187,7 @@ def slugify(slug): import unicodedata, re slug = slug.lower() - characters = '<>:"/\\|?*., ()#' + characters = '<>:"/\\|?\*., ()#' for ch in characters: slug = slug.replace(ch, '_') # import re diff --git a/blenderkit/ratings_utils.py b/blenderkit/ratings_utils.py index d813f4445f2585d49166f3a904496f392dd2adc7..46dc031b0ff227db086a305c137fd44f272361d3 100644 --- a/blenderkit/ratings_utils.py +++ b/blenderkit/ratings_utils.py @@ -101,7 +101,11 @@ def get_rating(asset_id, headers): if r.status_code == 200: rj = r.json() ratings = {} +<<<<<<< HEAD print(rj) +======= + # print(rj) +>>>>>>> blender-v3.0-release # store ratings - send them to task queue for r in rj['results']: ratings[r['ratingType']] = r['score'] diff --git a/blenderkit/search.py b/blenderkit/search.py index f86a9a5e0ca0bd12f33d63aad535fbb8d1888ede..24e46da7657658d9fcca041c57ed1584d8f2c944 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -117,7 +117,7 @@ def refresh_notifications_timer(): fetch_server_data() all_notifications_count = comments_utils.count_all_notifications() comments_utils.get_notifications_thread(preferences.api_key, all_count = all_notifications_count) - return 300 + return 7200 def update_ad(ad): @@ -197,9 +197,15 @@ def scene_load(context): categories.load_categories() if not bpy.app.timers.is_registered(refresh_token_timer) and not bpy.app.background: bpy.app.timers.register(refresh_token_timer, persistent=True, first_interval=36000) +<<<<<<< HEAD if utils.experimental_enabled() and not bpy.app.timers.is_registered( refresh_notifications_timer) and not bpy.app.background: bpy.app.timers.register(refresh_notifications_timer, persistent=True, first_interval=5) +======= + # if utils.experimental_enabled() and not bpy.app.timers.is_registered( + # refresh_notifications_timer) and not bpy.app.background: + # bpy.app.timers.register(refresh_notifications_timer, persistent=True, first_interval=5) +>>>>>>> blender-v3.0-release update_assets_data() @@ -218,10 +224,16 @@ def fetch_server_data(): get_profile() if bpy.context.window_manager.get('bkit_categories') is None: categories.fetch_categories_thread(api_key, force=False) +<<<<<<< HEAD all_notifications_count = comments_utils.count_all_notifications() comments_utils.get_notifications_thread(api_key, all_count = all_notifications_count) +======= + # all_notifications_count = comments_utils.count_all_notifications() + # comments_utils.get_notifications_thread(api_key, all_count = all_notifications_count) +>>>>>>> blender-v3.0-release first_time = True +first_search_parsing = True last_clipboard = '' @@ -408,7 +420,7 @@ def search_timer(): all_thumbs_loaded = all_loaded - global search_threads + global search_threads, first_search_parsing if len(search_threads) == 0: # utils.p('end search timer') props = utils.get_search_props() @@ -426,6 +438,15 @@ def search_timer(): # but most of the time only one is running anyway if not thread[0].is_alive(): + #check for notifications only for users that actually use the add-on + if first_search_parsing: + first_search_parsing = False + all_notifications_count = comments_utils.count_all_notifications() + comments_utils.get_notifications_thread(api_key, all_count=all_notifications_count) + if utils.experimental_enabled() and not bpy.app.timers.is_registered( + refresh_notifications_timer) and not bpy.app.background: + bpy.app.timers.register(refresh_notifications_timer, persistent=True, first_interval=5) + search_threads.remove(thread) # icons_dir = thread[1] scene = bpy.context.scene @@ -487,9 +508,14 @@ def search_timer(): # jump back ui_props.scroll_offset = 0 props.search_error = False - props.report = 'Found %i results. ' % (wm['search results orig']['count']) + props.report = f"Found {wm['search results orig']['count']} results." if len(wm['search results']) == 0: tasks_queue.add_task((reports.add_report, ('No matching results found.',))) +<<<<<<< HEAD +======= + else: + tasks_queue.add_task((reports.add_report, (f"Found {wm['search results orig']['count']} results.",))) +>>>>>>> blender-v3.0-release # undo push # bpy.ops.wm.undo_push_context(message='Get BlenderKit search') # show asset bar automatically, but only on first page - others are loaded also when asset bar is hidden. diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py index d20b1f6e5a70d745dc404db47460277cb382591a..c2d17a51852b4b5c7834823ccf8c0122aeadb4f6 100644 --- a/blenderkit/ui_panels.py +++ b/blenderkit/ui_panels.py @@ -2250,8 +2250,11 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties): def prefill_ratings(self): # pre-fill ratings ratings = ratings_utils.get_rating_local(self.asset_id) +<<<<<<< HEAD print('prefill ratings') print(ratings) +======= +>>>>>>> blender-v3.0-release if ratings and ratings.get('quality'): self.rating_quality = ratings['quality'] if ratings and ratings.get('working_hours'): diff --git a/blenderkit/upload.py b/blenderkit/upload.py index dfca4d94c56fe6e62f9d220e6741e5c130125424..3d8b705ba05e8ee8639b87d926aa114ed1b8c24c 100644 --- a/blenderkit/upload.py +++ b/blenderkit/upload.py @@ -582,7 +582,6 @@ def can_edit_asset(active_index=-1, asset_data=None): if not asset_data: sr = bpy.context.window_manager['search results'] asset_data = dict(sr[active_index]) - # print(profile, asset_data) if int(asset_data['author']['id']) == int(profile['user']['id']): return True return False diff --git a/blenderkit/utils.py b/blenderkit/utils.py index 79998c26c1aef4343cb502b217f91a5f545895ab..5bdace75f8f2c1df35babb6886f9cd62827d8253 100644 --- a/blenderkit/utils.py +++ b/blenderkit/utils.py @@ -844,7 +844,6 @@ def asset_from_newer_blender_version(asset_data): '''checks if asset is from a newer blender version, to avoid incompatibility''' bver = bpy.app.version aver = asset_data['sourceAppVersion'].split('.') - #print(aver,bver) bver_f = bver[0] + bver[1] * .01 + bver[2] * .0001 if len(aver)>=3: aver_f = int(aver[0]) + int(aver[1]) * .01 + int(aver[2]) * .0001 diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index 9fdc2ac336e533de27dd9ff9c753d061f9c5c254..069596fa99651b3656f96b1e2c0c5652b7094f6e 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -15,7 +15,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin SchmithĂĽsen, Jim Eckerlein, and many external contributors', - "version": (1, 8, 1), + "version": (1, 8, 2), 'blender': (3, 0, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export.py b/io_scene_gltf2/blender/exp/gltf2_blender_export.py index 522f13deb18b137ad422659a712c66cb5adf810e..fc78e9b5eb90c60fe18132df0cf41fdd60fcf6d5 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_export.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_export.py @@ -54,7 +54,7 @@ def save(context, export_settings): __notify_end(context, end_time - start_time) if not export_settings['gltf_current_frame']: - bpy.context.scene.frame_set(original_frame) + bpy.context.scene.frame_set(int(original_frame)) return {'FINISHED'} diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py index d70f4de2b5c51a695232f5839882ec1313b547a1..f1e94d9e0022049018ee40869733da5e91764fc2 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py @@ -157,7 +157,7 @@ def get_bone_matrix(blender_object_if_armature: typing.Optional[bpy.types.Object while frame <= end_frame: data[frame] = {} # we need to bake in the constraints - bpy.context.scene.frame_set(frame) + bpy.context.scene.frame_set(int(frame)) for pbone in blender_object_if_armature.pose.bones: if bake_bone is None: matrix = pbone.matrix_basis.copy() diff --git a/presets/interface_theme/Minimal_Dark.xml b/presets/interface_theme/Minimal_Dark.xml index af6ec7502cb2547732037bc78e14153b79c4c3b6..d9aa7cecc4e5fbb0b8f995c384648ed2a986676f 100644 --- a/presets/interface_theme/Minimal_Dark.xml +++ b/presets/interface_theme/Minimal_Dark.xml @@ -2,7 +2,7 @@ <Theme> <user_interface> <ThemeUserInterface - menu_shadow_fac="0.5" + menu_shadow_fac="0.35" menu_shadow_width="12" icon_alpha="1" icon_saturation="1" @@ -22,12 +22,12 @@ gizmo_view_align="#ffffff" gizmo_a="#4da84d" gizmo_b="#a33535" - icon_scene="#f2f2f2ff" - icon_collection="#f2f2f2ff" - icon_object="#f2f2f2ff" - icon_object_data="#f2f2f2ff" - icon_modifier="#f2f2f2ff" - icon_shading="#f2f2f2ff" + icon_scene="#e6e6e6ff" + icon_collection="#e6e6e6ff" + icon_object="#e6e6e6ff" + icon_object_data="#e6e6e6ff" + icon_modifier="#e6e6e6ff" + icon_shading="#e6e6e6ff" icon_folder="#e3c16eff" icon_border_intensity="0" > @@ -882,7 +882,7 @@ <ThemePanelColors header="#3b3b3b00" back="#393939ff" - sub_back="#343434ff" + sub_back="#0000001a" > </ThemePanelColors> </panelcolors> @@ -939,7 +939,7 @@ </text_editor> <node_editor> <ThemeNodeEditor - grid="#202020" + grid="#2d2d2d" node_selected="#00bdff" node_active="#00ff2f" wire="#1a1a1a" @@ -955,7 +955,7 @@ matte_node="#404040" distor_node="#404040" noodle_curving="5" - grid_levels="3" + grid_levels="7" dash_alpha="0.5" input_node="#404040" output_node="#404040" @@ -1613,4 +1613,4 @@ </ThemeFontStyle> </widget> </ThemeStyle> -</bpy> \ No newline at end of file +</bpy>