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>2003-10-17 18:02:08 +0400
committerTon Roosendaal <ton@blender.org>2003-10-17 18:02:08 +0400
commit0321602b6524ee2f7139610824893695d2f59b68 (patch)
treed38b4cde5cfdb7ace2671f730c4c4ee515bb980c /source/blender/blenloader
parent00cf36d6a5ce06f07960616bc06d06ceeea0f886 (diff)
- The basic layer for Themes in place!
- currently only implemented for 3d window - create as many themes you like, and name them - default theme is not editable, and always will be defined at startup (initTheme) - saves in .B.blend - themes for spaces can become local too, so you can set individual 3d windows at theme 'Maya' or so. (to be implemented) - it uses alpha as well...! API: This doesnt use the old method with BFCOLORID blahblah. The API is copied from OpenGL conventions (naming) as much as possible: - void BIF_ThemeColor(ScrArea *sa, int colorid) sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc) - void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset) sets a color with offset, no more weird COLORSHADE_LGREY stuff - void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col) like opengl, this gives you in *col the three rgb values - void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col) or the one to get 4 bytes ThemeColor calls for globals (UI etc) can also call NULL for *sa... this is to be implemented still. Next step: cleaning up interface.c for all weird colorcalls.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c27
-rw-r--r--source/blender/blenloader/intern/writefile.c8
2 files changed, 31 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 8a31016c6d8..358c99df3de 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3862,6 +3862,25 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_library(fd, main); /* only init users */
}
+static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
+{
+ Link *link;
+
+ bfd->user= read_struct(fd, bhead);
+ bfd->user->themes.first= bfd->user->themes.last= NULL;
+
+ bhead = blo_nextbhead(fd, bhead);
+
+ /* read all attached data */
+ while(bhead && bhead->code==DATA) {
+ link= read_struct(fd, bhead);
+ BLI_addtail(&bfd->user->themes, link);
+ bhead = blo_nextbhead(fd, bhead);
+ }
+
+ return bhead;
+}
+
BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
{
BHead *bhead= blo_firstbhead(fd);
@@ -3881,14 +3900,14 @@ BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
case DNA1:
case TEST:
case REND:
- case USER:
- if (bhead->code==USER) {
- bfd->user= read_struct(fd, bhead);
- } else if (bhead->code==GLOB) {
+ if (bhead->code==GLOB) {
fg= read_struct(fd, bhead);
}
bhead = blo_nextbhead(fd, bhead);
break;
+ case USER:
+ bhead= read_userdef(bfd, fd, bhead);
+ break;
case ENDB:
bhead = NULL;
break;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 03316bf00e3..546ff3b60e6 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -472,7 +472,15 @@ static void write_renderinfo(WriteData *wd) /* for renderdaemon */
static void write_userdef(WriteData *wd)
{
+ bTheme *btheme;
+
writestruct(wd, USER, "UserDef", 1, &U);
+
+ btheme= U.themes.first;
+ while(btheme) {
+ writestruct(wd, DATA, "bTheme", 1, btheme);
+ btheme= btheme->next;
+ }
}
static void write_effects(WriteData *wd, ListBase *lb)