Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_main_api.c
| Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | static Scene *rna_Main_scenes_new(Main *bmain, const char *name) | ||||
| return scene; | return scene; | ||||
| } | } | ||||
| static void rna_Main_scenes_remove( | static void rna_Main_scenes_remove( | ||||
| Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink) | Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink) | ||||
| { | { | ||||
| /* don't call BKE_id_free(...) directly */ | /* don't call BKE_id_free(...) directly */ | ||||
| Scene *scene = scene_ptr->data; | Scene *scene = scene_ptr->data; | ||||
| Scene *scene_new; | |||||
| if ((scene_new = scene->id.prev) || (scene_new = scene->id.next)) { | if (BKE_scene_can_be_removed(bmain, scene)) { | ||||
| Scene *scene_new = scene->id.prev ? scene->id.prev : scene->id.next; | |||||
| if (do_unlink) { | if (do_unlink) { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| if (WM_window_get_active_scene(win) == scene) { | if (WM_window_get_active_scene(win) == scene) { | ||||
| # ifdef WITH_PYTHON | # ifdef WITH_PYTHON | ||||
| BPy_BEGIN_ALLOW_THREADS; | BPy_BEGIN_ALLOW_THREADS; | ||||
| # endif | # endif | ||||
| WM_window_set_active_scene(bmain, C, win, scene_new); | WM_window_set_active_scene(bmain, C, win, scene_new); | ||||
| # ifdef WITH_PYTHON | # ifdef WITH_PYTHON | ||||
| BPy_END_ALLOW_THREADS; | BPy_END_ALLOW_THREADS; | ||||
| # endif | # endif | ||||
| } | } | ||||
| } | } | ||||
| rna_Main_ID_remove(bmain, reports, scene_ptr, do_unlink, true, true); | rna_Main_ID_remove(bmain, reports, scene_ptr, do_unlink, true, true); | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_reportf( | BKE_reportf(reports, | ||||
| reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2); | RPT_ERROR, | ||||
| "Scene '%s' is the last local one, cannot be removed", | |||||
| scene->id.name + 2); | |||||
mont29: ` local one` | |||||
| } | } | ||||
| } | } | ||||
| static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data) | static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data) | ||||
| { | { | ||||
| if (data != NULL && (data->tag & LIB_TAG_NO_MAIN)) { | if (data != NULL && (data->tag & LIB_TAG_NO_MAIN)) { | ||||
| BKE_report(reports, | BKE_report(reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| ▲ Show 20 Lines • Show All 2,227 Lines • Show Last 20 Lines | |||||
local one