diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-30 16:57:22 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-18 14:34:24 +0300 |
commit | 17bd5c9d4b1e9377b896c13043e24eaa7e979714 (patch) | |
tree | 60ca4e4118c01d88ccc04919d4f7ed46014875c1 /release/scripts/modules | |
parent | 70aec3732d0f03138d6477fd04c81dfd9fd21256 (diff) |
Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
for each. For many workflows one view layer can be used, these are more of an
advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
cases. The main thing that's still a bit slower is multiple scenes, we have to
change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
controls. Of course users may not want to set up their scenes differently
now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
files. There's a few things which are know to be not quite compatible, like
nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
#ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
be done later, we'll have to see how important this is as all objects within
the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bl_previews_utils/bl_previews_render.py | 36 | ||||
-rw-r--r-- | release/scripts/modules/bpy_types.py | 14 |
2 files changed, 25 insertions, 25 deletions
diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index 32266e972bb..fb3a18c6bea 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -68,7 +68,7 @@ def rna_backup_restore(data, backup): setattr(dt, path[-1], val) -def do_previews(do_objects, do_groups, do_scenes, do_data_intern): +def do_previews(do_objects, do_collections, do_scenes, do_data_intern): import collections # Helpers. @@ -251,9 +251,9 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): return 'BLENDER_RENDER' def object_bbox_merge(bbox, ob, ob_space, offset_matrix): - # Take group instances into account (including linked one in this case). - if ob.type == 'EMPTY' and ob.dupli_type == 'GROUP': - grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in ob.dupli_group.objects) + # Take collections instances into account (including linked one in this case). + if ob.type == 'EMPTY' and ob.dupli_type == 'COLLECTION': + grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in ob.dupli_group.all_objects) if (len(grp_objects) == 0): ob_bbox = ob.bound_box else: @@ -343,7 +343,7 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): render_contexts = {} objects_ignored = set() - groups_ignored = set() + collections_ignored = set() prev_scenename = bpy.context.screen.scene.name @@ -398,11 +398,11 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): if is_rendered is not ...: ob.hide_render = is_rendered - if do_groups: - for grp in ids_nolib(bpy.data.groups): - if grp.name in groups_ignored: + if do_collections: + for grp in ids_nolib(bpy.data.collections): + if grp.name in collections_ignored: continue - # Here too, we do want to keep linked objects members of local group... + # Here too, we do want to keep linked objects members of local collection... objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in grp.objects) render_engine = objects_render_engine_guess(objects) @@ -414,14 +414,14 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): scene = bpy.data.scenes[render_context.scene, None] bpy.context.screen.scene = scene - bpy.ops.object.group_instance_add(group=grp.name) + bpy.ops.object.collection_instance_add(collection=grp.name) grp_ob = next((ob for ob in scene.objects if ob.dupli_group and ob.dupli_group.name == grp.name)) grp_obname = grp_ob.name scene.update() offset_matrix = Matrix.Translation(grp.dupli_offset).inverted() - preview_render_do(render_context, 'groups', grp.name, objects, offset_matrix) + preview_render_do(render_context, 'collections', grp.name, objects, offset_matrix) scene = bpy.data.scenes[render_context.scene, None] scene.objects.unlink(bpy.data.objects[grp_obname, None]) @@ -462,7 +462,7 @@ def do_previews(do_objects, do_groups, do_scenes, do_data_intern): print("*NOT* Saving %s, because some error(s) happened while deleting temp render data..." % bpy.data.filepath) -def do_clear_previews(do_objects, do_groups, do_scenes, do_data_intern): +def do_clear_previews(do_objects, do_collections, do_scenes, do_data_intern): if do_data_intern: bpy.ops.wm.previews_clear(id_type=INTERN_PREVIEW_TYPES) @@ -470,8 +470,8 @@ def do_clear_previews(do_objects, do_groups, do_scenes, do_data_intern): for ob in ids_nolib(bpy.data.objects): ob.preview.image_size = (0, 0) - if do_groups: - for grp in ids_nolib(bpy.data.groups): + if do_collections: + for grp in ids_nolib(bpy.data.collections): grp.preview.image_size = (0, 0) if do_scenes: @@ -502,8 +502,8 @@ def main(): help="Do not generate a backup .blend1 file when saving processed ones.") parser.add_argument('--no_scenes', default=True, action="store_false", help="Do not generate/clear previews for scene IDs.") - parser.add_argument('--no_groups', default=True, action="store_false", - help="Do not generate/clear previews for group IDs.") + parser.add_argument('--no_collections', default=True, action="store_false", + help="Do not generate/clear previews for collection IDs.") parser.add_argument('--no_objects', default=True, action="store_false", help="Do not generate/clear previews for object IDs.") parser.add_argument('--no_data_intern', default=True, action="store_false", @@ -518,11 +518,11 @@ def main(): if args.clear: print("clear!") - do_clear_previews(do_objects=args.no_objects, do_groups=args.no_groups, do_scenes=args.no_scenes, + do_clear_previews(do_objects=args.no_objects, do_collections=args.no_collections, do_scenes=args.no_scenes, do_data_intern=args.no_data_intern) else: print("render!") - do_previews(do_objects=args.no_objects, do_groups=args.no_groups, do_scenes=args.no_scenes, + do_previews(do_objects=args.no_objects, do_collections=args.no_collections, do_scenes=args.no_scenes, do_data_intern=args.no_data_intern) # Not really necessary, but better be consistent. diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 324bb43d890..fd6f8e23727 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -60,7 +60,7 @@ class Library(bpy_types.ID): # See: readblenentry.c, IDTYPE_FLAGS_ISLINKABLE, # we could make this an attribute in rna. attr_links = ("actions", "armatures", "brushes", "cameras", - "curves", "grease_pencil", "groups", "images", + "curves", "grease_pencil", "collections", "images", "lamps", "lattices", "materials", "metaballs", "meshes", "node_groups", "objects", "scenes", "sounds", "speakers", "textures", "texts", @@ -96,12 +96,12 @@ class Texture(bpy_types.ID): ) -class Group(bpy_types.ID): +class Collection(bpy_types.ID): __slots__ = () @property def users_dupli_group(self): - """The dupli group this group is used in""" + """The collection instance objects this collection is used in""" import bpy return tuple(obj for obj in bpy.data.objects if self == obj.dupli_group) @@ -118,11 +118,11 @@ class Object(bpy_types.ID): if child.parent == self) @property - def users_group(self): - """The groups this object is in""" + def users_collection(self): + """The collections this object is in""" import bpy - return tuple(group for group in bpy.data.groups - if self in group.objects[:]) + return tuple(collection for collection in bpy.data.collections + if self in collection.objects[:]) @property def users_scene(self): |