[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19032] branches/blender2.5/blender/source /blender: 2.5
Ton Roosendaal
ton at blender.org
Wed Feb 18 14:29:58 CET 2009
Revision: 19032
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19032
Author: ton
Date: 2009-02-18 14:29:54 +0100 (Wed, 18 Feb 2009)
Log Message:
-----------
2.5
Several things in one commit; could not split this up easily,
one job invoked another, and so on. :)
- Added pulldowns for save/load .blend file in top bar.
- To enable "Save" without further popups (save over)
I've added a signaling function in window header to
indicate a succesful save.
- On any undo push it now signals 'file changed'. This
goes by notifiers nicely, but now registers only the
undopushes, which is quite unreliable. "Changed" state
shows in header as "Blender*" and for OSX with the
standard close button black dot.
- Made screencast show a button in top bar indicating such,
and allowing quit. No hotkey for quit yet... but ESC will
keep casting now.
- Fixed new BLF_init(), which should be in WM_init() and not
on any .B.blend read.
- Fixed CTRL+F3 "Save Screenshot", which was still using old
fileselect code.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/blenfont/intern/blf.c
branches/blender2.5/blender/source/blender/editors/screen/area.c
branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
branches/blender2.5/blender/source/blender/editors/screen/screendump.c
branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
branches/blender2.5/blender/source/blender/editors/space_info/space_info.c
branches/blender2.5/blender/source/blender/editors/util/undo.c
branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h
branches/blender2.5/blender/source/blender/windowmanager/WM_api.h
branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
branches/blender2.5/blender/source/blender/windowmanager/intern/wm.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_init_exit.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_jobs.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_operators.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c
branches/blender2.5/blender/source/blender/windowmanager/wm_window.h
Modified: branches/blender2.5/blender/source/blender/blenfont/intern/blf.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenfont/intern/blf.c 2009-02-18 13:21:44 UTC (rev 19031)
+++ branches/blender2.5/blender/source/blender/blenfont/intern/blf.c 2009-02-18 13:29:54 UTC (rev 19032)
@@ -99,7 +99,8 @@
for (i= 0; i < global_font_num; i++) {
font= global_font[i];
- blf_font_free(font);
+ if(font)
+ blf_font_free(font);
}
blf_font_exit();
Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c 2009-02-18 13:21:44 UTC (rev 19031)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c 2009-02-18 13:29:54 UTC (rev 19032)
@@ -119,7 +119,7 @@
case NC_SCREEN:
if(note->action==NA_EDITED)
ED_region_tag_redraw(ar);
- break;
+ /* pass on */
default:
if(ar->type && ar->type->listener)
ar->type->listener(ar, note);
Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c 2009-02-18 13:21:44 UTC (rev 19031)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c 2009-02-18 13:29:54 UTC (rev 19032)
@@ -1374,7 +1374,6 @@
/* is there only 1 area? */
if(oldscreen->areabase.first==oldscreen->areabase.last) return;
- if(sa->spacetype==SPACE_INFO) return;
oldscreen->full = SCREENFULL;
Modified: branches/blender2.5/blender/source/blender/editors/screen/screendump.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screendump.c 2009-02-18 13:21:44 UTC (rev 19031)
+++ branches/blender2.5/blender/source/blender/editors/screen/screendump.c 2009-02-18 13:29:54 UTC (rev 19032)
@@ -142,7 +142,6 @@
dumprect= screenshot(C, &dumpsx, &dumpsy, RNA_boolean_get(op->ptr, "full"));
if(dumprect) {
- SpaceFile *sfile;
ScreenshotData *scd= MEM_callocN(sizeof(ScreenshotData), "screenshot");
scd->dumpsx= dumpsx;
@@ -153,13 +152,9 @@
if(RNA_property_is_set(op->ptr, "filename"))
return screenshot_exec(C, op);
- ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_FILE);
+ RNA_string_set(op->ptr, "filename", G.ima);
- /* settings for filebrowser */
- sfile= (SpaceFile*)CTX_wm_space_data(C);
- sfile->op = op;
-
- ED_fileselect_set_params(sfile, FILE_BLENDER, "Save Screenshot As", G.ima, 0, 0, 0);
+ WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
@@ -169,7 +164,7 @@
void SCREEN_OT_screenshot(wmOperatorType *ot)
{
- ot->name= "Make Screenshot";
+ ot->name= "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
ot->idname= "SCREEN_OT_screenshot";
ot->invoke= screenshot_invoke;
@@ -242,7 +237,7 @@
*do_update= 1; // wait for opengl rect
- while(*stop==0 && G.afbreek==0) {
+ while(*stop==0) {
if(sj->dumprect) {
@@ -311,13 +306,13 @@
/* setup job */
WM_jobs_customdata(steve, sj, screenshot_freejob);
- WM_jobs_timer(steve, 0.1, 0, 0);
+ WM_jobs_timer(steve, 0.1, 0, NC_SCREEN|ND_SCREENCAST);
WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob);
- G.afbreek= 0; // XXX?
-
WM_jobs_start(steve);
+ WM_event_add_notifier(C, NC_SCREEN|ND_SCREENCAST, screen);
+
return OPERATOR_FINISHED;
}
Modified: branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_info/info_header.c 2009-02-18 13:21:44 UTC (rev 19031)
+++ branches/blender2.5/blender/source/blender/editors/space_info/info_header.c 2009-02-18 13:29:54 UTC (rev 19032)
@@ -29,17 +29,23 @@
#include <string.h>
#include <stdio.h>
+#include "DNA_packedFile_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_image.h"
+#include "BKE_main.h"
+#include "BKE_packedFile.h"
#include "BKE_screen.h"
#include "ED_screen.h"
@@ -56,12 +62,18 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "IMB_imbuf_types.h"
+
#include "info_intern.h"
+static int pupmenu() {return 0;}
+static int okee() {return 0;}
+static int error() {return 0;}
/* ************************ header area region *********************** */
#define B_STOPRENDER 1
+#define B_STOPCAST 2
static void do_viewmenu(bContext *C, void *arg, int event)
{
@@ -93,13 +105,229 @@
return block;
}
+static int buttons_do_unpack()
+{
+ int how;
+ char menu[2048];
+ char *line = menu;
+ int ret_value = 1, count = 0;
+
+ count = countPackedFiles();
+
+ if(!count) {
+ pupmenu("No packed files. Autopack disabled");
+ return ret_value;
+ }
+ if (count == 1)
+ line += sprintf(line, "Unpack 1 file%%t");
+ else
+ line += sprintf(line, "Unpack %d files%%t", count);
+
+ line += sprintf(line, "|Use files in current directory (create when necessary)%%x%d", PF_USE_LOCAL);
+ line += sprintf(line, "|Write files to current directory (overwrite existing files)%%x%d", PF_WRITE_LOCAL);
+ line += sprintf(line, "|%%l|Use files in original location (create when necessary)%%x%d", PF_USE_ORIGINAL);
+ line += sprintf(line, "|Write files to original location (overwrite existing files)%%x%d", PF_WRITE_ORIGINAL);
+ line += sprintf(line, "|%%l|Disable AutoPack, keep all packed files %%x%d", PF_KEEP);
+ line += sprintf(line, "|Ask for each file %%x%d", PF_ASK);
+
+ how = pupmenu(menu);
+
+ if(how == -1)
+ ret_value = 0;
+ else {
+ if (how != PF_KEEP) unpackAll(how);
+ G.fileflags &= ~G_AUTOPACK;
+ }
+
+ return ret_value;
+}
+static void check_packAll()
+{
+ // first check for dirty images
+ Image *ima;
+
+ for(ima = G.main->image.first; ima; ima= ima->id.next) {
+ if (ima->ibufs.first) { /* XXX FIX */
+ ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+
+ if (ibuf && (ibuf->userflags &= IB_BITMAPDIRTY))
+ break;
+ }
+ }
+
+ if (ima == NULL || okee("Some images are painted on. These changes will be lost. Continue ?")) {
+ packAll();
+ G.fileflags |= G_AUTOPACK;
+ }
+}
+
+static void do_info_externalfiles(bContext *C, void *arg, int event)
+{
+ switch (event) {
+
+ case 1: /* pack data */
+ check_packAll();
+ break;
+ case 3: /* unpack data */
+ if (buttons_do_unpack() != 0) {
+ /* Clear autopack bit only if user selected one of the unpack options */
+ G.fileflags &= ~G_AUTOPACK;
+ }
+ break;
+ case 10: /* make all paths relative */
+ if (G.relbase_valid) {
+ int tot,changed,failed,linked;
+ char str[512];
+ char txtname[24]; /* text block name */
+ txtname[0] = '\0';
+ makeFilesRelative(txtname, &tot, &changed, &failed, &linked);
+ if (failed) sprintf(str, "Make Relative%%t|Total files %i|Changed %i|Failed %i, See Text \"%s\"|Linked %i", tot, changed, failed, txtname, linked);
+ else sprintf(str, "Make Relative%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
+ pupmenu(str);
+ } else {
+ pupmenu("Can't set relative paths with an unsaved blend file");
+ }
+ break;
+ case 11: /* make all paths absolute */
+ {
+ int tot,changed,failed,linked;
+ char str[512];
+ char txtname[24]; /* text block name */
+ txtname[0] = '\0';
+ makeFilesAbsolute(txtname, &tot, &changed, &failed, &linked);
+ sprintf(str, "Make Absolute%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
+ if (failed) sprintf(str, "Make Absolute%%t|Total files %i|Changed %i|Failed %i, See Text \"%s\"|Linked %i", tot, changed, failed, txtname, linked);
+ else sprintf(str, "Make Absolute%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
+
+ pupmenu(str);
+ }
+ break;
+ case 12: /* check images exist */
+ {
+ char txtname[24]; /* text block name */
+ txtname[0] = '\0';
+
+ /* run the missing file check */
+ checkMissingFiles( txtname );
+
+ if (txtname[0] == '\0') {
+ okee("No external files missing");
+ } else {
+ char str[128];
+ sprintf(str, "Missing files listed in Text \"%s\"", txtname );
+ error(str);
+ }
+ }
+ break;
+ case 13: /* search for referenced files that are not available */
+// XXX if(curarea->spacetype==SPACE_INFO) {
+// ScrArea *sa;
+// sa= closest_bigger_area();
+// areawinset(sa->win);
+// }
+// activate_fileselect(FILE_SPECIAL, "Find Missing Files", "", findMissingFiles);
+ break;
+ }
+
+}
+
+
+uiBlock *info_externalfiles(bContext *C, ARegion *ar, void *arg_unused)
+{
+ uiBlock *block;
+ short yco = 20, menuwidth = 120;
+
+ block= uiBeginBlock(C, ar, "info_externalfiles", UI_EMBOSSP, UI_HELV);
+ uiBlockSetButmFunc(block, do_info_externalfiles, NULL);
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack into .blend file", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unpack into Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "");
+
+ uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Relative", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 10, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Absolute", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files...", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 60);
+ return block;
+}
+
+
+
+static void info_filemenu(bContext *C, uiMenuItem *head, void *arg_unused)
+{
+
+ uiMenuContext(head, WM_OP_EXEC_AREA);
+ uiMenuItemO(head, 0, "WM_OT_read_homefile");
+ uiMenuContext(head, WM_OP_INVOKE_AREA);
+ uiMenuItemO(head, 0, "WM_OT_open_mainfile");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list