Merge branch 'blender-v2.83-release'
This commit is contained in:
commit
2ec6a79dfb
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue