Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_tag.cc
| Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | case ID_RECALC_AUDIO: | ||||
| *component_type = NodeType::AUDIO; | *component_type = NodeType::AUDIO; | ||||
| break; | break; | ||||
| case ID_RECALC_PARAMETERS: | case ID_RECALC_PARAMETERS: | ||||
| *component_type = NodeType::PARAMETERS; | *component_type = NodeType::PARAMETERS; | ||||
| break; | break; | ||||
| case ID_RECALC_SOURCE: | case ID_RECALC_SOURCE: | ||||
| *component_type = NodeType::PARAMETERS; | *component_type = NodeType::PARAMETERS; | ||||
| break; | break; | ||||
| case ID_RECALC_TIME: | |||||
| BLI_assert(!"Should be handled outside of this function"); | |||||
| break; | |||||
| case ID_RECALC_ALL: | case ID_RECALC_ALL: | ||||
| case ID_RECALC_PSYS_ALL: | case ID_RECALC_PSYS_ALL: | ||||
| BLI_assert(!"Should not happen"); | BLI_assert(!"Should not happen"); | ||||
| break; | break; | ||||
| case ID_RECALC_TAG_FOR_UNDO: | case ID_RECALC_TAG_FOR_UNDO: | ||||
| break; /* Must be ignored by depsgraph. */ | break; /* Must be ignored by depsgraph. */ | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | void graph_id_tag_update_single_flag(Main *bmain, | ||||
| eUpdateSource update_source) | eUpdateSource update_source) | ||||
| { | { | ||||
| if (tag == ID_RECALC_EDITORS) { | if (tag == ID_RECALC_EDITORS) { | ||||
| if (graph != nullptr && graph->is_active) { | if (graph != nullptr && graph->is_active) { | ||||
| depsgraph_update_editors_tag(bmain, graph, id); | depsgraph_update_editors_tag(bmain, graph, id); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| if (tag == ID_RECALC_TIME) { | |||||
| if (graph != nullptr) { | |||||
| graph->need_update_time = true; | |||||
| } | |||||
| return; | |||||
| } | |||||
| /* Get description of what is to be tagged. */ | /* Get description of what is to be tagged. */ | ||||
| NodeType component_type; | NodeType component_type; | ||||
| OperationCode operation_code; | OperationCode operation_code; | ||||
| depsgraph_tag_to_component_opcode(id, tag, &component_type, &operation_code); | depsgraph_tag_to_component_opcode(id, tag, &component_type, &operation_code); | ||||
| /* Check whether we've got something to tag. */ | /* Check whether we've got something to tag. */ | ||||
| if (component_type == NodeType::UNDEFINED) { | if (component_type == NodeType::UNDEFINED) { | ||||
| /* Given ID does not support tag. */ | /* Given ID does not support tag. */ | ||||
| /* TODO(sergey): Shall we raise some panic here? */ | /* TODO(sergey): Shall we raise some panic here? */ | ||||
| ▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | case DEG_UPDATE_SOURCE_VISIBILITY: | ||||
| return "VISIBILITY"; | return "VISIBILITY"; | ||||
| } | } | ||||
| BLI_assert(!"Should never happen."); | BLI_assert(!"Should never happen."); | ||||
| return "UNKNOWN"; | return "UNKNOWN"; | ||||
| } | } | ||||
| int deg_recalc_flags_for_legacy_zero() | int deg_recalc_flags_for_legacy_zero() | ||||
| { | { | ||||
| return ID_RECALC_ALL & ~(ID_RECALC_PSYS_ALL | ID_RECALC_ANIMATION | ID_RECALC_SOURCE | | return ID_RECALC_ALL & | ||||
| ID_RECALC_TIME | ID_RECALC_EDITORS); | ~(ID_RECALC_PSYS_ALL | ID_RECALC_ANIMATION | ID_RECALC_SOURCE | ID_RECALC_EDITORS); | ||||
| } | } | ||||
| int deg_recalc_flags_effective(Depsgraph *graph, int flags) | int deg_recalc_flags_effective(Depsgraph *graph, int flags) | ||||
| { | { | ||||
| if (graph != nullptr) { | if (graph != nullptr) { | ||||
| if (!graph->is_active) { | if (!graph->is_active) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | switch (flag) { | ||||
| case ID_RECALC_AUDIO_MUTE: | case ID_RECALC_AUDIO_MUTE: | ||||
| return "AUDIO_MUTE"; | return "AUDIO_MUTE"; | ||||
| case ID_RECALC_AUDIO_LISTENER: | case ID_RECALC_AUDIO_LISTENER: | ||||
| return "AUDIO_LISTENER"; | return "AUDIO_LISTENER"; | ||||
| case ID_RECALC_AUDIO: | case ID_RECALC_AUDIO: | ||||
| return "AUDIO"; | return "AUDIO"; | ||||
| case ID_RECALC_PARAMETERS: | case ID_RECALC_PARAMETERS: | ||||
| return "PARAMETERS"; | return "PARAMETERS"; | ||||
| case ID_RECALC_TIME: | |||||
| return "TIME"; | |||||
| case ID_RECALC_SOURCE: | case ID_RECALC_SOURCE: | ||||
| return "SOURCE"; | return "SOURCE"; | ||||
| case ID_RECALC_ALL: | case ID_RECALC_ALL: | ||||
| return "ALL"; | return "ALL"; | ||||
| case ID_RECALC_TAG_FOR_UNDO: | case ID_RECALC_TAG_FOR_UNDO: | ||||
| return "TAG_FOR_UNDO"; | return "TAG_FOR_UNDO"; | ||||
| } | } | ||||
| return nullptr; | return nullptr; | ||||
| Show All 30 Lines | |||||
| { | { | ||||
| if (id_type == ID_NT) { | if (id_type == ID_NT) { | ||||
| /* Stupid workaround so parent datablocks of nested nodetree get looped | /* Stupid workaround so parent datablocks of nested nodetree get looped | ||||
| * over when we loop over tagged datablock types. */ | * over when we loop over tagged datablock types. */ | ||||
| DEG_graph_id_type_tag(depsgraph, ID_MA); | DEG_graph_id_type_tag(depsgraph, ID_MA); | ||||
| DEG_graph_id_type_tag(depsgraph, ID_TE); | DEG_graph_id_type_tag(depsgraph, ID_TE); | ||||
| DEG_graph_id_type_tag(depsgraph, ID_LA); | DEG_graph_id_type_tag(depsgraph, ID_LA); | ||||
| DEG_graph_id_type_tag(depsgraph, ID_WO); | DEG_graph_id_type_tag(depsgraph, ID_WO); | ||||
| DEG_graph_id_type_tag(depsgraph, ID_SCE); | DEG_graph_id_type_tag(depsgraph, ID_SCE); | ||||
| DEG_graph_id_type_tag(depsgraph, ID_SIM); | DEG_graph_id_type_tag(depsgraph, ID_SIM); | ||||
sybren: Why does this code need to know that a timesource needs tagging with `deg… | |||||
| } | } | ||||
| const int id_type_index = BKE_idtype_idcode_to_index(id_type); | const int id_type_index = BKE_idtype_idcode_to_index(id_type); | ||||
| deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph); | deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph); | ||||
| deg_graph->id_type_updated[id_type_index] = 1; | deg_graph->id_type_updated[id_type_index] = 1; | ||||
| } | } | ||||
| void DEG_id_type_tag(Main *bmain, short id_type) | void DEG_id_type_tag(Main *bmain, short id_type) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines | |||||
Why does this code need to know that a timesource needs tagging with deg::DEG_UPDATE_SOURCE_TIME? Shouldn't this be a function Depsgraph::tag_time_source() instead? See the Law of Demeter.