Cleanup: remove some G.main from BKE area.

This commit is contained in:
Bastien Montagne 2018-06-12 11:21:54 +02:00
parent 7bf4023689
commit 75bcb70c60
8 changed files with 27 additions and 25 deletions

View File

@ -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);

View File

@ -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__ */

View File

@ -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);
}

View File

@ -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));
}
}

View File

@ -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);
}
}

View File

@ -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)
{

View File

@ -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 */

View File

@ -2880,7 +2880,7 @@ static void do_render_all_options(Render *re)
/* ensure no images are in memory from previous animated sequences */
BKE_image_all_free_anim_ibufs(re->main, re->r.cfra);
BKE_sequencer_all_free_anim_ibufs(re->r.cfra);
BKE_sequencer_all_free_anim_ibufs(re->main, re->r.cfra);
if (RE_engine_render(re, 1)) {
/* in this case external render overrides all */