Cleanup: some more G.main removal/validation...

This commit is contained in:
Bastien Montagne 2018-06-15 17:21:07 +02:00
parent 2e25a48b05
commit da9b1b14ed
9 changed files with 11 additions and 9 deletions

View File

@ -805,6 +805,7 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in
return gpd_dst;
}
else {
BLI_assert(bmain != NULL);
bGPdata *gpd_copy;
BKE_id_copy_ex(bmain, &gpd_src->id, (ID **)&gpd_copy, 0, false);
return gpd_copy;

View File

@ -179,7 +179,7 @@ void gpencil_undo_push(bGPdata *gpd)
/* create new undo node */
undo_node = MEM_callocN(sizeof(bGPundonode), "gpencil undo node");
undo_node->gpd = BKE_gpencil_data_duplicate(G.main, gpd, true);
undo_node->gpd = BKE_gpencil_data_duplicate(NULL, gpd, true);
cur_node = undo_node;

View File

@ -1733,7 +1733,8 @@ static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA
StructRNA *srna;
/* look for collection property in Main */
RNA_main_pointer_create(G.main, ptr);
/* Note: using global Main is OK-ish here, UI shall not access other Mains anyay... */
RNA_main_pointer_create(G_MAIN, ptr);
*prop = NULL;

View File

@ -358,7 +358,7 @@ void EDBM_mesh_load(Main *bmain, Object *ob)
* cycles.
*/
#if 0
for (Object *other_object = G.main->object.first;
for (Object *other_object = bmain->object.first;
other_object != NULL;
other_object = other_object->id.next)
{

View File

@ -313,7 +313,7 @@ static void dpaint_bake_endjob(void *customdata)
G.is_rendering = false;
BKE_spacedata_draw_locks(false);
WM_set_locked_interface(G.main->wm.first, false);
WM_set_locked_interface(G_MAIN->wm.first, false);
/* Bake was successful:
* Report for ended bake and how long it took */

View File

@ -395,7 +395,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
/* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
* leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
* --> BKE_animsys_evaluate_all_animation(G.main, eval_time);
* --> BKE_animsys_evaluate_all_animation(CTX_data_main(C), eval_time);
* This doesn't work with drivers:
* --> BKE_animsys_evaluate_animdata(&fsDomain->id, fsDomain->adt, eval_time, ADT_RECALC_ALL);
*/

View File

@ -139,7 +139,7 @@ static void ptcache_job_endjob(void *customdata)
G.is_rendering = false;
BKE_spacedata_draw_locks(false);
WM_set_locked_interface(G.main->wm.first, false);
WM_set_locked_interface(G_MAIN->wm.first, false);
WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
WM_main_add_notifier(NC_OBJECT | ND_POINTCACHE, job->baker->pid.ob);

View File

@ -200,7 +200,7 @@ bool ED_undo_is_valid(const bContext *C, const char *undoname)
*/
UndoStack *ED_undo_stack_get(void)
{
wmWindowManager *wm = G.main->wm.first;
wmWindowManager *wm = G_MAIN->wm.first;
return wm->undo_stack;
}

View File

@ -133,8 +133,8 @@ void ED_editors_exit(bContext *C)
return;
/* frees all editmode undos */
if (G.main->wm.first) {
wmWindowManager *wm = G.main->wm.first;
if (G_MAIN->wm.first) {
wmWindowManager *wm = G_MAIN->wm.first;
/* normally we don't check for NULL undo stack, do here since it may run in different context. */
if (wm->undo_stack) {
BKE_undosys_stack_destroy(wm->undo_stack);