Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/node.cc
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_simulation_types.h" | #include "DNA_simulation_types.h" | ||||
| #include "DNA_texture_types.h" | #include "DNA_texture_types.h" | ||||
| #include "DNA_world_types.h" | #include "DNA_world_types.h" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_map.hh" | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_anim_data.h" | #include "BKE_anim_data.h" | ||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_cryptomatte.h" | #include "BKE_cryptomatte.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_lib_query.h" | #include "BKE_lib_query.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "BKE_node_ui_storage.hh" | |||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_threads.h" | #include "BLI_threads.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "NOD_common.h" | #include "NOD_common.h" | ||||
| #include "NOD_composite.h" | #include "NOD_composite.h" | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (node_dst->parent) { | ||||
| new_pointers, node_dst->parent, nullptr); | new_pointers, node_dst->parent, nullptr); | ||||
| } | } | ||||
| } | } | ||||
| BLI_ghash_free(new_pointers, nullptr, nullptr); | BLI_ghash_free(new_pointers, nullptr, nullptr); | ||||
| /* node tree will generate its own interface type */ | /* node tree will generate its own interface type */ | ||||
| ntree_dst->interface_type = nullptr; | ntree_dst->interface_type = nullptr; | ||||
| /* Don't copy error messages in the runtime struct. | |||||
| * They should be filled during execution anyway. */ | |||||
| ntree_dst->ui_storage = nullptr; | |||||
| } | } | ||||
| static void ntree_free_data(ID *id) | static void ntree_free_data(ID *id) | ||||
| { | { | ||||
| bNodeTree *ntree = (bNodeTree *)id; | bNodeTree *ntree = (bNodeTree *)id; | ||||
| /* XXX hack! node trees should not store execution graphs at all. | /* XXX hack! node trees should not store execution graphs at all. | ||||
| * This should be removed when old tree types no longer require it. | * This should be removed when old tree types no longer require it. | ||||
| Show All 37 Lines | static void ntree_free_data(ID *id) | ||||
| /* free preview hash */ | /* free preview hash */ | ||||
| if (ntree->previews) { | if (ntree->previews) { | ||||
| BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); | BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); | ||||
| } | } | ||||
| if (ntree->id.tag & LIB_TAG_LOCALIZED) { | if (ntree->id.tag & LIB_TAG_LOCALIZED) { | ||||
| BKE_libblock_free_data(&ntree->id, true); | BKE_libblock_free_data(&ntree->id, true); | ||||
| } | } | ||||
| delete ntree->ui_storage; | |||||
| } | } | ||||
| static void library_foreach_node_socket(LibraryForeachIDData *data, bNodeSocket *sock) | static void library_foreach_node_socket(LibraryForeachIDData *data, bNodeSocket *sock) | ||||
| { | { | ||||
| IDP_foreach_property( | IDP_foreach_property( | ||||
| sock->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data); | sock->prop, IDP_TYPE_FILTER_ID, BKE_lib_query_idpropertiesForeachIDLink_callback, data); | ||||
| switch ((eNodeSocketDatatype)sock->type) { | switch ((eNodeSocketDatatype)sock->type) { | ||||
| ▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | static void ntree_blend_write(BlendWriter *writer, ID *id, const void *id_address) | ||||
| if (ntree->id.us > 0 || BLO_write_is_undo(writer)) { | if (ntree->id.us > 0 || BLO_write_is_undo(writer)) { | ||||
| /* 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. */ | ||||
| ntree->init = 0; /* to set callbacks and force setting types */ | ntree->init = 0; /* to set callbacks and force setting types */ | ||||
| ntree->is_updating = false; | ntree->is_updating = false; | ||||
| ntree->typeinfo = nullptr; | ntree->typeinfo = nullptr; | ||||
| ntree->interface_type = nullptr; | ntree->interface_type = nullptr; | ||||
| ntree->progress = nullptr; | ntree->progress = nullptr; | ||||
| ntree->execdata = nullptr; | ntree->execdata = nullptr; | ||||
| ntree->ui_storage = nullptr; | |||||
| BLO_write_id_struct(writer, bNodeTree, id_address, &ntree->id); | BLO_write_id_struct(writer, bNodeTree, id_address, &ntree->id); | ||||
| ntreeBlendWrite(writer, ntree); | ntreeBlendWrite(writer, ntree); | ||||
| } | } | ||||
| } | } | ||||
| static void direct_link_node_socket(BlendDataReader *reader, bNodeSocket *sock) | static void direct_link_node_socket(BlendDataReader *reader, bNodeSocket *sock) | ||||
| Show All 15 Lines | void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree) | ||||
| /* note: writing and reading goes in sync, for speed */ | /* note: writing and reading goes in sync, for speed */ | ||||
| ntree->init = 0; /* to set callbacks and force setting types */ | ntree->init = 0; /* to set callbacks and force setting types */ | ||||
| ntree->is_updating = false; | ntree->is_updating = false; | ||||
| ntree->typeinfo = nullptr; | ntree->typeinfo = nullptr; | ||||
| ntree->interface_type = nullptr; | ntree->interface_type = nullptr; | ||||
| ntree->progress = nullptr; | ntree->progress = nullptr; | ||||
| ntree->execdata = nullptr; | ntree->execdata = nullptr; | ||||
| ntree->ui_storage = nullptr; | |||||
| BLO_read_data_address(reader, &ntree->adt); | BLO_read_data_address(reader, &ntree->adt); | ||||
| BKE_animdata_blend_read_data(reader, ntree->adt); | BKE_animdata_blend_read_data(reader, ntree->adt); | ||||
| BLO_read_list(reader, &ntree->nodes); | BLO_read_list(reader, &ntree->nodes); | ||||
| LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | ||||
| node->typeinfo = nullptr; | node->typeinfo = nullptr; | ||||
| ▲ Show 20 Lines • Show All 4,350 Lines • Show Last 20 Lines | |||||