Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_query.cc
| Show All 23 Lines | |||||
| */ | */ | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| extern "C" { | extern "C" { | ||||
| #include <string.h> // XXX: memcpy | #include <string.h> // XXX: memcpy | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_customdata.h" | |||||
| #include "BKE_idcode.h" | #include "BKE_idcode.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_action.h" // XXX: BKE_pose_channel_from_name | #include "BKE_action.h" // XXX: BKE_pose_channel_from_name | ||||
| } /* extern "C" */ | } /* extern "C" */ | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id) | ||||
| if (id_node == NULL) { | if (id_node == NULL) { | ||||
| /* TODO(sergey): Does it mean we need to check set scene? */ | /* TODO(sergey): Does it mean we need to check set scene? */ | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| return id_node->eval_flags; | return id_node->eval_flags; | ||||
| } | } | ||||
| uint64_t DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob) | void DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob, CustomData_Masks *r_mask) | ||||
| { | { | ||||
| if (graph == NULL) { | if (graph == NULL) { | ||||
| /* Happens when converting objects to mesh from a python script | /* Happens when converting objects to mesh from a python script | ||||
| * after modifying scene graph. | * after modifying scene graph. | ||||
| * | * | ||||
| * Currently harmless because it's only called for temporary | * Currently harmless because it's only called for temporary | ||||
| * objects which are out of the DAG anyway. */ | * objects which are out of the DAG anyway. */ | ||||
| return 0; | return; | ||||
sergey: This changes behavior from returning 0 for non-existing node to keep-at-garbage(stack… | |||||
Done Inline ActionsI don’t mind adding back a return value (a bool?) to mark that object was not found, but not sure how useful that would be? As for 'keep-as-garbage', that is kind of general new behavior for functions generating some cddata masking, they all now append to given mask, instead of fully setting its values. This allows to only pass around pointers, and cope for the lack of bitwise OR op for the C struct... mont29: I don’t mind adding back a return value (a bool?) to mark that object was not found, but not… | |||||
| } | } | ||||
| const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); | const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); | ||||
| const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id)); | const DEG::IDNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id)); | ||||
| if (id_node == NULL) { | if (id_node == NULL) { | ||||
| /* TODO(sergey): Does it mean we need to check set scene? */ | /* TODO(sergey): Does it mean we need to check set scene? */ | ||||
| return 0; | return; | ||||
| } | } | ||||
| return id_node->customdata_mask; | r_mask->vmask |= id_node->customdata_vmask; | ||||
| r_mask->emask |= id_node->customdata_emask; | |||||
| r_mask->fmask |= id_node->customdata_fmask; | |||||
| r_mask->pmask |= id_node->customdata_pmask; | |||||
| r_mask->lmask |= id_node->customdata_lmask; | |||||
| } | } | ||||
| Scene *DEG_get_evaluated_scene(const Depsgraph *graph) | Scene *DEG_get_evaluated_scene(const Depsgraph *graph) | ||||
| { | { | ||||
| const DEG::Depsgraph *deg_graph = | const DEG::Depsgraph *deg_graph = | ||||
| reinterpret_cast<const DEG::Depsgraph *>(graph); | reinterpret_cast<const DEG::Depsgraph *>(graph); | ||||
| Scene *scene_cow = deg_graph->scene_cow; | Scene *scene_cow = deg_graph->scene_cow; | ||||
| /* TODO(sergey): Shall we expand datablock here? Or is it OK to assume | /* TODO(sergey): Shall we expand datablock here? Or is it OK to assume | ||||
| ▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines | |||||
This changes behavior from returning 0 for non-existing node to keep-at-garbage(stack-allocated) value.
It is to be at least documented in the comment of DEG_get_customdata_mask_for_objectabout what happens if object is not found.