Revision: 30936
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30936
Author:   blendix
Date:     2010-08-01 14:47:49 +0200 (Sun, 01 Aug 2010)

Log Message:
-----------
2.5: code changes to reduce the usage of G.main and pass it along
or get it from the context instead.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_depsgraph.h
    trunk/blender/source/blender/blenkernel/BKE_material.h
    trunk/blender/source/blender/blenkernel/BKE_pointcache.h
    trunk/blender/source/blender/blenkernel/BKE_scene.h
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/blenkernel/intern/blender.c
    trunk/blender/source/blender/blenkernel/intern/depsgraph.c
    trunk/blender/source/blender/blenkernel/intern/material.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenkernel/intern/sequencer.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/animation/drivers.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/animation/keyingsets.c
    trunk/blender/source/blender/editors/armature/editarmature.c
    trunk/blender/source/blender/editors/curve/editcurve.c
    trunk/blender/source/blender/editors/include/ED_object.h
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/mesh/editmesh.c
    trunk/blender/source/blender/editors/mesh/meshtools.c
    trunk/blender/source/blender/editors/object/object_add.c
    trunk/blender/source/blender/editors/object/object_constraint.c
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/editors/object/object_group.c
    trunk/blender/source/blender/editors/object/object_hook.c
    trunk/blender/source/blender/editors/object/object_modifier.c
    trunk/blender/source/blender/editors/object/object_relations.c
    trunk/blender/source/blender/editors/object/object_transform.c
    trunk/blender/source/blender/editors/physics/particle_boids.c
    trunk/blender/source/blender/editors/physics/particle_object.c
    trunk/blender/source/blender/editors/render/render_internal.c
    trunk/blender/source/blender/editors/render/render_opengl.c
    trunk/blender/source/blender/editors/render/render_preview.c
    trunk/blender/source/blender/editors/screen/screen_edit.c
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/space_graph/graph_buttons.c
    trunk/blender/source/blender/editors/space_logic/logic_window.c
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/editors/space_node/node_edit.c
    trunk/blender/source/blender/editors/space_outliner/outliner.c
    trunk/blender/source/blender/editors/space_text/text_ops.c
    trunk/blender/source/blender/editors/space_view3d/view3d_buttons.c
    trunk/blender/source/blender/editors/space_view3d/view3d_header.c
    trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c
    trunk/blender/source/blender/editors/util/ed_util.c
    trunk/blender/source/blender/makesrna/intern/rna_boid.c
    trunk/blender/source/blender/makesrna/intern/rna_constraint.c
    trunk/blender/source/blender/makesrna/intern/rna_curve.c
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
    trunk/blender/source/blender/makesrna/intern/rna_modifier.c
    trunk/blender/source/blender/makesrna/intern/rna_object.c
    trunk/blender/source/blender/makesrna/intern/rna_object_force.c
    trunk/blender/source/blender/makesrna/intern/rna_particle.c
    trunk/blender/source/blender/makesrna/intern/rna_pose.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/makesrna/intern/rna_scene_api.c
    trunk/blender/source/blender/makesrna/intern/rna_smoke.c
    trunk/blender/source/blender/render/extern/include/RE_pipeline.h
    trunk/blender/source/blender/render/intern/include/render_types.h
    trunk/blender/source/blender/render/intern/include/texture.h
    trunk/blender/source/blender/render/intern/source/convertblender.c
    trunk/blender/source/blender/render/intern/source/envmap.c
    trunk/blender/source/blender/render/intern/source/pipeline.c
    trunk/blender/source/blender/render/intern/source/pointdensity.c
    trunk/blender/source/blender/render/intern/source/sss.c
    trunk/blender/source/blender/render/intern/source/texture.c
    trunk/blender/source/blender/render/intern/source/voxeldata.c
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
    trunk/blender/source/blender/windowmanager/intern/wm_files.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/blender/blenkernel/BKE_depsgraph.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_depsgraph.h     2010-08-01 
12:16:32 UTC (rev 30935)
+++ trunk/blender/source/blender/blenkernel/BKE_depsgraph.h     2010-08-01 
12:47:49 UTC (rev 30936)
@@ -70,7 +70,7 @@
 void   queue_delete(struct DagNodeQueue *queue);
 
 // queries
-struct DagForest       *build_dag(struct Scene *sce, short mask);
+struct DagForest       *build_dag(struct Main *bmain, struct Scene *sce, short 
mask);
 void                           free_forest(struct DagForest *Dag);
 
 // note :
@@ -97,14 +97,14 @@
 /* Note that the DAG never executes changes in Objects, only sets flags in 
Objects */
 
                /* (re)-create dependency graph for scene */
-void   DAG_scene_sort(struct Scene *sce);
+void   DAG_scene_sort(struct Main *bmain, struct Scene *sce);
 
                /* flag all objects that need recalc because they're animated */
-void   DAG_scene_update_flags(struct Scene *sce, unsigned int lay);
+void   DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned 
int lay);
                /* flushes all recalc flags in objects down the dependency tree 
*/
-void   DAG_scene_flush_update(struct Scene *sce, unsigned int lay, int time);
+void   DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned 
int lay, int time);
                /* tag objects for update on file load */
-void   DAG_on_load_update(void);
+void   DAG_on_load_update(struct Main *bmain);
 
                /* flag all IDs that need recalc because they're animated, 
influencing
                   this ID only. only for objects currently */
@@ -113,7 +113,7 @@
                   but note the DAG only supports objects and object data 
currently */
 void   DAG_id_flush_update(struct ID *id, short flag);
                /* when setting manual RECALC flags, call this afterwards */
-void   DAG_ids_flush_update(int time);
+void   DAG_ids_flush_update(struct Main *bmain, int time);
 
                /* (re)-create dependency graph for armature pose */
 void   DAG_pose_sort(struct Object *ob);

Modified: trunk/blender/source/blender/blenkernel/BKE_material.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_material.h      2010-08-01 
12:16:32 UTC (rev 30935)
+++ trunk/blender/source/blender/blenkernel/BKE_material.h      2010-08-01 
12:47:49 UTC (rev 30936)
@@ -35,6 +35,7 @@
 extern "C" {
 #endif
 
+struct Main;
 struct Material;
 struct ID;
 struct Object;
@@ -69,9 +70,9 @@
 /* rendering */
 
 void init_render_material(struct Material *, int, float *);
-void init_render_materials(int, float *);
+void init_render_materials(struct Main *, int, float *);
 void end_render_material(struct Material *);
-void end_render_materials(void);
+void end_render_materials(struct Main *);
 
 int material_in_material(struct Material *parmat, struct Material *mat);
 

Modified: trunk/blender/source/blender/blenkernel/BKE_pointcache.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_pointcache.h    2010-08-01 
12:16:32 UTC (rev 30935)
+++ trunk/blender/source/blender/blenkernel/BKE_pointcache.h    2010-08-01 
12:47:49 UTC (rev 30936)
@@ -70,15 +70,16 @@
 #define PTCACHE_READ_OLD                               3
 
 /* Structs */
+struct ClothModifierData;
+struct ListBase;
+struct Main;
 struct Object;
+struct ParticleKey;
+struct ParticleSystem;
+struct PointCache;
 struct Scene;
+struct SmokeModifierData;
 struct SoftBody;
-struct ParticleSystem;
-struct ParticleKey;
-struct ClothModifierData;
-struct SmokeModifierData;
-struct PointCache;
-struct ListBase;
 
 /* temp structure for read/write */
 typedef struct PTCacheData {
@@ -143,6 +144,7 @@
 } PTCacheID;
 
 typedef struct PTCacheBaker {
+       struct Main *main;
        struct Scene *scene;
        int bake;
        int render;
@@ -286,7 +288,7 @@
 /********************** Baking *********************/
 
 /* Bakes cache with cache_step sized jumps in time, not accurate but very 
fast. */
-void BKE_ptcache_quick_cache_all(struct Scene *scene);
+void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene);
 
 /* Bake cache or simulate to current frame with settings defined in the baker. 
*/
 void BKE_ptcache_make_cache(struct PTCacheBaker* baker);

Modified: trunk/blender/source/blender/blenkernel/BKE_scene.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_scene.h 2010-08-01 12:16:32 UTC 
(rev 30935)
+++ trunk/blender/source/blender/blenkernel/BKE_scene.h 2010-08-01 12:47:49 UTC 
(rev 30936)
@@ -82,8 +82,8 @@
 
 float BKE_curframe(struct Scene *scene);
 
-void scene_update_tagged(struct Scene *sce);
-void scene_update_for_newframe(struct Scene *sce, unsigned int lay);
+void scene_update_tagged(struct Main *bmain, struct Scene *sce);
+void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned 
int lay);
 
 void scene_add_render_layer(struct Scene *sce);
 

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c       2010-08-01 
12:16:32 UTC (rev 30935)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c       2010-08-01 
12:47:49 UTC (rev 30936)
@@ -289,7 +289,7 @@
        }
        
        /* "brew me a list that's sorted a bit faster now depsy" */
-       DAG_scene_sort(scene);
+       DAG_scene_sort(G.main, scene);
 }
 
 /* update scene for current frame */
@@ -299,7 +299,7 @@
        Base *base, *last=NULL;
        
        /* only stuff that moves or needs display still */
-       DAG_scene_update_flags(scene, scene->lay);
+       DAG_scene_update_flags(G.main, scene, scene->lay);
        
        /* find the last object with the tag 
         *      - all those afterwards are assumed to not be relevant for our 
calculations
@@ -327,7 +327,7 @@
         *        that doesn't force complete update, but for now, this is the
         *        most accurate way!
         */
-       scene_update_for_newframe(scene, scene->lay); // XXX this is the best 
way we can get anything moving
+       scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is 
the best way we can get anything moving
 #endif
 }
 

Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/blender.c    2010-08-01 
12:16:32 UTC (rev 30935)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c    2010-08-01 
12:47:49 UTC (rev 30936)
@@ -478,7 +478,7 @@
        G.fileflags= fileflags;
 
        if(success)
-               DAG_on_load_update();
+               DAG_on_load_update(G.main);
 
        return success;
 }

Modified: trunk/blender/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/depsgraph.c  2010-08-01 
12:16:32 UTC (rev 30935)
+++ trunk/blender/source/blender/blenkernel/intern/depsgraph.c  2010-08-01 
12:47:49 UTC (rev 30936)
@@ -658,7 +658,7 @@
                dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene 
Relation");
 }
 
-struct DagForest *build_dag(struct Scene *sce, short mask) 
+struct DagForest *build_dag(Main *bmain, Scene *sce, short mask) 
 {
        Base *base;
        Object *ob;
@@ -695,7 +695,7 @@
        }
        
        /* add groups used in current scene objects */
-       for(group= G.main->group.first; group; group= group->id.next) {
+       for(group= bmain->group.first; group; group= group->id.next) {
                if(group->id.flag & LIB_DOIT) {
                        for(go= group->gobject.first; go; go= go->next) {
                                build_dag_object(dag, scenenode, sce, go->ob, 
mask);
@@ -1605,7 +1605,7 @@
 }
 
 /* groups with objects in this scene need to be put in the right order as well 
*/
-static void scene_sort_groups(Scene *sce)
+static void scene_sort_groups(Main *bmain, Scene *sce)
 {
        Base *base;
        Group *group;
@@ -1613,14 +1613,14 @@
        Object *ob;
        
        /* test; are group objects all in this scene? */
-       for(ob= G.main->object.first; ob; ob= ob->id.next) {
+       for(ob= bmain->object.first; ob; ob= ob->id.next) {
                ob->id.flag &= ~LIB_DOIT;
                ob->id.newid= NULL;     /* newid abuse for GroupObject */
        }
        for(base = sce->base.first; base; base= base->next)
                base->object->id.flag |= LIB_DOIT;
        
-       for(group= G.main->group.first; group; group= group->id.next) {
+       for(group= bmain->group.first; group; group= group->id.next) {
                for(go= group->gobject.first; go; go= go->next) {
                        if((go->ob->id.flag & LIB_DOIT)==0)
                                break;
@@ -1649,7 +1649,7 @@
 }
 
 /* sort the base list on dependency order */
-void DAG_scene_sort(struct Scene *sce)
+void DAG_scene_sort(Main *bmain, Scene *sce)
 {
        DagNode *node;
        DagNodeQueue *nqueue;
@@ -1661,7 +1661,7 @@
        
        tempbase.first= tempbase.last= NULL;
        
-       build_dag(sce, DAG_RL_ALL_BUT_DATA);
+       build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA);
        
        dag_check_cycle(sce->theDag);
 
@@ -1731,7 +1731,7 @@
        queue_delete(nqueue);
        
        /* all groups with objects in this scene gets resorted too */
-       scene_sort_groups(sce);
+       scene_sort_groups(bmain, sce);
        
        if(G.f & G_DEBUG) {
                printf("\nordered\n");
@@ -1926,7 +1926,7 @@
 }
 
 /* flushes all recalc flags in objects down the dependency tree */
-void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time)
+void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, int 
time)
 {
        DagNode *firstnode;
        DagAdjList *itA;
@@ -1935,7 +1935,7 @@
        
        if(sce->theDag==NULL) {
                printf("DAG zero... not allowed to happen!\n");
-               DAG_scene_sort(sce);
+               DAG_scene_sort(bmain, sce);
        }
        
        firstnode= sce->theDag->DagNode.first;  // always scene node
@@ -2135,7 +2135,7 @@
        }               
 }
 /* flag all objects that need recalc, for changes in time for example */
-void DAG_scene_update_flags(Scene *scene, unsigned int lay)
+void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay)
 {
        Base *base;
        Object *ob;
@@ -2157,7 +2157,7 @@
        }       
        
        /* we do groups each once */
-       for(group= G.main->group.first; group; group= group->id.next) {
+       for(group= bmain->group.first; group; group= group->id.next) {
                if(group->id.flag & LIB_DOIT) {
                        for(go= group->gobject.first; go; go= go->next) {
                                dag_object_time_update_flags(go->ob);
@@ -2166,7 +2166,7 @@
        }
        
        for(sce= scene; sce; sce= sce->set)
-               DAG_scene_flush_update(sce, lay, 1);
+               DAG_scene_flush_update(bmain, sce, lay, 1);
        
        /* test: set time flag, to disable baked systems to update */
        for(SETLOOPER(scene, base)) {
@@ -2223,21 +2223,19 @@
        }
 }
 
-void DAG_ids_flush_update(int time)
+void DAG_ids_flush_update(Main *bmain, int time)
 {
-       Main *bmain= G.main;
        Scene *sce;
        unsigned int lay;
 

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to