diff options
Diffstat (limited to 'blenderkit')
-rw-r--r-- | blenderkit/__init__.py | 2 | ||||
-rw-r--r-- | blenderkit/append_link.py | 1 | ||||
-rw-r--r-- | blenderkit/asset_bar_op.py | 2 | ||||
-rw-r--r-- | blenderkit/asset_inspector.py | 2 | ||||
-rw-r--r-- | blenderkit/autothumb.py | 2 | ||||
-rw-r--r-- | blenderkit/download.py | 2 | ||||
-rw-r--r-- | blenderkit/ratings.py | 1 | ||||
-rw-r--r-- | blenderkit/search.py | 10 | ||||
-rw-r--r-- | blenderkit/ui.py | 18 | ||||
-rw-r--r-- | blenderkit/utils.py | 4 |
10 files changed, 26 insertions, 18 deletions
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py index c58e5d99..37fa907f 100644 --- a/blenderkit/__init__.py +++ b/blenderkit/__init__.py @@ -141,8 +141,6 @@ from bpy.types import ( @persistent def scene_load(context): - print('loading in background') - print(bpy.context.window_manager) if not bpy.app.background: search.load_previews() ui_props = bpy.context.scene.blenderkitUI diff --git a/blenderkit/append_link.py b/blenderkit/append_link.py index 28b0d24e..5b54a81b 100644 --- a/blenderkit/append_link.py +++ b/blenderkit/append_link.py @@ -67,7 +67,6 @@ def append_material(file_name, matname=None, link=False, fake_user=True): # we have to find the new material , due to possible name changes mat = None for m in bpy.data.materials: - print(m.name) if m not in mats_before: mat = m break; diff --git a/blenderkit/asset_bar_op.py b/blenderkit/asset_bar_op.py index 30d94e27..0ad63a83 100644 --- a/blenderkit/asset_bar_op.py +++ b/blenderkit/asset_bar_op.py @@ -633,7 +633,7 @@ class BlenderKitAssetBarOperator(BL_UI_OT_draw_operator): properties_width = r.width tooltip_x = min(widget.x_screen + widget.width, bpy.context.region.width - self.tooltip_panel.width - properties_width) - print(widget.x_screen + widget.width, bpy.context.region.width - self.tooltip_panel.width) + # print(widget.x_screen + widget.width, bpy.context.region.width - self.tooltip_panel.width) def register(): diff --git a/blenderkit/asset_inspector.py b/blenderkit/asset_inspector.py index ecc2ccf1..72b9827d 100644 --- a/blenderkit/asset_inspector.py +++ b/blenderkit/asset_inspector.py @@ -174,7 +174,7 @@ def check_printable(props, obs): for item in info: passed = item[0].endswith(' 0') if not passed: - print(item[0]) + # print(item[0]) printable = False props.printable_3d = printable diff --git a/blenderkit/autothumb.py b/blenderkit/autothumb.py index b7f2a8d0..8eb891b0 100644 --- a/blenderkit/autothumb.py +++ b/blenderkit/autothumb.py @@ -68,7 +68,7 @@ def get_texture_ui(tpath, iname): def check_thumbnail(props, imgpath): img = utils.get_hidden_image(imgpath, 'upload_preview', force_reload=True) - print(' check thumbnail ', img) + # print(' check thumbnail ', img) if img is not None: # and img.size[0] == img.size[1] and img.size[0] >= 512 and ( # img.file_format == 'JPEG' or img.file_format == 'PNG'): props.has_thumbnail = True diff --git a/blenderkit/download.py b/blenderkit/download.py index f0c101a1..a217cc83 100644 --- a/blenderkit/download.py +++ b/blenderkit/download.py @@ -319,7 +319,6 @@ def append_asset(asset_data, **kwargs): # downloaders=[], location=None, if scene is not None: props = scene.blenderkit asset_main = scene - # print(sprops.switch_after_append) if sprops.switch_after_append: bpy.context.window_manager.windows[0].scene = scene @@ -1036,7 +1035,6 @@ def asset_in_scene(asset_data): au = scene.get('assets used', {}) id = asset_data['assetBaseId'] - print(id) if id in au.keys(): ad = au[id] if ad.get('files'): diff --git a/blenderkit/ratings.py b/blenderkit/ratings.py index f6a221c4..8c4c2b63 100644 --- a/blenderkit/ratings.py +++ b/blenderkit/ratings.py @@ -57,6 +57,7 @@ def upload_review_thread(url, reviews, headers): # print('reviews upload failed: %s' % str(e)) + def upload_rating(asset): user_preferences = bpy.context.preferences.addons['blenderkit'].preferences api_key = user_preferences.api_key diff --git a/blenderkit/search.py b/blenderkit/search.py index 1b80251e..c4796f4c 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -444,14 +444,14 @@ def search_timer(): result_field.append(asset_data) # Get ratings from BlenderKit server - # if utils.profile_is_validator(): user_preferences = bpy.context.preferences.addons['blenderkit'].preferences api_key = user_preferences.api_key headers = utils.get_headers(api_key) - for r in rdata['results']: - if ratings_utils.get_rating_local(asset_data['id']) is None: - rating_thread = threading.Thread(target=ratings_utils.get_rating, args=([r['id'], headers]), daemon=True) - rating_thread.start() + if utils.profile_is_validator(): + for r in rdata['results']: + if ratings_utils.get_rating_local(asset_data['id']) is None: + rating_thread = threading.Thread(target=ratings_utils.get_rating, args=([r['id'], headers]), daemon=True) + rating_thread.start() wm[search_name] = result_field wm['search results'] = result_field diff --git a/blenderkit/ui.py b/blenderkit/ui.py index 68c19cf0..d5692eab 100644 --- a/blenderkit/ui.py +++ b/blenderkit/ui.py @@ -770,9 +770,8 @@ def deep_ray_cast(depsgraph, ray_origin, vec): empty_set = False, Vector((0, 0, 0)), Vector((0, 0, 1)), None, None, None if not object: return empty_set - try_object = object - + print(object.type) while try_object and (try_object.display_type == 'BOUNDS' or object_in_particle_collection(try_object)): ray_origin = snapped_location + vec.normalized() * 0.0003 try_has_hit, try_snapped_location, try_snapped_normal, try_face_index, try_object, try_matrix = bpy.context.scene.ray_cast( @@ -1538,7 +1537,7 @@ class AssetBarOperator(bpy.types.Operator): else: # first, test if object can have material applied. # TODO add other types here if droppable. - if object is not None and not object.is_library_indirect and object.type == 'MESH': + if object is not None and not object.is_library_indirect and object.type in utils.supported_material_drag: target_object = object.name # create final mesh to extract correct material slot depsgraph = bpy.context.evaluated_depsgraph_get() @@ -1552,7 +1551,11 @@ class AssetBarOperator(bpy.types.Operator): message="Please select the model," "go to the 'Selected Model' panel " "in BlenderKit and hit 'Bring to Scene' first.") - + print(object.type) + if object.type not in utils.supported_material_drag: + ui_panels.ui_message(title='Unsupported object type', + message="Only meshes are supported for material drag-drop.\n " + "Use click interaction for other object types.") self.report({'WARNING'}, "Invalid or library object as input:") target_object = '' target_slot = '' @@ -1564,12 +1567,17 @@ class AssetBarOperator(bpy.types.Operator): if ui_props.asset_type in ('MATERIAL', 'MODEL'): # this was meant for particles, commenting for now or ui_props.asset_type == 'MODEL': ao = bpy.context.active_object - if ao != None and not ao.is_library_indirect: + supported_material_click = ('MESH', 'CURVE', 'META', 'FONT', 'SURFACE', 'VOLUME', 'GPENCIL') + if ao != None and not ao.is_library_indirect and ao.type in supported_material_click: target_object = bpy.context.active_object.name target_slot = bpy.context.active_object.active_material_index # change snapped location for placing material downloader. ui_props.snapped_location = bpy.context.active_object.location else: + if ao != None and ui_props.asset_type == 'MATERIAL' and ao.type not in supported_material_click: + ui_panels.ui_message(title='Unsupported object type', + message="Can't assign material to this object type." + "Please select another object.") target_object = '' target_slot = '' # FIRST START SEARCH diff --git a/blenderkit/utils.py b/blenderkit/utils.py index 930fbd79..fd01e74b 100644 --- a/blenderkit/utils.py +++ b/blenderkit/utils.py @@ -38,6 +38,10 @@ IDLE_PRIORITY_CLASS = 0x00000040 NORMAL_PRIORITY_CLASS = 0x00000020 REALTIME_PRIORITY_CLASS = 0x00000100 +supported_material_click = ('MESH', 'CURVE', 'META', 'FONT', 'SURFACE', 'VOLUME', 'GPENCIL') +# supported_material_drag = ('MESH', 'CURVE', 'META', 'FONT', 'SURFACE', 'VOLUME', 'GPENCIL') +supported_material_drag = ('MESH') + def experimental_enabled(): preferences = bpy.context.preferences.addons['blenderkit'].preferences |