diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_animsys.h | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_nla.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 121 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_relations.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 10 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_group.c | 17 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 2 |
14 files changed, 122 insertions, 110 deletions
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 326c25e8899..7ae9527b2f7 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -76,7 +76,7 @@ struct AnimData *BKE_animdata_copy(struct Main *bmain, struct AnimData *adt, con bool BKE_animdata_copy_id(struct Main *bmain, struct ID *id_to, struct ID *id_from, const bool do_action, const bool do_id_user); /* Copy AnimData Actions */ -void BKE_animdata_copy_id_action(struct ID *id, const bool set_newid); +void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id, const bool set_newid); /* Merge copies of data from source AnimData block */ typedef enum eAnimData_MergeCopy_Modes { @@ -90,7 +90,9 @@ typedef enum eAnimData_MergeCopy_Modes { ADT_MERGECOPY_SRC_REF = 2 } eAnimData_MergeCopy_Modes; -void BKE_animdata_merge_copy(struct ID *dst_id, struct ID *src_id, eAnimData_MergeCopy_Modes action_mode, bool fix_drivers); +void BKE_animdata_merge_copy( + struct Main *bmain, struct ID *dst_id, struct ID *src_id, + eAnimData_MergeCopy_Modes action_mode, bool fix_drivers); /* ************************************* */ /* KeyingSets API */ @@ -141,7 +143,8 @@ void BKE_animdata_fix_paths_remove(struct ID *id, const char *path); /* -------------------------------------- */ /* Move animation data from src to destination if it's paths are based on basepaths */ -void BKE_animdata_separate_by_basepath(struct ID *srcID, struct ID *dstID, struct ListBase *basepaths); +void BKE_animdata_separate_by_basepath( + struct Main *bmain, struct ID *srcID, struct ID *dstID, struct ListBase *basepaths); /* Move F-Curves from src to destination if it's path is based on basepath */ void action_move_fcurves_by_basepath(struct bAction *srcAct, struct bAction *dstAct, const char basepath[]); 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 63c91ef9635..a541120638b 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -495,6 +495,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 0867170611f..ec979623a98 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -288,7 +288,7 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const bool do_action, co } /* 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); @@ -319,25 +319,27 @@ bool BKE_animdata_copy_id(Main *bmain, ID *id_to, ID *id_from, const bool do_act return true; } -void BKE_animdata_copy_id_action(ID *id, const bool set_newid) +void BKE_animdata_copy_id_action(Main *bmain, ID *id, const bool set_newid) { AnimData *adt = BKE_animdata_from_id(id); if (adt) { if (adt->action) { id_us_min((ID *)adt->action); - adt->action = set_newid ? ID_NEW_SET(adt->action, BKE_action_copy(G.main, adt->action)) : - BKE_action_copy(G.main, adt->action); + adt->action = set_newid ? ID_NEW_SET(adt->action, BKE_action_copy(bmain, adt->action)) : + BKE_action_copy(bmain, adt->action); } if (adt->tmpact) { id_us_min((ID *)adt->tmpact); - adt->tmpact = set_newid ? ID_NEW_SET(adt->tmpact, BKE_action_copy(G.main, adt->tmpact)) : - BKE_action_copy(G.main, adt->tmpact); + adt->tmpact = set_newid ? ID_NEW_SET(adt->tmpact, BKE_action_copy(bmain, adt->tmpact)) : + BKE_action_copy(bmain, adt->tmpact); } } } /* Merge copies of the data from the src AnimData into the destination AnimData */ -void BKE_animdata_merge_copy(ID *dst_id, ID *src_id, eAnimData_MergeCopy_Modes action_mode, bool fix_drivers) +void BKE_animdata_merge_copy( + Main *bmain, ID *dst_id, ID *src_id, + eAnimData_MergeCopy_Modes action_mode, bool fix_drivers) { AnimData *src = BKE_animdata_from_id(src_id); AnimData *dst = BKE_animdata_from_id(dst_id); @@ -355,8 +357,8 @@ void BKE_animdata_merge_copy(ID *dst_id, ID *src_id, eAnimData_MergeCopy_Modes a /* handle actions... */ if (action_mode == ADT_MERGECOPY_SRC_COPY) { /* make a copy of the actions */ - dst->action = BKE_action_copy(G.main, src->action); - dst->tmpact = BKE_action_copy(G.main, src->tmpact); + dst->action = BKE_action_copy(bmain, src->action); + dst->tmpact = BKE_action_copy(bmain, src->tmpact); } else if (action_mode == ADT_MERGECOPY_SRC_REF) { /* make a reference to it */ @@ -371,7 +373,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(bmain, &tracks, &src->nla_tracks); BLI_movelisttolist(&dst->nla_tracks, &tracks); } @@ -508,7 +510,8 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha * animation data is based off "basepath", creating new AnimData and * associated data as necessary */ -void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths) +void BKE_animdata_separate_by_basepath( + Main *bmain, ID *srcID, ID *dstID, ListBase *basepaths) { AnimData *srcAdt = NULL, *dstAdt = NULL; LinkData *ld; @@ -534,7 +537,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths if (srcAdt->action) { /* set up an action if necessary, and name it in a similar way so that it can be easily found again */ if (dstAdt->action == NULL) { - dstAdt->action = BKE_action_add(G.main, srcAdt->action->id.name + 2); + dstAdt->action = BKE_action_add(bmain, srcAdt->action->id.name + 2); } else if (dstAdt->action == srcAdt->action) { printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n", @@ -542,7 +545,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths /* TODO: review this... */ id_us_min(&dstAdt->action->id); - dstAdt->action = BKE_action_add(G.main, dstAdt->action->id.name + 2); + dstAdt->action = BKE_action_add(bmain, dstAdt->action->id.name + 2); } /* loop over base paths, trying to fix for each one... */ @@ -1051,20 +1054,20 @@ static void adt_apply_all_fcurves_cb(ID *id, AnimData *adt, void *wrapper_data) } /* apply the given callback function on all F-Curves attached to data in main database */ -void BKE_fcurves_main_cb(Main *mainptr, ID_FCurve_Edit_Callback func, void *user_data) +void BKE_fcurves_main_cb(Main *bmain, ID_FCurve_Edit_Callback func, void *user_data) { /* Wrap F-Curve operation stuff to pass to the general AnimData-level func */ AllFCurvesCbWrapper wrapper = {func, user_data}; /* Use the AnimData-based function so that we don't have to reimplement all that stuff */ - BKE_animdata_main_cb(mainptr, adt_apply_all_fcurves_cb, &wrapper); + BKE_animdata_main_cb(bmain, adt_apply_all_fcurves_cb, &wrapper); } /* Whole Database Ops -------------------------------------------- */ /* apply the given callback function on all data in main database */ -void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *user_data) +void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *user_data) { ID *id; @@ -1088,67 +1091,67 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u } (void)0 /* nodes */ - ANIMDATA_IDS_CB(mainptr->nodetree.first); + ANIMDATA_IDS_CB(bmain->nodetree.first); /* textures */ - ANIMDATA_NODETREE_IDS_CB(mainptr->tex.first, Tex); + ANIMDATA_NODETREE_IDS_CB(bmain->tex.first, Tex); /* lamps */ - ANIMDATA_NODETREE_IDS_CB(mainptr->lamp.first, Lamp); + ANIMDATA_NODETREE_IDS_CB(bmain->lamp.first, Lamp); /* materials */ - ANIMDATA_NODETREE_IDS_CB(mainptr->mat.first, Material); + ANIMDATA_NODETREE_IDS_CB(bmain->mat.first, Material); /* cameras */ - ANIMDATA_IDS_CB(mainptr->camera.first); + ANIMDATA_IDS_CB(bmain->camera.first); /* shapekeys */ - ANIMDATA_IDS_CB(mainptr->key.first); + ANIMDATA_IDS_CB(bmain->key.first); /* metaballs */ - ANIMDATA_IDS_CB(mainptr->mball.first); + ANIMDATA_IDS_CB(bmain->mball.first); /* curves */ - ANIMDATA_IDS_CB(mainptr->curve.first); + ANIMDATA_IDS_CB(bmain->curve.first); /* armatures */ - ANIMDATA_IDS_CB(mainptr->armature.first); + ANIMDATA_IDS_CB(bmain->armature.first); /* lattices */ - ANIMDATA_IDS_CB(mainptr->latt.first); + ANIMDATA_IDS_CB(bmain->latt.first); /* meshes */ - ANIMDATA_IDS_CB(mainptr->mesh.first); + ANIMDATA_IDS_CB(bmain->mesh.first); /* particles */ - ANIMDATA_IDS_CB(mainptr->particle.first); + ANIMDATA_IDS_CB(bmain->particle.first); /* speakers */ - ANIMDATA_IDS_CB(mainptr->speaker.first); + ANIMDATA_IDS_CB(bmain->speaker.first); /* movie clips */ - ANIMDATA_IDS_CB(mainptr->movieclip.first); + ANIMDATA_IDS_CB(bmain->movieclip.first); /* objects */ - ANIMDATA_IDS_CB(mainptr->object.first); + ANIMDATA_IDS_CB(bmain->object.first); /* masks */ - ANIMDATA_IDS_CB(mainptr->mask.first); + ANIMDATA_IDS_CB(bmain->mask.first); /* worlds */ - ANIMDATA_NODETREE_IDS_CB(mainptr->world.first, World); + ANIMDATA_NODETREE_IDS_CB(bmain->world.first, World); /* scenes */ - ANIMDATA_NODETREE_IDS_CB(mainptr->scene.first, Scene); + ANIMDATA_NODETREE_IDS_CB(bmain->scene.first, Scene); /* line styles */ - ANIMDATA_IDS_CB(mainptr->linestyle.first); + ANIMDATA_IDS_CB(bmain->linestyle.first); /* grease pencil */ - ANIMDATA_IDS_CB(mainptr->gpencil.first); + ANIMDATA_IDS_CB(bmain->gpencil.first); /* cache files */ - ANIMDATA_IDS_CB(mainptr->cachefiles.first); + ANIMDATA_IDS_CB(bmain->cachefiles.first); } /* Fix all RNA-Paths throughout the database (directly access the Global.main version) @@ -1158,7 +1161,7 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u /* TODO: use BKE_animdata_main_cb for looping over all data */ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const char *oldName, const char *newName) { - Main *mainptr = G.main; + Main *bmain = G.main; /* XXX UGLY! */ ID *id; /* macro for less typing @@ -1184,67 +1187,67 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha } (void)0 /* nodes */ - RENAMEFIX_ANIM_IDS(mainptr->nodetree.first); + RENAMEFIX_ANIM_IDS(bmain->nodetree.first); /* textures */ - RENAMEFIX_ANIM_NODETREE_IDS(mainptr->tex.first, Tex); + RENAMEFIX_ANIM_NODETREE_IDS(bmain->tex.first, Tex); /* lamps */ - RENAMEFIX_ANIM_NODETREE_IDS(mainptr->lamp.first, Lamp); + RENAMEFIX_ANIM_NODETREE_IDS(bmain->lamp.first, Lamp); /* materials */ - RENAMEFIX_ANIM_NODETREE_IDS(mainptr->mat.first, Material); + RENAMEFIX_ANIM_NODETREE_IDS(bmain->mat.first, Material); /* cameras */ - RENAMEFIX_ANIM_IDS(mainptr->camera.first); + RENAMEFIX_ANIM_IDS(bmain->camera.first); /* shapekeys */ - RENAMEFIX_ANIM_IDS(mainptr->key.first); + RENAMEFIX_ANIM_IDS(bmain->key.first); /* metaballs */ - RENAMEFIX_ANIM_IDS(mainptr->mball.first); + RENAMEFIX_ANIM_IDS(bmain->mball.first); /* curves */ - RENAMEFIX_ANIM_IDS(mainptr->curve.first); + RENAMEFIX_ANIM_IDS(bmain->curve.first); /* armatures */ - RENAMEFIX_ANIM_IDS(mainptr->armature.first); + RENAMEFIX_ANIM_IDS(bmain->armature.first); /* lattices */ - RENAMEFIX_ANIM_IDS(mainptr->latt.first); + RENAMEFIX_ANIM_IDS(bmain->latt.first); /* meshes */ - RENAMEFIX_ANIM_IDS(mainptr->mesh.first); + RENAMEFIX_ANIM_IDS(bmain->mesh.first); /* particles */ - RENAMEFIX_ANIM_IDS(mainptr->particle.first); + RENAMEFIX_ANIM_IDS(bmain->particle.first); /* speakers */ - RENAMEFIX_ANIM_IDS(mainptr->speaker.first); + RENAMEFIX_ANIM_IDS(bmain->speaker.first); /* movie clips */ - RENAMEFIX_ANIM_IDS(mainptr->movieclip.first); + RENAMEFIX_ANIM_IDS(bmain->movieclip.first); /* objects */ - RENAMEFIX_ANIM_IDS(mainptr->object.first); + RENAMEFIX_ANIM_IDS(bmain->object.first); /* masks */ - RENAMEFIX_ANIM_IDS(mainptr->mask.first); + RENAMEFIX_ANIM_IDS(bmain->mask.first); /* worlds */ - RENAMEFIX_ANIM_NODETREE_IDS(mainptr->world.first, World); + RENAMEFIX_ANIM_NODETREE_IDS(bmain->world.first, World); /* linestyles */ - RENAMEFIX_ANIM_IDS(mainptr->linestyle.first); + RENAMEFIX_ANIM_IDS(bmain->linestyle.first); /* grease pencil */ - RENAMEFIX_ANIM_IDS(mainptr->gpencil.first); + RENAMEFIX_ANIM_IDS(bmain->gpencil.first); /* cache files */ - RENAMEFIX_ANIM_IDS(mainptr->cachefiles.first); + RENAMEFIX_ANIM_IDS(bmain->cachefiles.first); /* scenes */ - RENAMEFIX_ANIM_NODETREE_IDS(mainptr->scene.first, Scene); + RENAMEFIX_ANIM_NODETREE_IDS(bmain->scene.first, Scene); } /* *********************************** */ diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index a885f22b739..2327da82615 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -772,9 +772,10 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop) if (id) { /* if property isn't editable, we're going to have an extra block hanging around until we save */ if (RNA_property_editable(ptr, prop)) { - if (id_copy(CTX_data_main(C), id, &newid, false) && newid) { + Main *bmain = CTX_data_main(C); + if (id_copy(bmain, id, &newid, false) && newid) { /* copy animation actions too */ - BKE_animdata_copy_id_action(id, false); + BKE_animdata_copy_id_action(bmain, id, false); /* us is 1 by convention, but RNA_property_pointer_set * will also increment it, so set it to zero */ newid->us = 0; diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index fc236cc2ad0..98586a5c2f5 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 b91887e6815..56705c834d5 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 ecd0335fc4e..7d1bb69c788 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -5724,10 +5724,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/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 9282148e857..338f573dfd5 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -377,7 +377,7 @@ int join_armature_exec(bContext *C, wmOperator *op) } else { /* merge in data - we'll fix the drivers manually */ - BKE_animdata_merge_copy(&ob->id, &base->object->id, ADT_MERGECOPY_KEEP_DST, false); + BKE_animdata_merge_copy(bmain, &ob->id, &base->object->id, ADT_MERGECOPY_KEEP_DST, false); } } @@ -388,7 +388,7 @@ int join_armature_exec(bContext *C, wmOperator *op) } else { /* merge in data - we'll fix the drivers manually */ - BKE_animdata_merge_copy(&arm->id, &curarm->id, ADT_MERGECOPY_KEEP_DST, false); + BKE_animdata_merge_copy(bmain, &arm->id, &curarm->id, ADT_MERGECOPY_KEEP_DST, false); } } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9ce7f556448..e079cfd1d90 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2098,7 +2098,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer /* duplicates using userflags */ if (dupflag & USER_DUP_ACT) { - BKE_animdata_copy_id_action(&obn->id, true); + BKE_animdata_copy_id_action(bmain, &obn->id, true); } if (dupflag & USER_DUP_MAT) { @@ -2112,7 +2112,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer id_us_min(id); if (dupflag & USER_DUP_ACT) { - BKE_animdata_copy_id_action(&obn->mat[a]->id, true); + BKE_animdata_copy_id_action(bmain, &obn->mat[a]->id, true); } } } @@ -2128,7 +2128,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer } if (dupflag & USER_DUP_ACT) { - BKE_animdata_copy_id_action(&psys->part->id, true); + BKE_animdata_copy_id_action(bmain, &psys->part->id, true); } id_us_min(id); @@ -2256,9 +2256,9 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer } if (dupflag & USER_DUP_ACT) { - BKE_animdata_copy_id_action((ID *)obn->data, true); + BKE_animdata_copy_id_action(bmain, (ID *)obn->data, true); if (key) { - BKE_animdata_copy_id_action((ID *)key, true); + BKE_animdata_copy_id_action(bmain, (ID *)key, true); } } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 4f441826bfd..84e3e63fede 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1786,7 +1786,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer /* Needed to remap texcomesh below. */ me = ob->data = ID_NEW_SET(ob->data, BKE_mesh_copy(bmain, ob->data)); if (me->key) /* We do not need to set me->key->id.newid here... */ - BKE_animdata_copy_id_action((ID *)me->key, false); + BKE_animdata_copy_id_action(bmain, (ID *)me->key, false); break; case OB_MBALL: ob->data = ID_NEW_SET(ob->data, BKE_mball_copy(bmain, ob->data)); @@ -1798,12 +1798,12 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer ID_NEW_REMAP(cu->bevobj); ID_NEW_REMAP(cu->taperobj); if (cu->key) /* We do not need to set cu->key->id.newid here... */ - BKE_animdata_copy_id_action((ID *)cu->key, false); + BKE_animdata_copy_id_action(bmain, (ID *)cu->key, false); break; case OB_LATTICE: ob->data = lat = ID_NEW_SET(ob->data, BKE_lattice_copy(bmain, ob->data)); if (lat->key) /* We do not need to set lat->key->id.newid here... */ - BKE_animdata_copy_id_action((ID *)lat->key, false); + BKE_animdata_copy_id_action(bmain, (ID *)lat->key, false); break; case OB_ARMATURE: DEG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -1830,7 +1830,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer * AnimData structure, which is not what we want. * (sergey) */ - BKE_animdata_copy_id_action((ID *)ob->data, false); + BKE_animdata_copy_id_action(bmain, (ID *)ob->data, false); id_us_min(id); } @@ -1845,13 +1845,13 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer } } -static void single_object_action_users(Scene *scene, ViewLayer *view_layer, const int flag) +static void single_object_action_users(Main *bmain, Scene *scene, ViewLayer *view_layer, const int flag) { FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob) { if (!ID_IS_LINKED(ob)) { DEG_id_tag_update(&ob->id, OB_RECALC_DATA); - BKE_animdata_copy_id_action(&ob->id, false); + BKE_animdata_copy_id_action(bmain, &ob->id, false); } } FOREACH_OBJECT_FLAG_END; @@ -1872,7 +1872,7 @@ static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, c if (ma->id.us > 1) { man = BKE_material_copy(bmain, ma); - BKE_animdata_copy_id_action(&man->id, false); + BKE_animdata_copy_id_action(bmain, &man->id, false); man->id.us = 0; assign_material(bmain, ob, man, a, BKE_MAT_ASSIGN_USERPREF); @@ -1916,7 +1916,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bo if (full) { single_obdata_users(bmain, scene, NULL, 0); - single_object_action_users(scene, NULL, 0); + single_object_action_users(bmain, scene, NULL, 0); single_mat_users_expand(bmain); } @@ -2457,7 +2457,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op) } if (RNA_boolean_get(op->ptr, "animation")) { - single_object_action_users(scene, view_layer, flag); + single_object_action_users(bmain, scene, view_layer, flag); } BKE_main_id_clear_newpoins(bmain); 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/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 5d326a0be38..926fff7a3b6 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -260,7 +260,7 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) waction = wgroup->adt->action = BKE_action_copy(bmain, wgroup->adt->action); /* now perform the moving */ - BKE_animdata_separate_by_basepath(&wgroup->id, &ntree->id, &anim_basepaths); + BKE_animdata_separate_by_basepath(bmain, &wgroup->id, &ntree->id, &anim_basepaths); /* paths + their wrappers need to be freed */ for (ld = anim_basepaths.first; ld; ld = ldn) { @@ -397,7 +397,8 @@ void NODE_OT_group_ungroup(wmOperatorType *ot) /* ******************** Separate operator ********************** */ /* returns 1 if its OK */ -static int node_group_separate_selected(bNodeTree *ntree, bNodeTree *ngroup, float offx, float offy, int make_copy) +static int node_group_separate_selected( + Main *bmain, bNodeTree *ntree, bNodeTree *ngroup, float offx, float offy, int make_copy) { bNodeLink *link, *link_next; bNode *node, *node_next, *newnode; @@ -492,7 +493,7 @@ static int node_group_separate_selected(bNodeTree *ntree, bNodeTree *ngroup, flo LinkData *ld, *ldn = NULL; /* now perform the moving */ - BKE_animdata_separate_by_basepath(&ngroup->id, &ntree->id, &anim_basepaths); + BKE_animdata_separate_by_basepath(bmain, &ngroup->id, &ntree->id, &anim_basepaths); /* paths + their wrappers need to be freed */ for (ld = anim_basepaths.first; ld; ld = ldn) { @@ -524,12 +525,13 @@ static const EnumPropertyItem node_group_separate_types[] = { static int node_group_separate_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); bNodeTree *ngroup, *nparent; int type = RNA_enum_get(op->ptr, "type"); float offx, offy; - ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); + ED_preview_kill_jobs(CTX_wm_manager(C), bmain); /* are we inside of a group? */ ngroup = snode->edittree; @@ -543,13 +545,13 @@ static int node_group_separate_exec(bContext *C, wmOperator *op) switch (type) { case NODE_GS_COPY: - if (!node_group_separate_selected(nparent, ngroup, offx, offy, 1)) { + if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 1)) { BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes"); return OPERATOR_CANCELLED; } break; case NODE_GS_MOVE: - if (!node_group_separate_selected(nparent, ngroup, offx, offy, 0)) { + if (!node_group_separate_selected(bmain, nparent, ngroup, offx, offy, 0)) { BKE_report(op->reports, RPT_WARNING, "Cannot separate nodes"); return OPERATOR_CANCELLED; } @@ -681,6 +683,7 @@ static int node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min, static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, bNode *gnode) { + Main *bmain = CTX_data_main(C); bNodeTree *ngroup = (bNodeTree *)gnode->id; bNodeLink *link, *linkn; bNode *node, *nextn; @@ -742,7 +745,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, if (ntree->adt) { LinkData *ld, *ldn = NULL; - BKE_animdata_separate_by_basepath(&ntree->id, &ngroup->id, &anim_basepaths); + BKE_animdata_separate_by_basepath(bmain, &ntree->id, &ngroup->id, &anim_basepaths); /* paths + their wrappers need to be freed */ for (ld = anim_basepaths.first; ld; ld = ldn) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 54fb4251a3b..5976fe283a8 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1831,7 +1831,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 */ |