Merge branch 'blender-v4.0-release'
This commit is contained in:
@@ -376,6 +376,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification;
|
||||
- (void)toggleFullScreen:(NSNotification *)notification;
|
||||
- (void)windowWillClose:(NSNotification *)notification;
|
||||
|
||||
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;
|
||||
@end
|
||||
|
||||
@implementation CocoaAppDelegate : NSObject
|
||||
@@ -493,6 +495,19 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
||||
}
|
||||
}
|
||||
|
||||
/* Explicitly opt-in to the secure codeing for the restorable state.
|
||||
*
|
||||
* This is something that only has affect on macOS 12+, and is implicitly
|
||||
* enabled on macOS 14.
|
||||
*
|
||||
* For the details see
|
||||
* https://sector7.computest.nl/post/2022-08-process-injection-breaking-all-macos-security-layers-with-a-single-vulnerability/
|
||||
*/
|
||||
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark initialization/finalization
|
||||
|
||||
@@ -63,11 +63,16 @@ static CLG_LogRef LOG = {"bke.collection"};
|
||||
|
||||
static bool collection_child_add(Collection *parent,
|
||||
Collection *collection,
|
||||
CollectionLightLinking *light_linking,
|
||||
const int flag,
|
||||
const bool add_us);
|
||||
static bool collection_child_remove(Collection *parent, Collection *collection);
|
||||
static bool collection_object_add(
|
||||
Main *bmain, Collection *collection, Object *ob, int flag, const bool add_us);
|
||||
static bool collection_object_add(Main *bmain,
|
||||
Collection *collection,
|
||||
Object *ob,
|
||||
CollectionLightLinking *light_linking,
|
||||
int flag,
|
||||
const bool add_us);
|
||||
|
||||
static void collection_object_remove_no_gobject_hash(Main *bmain,
|
||||
Collection *collection,
|
||||
@@ -141,10 +146,10 @@ static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, cons
|
||||
collection_dst->runtime.gobject_hash = nullptr;
|
||||
|
||||
LISTBASE_FOREACH (CollectionChild *, child, &collection_src->children) {
|
||||
collection_child_add(collection_dst, child->collection, flag, false);
|
||||
collection_child_add(collection_dst, child->collection, &child->light_linking, flag, false);
|
||||
}
|
||||
LISTBASE_FOREACH (CollectionObject *, cob, &collection_src->gobject) {
|
||||
collection_object_add(bmain, collection_dst, cob->ob, flag, false);
|
||||
collection_object_add(bmain, collection_dst, cob->ob, &cob->light_linking, flag, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +386,7 @@ static Collection *collection_add(Main *bmain,
|
||||
|
||||
/* Optionally add to parent collection. */
|
||||
if (collection_parent) {
|
||||
collection_child_add(collection_parent, collection, 0, true);
|
||||
collection_child_add(collection_parent, collection, nullptr, 0, true);
|
||||
}
|
||||
|
||||
return collection;
|
||||
@@ -405,14 +410,14 @@ void BKE_collection_add_from_object(Main *bmain,
|
||||
if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDABLE_LIBRARY(collection) &&
|
||||
BKE_collection_has_object(collection, ob_src))
|
||||
{
|
||||
collection_child_add(collection, collection_dst, 0, true);
|
||||
collection_child_add(collection, collection_dst, nullptr, 0, true);
|
||||
is_instantiated = true;
|
||||
}
|
||||
}
|
||||
FOREACH_SCENE_COLLECTION_END;
|
||||
|
||||
if (!is_instantiated) {
|
||||
collection_child_add(scene->master_collection, collection_dst, 0, true);
|
||||
collection_child_add(scene->master_collection, collection_dst, nullptr, 0, true);
|
||||
}
|
||||
|
||||
BKE_main_collection_sync(bmain);
|
||||
@@ -429,7 +434,7 @@ void BKE_collection_add_from_collection(Main *bmain,
|
||||
if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY(collection) &&
|
||||
collection_find_child(collection, collection_src))
|
||||
{
|
||||
collection_child_add(collection, collection_dst, 0, true);
|
||||
collection_child_add(collection, collection_dst, nullptr, 0, true);
|
||||
is_instantiated = true;
|
||||
}
|
||||
else if (!is_instantiated && collection_find_child(collection, collection_dst)) {
|
||||
@@ -441,7 +446,7 @@ void BKE_collection_add_from_collection(Main *bmain,
|
||||
FOREACH_SCENE_COLLECTION_END;
|
||||
|
||||
if (!is_instantiated) {
|
||||
collection_child_add(scene->master_collection, collection_dst, 0, true);
|
||||
collection_child_add(scene->master_collection, collection_dst, nullptr, 0, true);
|
||||
}
|
||||
|
||||
BKE_main_collection_sync(bmain);
|
||||
@@ -496,7 +501,7 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
|
||||
LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
|
||||
LISTBASE_FOREACH (CollectionParent *, cparent, &collection->runtime.parents) {
|
||||
Collection *parent = cparent->collection;
|
||||
collection_child_add(parent, child->collection, 0, true);
|
||||
collection_child_add(parent, child->collection, nullptr, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +510,7 @@ bool BKE_collection_delete(Main *bmain, Collection *collection, bool hierarchy)
|
||||
/* Link child object into parent collections. */
|
||||
LISTBASE_FOREACH (CollectionParent *, cparent, &collection->runtime.parents) {
|
||||
Collection *parent = cparent->collection;
|
||||
collection_object_add(bmain, parent, cob->ob, 0, true);
|
||||
collection_object_add(bmain, parent, cob->ob, nullptr, 0, true);
|
||||
}
|
||||
|
||||
/* Remove child object. */
|
||||
@@ -563,9 +568,9 @@ static Collection *collection_duplicate_recursive(Main *bmain,
|
||||
/* Optionally add to parent (we always want to do that,
|
||||
* even if collection_old had already been duplicated). */
|
||||
if (parent != nullptr) {
|
||||
if (collection_child_add(parent, collection_new, 0, true)) {
|
||||
CollectionChild *child = collection_find_child(parent, collection_old);
|
||||
if (collection_child_add(parent, collection_new, &child->light_linking, 0, true)) {
|
||||
/* Put collection right after existing one. */
|
||||
CollectionChild *child = collection_find_child(parent, collection_old);
|
||||
CollectionChild *child_new = collection_find_child(parent, collection_new);
|
||||
|
||||
if (child && child_new) {
|
||||
@@ -608,7 +613,7 @@ static Collection *collection_duplicate_recursive(Main *bmain,
|
||||
continue;
|
||||
}
|
||||
|
||||
collection_object_add(bmain, collection_new, ob_new, 0, true);
|
||||
collection_object_add(bmain, collection_new, ob_new, &cob->light_linking, 0, true);
|
||||
collection_object_remove(bmain, collection_new, ob_old, false);
|
||||
}
|
||||
}
|
||||
@@ -1220,8 +1225,12 @@ static Collection *collection_parent_editable_find_recursive(const ViewLayer *vi
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool collection_object_add(
|
||||
Main *bmain, Collection *collection, Object *ob, int flag, const bool add_us)
|
||||
static bool collection_object_add(Main *bmain,
|
||||
Collection *collection,
|
||||
Object *ob,
|
||||
CollectionLightLinking *light_linking,
|
||||
int flag,
|
||||
const bool add_us)
|
||||
{
|
||||
/* Cyclic dependency check. */
|
||||
if (ob->instance_collection) {
|
||||
@@ -1241,6 +1250,9 @@ static bool collection_object_add(
|
||||
CollectionObject *cob = static_cast<CollectionObject *>(
|
||||
MEM_callocN(sizeof(CollectionObject), __func__));
|
||||
cob->ob = ob;
|
||||
if (light_linking) {
|
||||
cob->light_linking = *light_linking;
|
||||
}
|
||||
*cob_p = cob;
|
||||
BLI_addtail(&collection->gobject, cob);
|
||||
BKE_collection_object_cache_free(collection);
|
||||
@@ -1312,7 +1324,7 @@ bool BKE_collection_object_add_notest(Main *bmain, Collection *collection, Objec
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!collection_object_add(bmain, collection, ob, 0, true)) {
|
||||
if (!collection_object_add(bmain, collection, ob, nullptr, 0, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1356,7 +1368,7 @@ void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, O
|
||||
if (!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY(collection) &&
|
||||
BKE_collection_has_object(collection, ob_src))
|
||||
{
|
||||
collection_object_add(bmain, collection, ob_dst, 0, true);
|
||||
collection_object_add(bmain, collection, ob_dst, nullptr, 0, true);
|
||||
is_instantiated = true;
|
||||
}
|
||||
}
|
||||
@@ -1365,7 +1377,7 @@ void BKE_collection_object_add_from(Main *bmain, Scene *scene, Object *ob_src, O
|
||||
if (!is_instantiated) {
|
||||
/* In case we could not find any non-linked collections in which instantiate our ob_dst,
|
||||
* fallback to scene's master collection... */
|
||||
collection_object_add(bmain, scene->master_collection, ob_dst, 0, true);
|
||||
collection_object_add(bmain, scene->master_collection, ob_dst, nullptr, 0, true);
|
||||
}
|
||||
|
||||
BKE_main_collection_sync(bmain);
|
||||
@@ -1709,6 +1721,7 @@ static CollectionParent *collection_find_parent(Collection *child, Collection *c
|
||||
|
||||
static bool collection_child_add(Collection *parent,
|
||||
Collection *collection,
|
||||
CollectionLightLinking *light_linking,
|
||||
const int flag,
|
||||
const bool add_us)
|
||||
{
|
||||
@@ -1722,6 +1735,9 @@ static bool collection_child_add(Collection *parent,
|
||||
|
||||
child = static_cast<CollectionChild *>(MEM_callocN(sizeof(CollectionChild), "CollectionChild"));
|
||||
child->collection = collection;
|
||||
if (light_linking) {
|
||||
child->light_linking = *light_linking;
|
||||
}
|
||||
BLI_addtail(&parent->children, child);
|
||||
|
||||
/* Don't add parent links for depsgraph datablocks, these are not kept in sync. */
|
||||
@@ -1761,7 +1777,7 @@ static bool collection_child_remove(Collection *parent, Collection *collection)
|
||||
|
||||
bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child)
|
||||
{
|
||||
if (!collection_child_add(parent, child, 0, true)) {
|
||||
if (!collection_child_add(parent, child, nullptr, 0, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1771,7 +1787,7 @@ bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child
|
||||
|
||||
bool BKE_collection_child_add_no_sync(Collection *parent, Collection *child)
|
||||
{
|
||||
return collection_child_add(parent, child, 0, true);
|
||||
return collection_child_add(parent, child, nullptr, 0, true);
|
||||
}
|
||||
|
||||
bool BKE_collection_child_remove(Main *bmain, Collection *parent, Collection *child)
|
||||
@@ -2021,7 +2037,7 @@ bool BKE_collection_move(Main *bmain,
|
||||
collection_child_remove(from_parent, collection);
|
||||
}
|
||||
|
||||
collection_child_add(to_parent, collection, 0, true);
|
||||
collection_child_add(to_parent, collection, nullptr, 0, true);
|
||||
|
||||
/* Move to specified location under parent. */
|
||||
if (relative) {
|
||||
|
||||
Reference in New Issue
Block a user