Commit: 75bcb70c60172e61d2e564c88f78843d617eb919
Author: Bastien Montagne
Date:   Tue Jun 12 11:21:54 2018 +0200
Branches: master
https://developer.blender.org/rB75bcb70c60172e61d2e564c88f78843d617eb919

Cleanup: remove some G.main from BKE area.

===================================================================

M       source/blender/blenkernel/BKE_nla.h
M       source/blender/blenkernel/BKE_sequencer.h
M       source/blender/blenkernel/intern/anim_sys.c
M       source/blender/blenkernel/intern/movieclip.c
M       source/blender/blenkernel/intern/nla.c
M       source/blender/blenkernel/intern/sequencer.c
M       source/blender/editors/space_nla/nla_edit.c
M       source/blender/render/intern/source/pipeline.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_nla.h 
b/source/blender/blenkernel/BKE_nla.h
index 4509d374b02..6f0b6d59984 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -34,6 +34,7 @@
  */
 
 struct AnimData;
+struct Main;
 struct NlaStrip;
 struct NlaTrack;
 struct bAction;
@@ -50,9 +51,9 @@ void BKE_nlastrip_free(ListBase *strips, struct NlaStrip 
*strip);
 void BKE_nlatrack_free(ListBase *tracks, struct NlaTrack *nlt);
 void BKE_nla_tracks_free(ListBase *tracks);
 
-struct NlaStrip *BKE_nlastrip_copy(struct NlaStrip *strip, const bool 
use_same_action);
-struct NlaTrack *BKE_nlatrack_copy(struct NlaTrack *nlt, const bool 
use_same_actions);
-void BKE_nla_tracks_copy(ListBase *dst, ListBase *src);
+struct NlaStrip *BKE_nlastrip_copy(struct Main *bmain, struct NlaStrip *strip, 
const bool use_same_action);
+struct NlaTrack *BKE_nlatrack_copy(struct Main *bmain, struct NlaTrack *nlt, 
const bool use_same_actions);
+void BKE_nla_tracks_copy(struct Main *bmain, ListBase *dst, ListBase *src);
 
 struct NlaTrack *BKE_nlatrack_add(struct AnimData *adt, struct NlaTrack *prev);
 struct NlaStrip *BKE_nlastrip_new(struct bAction *act);
diff --git a/source/blender/blenkernel/BKE_sequencer.h 
b/source/blender/blenkernel/BKE_sequencer.h
index 8d11ae89233..e00e2403dfc 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -491,6 +491,6 @@ struct ImBuf *BKE_sequencer_render_mask_input(
         int cfra, int fra_offset, bool make_float);
 void BKE_sequencer_color_balance_apply(struct StripColorBalance *cb, struct 
ImBuf *ibuf, float mul, bool make_float, struct ImBuf *mask_input);
 
-void BKE_sequencer_all_free_anim_ibufs(int cfra);
+void BKE_sequencer_all_free_anim_ibufs(struct Main *bmain, int cfra);
 
 #endif  /* __BKE_SEQUENCER_H__ */
diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 924b1951d37..b94bce9baee 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -284,7 +284,7 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, 
const bool do_action)
        }
 
        /* duplicate NLA data */
-       BKE_nla_tracks_copy(&dadt->nla_tracks, &adt->nla_tracks);
+       BKE_nla_tracks_copy(bmain, &dadt->nla_tracks, &adt->nla_tracks);
        
        /* duplicate drivers (F-Curves) */
        copy_fcurves(&dadt->drivers, &adt->drivers);
@@ -366,7 +366,7 @@ void BKE_animdata_merge_copy(ID *dst_id, ID *src_id, 
eAnimData_MergeCopy_Modes a
        if (src->nla_tracks.first) {
                ListBase tracks = {NULL, NULL};
                
-               BKE_nla_tracks_copy(&tracks, &src->nla_tracks);
+               BKE_nla_tracks_copy(G.main, &tracks, &src->nla_tracks);
                BLI_movelisttolist(&dst->nla_tracks, &tracks);
        }
        
diff --git a/source/blender/blenkernel/intern/movieclip.c 
b/source/blender/blenkernel/intern/movieclip.c
index 65768372a28..a11b0c62aa8 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -171,7 +171,7 @@ static void get_sequence_fname(const MovieClip *clip,
                BLI_strncpy(name, clip->name, sizeof(clip->name));
        }
 
-       BLI_path_abs(name, ID_BLEND_PATH(G.main, &clip->id));
+       BLI_path_abs(name, ID_BLEND_PATH_FROM_GLOBAL(&clip->id));
 }
 
 /* supposed to work with sequences only */
@@ -261,7 +261,7 @@ static void movieclip_open_anim_file(MovieClip *clip)
 
        if (!clip->anim) {
                BLI_strncpy(str, clip->name, FILE_MAX);
-               BLI_path_abs(str, ID_BLEND_PATH(G.main, &clip->id));
+               BLI_path_abs(str, ID_BLEND_PATH_FROM_GLOBAL(&clip->id));
 
                /* FIXME: make several stream accessible in image editor, too */
                clip->anim = openanim(str, IB_rect, 0, 
clip->colorspace_settings.name);
@@ -1300,7 +1300,7 @@ void BKE_movieclip_reload(Main *bmain, MovieClip *clip)
         */
        {
                Scene *scene;
-               for (scene = G.main->scene.first; scene; scene = 
scene->id.next) {
+               for (scene = bmain->scene.first; scene; scene = scene->id.next) 
{
                        if (scene->nodetree) {
                                nodeUpdateID(scene->nodetree, &clip->id);
                        }
@@ -1568,7 +1568,7 @@ void BKE_movieclip_filename_for_frame(MovieClip *clip, 
MovieClipUser *user, char
        }
        else {
                BLI_strncpy(name, clip->name, FILE_MAX);
-               BLI_path_abs(name, ID_BLEND_PATH(G.main, &clip->id));
+               BLI_path_abs(name, ID_BLEND_PATH_FROM_GLOBAL(&clip->id));
        }
 }
 
diff --git a/source/blender/blenkernel/intern/nla.c 
b/source/blender/blenkernel/intern/nla.c
index dadef74b4de..1db4e878c9a 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -54,9 +54,10 @@
 
 #include "BKE_action.h"
 #include "BKE_fcurve.h"
-#include "BKE_nla.h"
 #include "BKE_global.h"
 #include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_nla.h"
 
 #ifdef WITH_AUDASPACE
 #  include AUD_SPECIAL_H
@@ -162,7 +163,7 @@ void BKE_nla_tracks_free(ListBase *tracks)
  *
  * \param use_same_action When true, the existing action is used (instead of 
being duplicated)
  */
-NlaStrip *BKE_nlastrip_copy(NlaStrip *strip, const bool use_same_action)
+NlaStrip *BKE_nlastrip_copy(Main *bmain, NlaStrip *strip, const bool 
use_same_action)
 {
        NlaStrip *strip_d;
        NlaStrip *cs, *cs_d;
@@ -183,7 +184,7 @@ NlaStrip *BKE_nlastrip_copy(NlaStrip *strip, const bool 
use_same_action)
                }
                else {
                        /* use a copy of the action instead (user count 
shouldn't have changed yet) */
-                       strip_d->act = BKE_action_copy(G.main, strip_d->act);
+                       strip_d->act = BKE_action_copy(bmain, strip_d->act);
                }
        }
                
@@ -195,7 +196,7 @@ NlaStrip *BKE_nlastrip_copy(NlaStrip *strip, const bool 
use_same_action)
        BLI_listbase_clear(&strip_d->strips);
        
        for (cs = strip->strips.first; cs; cs = cs->next) {
-               cs_d = BKE_nlastrip_copy(cs, use_same_action);
+               cs_d = BKE_nlastrip_copy(bmain, cs, use_same_action);
                BLI_addtail(&strip_d->strips, cs_d);
        }
        
@@ -204,7 +205,7 @@ NlaStrip *BKE_nlastrip_copy(NlaStrip *strip, const bool 
use_same_action)
 }
 
 /* Copy NLA Track */
-NlaTrack *BKE_nlatrack_copy(NlaTrack *nlt, const bool use_same_actions)
+NlaTrack *BKE_nlatrack_copy(Main *bmain, NlaTrack *nlt, const bool 
use_same_actions)
 {
        NlaStrip *strip, *strip_d;
        NlaTrack *nlt_d;
@@ -221,7 +222,7 @@ NlaTrack *BKE_nlatrack_copy(NlaTrack *nlt, const bool 
use_same_actions)
        BLI_listbase_clear(&nlt_d->strips);
        
        for (strip = nlt->strips.first; strip; strip = strip->next) {
-               strip_d = BKE_nlastrip_copy(strip, use_same_actions);
+               strip_d = BKE_nlastrip_copy(bmain, strip, use_same_actions);
                BLI_addtail(&nlt_d->strips, strip_d);
        }
        
@@ -230,7 +231,7 @@ NlaTrack *BKE_nlatrack_copy(NlaTrack *nlt, const bool 
use_same_actions)
 }
 
 /* Copy all NLA data */
-void BKE_nla_tracks_copy(ListBase *dst, ListBase *src)
+void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src)
 {
        NlaTrack *nlt, *nlt_d;
        
@@ -245,7 +246,7 @@ void BKE_nla_tracks_copy(ListBase *dst, ListBase *src)
        for (nlt = src->first; nlt; nlt = nlt->next) {
                /* make a copy, and add the copy to the destination list */
                // XXX: we need to fix this sometime
-               nlt_d = BKE_nlatrack_copy(nlt, true);
+               nlt_d = BKE_nlatrack_copy(bmain, nlt, true);
                BLI_addtail(dst, nlt_d);
        }
 }
diff --git a/source/blender/blenkernel/intern/sequencer.c 
b/source/blender/blenkernel/intern/sequencer.c
index 557b781c5d0..ed855337041 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -5711,10 +5711,10 @@ static void sequencer_all_free_anim_ibufs(ListBase 
*seqbase, int cfra)
        }
 }
 
-void BKE_sequencer_all_free_anim_ibufs(int cfra)
+void BKE_sequencer_all_free_anim_ibufs(Main *bmain, int cfra)
 {
        BKE_sequencer_cache_cleanup();
-       for (Scene *scene = G.main->scene.first;
+       for (Scene *scene = bmain->scene.first;
             scene != NULL;
             scene = scene->id.next)
        {
diff --git a/source/blender/editors/space_nla/nla_edit.c 
b/source/blender/editors/space_nla/nla_edit.c
index 26ac06446c4..23cd504978c 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -1057,7 +1057,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator 
*op)
                        /* if selected, split the strip at its midpoint */
                        if (strip->flag & NLASTRIP_FLAG_SELECT) {
                                /* make a copy (assume that this is possible) */
-                               nstrip = BKE_nlastrip_copy(strip, linked);
+                               nstrip = BKE_nlastrip_copy(ac.bmain, strip, 
linked);
 
                                /* in case there's no space in the track above, 
or we haven't got a reference to it yet, try adding */
                                if (BKE_nlatrack_add_strip(nlt->next, nstrip) 
== 0) {
@@ -1207,7 +1207,7 @@ void NLA_OT_delete(wmOperatorType *ot)
 //  - variable-length splits?
 
 /* split a given Action-Clip strip */
-static void nlaedit_split_strip_actclip(AnimData *adt, NlaTrack *nlt, NlaStrip 
*strip, float cfra)
+static void nlaedit_split_strip_actclip(Main *bmain, AnimData *adt, NlaTrack 
*nlt, NlaStrip *strip, float cfra)
 {
        NlaStrip *nstrip;
        float splitframe, splitaframe;
@@ -1242,7 +1242,7 @@ static void nlaedit_split_strip_actclip(AnimData *adt, 
NlaTrack *nlt, NlaStrip *
        /* make a copy (assume that this is possible) and append
         * it immediately after the current strip
         */
-       nstrip = BKE_nlastrip_copy(strip, true);
+       nstrip = BKE_nlastrip_copy(bmain, strip, true);
        BLI_insertlinkafter(&nlt->strips, strip, nstrip);
 
        /* set the endpoint of the first strip and the start of the new strip
@@ -1303,7 +1303,7 @@ static int nlaedit_split_exec(bContext *C, wmOperator 
*UNUSED(op))
                                /* splitting method depends on the type of 
strip */
                                switch (strip->type) {
                                        case NLASTRIP_TYPE_CLIP: /* action-clip 
*/
-                                               
nlaedit_split_strip_actclip(adt, nlt, strip, (float)ac.scene->r.cfra);
+                                               
nlaedit_split_strip_actclip(ac.bmain, adt, nlt, strip, (float)ac.scene->r.cfra);
                                                break;
 
                                        case NLASTRIP_TYPE_META: /* meta-strips 
need special handling */
diff --git a/source/blender/render/intern/source/pipeline.c 
b/source/blender/render/intern/source/pipeline.c
index 1df21e47c66..45e45e4b3d3 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2880,7 +2880,7 @@ static void do_render_all_options(Render *re)
 
        /* ensure no images are in memory from previous animated sequen

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to