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:
authorBrecht Van Lommel <brecht@blender.org>2020-05-10 15:11:32 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-05-10 15:11:32 +0300
commit2ec6a79dfb402d95c661bb910864440a3d3872b3 (patch)
treedd5e66c5537420a67387c4f7aa46890305be1a8a
parent98344788e1c48e4d336cdee026e13c4a75f75438 (diff)
parentb4f07c45de2e012bf7342cc17974f4065fe73fdf (diff)
Merge branch 'blender-v2.83-release'
-rw-r--r--blenderkit/overrides.py27
-rw-r--r--blenderkit/search.py29
-rw-r--r--io_export_dxf/export_dxf.py4
3 files changed, 34 insertions, 26 deletions
diff --git a/blenderkit/overrides.py b/blenderkit/overrides.py
index a0c76326..606a19bb 100644
--- a/blenderkit/overrides.py
+++ b/blenderkit/overrides.py
@@ -187,18 +187,18 @@ class BringToScene(Operator):
return bpy.context.view_layer.objects.active is not None
def execute(self, context):
- import bpy
s = bpy.context.scene
sobs = s.collection.all_objects
aob = bpy.context.active_object
dg = aob.instance_collection
- instances = []
+ vlayer = bpy.context.view_layer
+ instances_emptys = []
# first, find instances of this collection in the scene
for ob in sobs:
- if ob.instance_collection == dg and ob not in instances:
- instances.append(ob)
+ if ob.instance_collection == dg and ob not in instances_emptys:
+ instances_emptys.append(ob)
ob.instance_collection = None
ob.instance_type = 'NONE'
# dg.make_local
@@ -208,21 +208,28 @@ class BringToScene(Operator):
dg.objects.unlink(ob)
try:
s.collection.objects.link(ob)
-
+ ob.select_set(True)
+ obs.append(ob)
if ob.parent == None:
parent = ob
bpy.context.view_layer.objects.active = parent
except Exception as e:
print(e)
- ob.select_set(True)
- obs.append(ob)
+
bpy.ops.object.make_local(type='ALL')
- for ob in obs:
- ob.select_set(True)
+
+ for i, ob in enumerate(obs):
+ if ob.name in vlayer.objects:
+ obs[i] = vlayer.objects[ob.name]
+ try:
+ ob.select_set(True)
+ except Exception as e:
+ print('failed to select an object from the collection, getting a replacement.')
+ print(e)
related = []
- for i, ob in enumerate(instances):
+ for i, ob in enumerate(instances_emptys):
if i > 0:
bpy.ops.object.duplicate(linked=True)
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 641b1548..8406e47d 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -55,7 +55,7 @@ from bpy.types import (
import requests, os, random
import time
import threading
-import tempfile
+import platform
import json
import bpy
@@ -133,19 +133,20 @@ last_clipboard = ''
def check_clipboard():
# 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
- 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:
- 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.
+ if platform.system() != 'Linux':
+ global last_clipboard
+ if bpy.context.window_manager.clipboard != last_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:
+ 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.
# @bpy.app.handlers.persistent
diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py
index 88a27b3b..71434a71 100644
--- a/io_export_dxf/export_dxf.py
+++ b/io_export_dxf/export_dxf.py
@@ -35,7 +35,7 @@ def exportDXF(context, filePath, settings):
"""
print("----------\nExporting to {}".format(filePath))
import time
- time1 = time.clock()
+ time1 = time.perf_counter()
if settings['verbose']:
print("Generating Object list for export... (Root parents only)")
@@ -71,7 +71,7 @@ def exportDXF(context, filePath, settings):
drawing.convert(filePath)
- duration = time.clock() - time1
+ duration = time.perf_counter() - time1
print('%s objects exported in %.2f seconds. -----DONE-----' %\
(exported, duration))
except IOError: