2 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL/BL DUAL LICENSE BLOCK *****
28 /** \file blender/editors/interface/resources.c
29 * \ingroup edinterface
36 #include "MEM_guardedalloc.h"
38 #include "DNA_curve_types.h"
39 #include "DNA_userdef_types.h"
40 #include "DNA_screen_types.h"
41 #include "DNA_space_types.h"
42 #include "DNA_windowmanager_types.h"
44 #include "BLI_blenlib.h"
45 #include "BLI_utildefines.h"
47 #include "BKE_DerivedMesh.h"
48 #include "BKE_global.h"
50 #include "BKE_texture.h"
55 #include "UI_interface.h"
56 #include "UI_interface_icons.h"
58 #include "interface_intern.h"
60 /* global for themes */
61 typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
63 static bTheme *theme_active=NULL;
64 static int theme_spacetype= SPACE_VIEW3D;
65 static int theme_regionid= RGN_TYPE_WINDOW;
67 void ui_resources_init(void)
69 UI_icons_init(BIFICONID_LAST);
72 void ui_resources_free(void)
78 /* ******************************************************** */
80 /* ******************************************************** */
82 const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
85 static char error[4]={240, 0, 240, 255};
86 static char alert[4]={240, 60, 60, 255};
87 static char headerdesel[4]={0,0,0,255};
89 const char *cp= error;
93 // first check for ui buttons theme
94 if(colorid < TH_THEMEUI) {
139 ts= &btheme->tuserpref;
142 ts= &btheme->tconsole;
163 if(theme_regionid==RGN_TYPE_WINDOW)
165 else if(theme_regionid==RGN_TYPE_CHANNELS)
167 else if(theme_regionid==RGN_TYPE_HEADER)
173 if(theme_regionid==RGN_TYPE_WINDOW)
175 else if(theme_regionid==RGN_TYPE_CHANNELS)
177 else if(theme_regionid==RGN_TYPE_HEADER)
183 if(theme_regionid==RGN_TYPE_WINDOW)
185 else if(theme_regionid==RGN_TYPE_CHANNELS)
186 cp= ts->list_text_hi;
187 else if(theme_regionid==RGN_TYPE_HEADER)
188 cp= ts->header_text_hi;
190 cp= ts->button_text_hi;
193 if(theme_regionid==RGN_TYPE_WINDOW)
195 else if(theme_regionid==RGN_TYPE_CHANNELS)
197 else if(theme_regionid==RGN_TYPE_HEADER)
198 cp= ts->header_title;
200 cp= ts->button_title;
204 cp= ts->header; break;
206 /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
208 headerdesel[0]= cp[0]>10?cp[0]-10:0;
209 headerdesel[1]= cp[1]>10?cp[1]-10:0;
210 headerdesel[2]= cp[2]>10?cp[2]-10:0;
214 cp= ts->header_text; break;
215 case TH_HEADER_TEXT_HI:
216 cp= ts->header_text_hi; break;
219 cp= ts->panel; break;
221 cp= ts->panel_text; break;
222 case TH_PANEL_TEXT_HI:
223 cp= ts->panel_text_hi; break;
226 cp= ts->button; break;
227 case TH_BUTBACK_TEXT:
228 cp= ts->button_text; break;
229 case TH_BUTBACK_TEXT_HI:
230 cp= ts->button_text_hi; break;
233 cp= ts->shade1; break;
235 cp= ts->shade2; break;
237 cp= ts->hilite; break;
246 cp= ts->speaker; break;
248 cp= ts->select; break;
250 cp= ts->active; break;
252 cp= ts->group; break;
253 case TH_GROUP_ACTIVE:
254 cp= ts->group_active; break;
256 cp= ts->transform; break;
258 cp= ts->vertex; break;
259 case TH_VERTEX_SELECT:
260 cp= ts->vertex_select; break;
262 cp= &ts->vertex_size; break;
263 case TH_OUTLINE_WIDTH:
264 cp= &ts->outline_width; break;
268 cp= ts->edge_select; break;
270 cp= ts->edge_seam; break;
272 cp= ts->edge_sharp; break;
274 cp= ts->edge_crease; break;
275 case TH_EDITMESH_ACTIVE:
276 cp= ts->editmesh_active; break;
277 case TH_EDGE_FACESEL:
278 cp= ts->edge_facesel; break;
282 cp= ts->face_select; break;
284 cp= ts->face_dot; break;
285 case TH_FACEDOT_SIZE:
286 cp= &ts->facedot_size; break;
287 case TH_DRAWEXTRA_EDGELEN:
288 cp= ts->extra_edge_len; break;
289 case TH_DRAWEXTRA_FACEAREA:
290 cp= ts->extra_face_area; break;
291 case TH_DRAWEXTRA_FACEANG:
292 cp= ts->extra_face_angle; break;
294 cp= ts->normal; break;
296 cp= ts->vertex_normal; break;
298 cp= ts->bone_solid; break;
300 cp= ts->bone_pose; break;
302 cp= ts->strip; break;
303 case TH_STRIP_SELECT:
304 cp= ts->strip_select; break;
306 cp= ts->cframe; break;
308 cp= ts->nurb_uline; break;
310 cp= ts->nurb_vline; break;
311 case TH_NURB_SEL_ULINE:
312 cp= ts->nurb_sel_uline; break;
313 case TH_NURB_SEL_VLINE:
314 cp= ts->nurb_sel_vline; break;
315 case TH_ACTIVE_SPLINE:
316 cp= ts->act_spline; break;
317 case TH_LASTSEL_POINT:
318 cp= ts->lastsel_point; break;
320 cp= ts->handle_free; break;
322 cp= ts->handle_auto; break;
323 case TH_HANDLE_AUTOCLAMP:
324 cp= ts->handle_auto_clamped; break;
326 cp= ts->handle_vect; break;
327 case TH_HANDLE_ALIGN:
328 cp= ts->handle_align; break;
329 case TH_HANDLE_SEL_FREE:
330 cp= ts->handle_sel_free; break;
331 case TH_HANDLE_SEL_AUTO:
332 cp= ts->handle_sel_auto; break;
333 case TH_HANDLE_SEL_AUTOCLAMP:
334 cp= ts->handle_sel_auto_clamped; break;
335 case TH_HANDLE_SEL_VECT:
336 cp= ts->handle_sel_vect; break;
337 case TH_HANDLE_SEL_ALIGN:
338 cp= ts->handle_sel_align; break;
341 cp= ts->syntaxb; break;
343 cp= ts->syntaxv; break;
345 cp= ts->syntaxc; break;
347 cp= ts->syntaxl; break;
349 cp= ts->syntaxn; break;
352 cp= ts->syntaxl; break;
354 cp= ts->syntaxn; break;
355 case TH_NODE_OPERATOR:
356 cp= ts->syntaxb; break;
357 case TH_NODE_CONVERTOR:
358 cp= ts->syntaxv; break;
360 cp= ts->syntaxc; break;
361 case TH_NODE_CURVING:
362 cp= &ts->noodle_curving; break;
365 cp= ts->movie; break;
367 cp= ts->image; break;
369 cp= ts->scene; break;
371 cp= ts->audio; break;
373 cp= ts->effect; break;
375 cp= ts->plugin; break;
376 case TH_SEQ_TRANSITION:
377 cp= ts->transition; break;
381 case TH_CONSOLE_OUTPUT:
382 cp= ts->console_output; break;
383 case TH_CONSOLE_INPUT:
384 cp= ts-> console_input; break;
385 case TH_CONSOLE_INFO:
386 cp= ts->console_info; break;
387 case TH_CONSOLE_ERROR:
388 cp= ts->console_error; break;
389 case TH_CONSOLE_CURSOR:
390 cp= ts->console_cursor; break;
392 case TH_HANDLE_VERTEX:
393 cp= ts->handle_vertex;
395 case TH_HANDLE_VERTEX_SELECT:
396 cp= ts->handle_vertex_select;
398 case TH_HANDLE_VERTEX_SIZE:
399 cp= &ts->handle_vertex_size;
402 case TH_DOPESHEET_CHANNELOB:
405 case TH_DOPESHEET_CHANNELSUBOB:
406 cp= ts->ds_subchannel;
409 case TH_PREVIEW_BACK:
410 cp= ts->preview_back;
413 case TH_STITCH_PREVIEW_FACE:
414 cp = ts->preview_stitch_face;
417 case TH_STITCH_PREVIEW_EDGE:
418 cp = ts->preview_stitch_edge;
421 case TH_STITCH_PREVIEW_VERT:
422 cp = ts->preview_stitch_vert;
425 case TH_STITCH_PREVIEW_STITCHABLE:
426 cp = ts->preview_stitch_stitchable;
429 case TH_STITCH_PREVIEW_UNSTITCHABLE:
430 cp = ts->preview_stitch_unstitchable;
432 case TH_STITCH_PREVIEW_ACTIVE:
433 cp = ts->preview_stitch_active;
435 case TH_MARKER_OUTLINE:
436 cp= ts->marker_outline; break;
438 cp= ts->marker; break;
440 cp= ts->act_marker; break;
442 cp= ts->sel_marker; break;
443 case TH_BUNDLE_SOLID:
444 cp= ts->bundle_solid; break;
446 cp= ts->dis_marker; break;
448 cp= ts->path_before; break;
450 cp= ts->path_after; break;
452 cp= ts->camera_path; break;
454 cp= ts->lock_marker; break;
460 case TH_SELECT_HIGHLIGHT:
461 cp= ts->selected_highlight;
467 return (unsigned char *)cp;
471 #define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
472 #define SETCOLF(col, r, g, b, a) col[0]=r*255; col[1]=g*255; col[2]= b*255; col[3]= a*255;
473 #define SETCOLTEST(col, r, g, b, a) if(col[3]==0) {col[0]=r; col[1]=g; col[2]= b; col[3]= a;}
475 /* use this call to init new bone color sets in Theme */
476 static void ui_theme_init_boneColorSets(bTheme *btheme)
480 /* define default color sets - currently we only define 15 of these, though that should be ample */
482 SETCOL(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
483 SETCOL(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
484 SETCOL(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
486 SETCOL(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
487 SETCOL(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
488 SETCOL(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
490 SETCOL(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
491 SETCOL(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
492 SETCOL(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
494 SETCOL(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
495 SETCOL(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
496 SETCOL(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
498 SETCOL(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
499 SETCOL(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
500 SETCOL(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
502 SETCOL(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
503 SETCOL(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
504 SETCOL(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
506 SETCOL(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
507 SETCOL(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
508 SETCOL(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
510 SETCOL(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
511 SETCOL(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
512 SETCOL(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
514 SETCOL(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
515 SETCOL(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
516 SETCOL(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
518 SETCOL(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
519 SETCOL(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
520 SETCOL(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
522 SETCOL(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
523 SETCOL(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
524 SETCOL(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
526 SETCOL(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
527 SETCOL(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
528 SETCOL(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
530 SETCOL(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
531 SETCOL(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
532 SETCOL(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
534 SETCOL(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
535 SETCOL(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
536 SETCOL(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
538 SETCOL(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
539 SETCOL(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
540 SETCOL(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
542 /* reset flags too */
543 for (i = 0; i < 20; i++)
544 btheme->tarm[i].flag = 0;
547 /* use this call to init new variables in themespace, if they're same for all */
548 static void ui_theme_init_new_do(ThemeSpace *ts)
550 SETCOLTEST(ts->header_text, 0, 0, 0, 255);
551 SETCOLTEST(ts->header_title, 0, 0, 0, 255);
552 SETCOLTEST(ts->header_text_hi, 255, 255, 255, 255);
554 SETCOLTEST(ts->panel_text, 0, 0, 0, 255);
555 SETCOLTEST(ts->panel_title, 0, 0, 0, 255);
556 SETCOLTEST(ts->panel_text_hi, 255, 255, 255, 255);
558 SETCOLTEST(ts->button, 145, 145, 145, 245);
559 SETCOLTEST(ts->button_title, 0, 0, 0, 255);
560 SETCOLTEST(ts->button_text, 0, 0, 0, 255);
561 SETCOLTEST(ts->button_text_hi, 255, 255, 255, 255);
563 SETCOLTEST(ts->list, 165, 165, 165, 255);
564 SETCOLTEST(ts->list_title, 0, 0, 0, 255);
565 SETCOLTEST(ts->list_text, 0, 0, 0, 255);
566 SETCOLTEST(ts->list_text_hi, 255, 255, 255, 255);
569 static void ui_theme_init_new(bTheme *btheme)
571 ui_theme_init_new_do(&btheme->tbuts);
572 ui_theme_init_new_do(&btheme->tv3d);
573 ui_theme_init_new_do(&btheme->tfile);
574 ui_theme_init_new_do(&btheme->tipo);
575 ui_theme_init_new_do(&btheme->tinfo);
576 ui_theme_init_new_do(&btheme->tact);
577 ui_theme_init_new_do(&btheme->tnla);
578 ui_theme_init_new_do(&btheme->tseq);
579 ui_theme_init_new_do(&btheme->tima);
580 ui_theme_init_new_do(&btheme->text);
581 ui_theme_init_new_do(&btheme->toops);
582 ui_theme_init_new_do(&btheme->ttime);
583 ui_theme_init_new_do(&btheme->tnode);
584 ui_theme_init_new_do(&btheme->tlogic);
585 ui_theme_init_new_do(&btheme->tuserpref);
586 ui_theme_init_new_do(&btheme->tconsole);
587 ui_theme_init_new_do(&btheme->tclip);
592 /* initialize default theme
593 * Note: when you add new colors, created & saved themes need initialized
594 * use function below, init_userdef_do_versions()
596 void ui_theme_init_default(void)
600 /* we search for the theme with name Default */
601 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
602 if(strcmp("Default", btheme->name)==0) break;
606 btheme= MEM_callocN(sizeof(bTheme), "theme");
607 BLI_addtail(&U.themes, btheme);
608 strcpy(btheme->name, "Default");
611 UI_SetTheme(0, 0); // make sure the global used in this file is set
614 ui_widget_color_init(&btheme->tui);
615 btheme->tui.iconfile[0]= 0;
616 btheme->tui.panel.show_header = FALSE;
617 SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
619 /* Bone Color Sets */
620 ui_theme_init_boneColorSets(btheme);
622 /* common (new) variables */
623 ui_theme_init_new(btheme);
626 SETCOLF(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
627 SETCOL(btheme->tv3d.text, 0, 0, 0, 255);
628 SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255);
630 SETCOLF(btheme->tv3d.header, 0.45, 0.45, 0.45, 1.0);
631 SETCOLF(btheme->tv3d.button, 0.45, 0.45, 0.45, 1.0);
632 SETCOL(btheme->tv3d.panel, 165, 165, 165, 127);
634 SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100);
635 SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
637 SETCOLF(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0);
638 SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
639 SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
640 SETCOL(btheme->tv3d.speaker, 0, 0, 0, 255);
641 SETCOL(btheme->tv3d.select, 241, 88, 0, 255);
642 SETCOL(btheme->tv3d.active, 255, 170, 64, 255);
643 SETCOL(btheme->tv3d.group, 8, 48, 8, 255);
644 SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255);
645 SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
646 SETCOL(btheme->tv3d.vertex, 0, 0, 0, 255);
647 SETCOL(btheme->tv3d.vertex_select, 255, 133, 0, 255);
648 btheme->tv3d.vertex_size= 3;
649 btheme->tv3d.outline_width= 1;
650 SETCOL(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255);
651 SETCOL(btheme->tv3d.edge_select, 255, 160, 0, 255);
652 SETCOL(btheme->tv3d.edge_seam, 219, 37, 18, 255);
653 SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
654 SETCOL(btheme->tv3d.face, 0, 0, 0, 18);
655 SETCOL(btheme->tv3d.face_select, 255, 133, 0, 60);
656 SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
657 SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
658 SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255);
659 SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
660 SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
661 SETCOL(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
662 SETCOL(btheme->tv3d.header_text, 0, 0, 0, 255);
663 SETCOL(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
664 SETCOL(btheme->tv3d.button_text, 0, 0, 0, 255);
665 SETCOL(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
666 SETCOL(btheme->tv3d.button_title, 0, 0, 0, 255);
667 SETCOL(btheme->tv3d.title, 0, 0, 0, 255);
669 btheme->tv3d.facedot_size= 4;
671 SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
672 SETCOL(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
673 SETCOL(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
675 SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
677 SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
678 SETCOL(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
679 SETCOL(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
680 SETCOL(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
682 SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
683 SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
684 SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
685 SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
686 SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
687 SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
688 SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
689 SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
691 SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
692 SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
694 SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
695 SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw
697 SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
698 SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
701 /* to have something initialized */
702 btheme->tbuts= btheme->tv3d;
704 SETCOLF(btheme->tbuts.back, 0.45, 0.45, 0.45, 1.0);
705 SETCOL(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
708 btheme->tipo= btheme->tv3d;
709 SETCOLF(btheme->tipo.back, 0.42, 0.42, 0.42, 1.0);
710 SETCOLF(btheme->tipo.list, 0.4, 0.4, 0.4, 1.0);
711 SETCOL(btheme->tipo.grid, 94, 94, 94, 255);
712 SETCOL(btheme->tipo.panel, 255, 255, 255, 150);
713 SETCOL(btheme->tipo.shade1, 150, 150, 150, 100); /* scrollbars */
714 SETCOL(btheme->tipo.shade2, 0x70, 0x70, 0x70, 100);
715 SETCOL(btheme->tipo.vertex, 0, 0, 0, 255);
716 SETCOL(btheme->tipo.vertex_select, 255, 133, 0, 255);
717 SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
718 btheme->tipo.vertex_size= 3;
720 SETCOL(btheme->tipo.handle_vertex, 0, 0, 0, 255);
721 SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
722 SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
723 SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
724 btheme->tipo.handle_vertex_size= 4;
726 SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
727 SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
728 SETCOL(btheme->tipo.group, 79, 101, 73, 255);
729 SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
732 btheme->tact= btheme->tipo;
733 SETCOL(btheme->tact.strip, 12, 10, 10, 128);
734 SETCOL(btheme->tact.strip_select, 255, 140, 0, 255);
737 btheme->tnla= btheme->tact;
740 /* to have something initialized */
741 btheme->tfile= btheme->tv3d;
742 SETCOLF(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
743 SETCOLF(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
744 SETCOLF(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
745 SETCOL(btheme->tfile.text, 250, 250, 250, 255);
746 SETCOL(btheme->tfile.text_hi, 15, 15, 15, 255);
747 SETCOL(btheme->tfile.panel, 145, 145, 145, 255); // bookmark/ui regions
748 SETCOL(btheme->tfile.active, 130, 130, 130, 255); // selected files
749 SETCOL(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
751 SETCOL(btheme->tfile.grid, 250, 250, 250, 255);
752 SETCOL(btheme->tfile.image, 250, 250, 250, 255);
753 SETCOL(btheme->tfile.movie, 250, 250, 250, 255);
754 SETCOL(btheme->tfile.scene, 250, 250, 250, 255);
758 btheme->tseq= btheme->tv3d;
759 SETCOL(btheme->tseq.back, 116, 116, 116, 255);
760 SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
761 SETCOL(btheme->tseq.image, 109, 88, 129, 255);
762 SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
763 SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
764 SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
765 SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
766 SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
767 SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
771 btheme->tima= btheme->tv3d;
772 SETCOL(btheme->tima.back, 53, 53, 53, 255);
773 SETCOL(btheme->tima.vertex, 0, 0, 0, 255);
774 SETCOL(btheme->tima.vertex_select, 255, 133, 0, 255);
775 btheme->tima.vertex_size= 3;
776 btheme->tima.facedot_size= 3;
777 SETCOL(btheme->tima.face, 255, 255, 255, 10);
778 SETCOL(btheme->tima.face_select, 255, 133, 0, 60);
779 SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
780 SETCOLF(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
781 SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
782 SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
783 SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
784 SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
785 SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
788 btheme->text= btheme->tv3d;
789 SETCOL(btheme->text.back, 153, 153, 153, 255);
790 SETCOL(btheme->text.shade1, 143, 143, 143, 255);
791 SETCOL(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
792 SETCOL(btheme->text.hilite, 255, 0, 0, 255);
794 /* syntax highlighting */
795 SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
796 SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
797 SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
798 SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
799 SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
802 btheme->toops= btheme->tv3d;
803 SETCOLF(btheme->toops.back, 0.45, 0.45, 0.45, 1.0);
805 SETCOLF(btheme->toops.match, 0.2, 0.5, 0.2, 0.3); /* highlighting search match - soft green*/
806 SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
809 btheme->tinfo= btheme->tv3d;
810 SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
812 /* space user preferences */
813 btheme->tuserpref= btheme->tv3d;
814 SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
817 btheme->tconsole= btheme->tv3d;
818 SETCOL(btheme->tconsole.back, 0, 0, 0, 255);
819 SETCOL(btheme->tconsole.console_output, 96, 128, 255, 255);
820 SETCOL(btheme->tconsole.console_input, 255, 255, 255, 255);
821 SETCOL(btheme->tconsole.console_info, 0, 170, 0, 255);
822 SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255);
823 SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255);
826 btheme->ttime= btheme->tv3d;
827 SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
828 SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
829 SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
831 /* space node, re-uses syntax color storage */
832 btheme->tnode= btheme->tv3d;
833 SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
834 SETCOL(btheme->tnode.syntaxl, 155, 155, 155, 160); /* TH_NODE, backdrop */
835 SETCOL(btheme->tnode.syntaxn, 100, 100, 100, 255); /* in/output */
836 SETCOL(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */
837 SETCOL(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */
838 SETCOL(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */
839 btheme->tnode.noodle_curving = 5;
842 btheme->tlogic= btheme->tv3d;
843 SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
846 btheme->tclip= btheme->tv3d;
848 SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
849 SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
850 SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
851 SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
852 SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
853 SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
854 SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
855 SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
856 SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
857 SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
858 SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
859 SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
860 btheme->tclip.handle_vertex_size= 4;
864 void UI_SetTheme(int spacetype, int regionid)
866 if(spacetype==0) { // called for safety, when delete themes
867 theme_active= U.themes.first;
868 theme_spacetype= SPACE_VIEW3D;
869 theme_regionid= RGN_TYPE_WINDOW;
872 // later on, a local theme can be found too
873 theme_active= U.themes.first;
874 theme_spacetype= spacetype;
875 theme_regionid= regionid;
879 bTheme *UI_GetTheme()
881 return U.themes.first;
884 // for space windows only
885 void UI_ThemeColor(int colorid)
887 const unsigned char *cp;
889 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
895 void UI_ThemeColor4(int colorid)
897 const unsigned char *cp;
899 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
904 // set the color with offset for shades
905 void UI_ThemeColorShade(int colorid, int offset)
908 const unsigned char *cp;
910 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
911 r= offset + (int) cp[0];
913 g= offset + (int) cp[1];
915 b= offset + (int) cp[2];
917 //glColor3ub(r, g, b);
918 glColor4ub(r, g, b, cp[3]);
920 void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
923 const unsigned char *cp;
925 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
926 r= coloffset + (int) cp[0];
928 g= coloffset + (int) cp[1];
930 b= coloffset + (int) cp[2];
932 a= alphaoffset + (int) cp[3];
934 glColor4ub(r, g, b, a);
937 // blend between to theme colors, and set it
938 void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
941 const unsigned char *cp1, *cp2;
943 cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
944 cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
946 CLAMP(fac, 0.0f, 1.0f);
947 r= floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
948 g= floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
949 b= floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
954 // blend between to theme colors, shade it, and set it
955 void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
958 const unsigned char *cp1, *cp2;
960 cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
961 cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
963 CLAMP(fac, 0.0f, 1.0f);
964 r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
965 g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
966 b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
975 // blend between to theme colors, shade it, and set it
976 void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset)
979 const unsigned char *cp1, *cp2;
981 cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
982 cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
984 CLAMP(fac, 0.0f, 1.0f);
985 r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
986 g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
987 b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
988 a= alphaoffset + floorf((1.0f-fac)*cp1[3] + fac*cp2[3]);
995 glColor4ub(r, g, b, a);
999 // get individual values, not scaled
1000 float UI_GetThemeValuef(int colorid)
1002 const unsigned char *cp;
1004 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1005 return ((float)cp[0]);
1009 // get individual values, not scaled
1010 int UI_GetThemeValue(int colorid)
1012 const unsigned char *cp;
1014 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1015 return ((int) cp[0]);
1020 // get the color, range 0.0-1.0
1021 void UI_GetThemeColor3fv(int colorid, float *col)
1023 const unsigned char *cp;
1025 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1026 col[0]= ((float)cp[0])/255.0f;
1027 col[1]= ((float)cp[1])/255.0f;
1028 col[2]= ((float)cp[2])/255.0f;
1031 // get the color, range 0.0-1.0, complete with shading offset
1032 void UI_GetThemeColorShade3fv(int colorid, int offset, float *col)
1035 const unsigned char *cp;
1037 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1039 r= offset + (int) cp[0];
1041 g= offset + (int) cp[1];
1043 b= offset + (int) cp[2];
1046 col[0]= ((float)r)/255.0f;
1047 col[1]= ((float)g)/255.0f;
1048 col[2]= ((float)b)/255.0f;
1051 // get the color, in char pointer
1052 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
1054 const unsigned char *cp;
1056 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1062 // get the color, in char pointer
1063 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
1065 const unsigned char *cp;
1067 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1074 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
1076 const unsigned char *cp;
1078 cp= UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
1085 // blends and shades between two char color pointers
1086 void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset)
1089 CLAMP(fac, 0.0f, 1.0f);
1090 r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
1091 g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
1092 b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
1094 r= r<0?0:(r>255?255:r);
1095 g= g<0?0:(g>255?255:g);
1096 b= b<0?0:(b>255?255:b);
1098 glColor3ub(r, g, b);
1101 void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset)
1105 r= offset+(int)cp[0];
1106 g= offset+(int)cp[1];
1107 b= offset+(int)cp[2];
1118 // get a 3 byte color, blended and shaded between two other char color pointers
1119 void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset)
1123 CLAMP(fac, 0.0f, 1.0f);
1124 r= offset+floor((1.0f-fac)*cp1[0] + fac*cp2[0]);
1125 g= offset+floor((1.0f-fac)*cp1[1] + fac*cp2[1]);
1126 b= offset+floor((1.0f-fac)*cp1[2] + fac*cp2[2]);
1137 void UI_ThemeClearColor(int colorid)
1141 UI_GetThemeColor3fv(colorid, col);
1142 glClearColor(col[0], col[1], col[2], 0.0);
1145 void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
1150 dst_col[0]= src_col[0]>219?255:src_col[0]+36;
1151 dst_col[1]= src_col[1]<26?0:src_col[1]-26;
1152 dst_col[2]= src_col[2]<26?0:src_col[2]-26;
1155 dst_col[0]= src_col[0]<46?0:src_col[0]-36;
1156 dst_col[1]= src_col[1]>189?255:src_col[1]+66;
1157 dst_col[2]= src_col[2]<46?0:src_col[2]-36;
1160 dst_col[0]= src_col[0]<26?0:src_col[0]-26;
1161 dst_col[1]= src_col[1]<26?0:src_col[1]-26;
1162 dst_col[2]= src_col[2]>209?255:src_col[2]+46;
1165 BLI_assert(!"invalid axis arg");
1169 /* ************************************************************* */
1171 /* patching UserDef struct and Themes */
1172 void init_userdef_do_versions(void)
1174 Main *bmain= G.main;
1177 /* the UserDef struct is not corrected with do_versions() .... ugh! */
1178 if(U.wheellinescroll == 0) U.wheellinescroll = 3;
1179 if(U.menuthreshold1==0) {
1180 U.menuthreshold1= 5;
1181 U.menuthreshold2= 2;
1183 if(U.tb_leftmouse==0) {
1187 if(U.mixbufsize==0) U.mixbufsize= 2048;
1188 if (strcmp(U.tempdir, "/") == 0) {
1189 BLI_system_temporary_dir(U.tempdir);
1191 if (U.autokey_mode == 0) {
1192 /* 'add/replace' but not on */
1195 if (U.savetime <= 0) {
1197 // XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
1199 /* transform widget settings */
1200 if(U.tw_hotspot==0) {
1202 U.tw_size= 20; // percentage of window size
1203 U.tw_handlesize= 16; // percentage of widget radius
1205 if(U.pad_rot_angle==0)
1206 U.pad_rot_angle= 15;
1208 /* signal for derivedmesh to use colorband */
1209 /* run in case this was on and is now off in the user prefs [#28096] */
1210 vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
1212 if (bmain->versionfile <= 191) {
1213 BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir));
1214 strcpy(U.sounddir, "/");
1217 /* patch to set Dupli Armature */
1218 if (bmain->versionfile < 220) {
1219 U.dupflag |= USER_DUP_ARM;
1222 /* added seam, normal color, undo */
1223 if (bmain->versionfile <= 234) {
1226 U.uiflag |= USER_GLOBALUNDO;
1227 if (U.undosteps==0) U.undosteps=32;
1229 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1230 /* check for alpha==0 is safe, then color was never set */
1231 if(btheme->tv3d.edge_seam[3]==0) {
1232 SETCOL(btheme->tv3d.edge_seam, 230, 150, 50, 255);
1234 if(btheme->tv3d.normal[3]==0) {
1235 SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
1237 if(btheme->tv3d.vertex_normal[3]==0) {
1238 SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
1240 if(btheme->tv3d.face_dot[3]==0) {
1241 SETCOL(btheme->tv3d.face_dot, 255, 138, 48, 255);
1242 btheme->tv3d.facedot_size= 4;
1246 if (bmain->versionfile <= 235) {
1247 /* illegal combo... */
1248 if (U.flag & USER_LMOUSESELECT)
1249 U.flag &= ~USER_TWOBUTTONMOUSE;
1251 if (bmain->versionfile <= 236) {
1253 /* new space type */
1254 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1255 /* check for alpha==0 is safe, then color was never set */
1256 if(btheme->ttime.back[3]==0) {
1257 // copied from ui_theme_init_default
1258 btheme->ttime= btheme->tv3d;
1259 SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
1260 SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
1261 SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
1263 if(btheme->text.syntaxn[3]==0) {
1264 SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
1265 SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
1266 SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
1267 SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
1268 SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
1272 if (bmain->versionfile <= 237) {
1275 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1276 /* check for alpha==0 is safe, then color was never set */
1277 if(btheme->tv3d.bone_solid[3]==0) {
1278 SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
1279 SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);
1283 if (bmain->versionfile <= 238) {
1286 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1287 /* check for alpha==0 is safe, then color was never set */
1288 if(btheme->tnla.strip[3]==0) {
1289 SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
1290 SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
1294 if (bmain->versionfile <= 239) {
1297 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1298 /* Lamp theme, check for alpha==0 is safe, then color was never set */
1299 if(btheme->tv3d.lamp[3]==0) {
1300 SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
1301 /* TEMPORAL, remove me! (ton) */
1302 U.uiflag |= USER_PLAINMENUS;
1306 if(U.obcenter_dia==0) U.obcenter_dia= 6;
1308 if (bmain->versionfile <= 241) {
1310 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1311 /* Node editor theme, check for alpha==0 is safe, then color was never set */
1312 if(btheme->tnode.syntaxn[3]==0) {
1313 /* re-uses syntax color storage */
1314 btheme->tnode= btheme->tv3d;
1315 SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
1316 SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
1317 SETCOL(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
1318 SETCOL(btheme->tnode.syntaxb, 127,127,127, 255); /* operator */
1319 SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
1320 SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
1322 /* Group theme colors */
1323 if(btheme->tv3d.group[3]==0) {
1324 SETCOL(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
1325 SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
1327 /* Sequence editor theme*/
1328 if(btheme->tseq.movie[3]==0) {
1329 SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
1330 SETCOL(btheme->tseq.image, 109, 88, 129, 255);
1331 SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
1332 SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
1333 SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
1334 SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
1335 SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
1336 SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
1340 /* set defaults for 3D View rotating axis indicator */
1341 /* since size can't be set to 0, this indicates it's not saved in startup.blend */
1342 if (U.rvisize == 0) {
1345 U.uiflag |= USER_SHOW_ROTVIEWICON;
1349 if (bmain->versionfile <= 242) {
1352 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1353 /* long keyframe color */
1354 /* check for alpha==0 is safe, then color was never set */
1355 if(btheme->tact.strip[3]==0) {
1356 SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
1357 SETCOL(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
1358 SETCOL(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
1361 /* IPO-Editor - Vertex Size*/
1362 if(btheme->tipo.vertex_size == 0) {
1363 btheme->tipo.vertex_size= 3;
1367 if (bmain->versionfile <= 243) {
1368 /* set default number of recently-used files (if not set) */
1369 if (U.recent_files == 0) U.recent_files = 10;
1371 if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) {
1373 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1374 SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
1376 if(U.coba_weight.tot==0)
1377 init_colorband(&U.coba_weight, 1);
1379 if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
1381 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1382 /* these should all use the same color */
1383 SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
1384 SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
1385 SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
1386 SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
1387 SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
1388 //SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
1389 SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
1392 if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) {
1394 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1395 /* action channel groups (recolor anyway) */
1396 SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
1397 SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
1399 /* bone custom-color sets */
1400 if (btheme->tarm[0].solid[3] == 0)
1401 ui_theme_init_boneColorSets(btheme);
1404 if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 16)) {
1405 U.flag |= USER_ADD_VIEWALIGNED|USER_ADD_EDITMODE;
1407 if ((bmain->versionfile < 247) || (bmain->versionfile == 247 && bmain->subversionfile <= 2)) {
1411 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1414 /* IPO Editor: Handles/Vertices */
1415 col = btheme->tipo.vertex;
1416 SETCOL(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
1417 col = btheme->tipo.vertex_select;
1418 SETCOL(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
1419 btheme->tipo.handle_vertex_size= btheme->tipo.vertex_size;
1421 /* Sequence/Image Editor: colors for GPencil text */
1422 col = btheme->tv3d.bone_pose;
1423 SETCOL(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
1424 SETCOL(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
1425 col = btheme->tv3d.vertex_select;
1426 SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
1429 if (bmain->versionfile < 250) {
1432 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1433 /* this was not properly initialized in 2.45 */
1434 if(btheme->tima.face_dot[3]==0) {
1435 SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
1436 SETCOL(btheme->tima.face_dot, 255, 133, 0, 255);
1437 btheme->tima.facedot_size= 2;
1440 /* DopeSheet - (Object) Channel color */
1441 SETCOL(btheme->tact.ds_channel, 82, 96, 110, 255);
1442 SETCOL(btheme->tact.ds_subchannel, 124, 137, 150, 255);
1443 /* DopeSheet - Group Channel color (saner version) */
1444 SETCOL(btheme->tact.group, 79, 101, 73, 255);
1445 SETCOL(btheme->tact.group_active, 135, 177, 125, 255);
1447 /* Graph Editor - (Object) Channel color */
1448 SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
1449 SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
1450 /* Graph Editor - Group Channel color */
1451 SETCOL(btheme->tipo.group, 79, 101, 73, 255);
1452 SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
1454 /* Nla Editor - (Object) Channel color */
1455 SETCOL(btheme->tnla.ds_channel, 82, 96, 110, 255);
1456 SETCOL(btheme->tnla.ds_subchannel, 124, 137, 150, 255);
1457 /* NLA Editor - New Strip colors */
1458 SETCOL(btheme->tnla.strip, 12, 10, 10, 128);
1459 SETCOL(btheme->tnla.strip_select, 255, 140, 0, 255);
1462 /* adjust grease-pencil distances */
1463 U.gp_manhattendist= 1;
1464 U.gp_euclideandist= 2;
1466 /* adjust default interpolation for new IPO-curves */
1467 U.ipo_new= BEZT_IPO_BEZ;
1470 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
1473 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1475 /* common (new) variables, it checks for alpha==0 */
1476 ui_theme_init_new(btheme);
1478 if(btheme->tui.wcol_num.outline[3]==0)
1479 ui_widget_color_init(&btheme->tui);
1481 /* Logic editor theme, check for alpha==0 is safe, then color was never set */
1482 if(btheme->tlogic.syntaxn[3]==0) {
1483 /* re-uses syntax color storage */
1484 btheme->tlogic= btheme->tv3d;
1485 SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
1488 SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
1489 SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
1493 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) {
1494 /* new audio system */
1495 if(U.audiochannels == 0)
1496 U.audiochannels = 2;
1497 if(U.audiodevice == 0) {
1505 if(U.audioformat == 0)
1506 U.audioformat = 0x24;
1507 if(U.audiorate == 0)
1508 U.audiorate = 44100;
1511 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 5))
1512 U.gameflags |= USER_DISABLE_VBO;
1514 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
1517 for(km=U.user_keymaps.first; km; km=km->next) {
1518 if (strcmp(km->idname, "Armature_Sketch")==0)
1519 strcpy(km->idname, "Armature Sketch");
1520 else if (strcmp(km->idname, "View3D")==0)
1521 strcpy(km->idname, "3D View");
1522 else if (strcmp(km->idname, "View3D Generic")==0)
1523 strcpy(km->idname, "3D View Generic");
1524 else if (strcmp(km->idname, "EditMesh")==0)
1525 strcpy(km->idname, "Mesh");
1526 else if (strcmp(km->idname, "TimeLine")==0)
1527 strcpy(km->idname, "Timeline");
1528 else if (strcmp(km->idname, "UVEdit")==0)
1529 strcpy(km->idname, "UV Editor");
1530 else if (strcmp(km->idname, "Animation_Channels")==0)
1531 strcpy(km->idname, "Animation Channels");
1532 else if (strcmp(km->idname, "GraphEdit Keys")==0)
1533 strcpy(km->idname, "Graph Editor");
1534 else if (strcmp(km->idname, "GraphEdit Generic")==0)
1535 strcpy(km->idname, "Graph Editor Generic");
1536 else if (strcmp(km->idname, "Action_Keys")==0)
1537 strcpy(km->idname, "Dopesheet");
1538 else if (strcmp(km->idname, "NLA Data")==0)
1539 strcpy(km->idname, "NLA Editor");
1540 else if (strcmp(km->idname, "Node Generic")==0)
1541 strcpy(km->idname, "Node Editor");
1542 else if (strcmp(km->idname, "Logic Generic")==0)
1543 strcpy(km->idname, "Logic Editor");
1544 else if (strcmp(km->idname, "File")==0)
1545 strcpy(km->idname, "File Browser");
1546 else if (strcmp(km->idname, "FileMain")==0)
1547 strcpy(km->idname, "File Browser Main");
1548 else if (strcmp(km->idname, "FileButtons")==0)
1549 strcpy(km->idname, "File Browser Buttons");
1550 else if (strcmp(km->idname, "Buttons Generic")==0)
1551 strcpy(km->idname, "Property Editor");
1554 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) {
1555 if(U.wmdrawmethod == USER_DRAW_TRIPLE)
1556 U.wmdrawmethod = USER_DRAW_AUTOMATIC;
1559 if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 3)) {
1560 if (U.flag & USER_LMOUSESELECT)
1561 U.flag &= ~USER_TWOBUTTONMOUSE;
1563 if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 4)) {
1566 /* default new handle type is auto handles */
1567 U.keyhandles_new = HD_AUTO;
1569 /* init new curve colors */
1570 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1571 /* init colors used for handles in 3D-View */
1572 SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
1573 SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
1574 SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
1575 SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
1576 SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
1577 SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
1578 SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
1579 SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
1580 SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
1582 /* same colors again for Graph Editor... */
1583 SETCOL(btheme->tipo.handle_free, 0, 0, 0, 255);
1584 SETCOL(btheme->tipo.handle_auto, 0x90, 0x90, 0x00, 255);
1585 SETCOL(btheme->tipo.handle_vect, 0x40, 0x90, 0x30, 255);
1586 SETCOL(btheme->tipo.handle_align, 0x80, 0x30, 0x60, 255);
1587 SETCOL(btheme->tipo.handle_sel_free, 0, 0, 0, 255);
1588 SETCOL(btheme->tipo.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
1589 SETCOL(btheme->tipo.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
1590 SETCOL(btheme->tipo.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
1593 SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
1596 if (bmain->versionfile <= 252) {
1599 /* init new curve colors */
1600 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1601 if (btheme->tv3d.lastsel_point[3] == 0)
1602 SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
1605 if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
1608 /* interface_widgets.c */
1609 struct uiWidgetColors wcol_progress= {
1611 {190, 190, 190, 255},
1612 {100, 100, 100, 180},
1616 {255, 255, 255, 255},
1622 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1623 /* init progress bar theme */
1624 btheme->tui.wcol_progress= wcol_progress;
1628 if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
1630 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1631 SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
1632 SETCOL(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
1633 SETCOL(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
1637 if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 4)) {
1639 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1640 if((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
1644 if (bmain->versionfile < 257) {
1645 /* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
1646 U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
1649 if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
1651 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1652 btheme->tnode.noodle_curving = 5;
1656 if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
1659 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1660 btheme->tv3d.speaker[3] = 255;
1664 if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 3)) {
1667 /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead
1668 * was changed in 260 as part of GSoC11, but version patch was wrong
1670 if (U.keyhandles_new == HD_AUTO)
1671 U.keyhandles_new = HD_AUTO_ANIM;
1673 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1674 if(btheme->tv3d.bundle_solid[3] == 0)
1675 SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
1677 if(btheme->tv3d.camera_path[3] == 0)
1678 SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
1680 if((btheme->tclip.back[3]) == 0) {
1681 btheme->tclip= btheme->tv3d;
1683 SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
1684 SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
1685 SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
1686 SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
1687 SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
1688 SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
1689 SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
1690 SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
1691 SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
1692 SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
1693 SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
1694 SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
1695 btheme->tclip.handle_vertex_size= 4;
1698 /* auto-clamped handles -> based on auto */
1699 if(btheme->tipo.handle_auto_clamped[3] == 0)
1700 SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
1701 if(btheme->tipo.handle_sel_auto_clamped[3] == 0)
1702 SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
1705 /* enable (Cycles) addon by default */
1706 if(!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
1707 bAddon *baddon= MEM_callocN(sizeof(bAddon), "bAddon");
1708 BLI_strncpy(baddon->module, "cycles", sizeof(baddon->module));
1709 BLI_addtail(&U.addons, baddon);
1713 if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
1716 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1717 SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
1718 btheme->tui.icon_alpha= 1.0;
1722 if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 4)) {
1724 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1725 SETCOLF(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
1726 SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
1727 SETCOLF(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
1728 SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
1729 SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
1730 SETCOLF(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
1732 SETCOLF(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
1733 SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
1736 U.use_16bit_textures = 1;
1739 if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 2)) {
1741 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1742 if (btheme->tui.wcol_menu_item.item[3] == 255)
1743 SETCOL(btheme->tui.wcol_menu_item.item, 172, 172, 172, 128);
1747 if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 3)) {
1749 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1750 if (btheme->tui.wcol_tooltip.inner[3] == 0) {
1751 btheme->tui.wcol_tooltip = btheme->tui.wcol_menu_back;
1756 /* GL Texture Garbage Collection (variable abused above!) */
1757 if (U.textimeout == 0) {
1758 U.texcollectrate = 60;
1761 if (U.memcachelimit <= 0) {
1762 U.memcachelimit = 32;
1764 if (U.frameserverport == 0) {
1765 U.frameserverport = 8080;
1767 if (U.dbl_click_time == 0) {
1768 U.dbl_click_time = 350;
1770 if (U.anim_player_preset == 0) {
1771 U.anim_player_preset = 1;
1773 if (U.scrcastfps == 0) {
1777 if (U.v2d_min_gridsize == 0) {
1778 U.v2d_min_gridsize= 35;
1780 if (U.dragthreshold == 0 )
1782 if (U.widget_unit==0)
1783 U.widget_unit= (U.dpi * 20 + 36)/72;
1784 if (U.anisotropic_filter <= 0)
1785 U.anisotropic_filter = 1;
1787 if (U.ndof_sensitivity == 0.0f) {
1788 U.ndof_sensitivity = 1.0f;
1789 U.ndof_flag = NDOF_LOCK_HORIZON |
1790 NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
1792 if (U.tweak_threshold == 0 )
1793 U.tweak_threshold= 10;
1795 /* funny name, but it is GE stuff, moves userdef stuff to engine */
1796 // XXX space_set_commmandline_options();
1797 /* this timer uses U */
1798 // XXX reset_autosave();