diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 15:18:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 15:23:35 +0300 |
commit | e8f8c13d4b76ba587ef7cf33370b286d4fbd36bc (patch) | |
tree | 371472ae220ad8740b310aaa8f4c5746448302c5 /source/blender/blenkernel/intern/collection.c | |
parent | 0c062a9e082130212447c2b67e8e16b8a2e622d1 (diff) | |
parent | 44bb73e765a6f79bc14a46449368f83e572d8bad (diff) |
PointCloud: Initial rendering support for Workbenchtmp-pointcloud-render
Also includes outline overlays. Removes the temp overlay drawing
We make the geometry follow camera like billboards this uses less
geometry. Currently we use half octahedron for now. Goal would be
to use icospheres.
This patch also optimize the case when pointcloud has uniform radius.
However we should premultiply the radius prop by the default radius
beforehand to avoid a multiplication on CPU.
Differential Revision: https://developer.blender.org/D8301
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 080d61f1500..7e22048379b 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -333,7 +333,6 @@ static Collection *collection_duplicate_recursive(Main *bmain, Collection *collection_new; bool do_full_process = false; const bool is_collection_master = (collection_old->flag & COLLECTION_IS_MASTER) != 0; - const bool is_collection_liboverride = ID_IS_OVERRIDE_LIBRARY(collection_old); const bool do_objects = (duplicate_flags & USER_DUP_OBJECT) != 0; @@ -346,7 +345,12 @@ static Collection *collection_duplicate_recursive(Main *bmain, } else if (collection_old->id.newid == NULL) { collection_new = (Collection *)BKE_id_copy_for_duplicate( - bmain, (ID *)collection_old, is_collection_liboverride, duplicate_flags); + bmain, (ID *)collection_old, duplicate_flags); + + if (collection_new == collection_old) { + return collection_new; + } + do_full_process = true; } else { @@ -382,17 +386,15 @@ static Collection *collection_duplicate_recursive(Main *bmain, Object *ob_old = cob->ob; Object *ob_new = (Object *)ob_old->id.newid; - /* If collection is an override, we do not want to duplicate any linked data-block, as that - * would generate a purely local data. */ - if (is_collection_liboverride && ID_IS_LINKED(ob_old)) { - continue; - } - if (ob_new == NULL) { ob_new = BKE_object_duplicate( bmain, ob_old, duplicate_flags, duplicate_options | LIB_ID_DUPLICATE_IS_SUBPROCESS); } + if (ob_new == ob_old) { + continue; + } + collection_object_add(bmain, collection_new, ob_new, 0, true); collection_object_remove(bmain, collection_new, ob_old, false); } @@ -403,13 +405,11 @@ static Collection *collection_duplicate_recursive(Main *bmain, LISTBASE_FOREACH_MUTABLE (CollectionChild *, child, &collection_old->children) { Collection *child_collection_old = child->collection; - if (is_collection_liboverride && ID_IS_LINKED(child_collection_old)) { - continue; - } - - collection_duplicate_recursive( + Collection *child_collection_new = collection_duplicate_recursive( bmain, collection_new, child_collection_old, duplicate_flags, duplicate_options); - collection_child_remove(collection_new, child_collection_old); + if (child_collection_new != child_collection_old) { + collection_child_remove(collection_new, child_collection_old); + } } return collection_new; @@ -434,6 +434,11 @@ Collection *BKE_collection_duplicate(Main *bmain, if (!is_subprocess) { BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false); BKE_main_id_clear_newpoins(bmain); + /* In case root duplicated ID is linked, assume we want to get a local copy of it and duplicate + * all expected linked data. */ + if (ID_IS_LINKED(collection)) { + duplicate_flags |= USER_DUP_LINKED_ID; + } } Collection *collection_new = collection_duplicate_recursive( |