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-02-11 20:56:48 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-02-11 20:56:48 +0300
commit6b61dff0841600368710710894ccc0c20867929f (patch)
treed2b09666cdcf8254cf467f9a32bb44441fbe6e0a
parent3d9a13e0d50ee72605348f2276b287040336ef6b (diff)
BlenderKit: fix bugsv2.82
clipboard pasting not working at all, kind of a showstopper, and an error in Rating drawing that spammed console. several tooltips fixed
-rw-r--r--blenderkit/__init__.py7
-rw-r--r--blenderkit/search.py45
-rw-r--r--blenderkit/ui_panels.py6
3 files changed, 45 insertions, 13 deletions
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py
index 82361f6e..d64ea133 100644
--- a/blenderkit/__init__.py
+++ b/blenderkit/__init__.py
@@ -1313,7 +1313,8 @@ class BlenderKitModelSearchProps(PropertyGroup, BlenderKitCommonSearchProps):
('LINK_COLLECTION', 'Link', 'Link Collection'),
('APPEND_OBJECTS', 'Append', 'Append as Objects'),
),
- description="choose if the assets will be linked or appended",
+ description="Appended objects are editable in your scene. Linked assets are saved in original files, "
+ "aren't editable but also don't increase your file size",
default="LINK_COLLECTION"
)
append_link: EnumProperty(
@@ -1453,8 +1454,8 @@ class BlenderKitAddonPreferences(AddonPreferences):
)
search_in_header: BoolProperty(
- name="Show BlenderKit search in 3d view header",
- description="Show BlenderKit search in 3d view header",
+ name="Show BlenderKit search in 3D view header",
+ description="Show BlenderKit search in 3D view header",
default=True
)
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 426f2923..bf430d91 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -148,24 +148,25 @@ def timer_update():
# clipboard monitoring to search assets from web
global last_clipboard
if bpy.context.window_manager.clipboard != last_clipboard:
- last_clipboard = bpy.context.window_manager.clipboard
+ last_clipboard = bpy.context.window_manager.clipboard
instr = 'asset_base_id:'
+ # first check if contains asset id, then asset type
if last_clipboard[:len(instr)] == instr:
atstr = 'asset_type:'
ati = last_clipboard.find(atstr)
+ #this only checks if the asset_type keyword is there but let's the keywords update function do the parsing.
if ati > -1:
- at = last_clipboard[ati:]
-
- search_props = utils.get_search_props()
- search_props.search_keywords = last_clipboard
- search()
+ search_props = utils.get_search_props()
+ search_props.search_keywords = last_clipboard
+ # don't run search after this - assigning to keywords runs the search_update function.
global search_threads
- # don't do anything while dragging - this could switch asset type during drag, and make results list length different,
- # causing a lot of throuble literally.
+ # don't do anything while dragging - this could switch asset during drag, and make results list length different,
+ # causing a lot of throuble.
if len(search_threads) == 0 or bpy.context.scene.blenderkitUI.dragging:
return 1
- for thread in search_threads: # TODO this doesn't check all processes when one gets removed,
+ for thread in search_threads:
+ # TODO this doesn't check all processes when one gets removed,
# but most of the time only one is running anyway
if not thread[0].is_alive():
search_threads.remove(thread) #
@@ -1189,6 +1190,32 @@ def search_update(self, context):
if ui_props.down_up != 'SEARCH':
ui_props.down_up = 'SEARCH'
+ # here we tweak the input if it comes form the clipboard. we need to get rid of asset type and set it to
+ sprops = utils.get_search_props()
+ instr = 'asset_base_id:'
+ atstr = 'asset_type:'
+ kwds = sprops.search_keywords
+ idi = kwds.find(instr)
+ ati = kwds.find(atstr)
+ # if the asset type already isn't there it means this update function
+ # was triggered by it's last iteration and needs to cancel
+ if idi>-1 and ati == -1:
+ return;
+ if ati > -1:
+ at = kwds[ati:].lower()
+ # uncertain length of the remaining string - find as better method to check the presence of asset type
+ if at.find('model') > -1:
+ ui_props.asset_type = 'MODEL'
+ elif at.find('material') > -1:
+ ui_props.asset_type = 'MATERIAL'
+ elif at.find('brush') > -1:
+ ui_props.asset_type = 'BRUSH'
+ # now we trim the input copypaste by anything extra that is there,
+ # this is also a way for this function to recognize that it already has parsed the clipboard
+ # the search props can have changed and this needs to transfer the data to the other field
+ # this complex behaviour is here for the case where the user needs to paste manually into blender?
+ sprops = utils.get_search_props()
+ sprops.search_keywords = kwds[:ati].rstrip()
search()
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index e9727d0e..cacc1df4 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -69,6 +69,10 @@ def label_multiline(layout, text='', icon='NONE', width=-1):
def draw_ratings(layout, context):
# layout.operator("wm.url_open", text="Read rating instructions", icon='QUESTION').url = 'https://support.google.com/?hl=en'
asset = utils.get_active_asset()
+ # the following shouldn't happen at all in an optimal case,
+ # this function should run only when asset was already checked to be existing
+ if asset == None:
+ return;
bkit_ratings = asset.bkit_ratings
ratings.draw_rating(layout, bkit_ratings, 'rating_quality', 'Quality')
@@ -406,7 +410,7 @@ class VIEW3D_PT_blenderkit_model_properties(Panel):
o = utils.get_active_model()
# o = bpy.context.active_object
if o.get('asset_data') is None:
- label_multiline(layout, text='To upload this asset to BlenderKit, go to the Find and Upload Assets pael.')
+ label_multiline(layout, text='To upload this asset to BlenderKit, go to the Find and Upload Assets panel.')
layout.prop(o, 'name')
if o.get('asset_data') is not None: