diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-01 16:47:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-01 16:47:49 +0400 |
commit | 5fa7d1c1b4e7bde1d173caa60af0e273c86b6f0b (patch) | |
tree | 186a794aef722993c7067a657b4d007c62dd669b /source/blender/makesrna | |
parent | c34f831757e0985b7523b6e5bbfadd7dd6a2c161 (diff) |
2.5: code changes to reduce the usage of G.main and pass it along
or get it from the context instead.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_boid.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.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 | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 2 |
12 files changed, 36 insertions, 30 deletions
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 7e52032687c..c4ed00794b0 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -97,7 +97,7 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) else DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 1c6c35a88de..05bddfa7a32 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -214,7 +214,7 @@ static void rna_Constraint_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - ED_object_constraint_dependency_update(scene, ptr->id.data); + ED_object_constraint_dependency_update(bmain, scene, ptr->id.data); } static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index d10aed1595a..335f5919004 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -254,7 +254,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(scene); + DAG_scene_sort(bmain, scene); rna_Curve_update_data(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index cd58b6574be..09f531cf95d 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -110,7 +110,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(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_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 18b0f1ca61a..fa5d703a84f 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -214,7 +214,7 @@ static void rna_Modifier_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Modifier_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } 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 4576a754f96..29666c6ed04 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -196,7 +196,7 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } /* when changing the selection flag the scene needs updating */ @@ -214,7 +214,7 @@ static void rna_Base_select_update(Main *bmain, Scene *scene, PointerRNA *ptr) ED_base_object_select(base, mode); } -static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object *ob) +static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob) { /* try to avoid scene sort */ if((ob->lay & scene->lay) && (base->lay & scene->lay)) { @@ -222,7 +222,7 @@ static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object * } else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { /* pass */ } else { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } } @@ -237,7 +237,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) SWAP(int, base->lay, ob->lay); - rna_Object_layer_update__internal(scene, base, ob); + rna_Object_layer_update__internal(bmain, scene, base, ob); ob->lay= base->lay; } @@ -246,7 +246,7 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Base *base= (Base*)ptr->data; Object *ob= (Object*)base->object; - rna_Object_layer_update__internal(scene, base, ob); + rna_Object_layer_update__internal(bmain, scene, base, ob); ob->lay= base->lay; } @@ -1031,12 +1031,12 @@ static int rna_Object_constraint_remove(Object *object, int index) static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, char *name, int type) { - return ED_object_modifier_add(reports, CTX_data_scene(C), object, name, type); + return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); } static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, ModifierData *md) { - ED_object_modifier_remove(reports, CTX_data_scene(C), object, md); + ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md); } static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d253201fbc1..a3a1186eedc 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -510,11 +510,11 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA if(!md) { if(pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE)==0) if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) - ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Surface); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Surface); } else { if(!pd || pd->shape != PFIELD_SHAPE_SURFACE) - ED_object_modifier_remove(NULL, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); } WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); @@ -538,7 +538,7 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point rna_FieldSettings_shape_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) DAG_id_flush_update(&ob->id, OB_RECALC_ALL); @@ -582,7 +582,7 @@ static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); @@ -640,9 +640,9 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P /* add/remove modifier as needed */ if(ob->pd->deflect && !md) - ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Collision); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); else if(!ob->pd->deflect && md) - ED_object_modifier_remove(NULL, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 74bc564064e..4baf81a9427 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -214,7 +214,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(scene); + DAG_scene_sort(bmain, scene); rna_Particle_redo(bmain, scene, ptr); } @@ -266,7 +266,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr psys->recalc = PSYS_RECALC_RESET; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } 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 21ece0ac4a9..d05a3d341ba 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -151,7 +151,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr bPose *pose = ptr->data; pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); update_pose_constraint_flags(pose); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 966e7696ede..027120b4f35 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -203,7 +203,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report ob->recalc |= OB_RECALC_ALL; - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); return base; } @@ -229,8 +229,8 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o ob->id.us--; /* needed otherwise the depgraph will contain free'd objects which can crash, see [#20958] */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(G.main, scene); + DAG_ids_flush_update(G.main, 0); WM_main_add_notifier(NC_SCENE|ND_OB_ACTIVE, scene); } @@ -838,7 +838,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA for(SETLOOPER(scene, base)) object_simplify_update(base->object); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_main_add_notifier(NC_GEOM|ND_DATA, NULL); } diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index eb48fb6c237..c3b60514d2a 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -39,9 +39,10 @@ #ifdef RNA_RUNTIME #include "BKE_animsys.h" -#include "BKE_scene.h" -#include "BKE_image.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" +#include "BKE_image.h" +#include "BKE_scene.h" #include "BKE_writeavi.h" @@ -50,11 +51,16 @@ static void rna_Scene_set_frame(Scene *scene, int frame) { scene->r.cfra= frame; CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME); - scene_update_for_newframe(scene, (1<<20) - 1); + scene_update_for_newframe(G.main, scene, (1<<20) - 1); WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); } +static void rna_Scene_update_tagged(Scene *scene) +{ + scene_update_tagged(G.main, scene); +} + static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports, char name[], int absolute, int insertkey_needed, int insertkey_visual) { @@ -102,7 +108,7 @@ void RNA_api_scene(StructRNA *srna) parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "update", "scene_update_tagged"); + func= RNA_def_function(srna, "update", "rna_Scene_update_tagged"); RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators."); /* Add Keying Set */ diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index cd2297cc273..f921595304d 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -55,7 +55,7 @@ static void rna_Smoke_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Smoke_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr) |