Merge branch 'blender-v2.82-release'
This commit is contained in:
commit
1f92e9903f
Notes:
blender-bot
2023-02-14 07:39:46 +01:00
Referenced by issue #73210, Hair particles not showing in 3D viewport except for particle edit mode
|
@ -142,6 +142,8 @@ bool BKE_collection_child_add(struct Main *bmain,
|
|||
struct Collection *parent,
|
||||
struct Collection *child);
|
||||
|
||||
bool BKE_collection_child_add_no_sync(struct Collection *parent, struct Collection *child);
|
||||
|
||||
bool BKE_collection_child_remove(struct Main *bmain,
|
||||
struct Collection *parent,
|
||||
struct Collection *child);
|
||||
|
|
|
@ -1057,6 +1057,11 @@ bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BKE_collection_child_add_no_sync(Collection *parent, Collection *child)
|
||||
{
|
||||
return collection_child_add(parent, child, 0, true);
|
||||
}
|
||||
|
||||
bool BKE_collection_child_remove(Main *bmain, Collection *parent, Collection *child)
|
||||
{
|
||||
if (!collection_child_remove(parent, child)) {
|
||||
|
|
|
@ -340,6 +340,23 @@ static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBas
|
|||
FOREACH_FINALIZE_VOID;
|
||||
}
|
||||
|
||||
/* Used by both real Collection data-blokcs, and the fake horror of master collection from Scene.
|
||||
*/
|
||||
static void library_foreach_collection(LibraryForeachIDData *data, Collection *collection)
|
||||
{
|
||||
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
|
||||
FOREACH_CALLBACK_INVOKE(data, cob->ob, IDWALK_CB_USER);
|
||||
}
|
||||
for (CollectionChild *child = collection->children.first; child; child = child->next) {
|
||||
FOREACH_CALLBACK_INVOKE(data, child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
|
||||
}
|
||||
for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
|
||||
FOREACH_CALLBACK_INVOKE(data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK);
|
||||
}
|
||||
|
||||
FOREACH_FINALIZE_VOID;
|
||||
}
|
||||
|
||||
static void library_foreach_ID_as_subdata_link(ID **id_pp,
|
||||
LibraryIDLinkCallback callback,
|
||||
void *user_data,
|
||||
|
@ -484,14 +501,7 @@ static void library_foreach_ID_link(Main *bmain,
|
|||
SEQ_END;
|
||||
}
|
||||
|
||||
for (CollectionObject *cob = scene->master_collection->gobject.first; cob;
|
||||
cob = cob->next) {
|
||||
CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER);
|
||||
}
|
||||
for (CollectionChild *child = scene->master_collection->children.first; child;
|
||||
child = child->next) {
|
||||
CALLBACK_INVOKE(child->collection, IDWALK_CB_USER);
|
||||
}
|
||||
library_foreach_collection(&data, scene->master_collection);
|
||||
|
||||
ViewLayer *view_layer;
|
||||
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
|
||||
|
@ -800,15 +810,7 @@ static void library_foreach_ID_link(Main *bmain,
|
|||
|
||||
case ID_GR: {
|
||||
Collection *collection = (Collection *)id;
|
||||
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
|
||||
CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER);
|
||||
}
|
||||
for (CollectionChild *child = collection->children.first; child; child = child->next) {
|
||||
CALLBACK_INVOKE(child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
|
||||
}
|
||||
for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
|
||||
CALLBACK_INVOKE(parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK);
|
||||
}
|
||||
library_foreach_collection(&data, collection);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
|
|||
|
||||
if (scene_eval->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) {
|
||||
/* Update Motion Blur Matrices */
|
||||
if (camera) {
|
||||
if (camera && (camera->type == OB_CAMERA) && (camera->data != NULL)) {
|
||||
float persmat[4][4];
|
||||
float ctime = DEG_get_ctime(draw_ctx->depsgraph);
|
||||
float delta = scene_eval->eevee.motion_blur_shutter;
|
||||
|
|
|
@ -1721,14 +1721,6 @@ static void libblock_relink_collection(Collection *collection, const bool do_col
|
|||
}
|
||||
}
|
||||
|
||||
static void libblock_relink_collections_from_scene(Scene *scene)
|
||||
{
|
||||
/* Will also handle the master collection. */
|
||||
BKE_libblock_relink_to_newid(&scene->id);
|
||||
|
||||
libblock_relink_collection(scene->master_collection, false);
|
||||
}
|
||||
|
||||
static Collection *single_object_users_collection(Main *bmain,
|
||||
Scene *scene,
|
||||
Collection *collection,
|
||||
|
@ -1763,8 +1755,13 @@ static Collection *single_object_users_collection(Main *bmain,
|
|||
child_next = child->next;
|
||||
Collection *collection_child_new = single_object_users_collection(
|
||||
bmain, scene, child->collection, flag, copy_collections, false);
|
||||
|
||||
if (is_master_collection && copy_collections && child->collection != collection_child_new) {
|
||||
BKE_collection_child_add(bmain, collection, collection_child_new);
|
||||
/* We do not want a collection sync here, our collections are in a complete unsetled state
|
||||
* currently. With current code, that would lead to a memory leak - because of reasons.
|
||||
* It would be a useless loss of computing anyway, since caller has to fully refresh
|
||||
* viewlayers/collections caching at the end. */
|
||||
BKE_collection_child_add_no_sync(collection, collection_child_new);
|
||||
BLI_remlink(&collection->children, child);
|
||||
MEM_freeN(child);
|
||||
if (child == orig_child_last) {
|
||||
|
@ -1784,57 +1781,20 @@ static void single_object_users(
|
|||
Collection *master_collection = scene->master_collection;
|
||||
single_object_users_collection(bmain, scene, master_collection, flag, copy_collections, true);
|
||||
|
||||
/* duplicate collections that consist entirely of duplicated objects */
|
||||
/* XXX I guess that was designed for calls from 'make single user' operator.
|
||||
* But since copy_collection is always false then, was not doing anything.
|
||||
* And that kind of behavior should be added at operator level,
|
||||
* not in a utility function also used by rather different code. */
|
||||
#if 0
|
||||
if (copy_collections) {
|
||||
Collection *collection, *collectionn;
|
||||
for (collection = bmain->collections.first; collection; collection = collection->id.next) {
|
||||
bool all_duplicated = true;
|
||||
bool any_duplicated = false;
|
||||
|
||||
for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
|
||||
any_duplicated = true;
|
||||
if (cob->ob->id.newid == NULL) {
|
||||
all_duplicated = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (any_duplicated && all_duplicated) {
|
||||
// TODO: test if this works, with child collections ..
|
||||
collectionn = ID_NEW_SET(collection, BKE_collection_copy(bmain, NULL, collection));
|
||||
|
||||
for (CollectionObject *cob = collectionn->gobject.first; cob; cob = cob->next) {
|
||||
cob->ob = (Object *)cob->ob->id.newid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Will also handle the master collection. */
|
||||
BKE_libblock_relink_to_newid(&scene->id);
|
||||
|
||||
/* Collection and object pointers in collections */
|
||||
libblock_relink_collections_from_scene(scene);
|
||||
libblock_relink_collection(scene->master_collection, false);
|
||||
|
||||
/* collection pointers in scene */
|
||||
BKE_scene_groups_relink(scene);
|
||||
|
||||
/* active camera */
|
||||
ID_NEW_REMAP(scene->camera);
|
||||
/* We also have to handle runtime things in UI. */
|
||||
if (v3d) {
|
||||
ID_NEW_REMAP(v3d->camera);
|
||||
}
|
||||
/* Camera pointers of markers. */
|
||||
for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
|
||||
ID_NEW_REMAP(marker->camera);
|
||||
}
|
||||
|
||||
/* Making single user may affect other scenes if they share
|
||||
* with current one some collections in their ViewLayer. */
|
||||
BKE_main_collection_sync(bmain);
|
||||
BKE_main_collection_sync_remap(bmain);
|
||||
}
|
||||
|
||||
/* not an especially efficient function, only added so the single user
|
||||
|
@ -2060,13 +2020,19 @@ void ED_object_single_users(Main *bmain,
|
|||
single_obdata_users(bmain, scene, NULL, NULL, 0);
|
||||
single_object_action_users(bmain, scene, NULL, NULL, 0);
|
||||
single_mat_users_expand(bmain);
|
||||
|
||||
/* Duplicating obdata and other IDs may require another update of the collections and objects
|
||||
* pointers, especially regarding drivers and custom props, see T66641.
|
||||
* Note that this whole scene duplication code and 'make single user' functions have te be
|
||||
* rewritten at some point to make use of proper modern ID management code,
|
||||
* but that is no small task.
|
||||
* For now we are doomed to that kind of band-aid to try to cover most of remapping cases. */
|
||||
libblock_relink_collections_from_scene(scene);
|
||||
|
||||
/* Will also handle the master collection. */
|
||||
BKE_libblock_relink_to_newid(&scene->id);
|
||||
|
||||
/* Collection and object pointers in collections */
|
||||
libblock_relink_collection(scene->master_collection, false);
|
||||
}
|
||||
|
||||
/* Relink nodetrees' pointers that have been duplicated. */
|
||||
|
|
Loading…
Reference in New Issue