forked from bartvdbraak/blender
Fix #21543: running python script from command line would lose active
scene from context for background render. Ideally this should not be using the context to get the scene but currently the active scene is not stored anywhere, as it's a concept we tried to get rid of.. just did a simple fix for now.
This commit is contained in:
parent
865ceab545
commit
119bd10d95
@ -796,6 +796,7 @@ static int run_python(int argc, char **argv, void *data)
|
||||
/* XXX, temp setting the WM is ugly, splash also does this :S */
|
||||
wmWindowManager *wm= CTX_wm_manager(C);
|
||||
wmWindow *prevwin= CTX_wm_window(C);
|
||||
Scene *prevscene= CTX_data_scene(C);
|
||||
|
||||
if(wm->windows.first) {
|
||||
CTX_wm_window_set(C, wm->windows.first);
|
||||
@ -808,6 +809,9 @@ static int run_python(int argc, char **argv, void *data)
|
||||
fprintf(stderr, "Python script \"%s\" running with missing context data.\n", argv[1]);
|
||||
BPY_run_python_script(C, filename, NULL, NULL); // use reports?
|
||||
}
|
||||
|
||||
CTX_data_scene_set(C, prevscene);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
printf("\nError: you must specify a Python script after '-P '.\n");
|
||||
|
Loading…
Reference in New Issue
Block a user