Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVilém Duha <vilda.novak@gmail.com>2020-01-10 22:27:11 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-01-13 12:36:31 +0300
commitc96469928a3b0f6db6c31e183481f68b5d35c050 (patch)
treef1f5b0b10122e8ce0a26c00a0e24fa099d348f28 /blenderkit
parent329f2c4a8b9fd0cc5a22f0d938757b7749e34b7e (diff)
BlenderKit: several more UI fixes
Diffstat (limited to 'blenderkit')
-rw-r--r--blenderkit/search.py21
-rw-r--r--blenderkit/ui_panels.py22
2 files changed, 27 insertions, 16 deletions
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 9923610f..b612cf41 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 44bd4d2e..ed6c993b 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