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:
-rw-r--r--curve_simplify.py2
-rw-r--r--io_scene_fbx/import_fbx.py6
-rw-r--r--io_scene_obj/import_obj.py2
-rw-r--r--object_print3d_utils/mesh_helpers.py16
-rw-r--r--rigify/generate.py2
-rw-r--r--rigify/legacy/generate.py2
-rw-r--r--rigify/legacy/utils.py6
-rw-r--r--rigify/utils.py6
8 files changed, 19 insertions, 23 deletions
diff --git a/curve_simplify.py b/curve_simplify.py
index e14b2857..e0d59c60 100644
--- a/curve_simplify.py
+++ b/curve_simplify.py
@@ -307,7 +307,7 @@ def main(context, obj, options, curve_dimension):
# create new object and put into scene
newCurve = bpy.data.objects.new("Simple_" + obj.name, curve)
- coll = context.view_layer.collections.active.collection
+ coll = context.view_layer.active_layer_collection.collection
coll.objects.link(newCurve)
newCurve.select_set('SELECT')
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 353a027f..0a8be6cf 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1970,7 +1970,7 @@ class FbxImportHelperNode:
child.build_skeleton_children(fbx_tmpl, settings, scene, view_layer)
# instance in scene
- view_layer.collections.active.collection.objects.link(obj)
+ view_layer.active_layer_collection.collection.objects.link(obj)
obj.select_set('SELECT')
return obj
@@ -2097,7 +2097,7 @@ class FbxImportHelperNode:
blen_read_custom_properties(self.fbx_elem, arm, settings)
# instance in scene
- view_layer.collections.active.collection.objects.link(arm)
+ view_layer.active_layer_collection.collection.objects.link(arm)
arm.select_set('SELECT')
# Add bones:
@@ -2140,7 +2140,7 @@ class FbxImportHelperNode:
child.build_hierarchy(fbx_tmpl, settings, scene, view_layer)
# instance in scene
- view_layer.collections.active.collection.objects.link(obj)
+ view_layer.active_layer_collection.collection.objects.link(obj)
obj.select_set('SELECT')
return obj
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 84ea3706..71810bcc 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -1179,7 +1179,7 @@ def load(context,
create_nurbs(context_nurbs, verts_loc, new_objects)
view_layer = context.view_layer
- collection = view_layer.collections.active.collection
+ collection = view_layer.active_layer_collection.collection
# Create new obj
for obj in new_objects:
diff --git a/object_print3d_utils/mesh_helpers.py b/object_print3d_utils/mesh_helpers.py
index 873f30d2..44cce337 100644
--- a/object_print3d_utils/mesh_helpers.py
+++ b/object_print3d_utils/mesh_helpers.py
@@ -158,12 +158,8 @@ def bmesh_check_thick_object(obj, thickness):
context = bpy.context
scene = context.scene
layer = context.view_layer
- layer_collection = context.layer_collection
- if layer_collection is None:
- scene_collection = scene.master_collection.collections.new("")
- layer_collection = layer.collections.link(scene_collection)
- else:
- scene_collection = layer_collection.collection
+ layer_collection = context.layer_collection or layer.active_layer_collection
+ scene_collection = layer_collection.collection
me_tmp = bpy.data.meshes.new(name="~temp~")
bm.to_mesh(me_tmp)
@@ -241,12 +237,8 @@ def object_merge(context, objects):
scene = context.scene
layer = context.view_layer
- layer_collection = context.layer_collection
- if layer_collection is None:
- scene_collection = scene.master_collection.collections.new("")
- layer_collection = layer.collections.link(scene_collection)
- else:
- scene_collection = layer_collection.collection
+ layer_collection = context.layer_collection or layer.active_layer_collection
+ scene_collection = layer_collection.collection
# deselect all
for obj in scene.objects:
diff --git a/rigify/generate.py b/rigify/generate.py
index 948ece11..b38bfd6d 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -521,7 +521,7 @@ def generate_rig(context, metarig):
#----------------------------------
# Restore active collection
- view_layer.collections.active = layer_collection
+ view_layer.active_layer_collection = layer_collection
def create_selection_sets(obj, metarig):
diff --git a/rigify/legacy/generate.py b/rigify/legacy/generate.py
index 9a39e333..77c4e28e 100644
--- a/rigify/legacy/generate.py
+++ b/rigify/legacy/generate.py
@@ -435,7 +435,7 @@ def generate_rig(context, metarig):
#----------------------------------
# Restore active collection
- view_layer.collections.active = layer_collection
+ view_layer.active_layer_collection = layer_collection
def get_bone_rigs(obj, bone_name, halt_on_missing=False):
diff --git a/rigify/legacy/utils.py b/rigify/legacy/utils.py
index 0f3a092e..1f017022 100644
--- a/rigify/legacy/utils.py
+++ b/rigify/legacy/utils.py
@@ -965,9 +965,11 @@ def ensure_widget_collection(context):
collection.children.link(widget_collection)
widget_layer_collection = [c for c in layer_collection.children if c.collection == widget_collection][0]
+ elif widget_collection == view_layer.layer_collection.collection:
+ widget_layer_collection = view_layer.layer_collection
else:
- widget_layer_collection = get_layer_collection_from_collection(view_layer.collections, widget_collection)
+ widget_layer_collection = get_layer_collection_from_collection(view_layer.layer_collection.children, widget_collection)
# Make the widget the active collection for the upcoming added (widget) objects
- view_layer.collections.active = widget_layer_collection
+ view_layer.active_layer_collection = widget_layer_collection
return widget_collection
diff --git a/rigify/utils.py b/rigify/utils.py
index 23596b3c..2722659d 100644
--- a/rigify/utils.py
+++ b/rigify/utils.py
@@ -1290,9 +1290,11 @@ def ensure_widget_collection(context):
collection.children.link(widget_collection)
widget_layer_collection = [c for c in layer_collection.children if c.collection == widget_collection][0]
+ elif widget_collection == view_layer.layer_collection.collection:
+ widget_layer_collection = view_layer.layer_collection
else:
- widget_layer_collection = get_layer_collection_from_collection(view_layer.collections, widget_collection)
+ widget_layer_collection = get_layer_collection_from_collection(view_layer.layer_collection.children, widget_collection)
# Make the widget the active collection for the upcoming added (widget) objects
- view_layer.collections.active = widget_layer_collection
+ view_layer.active_layer_collection = widget_layer_collection
return widget_collection