diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-16 13:17:45 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-16 13:24:41 +0300 |
commit | 5baf0de6e74a4df43dea91e177aeece5468648c4 (patch) | |
tree | 8cd672b0946e29e75514c6513b0de1f271ad8d12 | |
parent | 7e954d974a5955bd347f1dd070660d45af6ea789 (diff) | |
parent | 3baf31e73a7176fac8081b6648ce768b9504c2b1 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature_update.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mask_evaluate.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 20 | ||||
-rw-r--r-- | source/blender/depsgraph/DEG_depsgraph.h | 26 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 57 |
15 files changed, 148 insertions, 88 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index d1b26d9a2a0..ecdb180d2ed 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -77,6 +77,8 @@ #include "atomic_ops.h" +#include "DEG_depsgraph.h" + /* ***************************************** */ /* AnimData API */ @@ -2879,15 +2881,13 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) /* ************** */ /* Evaluation API */ -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf - void BKE_animsys_eval_animdata(const EvaluationContext *eval_ctx, ID *id) { AnimData *adt = BKE_animdata_from_id(id); Scene *scene = NULL; /* XXX: this is only needed for flushing RNA updates, * which should get handled as part of the dependency graph instead... */ - DEBUG_PRINT("%s on %s, time=%f\n\n", __func__, id->name, (double)eval_ctx->ctime); + DEG_debug_print_eval_time(__func__, id->name, id, eval_ctx->ctime); BKE_animsys_evaluate_animdata(scene, id, adt, eval_ctx->ctime, ADT_RECALC_ANIM); } @@ -2920,11 +2920,8 @@ void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, fcu = find_driver_from_evaluated_id(id, fcu); - DEBUG_PRINT("%s on %s (%s[%d])\n", - __func__, - id->name, - fcu->rna_path, - fcu->array_index); + DEG_debug_print_eval_subdata_index( + __func__, id->name, id, "fcu", fcu->rna_path, fcu, fcu->array_index); RNA_id_pointer_create(id, &id_ptr); @@ -2957,5 +2954,3 @@ void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, } } } - -#undef DEBUG_PRINT diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 203dcbf247c..bf065ef992c 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -50,7 +50,7 @@ #include "BKE_global.h" #include "BKE_main.h" -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf +#include "DEG_depsgraph.h" /* ********************** SPLINE IK SOLVER ******************* */ @@ -566,7 +566,7 @@ void BKE_pose_eval_init(const struct EvaluationContext *UNUSED(eval_ctx), { bPoseChannel *pchan; - DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); + DEG_debug_print_eval(__func__, ob->id.name, ob); BLI_assert(ob->type == OB_ARMATURE); @@ -588,7 +588,7 @@ void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx, Object *ob, bPose *UNUSED(pose)) { - DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); + DEG_debug_print_eval(__func__, ob->id.name, ob); BLI_assert(ob->type == OB_ARMATURE); const float ctime = BKE_scene_frame_get(scene); /* not accurate... */ bArmature *arm = (bArmature *)ob->data; @@ -609,7 +609,8 @@ void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan) { - DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, pchan->name); + DEG_debug_print_eval_subdata( + __func__, ob->id.name, ob, "pchan", pchan->name, pchan); BLI_assert(ob->type == OB_ARMATURE); bArmature *arm = (bArmature *)ob->data; if (arm->edbo || (arm->flag & ARM_RESTPOS)) { @@ -644,7 +645,8 @@ void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan) { - DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, pchan->name); + DEG_debug_print_eval_subdata( + __func__, ob->id.name, ob, "pchan", pchan->name, pchan); bArmature *arm = (bArmature *)ob->data; if (arm->flag & ARM_RESTPOS) { return; @@ -664,7 +666,7 @@ void BKE_pose_bone_done(const struct EvaluationContext *UNUSED(eval_ctx), bPoseChannel *pchan) { float imat[4][4]; - DEBUG_PRINT("%s on pchan %s\n", __func__, pchan->name); + DEG_debug_print_eval(__func__, pchan->name, pchan); if (pchan->bone) { invert_m4_m4(imat, pchan->bone->arm_mat); mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat); @@ -676,7 +678,8 @@ void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *rootchan) { - DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, rootchan->name); + DEG_debug_print_eval_subdata( + __func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan); BLI_assert(ob->type == OB_ARMATURE); const float ctime = BKE_scene_frame_get(scene); /* not accurate... */ bArmature *arm = (bArmature *)ob->data; @@ -690,8 +693,10 @@ void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *rootchan) + { - DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, rootchan->name); + DEG_debug_print_eval_subdata( + __func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan); BLI_assert(ob->type == OB_ARMATURE); const float ctime = BKE_scene_frame_get(scene); /* not accurate... */ bArmature *arm = (bArmature *)ob->data; @@ -707,7 +712,7 @@ void BKE_pose_eval_flush(const struct EvaluationContext *UNUSED(eval_ctx), bPose *UNUSED(pose)) { float ctime = BKE_scene_frame_get(scene); /* not accurate... */ - DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); + DEG_debug_print_eval(__func__, ob->id.name, ob); BLI_assert(ob->type == OB_ARMATURE); /* 6. release the IK tree */ @@ -717,7 +722,7 @@ void BKE_pose_eval_flush(const struct EvaluationContext *UNUSED(eval_ctx), void BKE_pose_eval_proxy_copy(const struct EvaluationContext *UNUSED(eval_ctx), Object *ob) { BLI_assert(ID_IS_LINKED(ob) && ob->proxy_from != NULL); - DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); + DEG_debug_print_eval(__func__, ob->id.name, ob); if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) { printf("Proxy copy error, lib Object: %s proxy Object: %s\n", ob->id.name + 2, ob->proxy_from->id.name + 2); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index b5ad2bcef4e..0c4dbdf7763 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -5258,9 +5258,7 @@ void BKE_curve_rect_from_textbox(const struct Curve *cu, const struct TextBox *t void BKE_curve_eval_geometry(const EvaluationContext *UNUSED(eval_ctx), Curve *curve) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s\n", __func__, curve->id.name); - } + DEG_debug_print_eval(__func__, curve->id.name, curve); if (curve->bb == NULL || (curve->bb->flag & BOUNDBOX_DIRTY)) { BKE_curve_texspace_calc(curve); } diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index c3fe586bbbb..20da1e7b7ac 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -55,7 +55,7 @@ #include "BKE_object.h" #include "BKE_scene.h" -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf +#include "DEG_depsgraph.h" /** Free (or release) any data used by this group (does not free the group itself). */ void BKE_group_free(Group *group) @@ -403,7 +403,7 @@ static void group_eval_layer_collections( void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx, Group *group) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, group->id.name, group); + DEG_debug_print_eval(__func__, group->id.name, group); BKE_layer_eval_layer_collection_pre(eval_ctx, &group->id, group->view_layer); group_eval_layer_collections(eval_ctx, group, diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index cde256a0f14..78af18fa362 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -57,8 +57,6 @@ #include "MEM_guardedalloc.h" -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf - /* prototype */ struct EngineSettingsCB_Type; static void layer_collections_sync_flags(ListBase *layer_collections_dst, const ListBase *layer_collections_src); @@ -2245,7 +2243,7 @@ static void idproperty_reset(IDProperty **props, IDProperty *props_ref) void BKE_layer_eval_layer_collection_pre(const struct EvaluationContext *UNUSED(eval_ctx), ID *owner_id, ViewLayer *view_layer) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, view_layer->name, view_layer); + DEG_debug_print_eval(__func__, view_layer->name, view_layer); Scene *scene = (GS(owner_id->name) == ID_SCE) ? (Scene *)owner_id : NULL; for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) { @@ -2289,14 +2287,17 @@ void BKE_layer_eval_layer_collection(const EvaluationContext *eval_ctx, LayerCollection *layer_collection, LayerCollection *parent_layer_collection) { - DEBUG_PRINT("%s on %s (%p) [%s], parent %s (%p) [%s]\n", - __func__, - layer_collection->scene_collection->name, - layer_collection->scene_collection, - collection_type_lookup[layer_collection->scene_collection->type], - (parent_layer_collection != NULL) ? parent_layer_collection->scene_collection->name : "NONE", - (parent_layer_collection != NULL) ? parent_layer_collection->scene_collection : NULL, - (parent_layer_collection != NULL) ? collection_type_lookup[parent_layer_collection->scene_collection->type] : ""); + if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { + /* TODO)sergey): Try to make it more generic and handled by depsgraph messaging. */ + printf("%s on %s (%p) [%s], parent %s (%p) [%s]\n", + __func__, + layer_collection->scene_collection->name, + layer_collection->scene_collection, + collection_type_lookup[layer_collection->scene_collection->type], + (parent_layer_collection != NULL) ? parent_layer_collection->scene_collection->name : "NONE", + (parent_layer_collection != NULL) ? parent_layer_collection->scene_collection : NULL, + (parent_layer_collection != NULL) ? collection_type_lookup[parent_layer_collection->scene_collection->type] : ""); + } BLI_assert(layer_collection != parent_layer_collection); /* visibility */ @@ -2345,7 +2346,7 @@ void BKE_layer_eval_layer_collection(const EvaluationContext *eval_ctx, void BKE_layer_eval_layer_collection_post(const struct EvaluationContext *UNUSED(eval_ctx), ViewLayer *view_layer) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, view_layer->name, view_layer); + DEG_debug_print_eval(__func__, view_layer->name, view_layer); /* if base is not selectabled, clear select */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { if ((base->flag & BASE_SELECTABLED) == 0) { diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 841008d1acc..7d977463abf 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -47,7 +47,6 @@ #include "DEG_depsgraph.h" - unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) { float max_segment = 0.01f; @@ -898,11 +897,9 @@ void BKE_mask_layer_evaluate_deform(MaskLayer *masklay, const float ctime) } } -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf - void BKE_mask_eval_animation(struct EvaluationContext *eval_ctx, Mask *mask) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, mask->id.name, mask); + DEG_debug_print_eval(__func__, mask->id.name, mask); for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) @@ -913,7 +910,7 @@ void BKE_mask_eval_animation(struct EvaluationContext *eval_ctx, Mask *mask) void BKE_mask_eval_update(struct EvaluationContext *eval_ctx, Mask *mask) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, mask->id.name, mask); + DEG_debug_print_eval(__func__, mask->id.name, mask); for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 87a57e2973a..a0059a99473 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -72,6 +72,7 @@ #include "BKE_editmesh.h" #include "BKE_font.h" +#include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "GPU_material.h" @@ -1774,9 +1775,7 @@ bool BKE_object_material_edit_image_set(Object *ob, short mat_nr, Image *image) void BKE_material_eval(const struct EvaluationContext *UNUSED(eval_ctx), Material *material) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s (%p)\n", __func__, material->id.name, material); - } + DEG_debug_print_eval(__func__, material->id.name, material); if ((BLI_listbase_is_empty(&material->gpumaterial) == false)) { GPU_material_uniform_buffer_tag_dirty(&material->gpumaterial); } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 9f346d10272..abbf073f646 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2670,9 +2670,7 @@ Mesh *BKE_mesh_new_from_object( void BKE_mesh_eval_geometry(const EvaluationContext *UNUSED(eval_ctx), Mesh *mesh) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s\n", __func__, mesh->id.name); - } + DEG_debug_print_eval(__func__, mesh->id.name, mesh); if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) { BKE_mesh_texspace_calc(mesh); } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 607307554da..9ed715d7591 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -73,12 +73,12 @@ #include "IMB_imbuf.h" #include "IMB_moviecache.h" +#include "DEG_depsgraph.h" + #ifdef WITH_OPENEXR # include "intern/openexr/openexr_multi.h" #endif -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf - /*********************** movieclip buffer loaders *************************/ static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen) @@ -1611,6 +1611,6 @@ bool BKE_movieclip_put_frame_if_possible(MovieClip *clip, void BKE_movieclip_eval_update(struct EvaluationContext *UNUSED(eval_ctx), MovieClip *clip) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, clip->id.name, clip); + DEG_debug_print_eval(__func__, clip->id.name, clip); BKE_tracking_dopesheet_tag_update(&clip->tracking); } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 1e41c276de4..41b7cd1f48e 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -75,6 +75,8 @@ #include "NOD_shader.h" #include "NOD_texture.h" +#include "DEG_depsgraph.h" + #define NODE_DEFAULT_MAX_WIDTH 700 /* Fallback types for undefined tree, nodes, sockets */ @@ -3871,8 +3873,6 @@ void BKE_nodetree_shading_params_eval(const struct EvaluationContext *UNUSED(eva bNodeTree *ntree_dst, const bNodeTree *ntree_src) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s (%p)\n", __func__, ntree_src->id.name, ntree_dst); - } + DEG_debug_print_eval(__func__, ntree_src->id.name, ntree_dst); BKE_nodetree_copy_default_values(ntree_dst, ntree_src); } diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index ada3838830e..2a33937e6ed 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -65,12 +65,11 @@ #include "MEM_guardedalloc.h" #include "DEG_depsgraph.h" -#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) printf void BKE_object_eval_local_transform(const EvaluationContext *UNUSED(eval_ctx), Object *ob) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, ob->id.name, ob); + DEG_debug_print_eval(__func__, ob->id.name, ob); /* calculate local matrix */ BKE_object_to_mat4(ob, ob->obmat); @@ -88,7 +87,7 @@ void BKE_object_eval_parent(const EvaluationContext *UNUSED(eval_ctx), float tmat[4][4]; float locmat[4][4]; - DEBUG_PRINT("%s on %s (%p)\n", __func__, ob->id.name, ob); + DEG_debug_print_eval(__func__, ob->id.name, ob); /* get local matrix (but don't calculate it, as that was done already!) */ // XXX: redundant? @@ -117,7 +116,7 @@ void BKE_object_eval_constraints(const EvaluationContext *eval_ctx, bConstraintOb *cob; float ctime = BKE_scene_frame_get(scene); - DEBUG_PRINT("%s on %s (%p)\n", __func__, ob->id.name, ob); + DEG_debug_print_eval(__func__, ob->id.name, ob); /* evaluate constraints stack */ /* TODO: split this into: @@ -135,7 +134,7 @@ void BKE_object_eval_constraints(const EvaluationContext *eval_ctx, void BKE_object_eval_done(const EvaluationContext *UNUSED(eval_ctx), Object *ob) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, ob->id.name, ob); + DEG_debug_print_eval(__func__, ob->id.name, ob); /* Set negative scale flag in object. */ if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE; @@ -305,7 +304,7 @@ void BKE_object_eval_uber_data(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, ob->id.name, ob); + DEG_debug_print_eval(__func__, ob->id.name, ob); BLI_assert(ob->type != OB_ARMATURE); BKE_object_handle_data_update(eval_ctx, scene, ob); @@ -383,7 +382,7 @@ void BKE_object_eval_cloth(const EvaluationContext *UNUSED(eval_ctx), Scene *scene, Object *object) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, object->id.name, object); + DEG_debug_print_eval(__func__, object->id.name, object); BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH); } @@ -406,7 +405,7 @@ void BKE_object_eval_transform_all(const EvaluationContext *eval_ctx, void BKE_object_eval_update_shading(const EvaluationContext *UNUSED(eval_ctx), Object *object) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, object->id.name, object); + DEG_debug_print_eval(__func__, object->id.name, object); if (object->type == OB_MESH) { BKE_mesh_batch_cache_dirty(object->data, BKE_MESH_BATCH_DIRTY_SHADING); } @@ -415,7 +414,7 @@ void BKE_object_eval_update_shading(const EvaluationContext *UNUSED(eval_ctx), void BKE_object_data_select_update(const EvaluationContext *UNUSED(eval_ctx), struct ID *object_data) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, object_data->name, object_data); + DEG_debug_print_eval(__func__, object_data->name, object_data); switch (GS(object_data->name)) { case ID_ME: BKE_mesh_batch_cache_dirty((Mesh *)object_data, @@ -437,7 +436,7 @@ void BKE_object_data_select_update(const EvaluationContext *UNUSED(eval_ctx), void BKE_object_eval_flush_base_flags(const EvaluationContext *UNUSED(eval_ctx), Object *object, Base *base, bool is_from_set) { - DEBUG_PRINT("%s on %s (%p)\n", __func__, object->id.name, object); + DEG_debug_print_eval(__func__, object->id.name, object); /* Make sure we have the base collection settings is already populated. * This will fail when BKE_layer_eval_layer_collection_pre hasn't run yet. diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 4cf8533d843..f27a570ca29 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -95,6 +95,7 @@ #include "PIL_time.h" #include "RE_shader_ext.h" +#include "DEG_depsgraph.h" /* fluid sim particle import */ #ifdef WITH_MOD_FLUID @@ -4419,18 +4420,14 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, void BKE_particle_system_settings_eval(const struct EvaluationContext *UNUSED(eval_ctx), ParticleSystem *psys) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s (%p)\n", __func__, psys->name, psys); - } + DEG_debug_print_eval(__func__, psys->name, psys); psys->recalc |= psys->part->recalc; } void BKE_particle_system_settings_recalc_clear(struct EvaluationContext *UNUSED(eval_ctx), ParticleSettings *particle_settings) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s (%p)\n", __func__, particle_settings->id.name, particle_settings); - } + DEG_debug_print_eval(__func__, particle_settings->id.name, particle_settings); particle_settings->recalc = 0; } @@ -4438,8 +4435,6 @@ void BKE_particle_system_eval_init(const struct EvaluationContext *UNUSED(eval_c Scene *scene, Object *ob) { - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s (%p)\n", __func__, ob->id.name, ob); - } + DEG_debug_print_eval(__func__, ob->id.name, ob); BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH); } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 12a53f5f3e5..69e36f66dad 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -66,6 +66,8 @@ #include "BKE_rigidbody.h" #include "BKE_scene.h" +#include "DEG_depsgraph.h" + /* ************************************** */ /* Memory Management */ @@ -1688,11 +1690,7 @@ void BKE_rigidbody_rebuild_sim(const struct EvaluationContext *eval_ctx, Scene *scene) { float ctime = BKE_scene_frame_get(scene); - - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s at %f\n", __func__, ctime); - } - + DEG_debug_print_eval_time(__func__, scene->id.name, scene, ctime); /* rebuild sim data (i.e. after resetting to start of timeline) */ if (BKE_scene_check_rigidbody_active(scene)) { BKE_rigidbody_rebuild_world(eval_ctx, scene, ctime); @@ -1703,11 +1701,7 @@ void BKE_rigidbody_eval_simulation(const struct EvaluationContext *eval_ctx, Scene *scene) { float ctime = BKE_scene_frame_get(scene); - - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s at %f\n", __func__, ctime); - } - + DEG_debug_print_eval_time(__func__, scene->id.name, scene, ctime); /* evaluate rigidbody sim */ if (BKE_scene_check_rigidbody_active(scene)) { BKE_rigidbody_do_simulation(eval_ctx, scene, ctime); @@ -1720,11 +1714,7 @@ void BKE_rigidbody_object_sync_transforms(const struct EvaluationContext *UNUSED { RigidBodyWorld *rbw = scene->rigidbody_world; float ctime = BKE_scene_frame_get(scene); - - if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { - printf("%s on %s\n", __func__, ob->id.name); - } - + DEG_debug_print_eval_time(__func__, ob->id.name, ob, ctime); /* read values pushed into RBO from sim/cache... */ BKE_rigidbody_sync_transforms(rbw, ob, ctime); } diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 477c0dd36ea..5cd1b48e80e 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -280,6 +280,32 @@ typedef void (*DEG_EditorUpdateSceneCb)( void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG_EditorUpdateSceneCb scene_func); +/* Evaluation Debug ------------------------------ */ + +void DEG_debug_print_eval(const char* function_name, + const char* object_name, + const void* object_address); + +void DEG_debug_print_eval_subdata(const char *function_name, + const char *object_name, + const void *object_address, + const char *subdata_comment, + const char *subdata_name, + const void *subdata_address); + +void DEG_debug_print_eval_subdata_index(const char *function_name, + const char *object_name, + const void *object_address, + const char *subdata_comment, + const char *subdata_name, + const void *subdata_address, + const int subdata_index); + +void DEG_debug_print_eval_time(const char* function_name, + const char* object_name, + const void* object_address, + float time); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index ee4ffee772e..a05e422d602 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -553,3 +553,60 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG::deg_editor_update_id_cb = id_func; DEG::deg_editor_update_scene_cb = scene_func; } + +void DEG_debug_print_eval(const char *function_name, + const char *object_name, + const void *object_address) +{ + if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + return; + } + printf("%s on %s (%p)\n", function_name, object_name, object_address); +} + +void DEG_debug_print_eval_subdata(const char *function_name, + const char *object_name, + const void *object_address, + const char *subdata_comment, + const char *subdata_name, + const void *subdata_address) +{ + if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + return; + } + printf("%s on %s (%p) %s %s (%p)\n", + function_name, + object_name, object_address, + subdata_comment, + subdata_name, subdata_address); +} + +void DEG_debug_print_eval_subdata_index(const char *function_name, + const char *object_name, + const void *object_address, + const char *subdata_comment, + const char *subdata_name, + const void *subdata_address, + const int subdata_index) +{ + if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + return; + } + printf("%s on %s (%p) %s %s[%d] (%p)\n", + function_name, + object_name, object_address, + subdata_comment, + subdata_name, subdata_index, subdata_address); +} + +void DEG_debug_print_eval_time(const char *function_name, + const char *object_name, + const void *object_address, + float time) +{ + if ((G.debug & G_DEBUG_DEPSGRAPH_EVAL) == 0) { + return; + } + printf("%s on %s (%p) at time %f\n", + function_name, object_name, object_address, time); +} |