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:
authorTon Roosendaal <ton@blender.org>2012-12-12 22:58:11 +0400
committerTon Roosendaal <ton@blender.org>2012-12-12 22:58:11 +0400
commit12b642062c6fcef70151bd2424c2ebbc6a1a6843 (patch)
treecefb983f370b982f5e8b606c21ac884eb32a35a2 /source/blender/windowmanager/intern/wm_files.c
parent26ae649b01c1147ec2fbb147bb652a8bc49a0019 (diff)
Holiday coding log :)
Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c99
1 files changed, 74 insertions, 25 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index de59ec8d339..2e2595259ce 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -283,7 +283,9 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* in case UserDef was read, we re-initialize all, and do versioning */
static void wm_init_userdef(bContext *C)
{
+ /* versioning is here */
UI_init_userdef();
+
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
sound_init(CTX_data_main(C));
@@ -300,6 +302,10 @@ static void wm_init_userdef(bContext *C)
/* update tempdir from user preferences */
BLI_init_temporary_dir(U.tempdir);
+
+ /* displays with larger native pixels, like Macbook. Used to scale dpi with */
+ U.pixelsize = GHOST_GetNativePixelSize();
+ BKE_userdef_state();
}
@@ -388,6 +394,8 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
+ /* confusing this global... */
+ G.relbase_valid = 1;
retval = BKE_read_file(C, filepath, reports);
G.save_over = 1;
@@ -408,7 +416,6 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
}
if (retval != BKE_READ_FILE_FAIL) {
- G.relbase_valid = 1;
if (do_history) {
write_history();
}
@@ -485,11 +492,12 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'New File' */
-/* op can be NULL */
-int WM_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory)
+/* both startup.blend and userpref.blend are checked */
+int wm_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory)
{
ListBase wmbase;
- char tstr[FILE_MAX];
+ char startstr[FILE_MAX];
+ char prefstr[FILE_MAX];
int success = 0;
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
@@ -498,10 +506,12 @@ int WM_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory
if (!from_memory) {
char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
if (cfgdir) {
- BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, startstr, cfgdir, BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, prefstr, cfgdir, BLENDER_USERPREF_FILE);
}
else {
- tstr[0] = '\0';
+ startstr[0] = '\0';
+ prefstr[0] = '\0';
from_memory = 1;
}
}
@@ -512,14 +522,20 @@ int WM_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory
/* put aside screens to match with persistent windows later */
wm_window_match_init(C, &wmbase);
- if (!from_memory && BLI_exists(tstr)) {
- success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL);
+ if (!from_memory && BLI_exists(startstr)) {
+ success = (BKE_read_file(C, startstr, 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");
- success = 0;
- }
}
+ if (!from_memory && BLI_exists(prefstr)) {
+ success = BKE_read_file_userdef(prefstr, NULL);
+ if (success) printf("read new prefs: %s\n", prefstr);
+ }
+
+ 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) {
success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
if (wmbase.first == NULL) wm_clear_default_size(C);
@@ -584,13 +600,13 @@ int WM_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory
return TRUE;
}
-int WM_homefile_read_exec(bContext *C, wmOperator *op)
+int wm_homefile_read_exec(bContext *C, wmOperator *op)
{
int from_memory = strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0;
- return WM_homefile_read(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ return wm_homefile_read(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
-void WM_read_history(void)
+void wm_read_history(void)
{
char name[FILE_MAX];
LinkNode *l, *lines;
@@ -630,6 +646,10 @@ static void write_history(void)
FILE *fp;
int i;
+ /* no write history for recovered startup files */
+ if (G.main->name[0] == 0)
+ return;
+
/* will be NULL in background mode */
user_config_dir = BLI_get_folder_create(BLENDER_USER_CONFIG, NULL);
if (!user_config_dir)
@@ -762,12 +782,11 @@ int write_crash_blend(void)
}
}
-int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports)
+int wm_file_write(bContext *C, const char *target, int fileflags, ReportList *reports)
{
Library *li;
int len;
char filepath[FILE_MAX];
-
int *thumb = NULL;
ImBuf *ibuf_thumb = NULL;
@@ -861,7 +880,7 @@ int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *re
}
/* operator entry */
-int WM_homefile_write_exec(bContext *C, wmOperator *op)
+int wm_homefile_write_exec(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
@@ -881,7 +900,7 @@ int WM_homefile_write_exec(bContext *C, wmOperator *op)
/* force save as regular blend file */
fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);
- if (BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) {
+ if (BLO_write_file(CTX_data_main(C), filepath, fileflags | G_FILE_USERPREFS, op->reports, NULL) == 0) {
printf("fail\n");
return OPERATOR_CANCELLED;
}
@@ -893,6 +912,28 @@ int WM_homefile_write_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+/* Only save the prefs block. operator entry */
+int wm_userpref_write_exec(bContext *C, wmOperator *op)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ char filepath[FILE_MAX];
+
+ /* update keymaps in user preferences */
+ WM_keyconfig_update(wm);
+
+ BLI_make_file_string("/", filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_USERPREF_FILE);
+ printf("trying to save userpref at %s ", filepath);
+
+ if (BKE_write_file_userdef(filepath, op->reports) == 0) {
+ printf("fail\n");
+ return OPERATOR_CANCELLED;
+ }
+
+ printf("ok\n");
+
+ return OPERATOR_FINISHED;
+}
+
/************************ autosave ****************************/
void wm_autosave_location(char *filepath)
@@ -936,7 +977,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
wmWindow *win;
wmEventHandler *handler;
char filepath[FILE_MAX];
- int fileflags;
+
Scene *scene = CTX_data_scene(C);
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
@@ -960,12 +1001,17 @@ 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);
-
- /* no error reporting to console */
- BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
+ if (U.uiflag & USER_GLOBALUNDO) {
+ /* fast save of last undobuffer, now with UI */
+ BKE_undo_save_file(C, filepath);
+ }
+ else {
+ /* save as regular blend file */
+ int 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);
}
@@ -1002,3 +1048,6 @@ void wm_autosave_read(bContext *C, ReportList *reports)
WM_file_read(C, filename, reports);
}
+
+
+