diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-21 23:33:04 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-21 23:33:04 +0400 |
commit | 20220d47e38c4ad22ad89481fd40b804cc2fd1ef (patch) | |
tree | 5e01f917fa80465bb6401d63f8057641813983d9 /source/blender/makesrna/intern | |
parent | 074565330db93ceb2304247f9bf6499b05cb3b80 (diff) |
Dependency Graph: some refactoring which should have no user visible impact
besides performance in some cases.
* DAG_scene_sort is now removed and replaced by DAG_relations_tag_update in
most cases. This will clear the dependency graph, and only rebuild it right
before it's needed again when the scene is re-evaluated.
This is done because DAG_scene_sort is slow when called many times from
python operators. Further the scene argument is not needed because most
operations can potentially affect more than the current scene.
* DAG_scene_relations_update will now rebuild the dependency graph if it's not
there yet, and DAG_scene_relations_rebuild will force a rebuild for the rare
cases that need it.
* Remove various places where ob->recalc was set manually. This should go
through DAG_id_tag_update() in nearly all cases instead since this is now
a fast operation. Also removed DAG_ids_flush_update that goes along with
such manual tagging of ob->recalc.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_boid.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_dynamicpaint.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 2 |
11 files changed, 21 insertions, 25 deletions
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 3da718afd1c..63f4e480468 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -100,7 +100,7 @@ static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); } -static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Boids_reset_deps(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (ptr->type == &RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem *)ptr->data; @@ -112,7 +112,7 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) else DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 8f8136b0a28..b7ef76eeaf3 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -304,7 +304,7 @@ static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); rna_Curve_update_data(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 99d2f6dbbda..a505ae0dec2 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -152,7 +152,7 @@ static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, Poi static void rna_DynamicPaint_resetDependancy(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_DynamicPaintSurface_reset(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 82e2cb3b0ea..a91832268e2 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -116,7 +116,7 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA driver->flag &= ~DRIVER_FLAG_INVALID; /* TODO: this really needs an update guard... */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA); WM_main_add_notifier(NC_SCENE | ND_FRAME, scene); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 1eaf54a69aa..810999033a4 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -267,7 +267,7 @@ static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Modifier_update(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 47b775801f6..3e7567e0eda 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -293,12 +293,10 @@ static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA rna_Object_internal_update_data(bmain, scene, ptr); } -static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { DAG_id_tag_update(ptr->id.data, OB_RECALC_OB); - if (scene) { - DAG_scene_sort(bmain, scene); - } + DAG_relations_tag_update(bmain); WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data); } @@ -332,7 +330,7 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b /* pass */ } else { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } DAG_id_type_tag(bmain, ID_OB); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index dcb288a6f32..434f767ccad 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -547,7 +547,7 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point rna_FieldSettings_shape_update(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); @@ -590,9 +590,9 @@ static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene), WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } -static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); DAG_id_tag_update((ID *)ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f90389146aa..d6f3f594395 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -622,7 +622,7 @@ static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); rna_Particle_redo(bmain, scene, ptr); } @@ -659,7 +659,7 @@ static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget return NULL; } -static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { if (ptr->type == &RNA_ParticleTarget) { Object *ob = (Object *)ptr->id.data; @@ -687,7 +687,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr psys->recalc = PSYS_RECALC_RESET; DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 23f61282b78..1ed675962f3 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -187,13 +187,13 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value) } } -static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { Object *ob = ptr->id.data; bPose *pose = ptr->data; pose->flag |= POSE_RECALC; /* checks & sorts pose channels */ - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); BKE_pose_update_constraint_flags(pose); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7718dc2376d..afee72ff873 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -381,10 +381,10 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report if (scene == scene_act) ob->lay = base->lay; - ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; + DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); /* slows down importers too much, run scene.update() */ - /* DAG_scene_sort(G.main, scene); */ + /* DAG_srelations_tag_update(G.main); */ WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); @@ -412,8 +412,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o ob->id.us--; /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */ - DAG_scene_sort(G.main, scene); - DAG_ids_flush_update(G.main, 0); + DAG_relations_tag_update(G.main); WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); } @@ -1260,7 +1259,6 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi for (SETLOOPER(sce, sce_iter, base)) object_simplify_update(base->object); - DAG_ids_flush_update(bmain, 0); WM_main_add_notifier(NC_GEOM | ND_DATA, NULL); } diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index bdcda79583e..86b97b93437 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -62,7 +62,7 @@ static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Smoke_update(bmain, scene, ptr); - DAG_scene_sort(bmain, scene); + DAG_relations_tag_update(bmain); } static void rna_Smoke_resetCache(Main *bmain, Scene *scene, PointerRNA *ptr) |