Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/writefile.c
| Show First 20 Lines • Show All 1,127 Lines • ▼ Show 20 Lines | static void write_nodetree_nolib(WriteData *wd, bNodeTree *ntree) | ||||
| } | } | ||||
| for (sock = ntree->inputs.first; sock; sock = sock->next) { | for (sock = ntree->inputs.first; sock; sock = sock->next) { | ||||
| write_node_socket_interface(wd, sock); | write_node_socket_interface(wd, sock); | ||||
| } | } | ||||
| for (sock = ntree->outputs.first; sock; sock = sock->next) { | for (sock = ntree->outputs.first; sock; sock = sock->next) { | ||||
| write_node_socket_interface(wd, sock); | write_node_socket_interface(wd, sock); | ||||
| } | } | ||||
| /* Clear the accumulated recalc flags in case of undo step saving. */ | |||||
| if (wd->use_memfile) { | |||||
| ntree->id.recalc_undo_accumulated = 0; | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| * Take care using 'use_active_win', since we wont want the currently active window | * Take care using 'use_active_win', since we wont want the currently active window | ||||
| * to change which scene renders (currently only used for undo). | * to change which scene renders (currently only used for undo). | ||||
| */ | */ | ||||
| static void current_screen_compat(Main *mainvar, | static void current_screen_compat(Main *mainvar, | ||||
| bool use_active_win, | bool use_active_win, | ||||
| ▲ Show 20 Lines • Show All 1,300 Lines • ▼ Show 20 Lines | static void write_collection_nolib(WriteData *wd, Collection *collection) | ||||
| LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { | LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { | ||||
| writestruct(wd, DATA, CollectionObject, 1, cob); | writestruct(wd, DATA, CollectionObject, 1, cob); | ||||
| } | } | ||||
| LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { | LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { | ||||
| writestruct(wd, DATA, CollectionChild, 1, child); | writestruct(wd, DATA, CollectionChild, 1, child); | ||||
| } | } | ||||
| /* Clear the accumulated recalc flags in case of undo step saving. */ | |||||
| if (wd->use_memfile) { | |||||
| collection->id.recalc_undo_accumulated = 0; | |||||
| } | |||||
| } | } | ||||
| static void write_collection(WriteData *wd, Collection *collection, const void *id_address) | static void write_collection(WriteData *wd, Collection *collection, const void *id_address) | ||||
| { | { | ||||
| if (collection->id.us > 0 || wd->use_memfile) { | if (collection->id.us > 0 || wd->use_memfile) { | ||||
| /* Clean up, important in undo case to reduce false detection of changed datablocks. */ | /* Clean up, important in undo case to reduce false detection of changed datablocks. */ | ||||
| collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE; | collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE; | ||||
| collection->tag = 0; | collection->tag = 0; | ||||
| ▲ Show 20 Lines • Show All 1,594 Lines • ▼ Show 20 Lines | while (a--) { | ||||
| (id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT | LIB_TAG_NOT_ALLOCATED)) == 0); | (id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT | LIB_TAG_NOT_ALLOCATED)) == 0); | ||||
| const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_library; | const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_library; | ||||
| if (do_override) { | if (do_override) { | ||||
| BKE_lib_override_library_operations_store_start(bmain, override_storage, id); | BKE_lib_override_library_operations_store_start(bmain, override_storage, id); | ||||
| } | } | ||||
| if (wd->use_memfile) { | |||||
| /* Record the changes that happened up to this undo push in | |||||
| * recalc_up_to_undo_push, and clear recalc_after_undo_push again | |||||
| * to start accumulating for the next undo push. */ | |||||
| id->recalc_up_to_undo_push = id->recalc_after_undo_push; | |||||
| id->recalc_after_undo_push = 0; | |||||
| bNodeTree *nodetree = ntreeFromID(id); | |||||
| if (nodetree != NULL) { | |||||
| nodetree->id.recalc_up_to_undo_push = nodetree->id.recalc_after_undo_push; | |||||
| nodetree->id.recalc_after_undo_push = 0; | |||||
| } | |||||
| if (GS(id->name) == ID_SCE) { | |||||
| Scene *scene = (Scene *)id; | |||||
| if (scene->master_collection != NULL) { | |||||
| scene->master_collection->id.recalc_up_to_undo_push = | |||||
| scene->master_collection->id.recalc_after_undo_push; | |||||
| scene->master_collection->id.recalc_after_undo_push = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| memcpy(id_buffer, id, idtype_struct_size); | memcpy(id_buffer, id, idtype_struct_size); | ||||
| ((ID *)id_buffer)->tag = 0; | ((ID *)id_buffer)->tag = 0; | ||||
| switch ((ID_Type)GS(id->name)) { | switch ((ID_Type)GS(id->name)) { | ||||
| case ID_WM: | case ID_WM: | ||||
| write_windowmanager(wd, (wmWindowManager *)id_buffer, id); | write_windowmanager(wd, (wmWindowManager *)id_buffer, id); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | while (a--) { | ||||
| if (do_override) { | if (do_override) { | ||||
| BKE_lib_override_library_operations_store_end(override_storage, id); | BKE_lib_override_library_operations_store_end(override_storage, id); | ||||
| } | } | ||||
| if (wd->use_memfile) { | if (wd->use_memfile) { | ||||
| /* Very important to do it after every ID write now, otherwise we cannot know whether a | /* Very important to do it after every ID write now, otherwise we cannot know whether a | ||||
| * specific ID changed or not. */ | * specific ID changed or not. */ | ||||
| mywrite_flush(wd); | mywrite_flush(wd); | ||||
| /* Clear the accumulated recalc flags in case of undo step saving. */ | |||||
| id->recalc_undo_accumulated = 0; | |||||
| } | } | ||||
| } | } | ||||
| if (id_buffer != id_buffer_static) { | if (id_buffer != id_buffer_static) { | ||||
| MEM_SAFE_FREE(id_buffer); | MEM_SAFE_FREE(id_buffer); | ||||
| } | } | ||||
| mywrite_flush(wd); | mywrite_flush(wd); | ||||
| ▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines | |||||