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:
authorJean-Luc Peurière <jlp@nerim.net>2008-03-14 02:54:02 +0300
committerJean-Luc Peurière <jlp@nerim.net>2008-03-14 02:54:02 +0300
commita68a7f42b02ad0260220d94f36ab61c772db071a (patch)
tree620b763cd24fbfc1259f00ccb005217914af0c6f /source/blender/src/usiblender.c
parent526d0bec4722900a86d81ff0f5d71504b2b4ad8c (diff)
parent15215493bf9d1d08e650109e6eb6189fc76e289e (diff)
resolved conflict state with HEAD r14096
blenderbuttons still bad not let this compile
Diffstat (limited to 'source/blender/src/usiblender.c')
-rw-r--r--source/blender/src/usiblender.c197
1 files changed, 171 insertions, 26 deletions
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c
index 020eb502765..7ed1c430431 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/src/usiblender.c
@@ -74,6 +74,7 @@
#include "BKE_blender.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
+#include "BKE_DerivedMesh.h"
#include "BKE_exotic.h"
#include "BKE_font.h"
#include "BKE_global.h"
@@ -81,7 +82,9 @@
#include "BKE_mball.h"
#include "BKE_node.h"
#include "BKE_packedFile.h"
+#include "BKE_texture.h"
#include "BKE_utildefines.h"
+#include "BKE_pointcache.h"
#ifdef WITH_VERSE
#include "BKE_verse.h"
@@ -94,12 +97,14 @@
#include "BIF_interface.h"
#include "BIF_usiblender.h"
#include "BIF_drawtext.h"
+#include "BIF_editaction.h"
#include "BIF_editarmature.h"
#include "BIF_editlattice.h"
#include "BIF_editfont.h"
#include "BIF_editmesh.h"
#include "BIF_editmode_undo.h"
#include "BIF_editsound.h"
+#include "BIF_filelist.h"
#include "BIF_poseobject.h"
#include "BIF_previewrender.h"
#include "BIF_renderwin.h"
@@ -173,9 +178,7 @@ static void init_userdef_file(void)
}
if(U.mixbufsize==0) U.mixbufsize= 2048;
if (BLI_streq(U.tempdir, "/")) {
- char *tmp= getenv("TEMP");
-
- strcpy(U.tempdir, tmp?tmp:"/tmp/");
+ BLI_where_is_temp(U.tempdir, 0);
}
if (U.savetime <= 0) {
U.savetime = 1;
@@ -197,6 +200,19 @@ static void init_userdef_file(void)
U.ndof_rotate = 100;
}
+ if(U.flag & USER_CUSTOM_RANGE)
+ vDM_ColorBand_store(&U.coba_weight); /* signal for derivedmesh to use colorband */
+
+ /* Auto-keyframing settings */
+ if(U.autokey_mode == 0) {
+ /* AUTOKEY_MODE_NORMAL - AUTOKEY_ON = x <==> 3 - 1 = 2 */
+ U.autokey_mode |= 2;
+
+ if(U.flag & (1<<15)) U.autokey_flag |= AUTOKEY_FLAG_INSERTAVAIL;
+ if(U.flag & (1<<19)) U.autokey_flag |= AUTOKEY_FLAG_INSERTNEEDED;
+ if(G.flags & (1<<30)) U.autokey_flag |= AUTOKEY_FLAG_AUTOMATKEY;
+ }
+
if (G.main->versionfile <= 191) {
strcpy(U.plugtexdir, U.textudir);
strcpy(U.sounddir, "/");
@@ -365,6 +381,100 @@ static void init_userdef_file(void)
/* set default number of recently-used files (if not set) */
if (U.recent_files == 0) U.recent_files = 10;
}
+ if (G.main->versionfile < 245 || (G.main->versionfile == 245 && G.main->subversionfile < 3)) {
+ bTheme *btheme;
+ for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
+ }
+ if(U.coba_weight.tot==0)
+ init_colorband(&U.coba_weight, 1);
+ }
+ if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 11)) {
+ bTheme *btheme;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ /* these should all use the same colour */
+ SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
+ SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
+ SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
+ SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
+ SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
+ SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255);
+ SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
+ }
+ }
+ if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 13)) {
+ bTheme *btheme;
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ /* action channel groups (recolour anyway) */
+ SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
+ SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
+
+ /* bone custom-color sets */
+ // FIXME: this check for initialised colors is bad
+ if (btheme->tarm[0].solid[3] == 0) {
+ /* set 1 */
+ SETCOL(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
+ SETCOL(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
+ SETCOL(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
+ /* set 2 */
+ SETCOL(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
+ SETCOL(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
+ SETCOL(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
+ /* set 3 */
+ SETCOL(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
+ SETCOL(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
+ SETCOL(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
+ /* set 4 */
+ SETCOL(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
+ SETCOL(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
+ SETCOL(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
+ /* set 5 */
+ SETCOL(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
+ SETCOL(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
+ SETCOL(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
+ /* set 6 */
+ SETCOL(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
+ SETCOL(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
+ SETCOL(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
+ /* set 7 */
+ SETCOL(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
+ SETCOL(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
+ SETCOL(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
+ /* set 8 */
+ SETCOL(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
+ SETCOL(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
+ SETCOL(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
+ /* set 9 */
+ SETCOL(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
+ SETCOL(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
+ SETCOL(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
+ /* set 10 */
+ SETCOL(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
+ SETCOL(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
+ SETCOL(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
+ /* set 11 */
+ SETCOL(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
+ SETCOL(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
+ SETCOL(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
+ /* set 12 */
+ SETCOL(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
+ SETCOL(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
+ SETCOL(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
+ /* set 13 */
+ SETCOL(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
+ SETCOL(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
+ SETCOL(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
+ /* set 14 */
+ SETCOL(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
+ SETCOL(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
+ SETCOL(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
+ /* set 15 */
+ SETCOL(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
+ SETCOL(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
+ SETCOL(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
+ }
+ }
+ }
/* GL Texture Garbage Collection (variable abused above!) */
if (U.textimeout == 0) {
@@ -439,6 +549,8 @@ void BIF_read_file(char *name)
retval= BKE_read_exotic(name);
if (retval== 0) {
+ BIF_clear_tempfiles();
+
/* we didn't succeed, now try to read Blender file */
retval= BKE_read_file(name, NULL);
@@ -450,7 +562,7 @@ void BIF_read_file(char *name)
if(retval==2) init_userdef_file(); // in case a userdef is read from regular .blend
- G.relbase_valid = 1;
+ if (retval!=0) G.relbase_valid = 1;
undo_editmode_clear();
BKE_reset_undo();
@@ -489,6 +601,8 @@ int BIF_read_homefile(int from_memory)
int success;
struct TmpFont *tf;
+ BIF_clear_tempfiles();
+
BLI_clean(home);
tf= G.ttfdata.first;
@@ -534,13 +648,15 @@ int BIF_read_homefile(int from_memory)
static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE])
{
char pidstr[32];
+#ifdef WIN32
char subdir[9];
char savedir[FILE_MAXDIR];
+#endif
sprintf(pidstr, "%d.blend", abs(getpid()));
#ifdef WIN32
- if (!BLI_exists(U.tempdir)) {
+ if (!BLI_exists(btempdir)) {
BLI_strncpy(subdir, "autosave", sizeof(subdir));
BLI_make_file_string("/", savedir, BLI_gethome(), subdir);
@@ -553,7 +669,7 @@ static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE])
}
#endif
- BLI_make_file_string("/", buf, U.tempdir, pidstr);
+ BLI_make_file_string("/", buf, btempdir, pidstr);
}
void BIF_read_autosavefile(void)
@@ -633,20 +749,23 @@ static void readBlog(void)
tmps[2]='\\';
tmps[3]=0;
- fsmenu_insert_entry(tmps, 0);
+ fsmenu_insert_entry(tmps, 0, 0);
}
}
/* Adding Desktop and My Documents */
- fsmenu_append_seperator();
+ fsmenu_append_separator();
SHGetSpecialFolderPath(0, folder, CSIDL_PERSONAL, 0);
- fsmenu_insert_entry(folder, 0);
+ fsmenu_insert_entry(folder, 0, 0);
SHGetSpecialFolderPath(0, folder, CSIDL_DESKTOPDIRECTORY, 0);
- fsmenu_insert_entry(folder, 0);
+ fsmenu_insert_entry(folder, 0, 0);
- fsmenu_append_seperator();
+ fsmenu_append_separator();
}
+#else
+ /* add home dir on linux systems */
+ fsmenu_insert_entry(BLI_gethome(), 0, 0);
#endif
BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs");
@@ -656,16 +775,16 @@ static void readBlog(void)
char *line= l->link;
if (!BLI_streq(line, "")) {
- fsmenu_insert_entry(line, 0);
+ fsmenu_insert_entry(line, 0, 1);
}
}
- fsmenu_append_seperator();
+ fsmenu_append_separator();
/* add last saved file */
BLI_split_dirfile(G.sce, name, filename); /* G.sce shouldn't be relative */
- fsmenu_insert_entry(name, 0);
+ fsmenu_insert_entry(name, 0, 0);
BLI_free_file_lines(lines);
}
@@ -742,11 +861,17 @@ static void do_history(char *name)
void BIF_write_file(char *target)
{
Library *li;
- int writeflags;
- char di[FILE_MAXDIR];
+ int writeflags, len;
+ char di[FILE_MAX];
char *err;
- if (BLI_streq(target, "")) return;
+ len = strlen(target);
+
+ if (len == 0) return;
+ if (len >= FILE_MAX) {
+ error("Path too long, cannot save");
+ return;
+ }
/* send the OnSave event */
if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript(&G.scene->id, SCRIPT_ONSAVE);
@@ -758,7 +883,7 @@ void BIF_write_file(char *target)
}
}
- if (!BLO_has_bfile_extension(target)) {
+ if (!BLO_has_bfile_extension(target) && (len+6 < FILE_MAX)) {
sprintf(di, "%s.blend", target);
} else {
strcpy(di, target);
@@ -826,6 +951,16 @@ void BIF_write_autosave(void)
BLO_write_file(tstr, write_flags, &err);
}
+/* remove temp files assosiated with this blend file when quitting, loading or saving in a new path */
+void BIF_clear_tempfiles( void )
+{
+ /* TODO - remove exr files from the temp dir */
+
+ if (!G.relbase_valid) { /* We could have pointcache saved in tyhe temp dir, if its there */
+ BKE_ptcache_remove();
+ }
+}
+
/* if global undo; remove tempsave, otherwise rename */
static void delete_autosave(void)
{
@@ -835,7 +970,7 @@ static void delete_autosave(void)
if (BLI_exists(tstr)) {
char str[FILE_MAXDIR+FILE_MAXFILE];
- BLI_make_file_string("/", str, U.tempdir, "quit.blend");
+ BLI_make_file_string("/", str, btempdir, "quit.blend");
if(U.uiflag & USER_GLOBALUNDO) BLI_delete(tstr, 0, 0);
else BLI_rename(tstr, str);
@@ -891,6 +1026,8 @@ void BIF_init(void)
BIF_resources_init(); /* after homefile, to dynamically load an icon file based on theme settings */
+ BIF_filelist_init_icons();
+
init_gl_stuff(); /* drawview.c, after homefile */
readBlog();
BLI_strncpy(G.lib, G.sce, FILE_MAX);
@@ -904,6 +1041,9 @@ extern ListBase editelems;
void exit_usiblender(void)
{
struct TmpFont *tf;
+
+ BIF_clear_tempfiles();
+
tf= G.ttfdata.first;
while(tf)
{
@@ -944,6 +1084,7 @@ void exit_usiblender(void)
free_blender(); /* blender.c, does entire library */
free_matcopybuf();
free_ipocopybuf();
+ free_actcopybuf();
free_vertexpaint();
free_imagepaint();
@@ -970,9 +1111,18 @@ void exit_usiblender(void)
quicktime_exit();
#endif
+ /* undo free stuff */
+ undo_editmode_clear();
+
+ BKE_undo_save_quit(); // saves quit.blend if global undo is on
+ BKE_reset_undo();
+
if (!G.background) {
BIF_resources_free();
-
+
+ BIF_filelist_free_icons();
+
+ BIF_free_render_spare();
BIF_close_render_display();
mainwindow_close();
}
@@ -984,12 +1134,7 @@ void exit_usiblender(void)
if (copybuf) MEM_freeN(copybuf);
if (copybufinfo) MEM_freeN(copybufinfo);
- /* undo free stuff */
- undo_editmode_clear();
-
- BKE_undo_save_quit(); // saves quit.blend if global undo is on
- BKE_reset_undo();
-
+//
BLI_freelistN(&U.themes);
BIF_preview_free_dbase();