[CG Pipeline] Refactor
This commit is contained in:
parent
6538f70d54
commit
b3612d8655
23 changed files with 634 additions and 645 deletions
|
@ -54,4 +54,26 @@ def copy_collections_recursive(collection, suffix='copy', linked=False):
|
|||
parent = double_lut[obj.parent]
|
||||
if parent:
|
||||
double.parent = parent
|
||||
return '_'.join((collection.name, suffix))
|
||||
|
||||
|
||||
def unlink_from_collections(obj):
|
||||
''' Unlinking object from all collections. '''
|
||||
for col in bpy.data.collections:
|
||||
if obj.name in col.objects:
|
||||
col.objects.unlink(obj)
|
||||
return obj
|
||||
|
||||
|
||||
def remove_collections_with_objects(collection=None):
|
||||
'''Removes all collection (or given) with objects from scene '''
|
||||
if collection:
|
||||
for obj in collection.objects:
|
||||
bpy.data.objects.remove(obj, do_unlink=True)
|
||||
bpy.data.collections.remove(collection)
|
||||
else:
|
||||
for col in bpy.data.collections:
|
||||
for obj in col.objects:
|
||||
bpy.data.objects.remove(obj, do_unlink=True)
|
||||
bpy.data.collections.remove(col)
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue