diff --git a/blenderkit/search.py b/blenderkit/search.py index 9923610fa9000deb118e5ee800cab0b25880d91c..b612cf416613d1cfd70beaee4e5b47d36761c4de 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -327,15 +327,24 @@ def split_subs(text, threshold=40): # temporarily disable this, to be able to do this in drawing code text = text.rstrip() + text = text.replace('\r\n', '\n') + lines = [] while len(text) > threshold: - i = text.rfind(' ', 0, threshold) - i1 = text.rfind(',', 0, threshold) - i2 = text.rfind('.', 0, threshold) - i = max(i, i1, i2) - if i <= 0: - i = threshold + #first handle if there's an \n line ending + i_rn = text.find('\n') + print(i_rn) + if 1 < i_rn < threshold: + i = i_rn + text = text.replace('\n','',1) + else: + i = text.rfind(' ', 0, threshold) + i1 = text.rfind(',', 0, threshold) + i2 = text.rfind('.', 0, threshold) + i = max(i, i1, i2) + if i <= 0: + i = threshold lines.append(text[:i]) text = text[i:] lines.append(text) diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py index 44bd4d2efdba53379055ac1b870422ee3f2ede2a..ed6c993b9c07ebe70f533e3b54b06102e7ab5032 100644 --- a/blenderkit/ui_panels.py +++ b/blenderkit/ui_panels.py @@ -768,16 +768,17 @@ class OBJECT_MT_blenderkit_asset_menu(bpy.types.Menu): op = layout.operator('view3d.blenderkit_search', text='Search Similar') op.keywords = asset_data['name'] + ' ' + asset_data['description'] + ' ' + ' '.join(asset_data['tags']) - if bpy.context.view_layer.objects.active is not None and ui_props.asset_type == 'MODEL': - aob = bpy.context.active_object - op = layout.operator('scene.blenderkit_download', text='Replace Active Models') - op.asset_type = ui_props.asset_type - op.asset_index = ui_props.active_index - op.model_location = aob.location - op.model_rotation = aob.rotation_euler - op.target_object = aob.name - op.material_target_slot = aob.active_material_index - op.replace = True + if asset_data['can_download']: + if bpy.context.view_layer.objects.active is not None and ui_props.asset_type == 'MODEL': + aob = bpy.context.active_object + op = layout.operator('scene.blenderkit_download', text='Replace Active Models') + op.asset_type = ui_props.asset_type + op.asset_index = ui_props.active_index + op.model_location = aob.location + op.model_rotation = aob.rotation_euler + op.target_object = aob.name + op.material_target_slot = aob.active_material_index + op.replace = True wm = bpy.context.window_manager profile = wm.get('bkit profile') @@ -870,6 +871,7 @@ class UrlPopupDialog(bpy.types.Operator): layout = self.layout label_multiline(layout, text=self.message) + layout.active_default = True op = layout.operator("wm.url_open", text=self.link_text, icon='QUESTION') op.url = self.url