Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c246
1 files changed, 123 insertions, 123 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index e57fb96dc73..96420a6968c 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -28,9 +28,9 @@
*/
- /* placed up here because of crappy
- * winsock stuff.
- */
+/* placed up here because of crappy
+ * winsock stuff.
+ */
#include <stddef.h>
#include <string.h>
#include <errno.h>
@@ -133,20 +133,20 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
wmWindowManager *wm;
wmWindow *win, *active_win;
- *wmlist= G.main->wm;
- G.main->wm.first= G.main->wm.last= NULL;
+ *wmlist = G.main->wm;
+ G.main->wm.first = G.main->wm.last = NULL;
active_win = CTX_wm_window(C);
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
- for (wm= wmlist->first; wm; wm= wm->id.next) {
+ for (wm = wmlist->first; wm; wm = wm->id.next) {
WM_jobs_stop_all(wm);
- for (win= wm->windows.first; win; win= win->next) {
+ for (win = wm->windows.first; win; win = win->next) {
- CTX_wm_window_set(C, win); /* needed by operator close callbacks */
+ CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, win->screen);
@@ -160,13 +160,13 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
/* just had return; here from r12991, this code could just get removed?*/
#if 0
- if (wm==NULL) return;
+ if (wm == NULL) return;
if (G.fileflags & G_FILE_NO_UI) return;
/* we take apart the used screens from non-active window */
- for (win= wm->windows.first; win; win= win->next) {
+ for (win = wm->windows.first; win; win = win->next) {
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
- if (win!=wm->winactive) {
+ if (win != wm->winactive) {
BLI_remlink(&G.main->screen, win->screen);
//BLI_addtail(screenbase, win->screen);
}
@@ -187,8 +187,8 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
wmWindow *oldwin, *win;
/* cases 1 and 2 */
- if (oldwmlist->first==NULL) {
- if (G.main->wm.first); /* nothing todo */
+ if (oldwmlist->first == NULL) {
+ if (G.main->wm.first) ; /* nothing todo */
else
wm_add_default(C);
}
@@ -196,29 +196,29 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* cases 3 and 4 */
/* we've read file without wm..., keep current one entirely alive */
- if (G.main->wm.first==NULL) {
- bScreen *screen= NULL;
+ if (G.main->wm.first == NULL) {
+ bScreen *screen = NULL;
/* when loading without UI, no matching needed */
- if (!(G.fileflags & G_FILE_NO_UI) && (screen= CTX_wm_screen(C))) {
+ if (!(G.fileflags & G_FILE_NO_UI) && (screen = CTX_wm_screen(C))) {
/* match oldwm to new dbase, only old files */
- for (wm= oldwmlist->first; wm; wm= wm->id.next) {
+ for (wm = oldwmlist->first; wm; wm = wm->id.next) {
- for (win= wm->windows.first; win; win= win->next) {
+ for (win = wm->windows.first; win; win = win->next) {
/* all windows get active screen from file */
- if (screen->winid==0)
- win->screen= screen;
+ if (screen->winid == 0)
+ win->screen = screen;
else
- win->screen= ED_screen_duplicate(win, screen);
+ win->screen = ED_screen_duplicate(win, screen);
- BLI_strncpy(win->screenname, win->screen->id.name+2, sizeof(win->screenname));
- win->screen->winid= win->winid;
+ BLI_strncpy(win->screenname, win->screen->id.name + 2, sizeof(win->screenname));
+ win->screen->winid = win->winid;
}
}
}
- G.main->wm= *oldwmlist;
+ G.main->wm = *oldwmlist;
/* screens were read from file! */
ED_screens_initialize(G.main->wm.first);
@@ -226,47 +226,47 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
else {
/* what if old was 3, and loaded 1? */
/* this code could move to setup_appdata */
- oldwm= oldwmlist->first;
- wm= G.main->wm.first;
+ oldwm = oldwmlist->first;
+ wm = G.main->wm.first;
/* preserve key configurations in new wm, to preserve their keymaps */
- wm->keyconfigs= oldwm->keyconfigs;
- wm->addonconf= oldwm->addonconf;
- wm->defaultconf= oldwm->defaultconf;
- wm->userconf= oldwm->userconf;
+ wm->keyconfigs = oldwm->keyconfigs;
+ wm->addonconf = oldwm->addonconf;
+ wm->defaultconf = oldwm->defaultconf;
+ wm->userconf = oldwm->userconf;
- oldwm->keyconfigs.first= oldwm->keyconfigs.last= NULL;
- oldwm->addonconf= NULL;
- oldwm->defaultconf= NULL;
- oldwm->userconf= NULL;
+ oldwm->keyconfigs.first = oldwm->keyconfigs.last = NULL;
+ oldwm->addonconf = NULL;
+ oldwm->defaultconf = NULL;
+ oldwm->userconf = NULL;
/* ensure making new keymaps and set space types */
- wm->initialized= 0;
- wm->winactive= NULL;
+ wm->initialized = 0;
+ wm->winactive = NULL;
/* only first wm in list has ghostwins */
- for (win= wm->windows.first; win; win= win->next) {
- for (oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
+ for (win = wm->windows.first; win; win = win->next) {
+ for (oldwin = oldwm->windows.first; oldwin; oldwin = oldwin->next) {
- if (oldwin->winid == win->winid ) {
- win->ghostwin= oldwin->ghostwin;
- win->active= oldwin->active;
+ if (oldwin->winid == win->winid) {
+ win->ghostwin = oldwin->ghostwin;
+ win->active = oldwin->active;
if (win->active)
- wm->winactive= win;
+ wm->winactive = win;
if (!G.background) /* file loading in background mode still calls this */
- GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
+ GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
- oldwin->ghostwin= NULL;
+ oldwin->ghostwin = NULL;
- win->eventstate= oldwin->eventstate;
- oldwin->eventstate= NULL;
+ win->eventstate = oldwin->eventstate;
+ oldwin->eventstate = NULL;
/* ensure proper screen rescaling */
- win->sizex= oldwin->sizex;
- win->sizey= oldwin->sizey;
- win->posx= oldwin->posx;
- win->posy= oldwin->posy;
+ win->sizex = oldwin->sizex;
+ win->sizey = oldwin->sizey;
+ win->posx = oldwin->posx;
+ win->posy = oldwin->posy;
}
}
}
@@ -283,14 +283,14 @@ static void wm_init_userdef(bContext *C)
sound_init(CTX_data_main(C));
/* needed so loading a file from the command line respects user-pref [#26156] */
- if (U.flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
- else G.fileflags &= ~G_FILE_NO_UI;
+ if (U.flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
+ else G.fileflags &= ~G_FILE_NO_UI;
/* set the python auto-execute setting from user prefs */
/* enabled by default, unless explicitly enabled in the command line which overrides */
if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC;
- else G.f &= ~G_SCRIPT_AUTOEXEC;
+ else G.f &= ~G_SCRIPT_AUTOEXEC;
}
/* update tempdir from user preferences */
@@ -300,11 +300,11 @@ static void wm_init_userdef(bContext *C)
/* return codes */
-#define BKE_READ_EXOTIC_FAIL_PATH -3 /* file format is not supported */
-#define BKE_READ_EXOTIC_FAIL_FORMAT -2 /* file format is not supported */
-#define BKE_READ_EXOTIC_FAIL_OPEN -1 /* Can't open the file */
-#define BKE_READ_EXOTIC_OK_BLEND 0 /* .blend file */
-#define BKE_READ_EXOTIC_OK_OTHER 1 /* other supported formats */
+#define BKE_READ_EXOTIC_FAIL_PATH -3 /* file format is not supported */
+#define BKE_READ_EXOTIC_FAIL_FORMAT -2 /* file format is not supported */
+#define BKE_READ_EXOTIC_FAIL_OPEN -1 /* Can't open the file */
+#define BKE_READ_EXOTIC_OK_BLEND 0 /* .blend file */
+#define BKE_READ_EXOTIC_OK_OTHER 1 /* other supported formats */
/* intended to check for non-blender formats but for now it only reads blends */
@@ -317,32 +317,32 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
// make sure we're not trying to read a directory....
- len= strlen(name);
- if (ELEM(name[len-1], '/', '\\')) {
- retval= BKE_READ_EXOTIC_FAIL_PATH;
+ len = strlen(name);
+ if (ELEM(name[len - 1], '/', '\\')) {
+ retval = BKE_READ_EXOTIC_FAIL_PATH;
}
else {
- gzfile = BLI_gzopen(name,"rb");
+ gzfile = BLI_gzopen(name, "rb");
if (gzfile == NULL) {
- retval= BKE_READ_EXOTIC_FAIL_OPEN;
+ retval = BKE_READ_EXOTIC_FAIL_OPEN;
}
else {
- len= gzread(gzfile, header, sizeof(header));
+ len = gzread(gzfile, header, sizeof(header));
gzclose(gzfile);
if (len == sizeof(header) && strncmp(header, "BLENDER", 7) == 0) {
- retval= BKE_READ_EXOTIC_OK_BLEND;
+ retval = BKE_READ_EXOTIC_OK_BLEND;
}
else {
//XXX waitcursor(1);
-#if 0 /* historic stuff - no longer used */
+#if 0 /* historic stuff - no longer used */
if (is_foo_format(name)) {
read_foo(name);
- retval= BKE_READ_EXOTIC_OK_OTHER;
+ retval = BKE_READ_EXOTIC_OK_OTHER;
}
else
#endif
{
- retval= BKE_READ_EXOTIC_FAIL_FORMAT;
+ retval = BKE_READ_EXOTIC_FAIL_FORMAT;
}
//XXX waitcursor(0);
}
@@ -366,25 +366,25 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
/* first try to append data from exotic file formats... */
/* it throws error box when file doesn't exist and returns -1 */
/* note; it should set some error message somewhere... (ton) */
- retval= wm_read_exotic(CTX_data_scene(C), filepath);
+ retval = wm_read_exotic(CTX_data_scene(C), filepath);
/* we didn't succeed, now try to read Blender file */
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
- int G_f= G.f;
+ int G_f = G.f;
ListBase wmbase;
/* put aside screens to match with persistent windows later */
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
- retval= BKE_read_file(C, filepath, reports);
+ retval = BKE_read_file(C, filepath, reports);
G.save_over = 1;
/* this flag is initialized by the operator but overwritten on read.
* need to re-enable it here else drivers + registered scripts wont work. */
if (G.f != G_f) {
- const int flags_keep= (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
- G.f= (G.f & ~flags_keep) | (G_f & flags_keep);
+ const int flags_keep = (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
+ G.f = (G.f & ~flags_keep) | (G_f & flags_keep);
}
/* match the read WM with current WM */
@@ -405,7 +405,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
}
- WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
+ WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
// refresh_interface_font();
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
@@ -437,14 +437,14 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
/* TODO, make this show in header info window */
{
Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+ for (sce = G.main->scene.first; sce; sce = sce->id.next) {
if (sce->r.engine[0] &&
BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL)
{
BKE_reportf(reports, RPT_WARNING,
"Engine not available: '%s' for scene: %s, "
"an addon may need to be installed or enabled",
- sce->r.engine, sce->id.name+2);
+ sce->r.engine, sce->id.name + 2);
}
}
}
@@ -452,13 +452,13 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
// XXX undo_editmode_clear();
BKE_reset_undo();
- BKE_write_undo(C, "original"); /* save current state */
+ BKE_write_undo(C, "original"); /* save current state */
}
else if (retval == BKE_READ_EXOTIC_OK_OTHER)
BKE_write_undo(C, "Import file");
else if (retval == BKE_READ_EXOTIC_FAIL_OPEN) {
BKE_reportf(reports, RPT_ERROR, IFACE_("Can't read file: \"%s\", %s."), filepath,
- errno ? strerror(errno) : IFACE_("Unable to open the file"));
+ errno ? strerror(errno) : IFACE_("Unable to open the file"));
}
else if (retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
BKE_reportf(reports, RPT_ERROR, IFACE_("File format is not supported in file: \"%s\"."), filepath);
@@ -483,7 +483,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
{
ListBase wmbase;
char tstr[FILE_MAX];
- int success= 0;
+ int success = 0;
free_ttfont(); /* still weird... what does it here? */
@@ -508,12 +508,12 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
if (!from_memory && BLI_exists(tstr)) {
success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL);
- if (U.themes.first==NULL) {
- printf("\nError: No valid "STRINGIFY(BLENDER_STARTUP_FILE)", fall back to built-in default.\n\n");
+ if (U.themes.first == NULL) {
+ printf("\nError: No valid "STRINGIFY (BLENDER_STARTUP_FILE)", fall back to built-in default.\n\n");
success = 0;
}
}
- if (success==0) {
+ if (success == 0) {
success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
if (wmbase.first == NULL) wm_clear_default_size(C);
@@ -535,21 +535,21 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
wm_window_match_do(C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
- G.main->name[0]= '\0';
+ G.main->name[0] = '\0';
/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
if (!G.background) GPU_default_lights();
/* XXX */
- G.save_over = 0; // start with save preference untitled.blend
- G.fileflags &= ~G_FILE_AUTOPLAY; /* disable autoplay in startup.blend... */
+ G.save_over = 0; // start with save preference untitled.blend
+ G.fileflags &= ~G_FILE_AUTOPLAY; /* disable autoplay in startup.blend... */
// mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender"
// refresh_interface_font();
// undo_editmode_clear();
BKE_reset_undo();
- BKE_write_undo(C, "original"); /* save current state */
+ BKE_write_undo(C, "original"); /* save current state */
ED_editors_init(C);
DAG_on_visible_update(CTX_data_main(C), TRUE);
@@ -565,7 +565,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
}
#endif
- WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
+ WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
/* in background mode the scene will stay NULL */
if (!G.background) {
@@ -577,7 +577,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
int WM_read_homefile_exec(bContext *C, wmOperator *op)
{
- int from_memory= strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0;
+ int from_memory = strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0;
return WM_read_homefile(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -594,15 +594,15 @@ void WM_read_history(void)
BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);
- lines= BLI_file_read_as_lines(name);
+ lines = BLI_file_read_as_lines(name);
G.recent_files.first = G.recent_files.last = NULL;
/* read list of recent opened files from recent-files.txt to memory */
- for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) {
+ for (l = lines, num = 0; l && (num < U.recent_files); l = l->next) {
line = l->link;
if (line[0] && BLI_exists(line)) {
- recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
+ recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
BLI_addtail(&(G.recent_files), recent);
recent->filepath = BLI_strdup(line);
num++;
@@ -630,21 +630,21 @@ static void write_history(void)
recent = G.recent_files.first;
/* refresh recent-files.txt of recent opened files, when current file was changed */
- if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name)!=0)) {
- fp= BLI_fopen(name, "w");
+ if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name) != 0)) {
+ fp = BLI_fopen(name, "w");
if (fp) {
/* add current file to the beginning of list */
- recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
+ recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
recent->filepath = BLI_strdup(G.main->name);
BLI_addhead(&(G.recent_files), recent);
/* write current file to recent-files.txt */
fprintf(fp, "%s\n", recent->filepath);
recent = recent->next;
- i=1;
+ i = 1;
/* write rest of recent opened files to recent-files.txt */
- while ((i<U.recent_files) && (recent)) {
+ while ((i < U.recent_files) && (recent)) {
/* this prevents to have duplicities in list */
- if (BLI_path_cmp(recent->filepath, G.main->name)!=0) {
+ if (BLI_path_cmp(recent->filepath, G.main->name) != 0) {
fprintf(fp, "%s\n", recent->filepath);
recent = recent->next;
}
@@ -669,21 +669,21 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
/* will be scaled down, but gives some nice oversampling */
ImBuf *ibuf;
int *thumb;
- char err_out[256]= "unknown";
+ char err_out[256] = "unknown";
- *thumb_pt= NULL;
+ *thumb_pt = NULL;
/* scene can be NULL if running a script at startup and calling the save operator */
- if (G.background || scene==NULL || scene->camera==NULL)
+ if (G.background || scene == NULL || scene->camera == NULL)
return NULL;
/* gets scaled to BLEN_THUMB_SIZE */
- ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera,
- BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
- IB_rect, OB_SOLID, FALSE, err_out);
+ ibuf = ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera,
+ BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
+ IB_rect, OB_SOLID, FALSE, err_out);
if (ibuf) {
- float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
+ float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
/* dirty oversampling */
IMB_scaleImBuf(ibuf, BLEN_THUMB_SIZE, BLEN_THUMB_SIZE);
@@ -692,7 +692,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
IMB_overlayblend_thumb(ibuf->rect, ibuf->x, ibuf->y, aspect);
/* first write into thumb buffer */
- thumb= MEM_mallocN(((2 + (BLEN_THUMB_SIZE * BLEN_THUMB_SIZE))) * sizeof(int), "write_file thumb");
+ thumb = MEM_mallocN(((2 + (BLEN_THUMB_SIZE * BLEN_THUMB_SIZE))) * sizeof(int), "write_file thumb");
thumb[0] = BLEN_THUMB_SIZE;
thumb[1] = BLEN_THUMB_SIZE;
@@ -702,11 +702,11 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
else {
/* '*thumb_pt' needs to stay NULL to prevent a bad thumbnail from being handled */
fprintf(stderr, "blend_file_thumb failed to create thumbnail: %s\n", err_out);
- thumb= NULL;
+ thumb = NULL;
}
/* must be freed by caller */
- *thumb_pt= thumb;
+ *thumb_pt = thumb;
return ibuf;
}
@@ -735,8 +735,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
int len;
char filepath[FILE_MAX];
- int *thumb= NULL;
- ImBuf *ibuf_thumb= NULL;
+ int *thumb = NULL;
+ ImBuf *ibuf_thumb = NULL;
len = strlen(target);
@@ -755,7 +755,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* don't use 'target' anymore */
/* send the OnSave event */
- for (li= G.main->library.first; li; li= li->id.next) {
+ for (li = G.main->library.first; li; li = li->id.next) {
if (BLI_path_cmp(li->filepath, filepath) == 0) {
BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.240s'", filepath);
return -1;
@@ -765,7 +765,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* blend file thumbnail */
/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
if (U.flag & USER_SAVE_PREVIEWS) {
- ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
+ ibuf_thumb = blend_file_thumb(CTX_data_scene(C), &thumb);
}
BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE);
@@ -787,7 +787,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
if (!copy) {
G.relbase_valid = 1;
- BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
+ BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
G.save_over = 1; /* disable untitled.blend convention */
}
@@ -807,7 +807,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* run this function after because the file cant be written before the blend is */
if (ibuf_thumb) {
- ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);
+ ibuf_thumb = IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);
IMB_freeImBuf(ibuf_thumb);
}
@@ -829,8 +829,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* operator entry */
int WM_write_homefile(bContext *C, wmOperator *op)
{
- wmWindowManager *wm= CTX_wm_manager(C);
- wmWindow *win= CTX_wm_window(C);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
char filepath[FILE_MAX];
int fileflags;
@@ -854,7 +854,7 @@ int WM_write_homefile(bContext *C, wmOperator *op)
printf("ok\n");
- G.save_over= 0;
+ G.save_over = 0;
return OPERATOR_FINISHED;
}
@@ -894,7 +894,7 @@ void WM_autosave_init(wmWindowManager *wm)
wm_autosave_timer_ended(wm);
if (U.flag & USER_AUTOSAVE)
- wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0);
+ wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
}
void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt))
@@ -907,10 +907,10 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
/* if a modal operator is running, don't autosave, but try again in 10 seconds */
- for (win=wm->windows.first; win; win=win->next) {
- for (handler=win->modalhandlers.first; handler; handler=handler->next) {
+ for (win = wm->windows.first; win; win = win->next) {
+ for (handler = win->modalhandlers.first; handler; handler = handler->next) {
if (handler->op) {
- wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
+ wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
return;
}
}
@@ -919,20 +919,20 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
wm_autosave_location(filepath);
/* force save as regular blend file */
- fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_AUTOPLAY |G_FILE_LOCK|G_FILE_SIGN|G_FILE_HISTORY);
+ fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);
/* no error reporting to console */
BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
/* do timer after file write, just in case file write takes a long time */
- wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0);
+ wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
}
void wm_autosave_timer_ended(wmWindowManager *wm)
{
if (wm->autosavetimer) {
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
- wm->autosavetimer= NULL;
+ wm->autosavetimer = NULL;
}
}