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-13 12:35:57 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-01-13 12:36:32 +0300
commitea1aedbc57d46cedfae09be286b3fd64fa54c2c7 (patch)
tree7cb737752b897fc35639dbd1886ef54f86ac08ff /blenderkit
parentcca88a08d5f5537f5c5cf57d061bf4d4b935de71 (diff)
BlenderKit: UI typo fixes, and slight optimisation.
Diffstat (limited to 'blenderkit')
-rw-r--r--blenderkit/__init__.py6
-rw-r--r--blenderkit/bg_blender.py2
-rw-r--r--blenderkit/bkit_oauth.py4
-rw-r--r--blenderkit/download.py2
-rw-r--r--blenderkit/search.py1
-rw-r--r--blenderkit/ui.py15
-rw-r--r--blenderkit/ui_panels.py8
7 files changed, 20 insertions, 18 deletions
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py
index a2a4a9f8..f47f57eb 100644
--- a/blenderkit/__init__.py
+++ b/blenderkit/__init__.py
@@ -1217,8 +1217,8 @@ class BlenderKitModelSearchProps(PropertyGroup, BlenderKitCommonSearchProps):
append_method: EnumProperty(
name="Import Method",
items=(
- ('LINK_COLLECTION', 'Link Collection', ''),
- ('APPEND_OBJECTS', 'Append Objects', ''),
+ ('LINK_COLLECTION', 'Link', 'Link Collection'),
+ ('APPEND_OBJECTS', 'Append', 'Append as Objects'),
),
description="choose if the assets will be linked or appended",
default="LINK_COLLECTION"
@@ -1343,7 +1343,7 @@ class BlenderKitAddonPreferences(AddonPreferences):
login_attempt: BoolProperty(
name="Login/Signup attempt",
- description="When this is on, BlenderKit is trying to connect and login.",
+ description="When this is on, BlenderKit is trying to connect and login",
default=False
)
diff --git a/blenderkit/bg_blender.py b/blenderkit/bg_blender.py
index 9d3521e4..e8ccb04d 100644
--- a/blenderkit/bg_blender.py
+++ b/blenderkit/bg_blender.py
@@ -155,7 +155,7 @@ process_sources = (
class KillBgProcess(bpy.types.Operator):
- '''Remove processes in background.'''
+ '''Remove processes in background'''
bl_idname = "object.kill_bg_process"
bl_label = "Kill Background Process"
bl_options = {'REGISTER'}
diff --git a/blenderkit/bkit_oauth.py b/blenderkit/bkit_oauth.py
index a3d86793..dc272104 100644
--- a/blenderkit/bkit_oauth.py
+++ b/blenderkit/bkit_oauth.py
@@ -99,7 +99,7 @@ def write_tokens(auth_token, refresh_token, oauth_response):
class RegisterLoginOnline(bpy.types.Operator):
- """Login online on BlenderKit webpage."""
+ """Login online on BlenderKit webpage"""
bl_idname = "wm.blenderkit_login"
bl_label = "BlenderKit login or signup"
@@ -124,7 +124,7 @@ class RegisterLoginOnline(bpy.types.Operator):
class Logout(bpy.types.Operator):
- """Logout from BlenderKit immediately."""
+ """Logout from BlenderKit immediately"""
bl_idname = "wm.blenderkit_logout"
bl_label = "BlenderKit logout"
diff --git a/blenderkit/download.py b/blenderkit/download.py
index d652807e..c4a14ecd 100644
--- a/blenderkit/download.py
+++ b/blenderkit/download.py
@@ -823,7 +823,7 @@ asset_types = (
class BlenderkitKillDownloadOperator(bpy.types.Operator):
- """Kill a download."""
+ """Kill a download"""
bl_idname = "scene.blenderkit_download_kill"
bl_label = "BlenderKit Kill Asset Download"
bl_options = {'REGISTER', 'INTERNAL'}
diff --git a/blenderkit/search.py b/blenderkit/search.py
index b612cf41..cdde9523 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -334,7 +334,6 @@ def split_subs(text, threshold=40):
while len(text) > 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)
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index 72d0e4b8..069809c6 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -759,7 +759,7 @@ def draw_callback_2d_search(self, context):
ui_props.thumb_size,
img,
1)
- if search_results_orig['count'] - ui_props.scrolloffset > (ui_props.wcount * ui_props.hcount):
+ if search_results_orig['count'] - ui_props.scrolloffset > (ui_props.wcount * ui_props.hcount) + 1:
if ui_props.active_index == -1:
ui_bgl.draw_rect(ui_props.bar_x + ui_props.bar_width - 25,
ui_props.bar_y - ui_props.bar_height, 25,
@@ -838,7 +838,7 @@ def draw_callback_2d_search(self, context):
directory = paths.get_temp_dir('%s_search' % mappingdict[props.asset_type])
sr = s.get('search results')
- if sr != None and ui_props.active_index != -3:
+ if sr != None and -1 < ui_props.active_index < len(sr):
r = sr[ui_props.active_index]
tpath = os.path.join(directory, r['thumbnail'])
@@ -1151,6 +1151,7 @@ def update_ui_size(area, region):
ui.rating_x = ui.bar_x
ui.rating_y = ui.bar_y - ui.bar_height
+
def get_largest_3dview():
maxsurf = 0
maxa = None
@@ -1171,6 +1172,7 @@ def get_largest_3dview():
region = r
return maxw, maxa, region
+
class AssetBarOperator(bpy.types.Operator):
'''runs search and displays the asset bar at the same time'''
bl_idname = "view3d.blenderkit_asset_bar"
@@ -1186,7 +1188,7 @@ class AssetBarOperator(bpy.types.Operator):
description="search only subtree of this category",
default="", options={'SKIP_SAVE'})
- tooltip: bpy.props.StringProperty(default = 'runs search and displays the asset bar at the same time')
+ tooltip: bpy.props.StringProperty(default='runs search and displays the asset bar at the same time')
@classmethod
def description(cls, context, properties):
@@ -1309,7 +1311,7 @@ class AssetBarOperator(bpy.types.Operator):
r = self.region
s = bpy.context.scene
sr = s.get('search results')
-
+ search_results_orig = s.get('search results orig')
# If there aren't any results, we need no interaction(yet)
if sr is None:
return {'PASS_THROUGH'}
@@ -1415,8 +1417,9 @@ class AssetBarOperator(bpy.types.Operator):
else:
ui_props.draw_tooltip = False
- if mx > ui_props.bar_x + ui_props.bar_width - 50 and len(sr) - ui_props.scrolloffset > (
- ui_props.wcount * ui_props.hcount):
+ if mx > ui_props.bar_x + ui_props.bar_width - 50 and search_results_orig[
+ 'count'] - ui_props.scrolloffset > (
+ ui_props.wcount * ui_props.hcount) + 1:
ui_props.active_index = -1
return {'RUNNING_MODAL'}
if mx < ui_props.bar_x + 50 and ui_props.scrolloffset > 0:
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index 95dddc48..5890eb75 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -351,8 +351,8 @@ def draw_panel_model_search(self, context):
layout.separator()
layout.label(text='Import method:')
- col = layout.column()
- col.prop(props, 'append_method', expand=True, icon_only=False)
+ row = layout.row()
+ row.prop(props, 'append_method', expand=True, icon_only=False)
layout.prop(props, 'randomize_rotation')
if props.randomize_rotation:
layout.prop(props, 'randomize_rotation_amount')
@@ -774,7 +774,7 @@ 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 asset_data['can_download']:
+ if asset_data.get('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')
@@ -976,7 +976,7 @@ class VIEW3D_PT_blenderkit_downloads(Panel):
def header_search_draw(self, context):
- '''Top bar menu in 3d view.'''
+ '''Top bar menu in 3d view'''
layout = self.layout
s = bpy.context.scene
ui_props = s.blenderkitUI