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. The Blender
8 * Foundation also sells licenses for use in proprietary software under
9 * the Blender License. See http://www.blender.org/BL/ for information
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
22 * All rights reserved.
24 * The Original Code is: all of this file.
26 * Contributor(s): none yet.
28 * ***** END GPL/BL DUAL LICENSE BLOCK *****
31 /** \file blender/editors/interface/resources.c
32 * \ingroup edinterface
39 #include "MEM_guardedalloc.h"
41 #include "DNA_curve_types.h"
42 #include "DNA_userdef_types.h"
43 #include "DNA_screen_types.h"
44 #include "DNA_space_types.h"
45 #include "DNA_windowmanager_types.h"
47 #include "BLI_blenlib.h"
48 #include "BLI_utildefines.h"
50 #include "BKE_DerivedMesh.h"
51 #include "BKE_global.h"
53 #include "BKE_texture.h"
58 #include "UI_interface.h"
59 #include "UI_interface_icons.h"
61 #include "interface_intern.h"
63 /* global for themes */
64 typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
66 static bTheme *theme_active=NULL;
67 static int theme_spacetype= SPACE_VIEW3D;
68 static int theme_regionid= RGN_TYPE_WINDOW;
70 void ui_resources_init(void)
72 UI_icons_init(BIFICONID_LAST);
75 void ui_resources_free(void)
81 /* ******************************************************** */
83 /* ******************************************************** */
85 const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
88 static char error[4]={240, 0, 240, 255};
89 static char alert[4]={240, 60, 60, 255};
90 static char headerdesel[4]={0,0,0,255};
92 const char *cp= error;
96 // first check for ui buttons theme
97 if(colorid < TH_THEMEUI) {
142 ts= &btheme->tuserpref;
145 ts= &btheme->tconsole;
166 if(theme_regionid==RGN_TYPE_WINDOW)
168 else if(theme_regionid==RGN_TYPE_CHANNELS)
170 else if(theme_regionid==RGN_TYPE_HEADER)
176 if(theme_regionid==RGN_TYPE_WINDOW)
178 else if(theme_regionid==RGN_TYPE_CHANNELS)
180 else if(theme_regionid==RGN_TYPE_HEADER)
186 if(theme_regionid==RGN_TYPE_WINDOW)
188 else if(theme_regionid==RGN_TYPE_CHANNELS)
189 cp= ts->list_text_hi;
190 else if(theme_regionid==RGN_TYPE_HEADER)
191 cp= ts->header_text_hi;
193 cp= ts->button_text_hi;
196 if(theme_regionid==RGN_TYPE_WINDOW)
198 else if(theme_regionid==RGN_TYPE_CHANNELS)
200 else if(theme_regionid==RGN_TYPE_HEADER)
201 cp= ts->header_title;
203 cp= ts->button_title;
207 cp= ts->header; break;
209 /* we calculate a dynamic builtin header deselect color, also for pulldowns... */
211 headerdesel[0]= cp[0]>10?cp[0]-10:0;
212 headerdesel[1]= cp[1]>10?cp[1]-10:0;
213 headerdesel[2]= cp[2]>10?cp[2]-10:0;
217 cp= ts->header_text; break;
218 case TH_HEADER_TEXT_HI:
219 cp= ts->header_text_hi; break;
222 cp= ts->panel; break;
224 cp= ts->panel_text; break;
225 case TH_PANEL_TEXT_HI:
226 cp= ts->panel_text_hi; break;
229 cp= ts->button; break;
230 case TH_BUTBACK_TEXT:
231 cp= ts->button_text; break;
232 case TH_BUTBACK_TEXT_HI:
233 cp= ts->button_text_hi; break;
236 cp= ts->shade1; break;
238 cp= ts->shade2; break;
240 cp= ts->hilite; break;
249 cp= ts->speaker; break;
251 cp= ts->select; break;
253 cp= ts->active; break;
255 cp= ts->group; break;
256 case TH_GROUP_ACTIVE:
257 cp= ts->group_active; break;
259 cp= ts->transform; break;
261 cp= ts->vertex; break;
262 case TH_VERTEX_SELECT:
263 cp= ts->vertex_select; break;
265 cp= &ts->vertex_size; break;
266 case TH_OUTLINE_WIDTH:
267 cp= &ts->outline_width; break;
271 cp= ts->edge_select; break;
273 cp= ts->edge_seam; break;
275 cp= ts->edge_sharp; break;
277 cp= ts->edge_crease; break;
278 case TH_EDITMESH_ACTIVE:
279 cp= ts->editmesh_active; break;
280 case TH_EDGE_FACESEL:
281 cp= ts->edge_facesel; break;
285 cp= ts->face_select; break;
287 cp= ts->face_dot; break;
288 case TH_FACEDOT_SIZE:
289 cp= &ts->facedot_size; break;
290 case TH_DRAWEXTRA_EDGELEN:
291 cp= ts->extra_edge_len; break;
292 case TH_DRAWEXTRA_FACEAREA:
293 cp= ts->extra_face_area; break;
294 case TH_DRAWEXTRA_FACEANG:
295 cp= ts->extra_face_angle; break;
297 cp= ts->normal; break;
299 cp= ts->vertex_normal; break;
301 cp= ts->bone_solid; break;
303 cp= ts->bone_pose; break;
305 cp= ts->strip; break;
306 case TH_STRIP_SELECT:
307 cp= ts->strip_select; break;
309 cp= ts->cframe; break;
311 cp= ts->nurb_uline; break;
313 cp= ts->nurb_vline; break;
314 case TH_NURB_SEL_ULINE:
315 cp= ts->nurb_sel_uline; break;
316 case TH_NURB_SEL_VLINE:
317 cp= ts->nurb_sel_vline; break;
318 case TH_ACTIVE_SPLINE:
319 cp= ts->act_spline; break;
320 case TH_LASTSEL_POINT:
321 cp= ts->lastsel_point; break;
323 cp= ts->handle_free; break;
325 cp= ts->handle_auto; break;
326 case TH_HANDLE_AUTOCLAMP:
327 cp= ts->handle_auto_clamped; break;
329 cp= ts->handle_vect; break;
330 case TH_HANDLE_ALIGN:
331 cp= ts->handle_align; break;
332 case TH_HANDLE_SEL_FREE:
333 cp= ts->handle_sel_free; break;
334 case TH_HANDLE_SEL_AUTO:
335 cp= ts->handle_sel_auto; break;
336 case TH_HANDLE_SEL_AUTOCLAMP:
337 cp= ts->handle_sel_auto_clamped; break;
338 case TH_HANDLE_SEL_VECT:
339 cp= ts->handle_sel_vect; break;
340 case TH_HANDLE_SEL_ALIGN:
341 cp= ts->handle_sel_align; break;
344 cp= ts->syntaxb; break;
346 cp= ts->syntaxv; break;
348 cp= ts->syntaxc; break;
350 cp= ts->syntaxl; break;
352 cp= ts->syntaxn; break;
355 cp= ts->syntaxl; break;
357 cp= ts->syntaxn; break;
358 case TH_NODE_OPERATOR:
359 cp= ts->syntaxb; break;
360 case TH_NODE_CONVERTOR:
361 cp= ts->syntaxv; break;
363 cp= ts->syntaxc; break;
364 case TH_NODE_CURVING:
365 cp= &ts->noodle_curving; break;
368 cp= ts->movie; break;
370 cp= ts->image; break;
372 cp= ts->scene; break;
374 cp= ts->audio; break;
376 cp= ts->effect; break;
378 cp= ts->plugin; break;
379 case TH_SEQ_TRANSITION:
380 cp= ts->transition; break;
384 case TH_CONSOLE_OUTPUT:
385 cp= ts->console_output; break;
386 case TH_CONSOLE_INPUT:
387 cp= ts-> console_input; break;
388 case TH_CONSOLE_INFO:
389 cp= ts->console_info; break;
390 case TH_CONSOLE_ERROR:
391 cp= ts->console_error; break;
392 case TH_CONSOLE_CURSOR:
393 cp= ts->console_cursor; break;
395 case TH_HANDLE_VERTEX:
396 cp= ts->handle_vertex;
398 case TH_HANDLE_VERTEX_SELECT:
399 cp= ts->handle_vertex_select;
401 case TH_HANDLE_VERTEX_SIZE:
402 cp= &ts->handle_vertex_size;
405 case TH_DOPESHEET_CHANNELOB:
408 case TH_DOPESHEET_CHANNELSUBOB:
409 cp= ts->ds_subchannel;
412 case TH_PREVIEW_BACK:
413 cp= ts->preview_back;
416 case TH_MARKER_OUTLINE:
417 cp= ts->marker_outline; break;
419 cp= ts->marker; break;
421 cp= ts->act_marker; break;
423 cp= ts->sel_marker; break;
424 case TH_BUNDLE_SOLID:
425 cp= ts->bundle_solid; break;
427 cp= ts->dis_marker; break;
429 cp= ts->path_before; break;
431 cp= ts->path_after; break;
433 cp= ts->camera_path; break;
435 cp= ts->lock_marker; break;
440 return (unsigned char *)cp;
444 #define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
445 #define SETCOLF(col, r, g, b, a) col[0]=r*255; col[1]=g*255; col[2]= b*255; col[3]= a*255;
446 #define SETCOLTEST(col, r, g, b, a) if(col[3]==0) {col[0]=r; col[1]=g; col[2]= b; col[3]= a;}
448 /* use this call to init new bone color sets in Theme */
449 static void ui_theme_init_boneColorSets(bTheme *btheme)
453 /* define default color sets - currently we only define 15 of these, though that should be ample */
455 SETCOL(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
456 SETCOL(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
457 SETCOL(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
459 SETCOL(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
460 SETCOL(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
461 SETCOL(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
463 SETCOL(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
464 SETCOL(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
465 SETCOL(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
467 SETCOL(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
468 SETCOL(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
469 SETCOL(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
471 SETCOL(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
472 SETCOL(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
473 SETCOL(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
475 SETCOL(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
476 SETCOL(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
477 SETCOL(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
479 SETCOL(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
480 SETCOL(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
481 SETCOL(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
483 SETCOL(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
484 SETCOL(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
485 SETCOL(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
487 SETCOL(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
488 SETCOL(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
489 SETCOL(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
491 SETCOL(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
492 SETCOL(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
493 SETCOL(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
495 SETCOL(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
496 SETCOL(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
497 SETCOL(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
499 SETCOL(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
500 SETCOL(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
501 SETCOL(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
503 SETCOL(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
504 SETCOL(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
505 SETCOL(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
507 SETCOL(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
508 SETCOL(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
509 SETCOL(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
511 SETCOL(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
512 SETCOL(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
513 SETCOL(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
515 /* reset flags too */
516 for (i = 0; i < 20; i++)
517 btheme->tarm[i].flag = 0;
520 /* use this call to init new variables in themespace, if they're same for all */
521 static void ui_theme_init_new_do(ThemeSpace *ts)
523 SETCOLTEST(ts->header_text, 0, 0, 0, 255);
524 SETCOLTEST(ts->header_title, 0, 0, 0, 255);
525 SETCOLTEST(ts->header_text_hi, 255, 255, 255, 255);
527 SETCOLTEST(ts->panel_text, 0, 0, 0, 255);
528 SETCOLTEST(ts->panel_title, 0, 0, 0, 255);
529 SETCOLTEST(ts->panel_text_hi, 255, 255, 255, 255);
531 SETCOLTEST(ts->button, 145, 145, 145, 245);
532 SETCOLTEST(ts->button_title, 0, 0, 0, 255);
533 SETCOLTEST(ts->button_text, 0, 0, 0, 255);
534 SETCOLTEST(ts->button_text_hi, 255, 255, 255, 255);
536 SETCOLTEST(ts->list, 165, 165, 165, 255);
537 SETCOLTEST(ts->list_title, 0, 0, 0, 255);
538 SETCOLTEST(ts->list_text, 0, 0, 0, 255);
539 SETCOLTEST(ts->list_text_hi, 255, 255, 255, 255);
542 static void ui_theme_init_new(bTheme *btheme)
544 ui_theme_init_new_do(&btheme->tbuts);
545 ui_theme_init_new_do(&btheme->tv3d);
546 ui_theme_init_new_do(&btheme->tfile);
547 ui_theme_init_new_do(&btheme->tipo);
548 ui_theme_init_new_do(&btheme->tinfo);
549 ui_theme_init_new_do(&btheme->tact);
550 ui_theme_init_new_do(&btheme->tnla);
551 ui_theme_init_new_do(&btheme->tseq);
552 ui_theme_init_new_do(&btheme->tima);
553 ui_theme_init_new_do(&btheme->text);
554 ui_theme_init_new_do(&btheme->toops);
555 ui_theme_init_new_do(&btheme->ttime);
556 ui_theme_init_new_do(&btheme->tnode);
557 ui_theme_init_new_do(&btheme->tlogic);
558 ui_theme_init_new_do(&btheme->tuserpref);
559 ui_theme_init_new_do(&btheme->tconsole);
560 ui_theme_init_new_do(&btheme->tclip);
565 /* initialize default theme
566 Note: when you add new colors, created & saved themes need initialized
567 use function below, init_userdef_do_versions()
569 void ui_theme_init_default(void)
573 /* we search for the theme with name Default */
574 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
575 if(strcmp("Default", btheme->name)==0) break;
579 btheme= MEM_callocN(sizeof(bTheme), "theme");
580 BLI_addtail(&U.themes, btheme);
581 strcpy(btheme->name, "Default");
584 UI_SetTheme(0, 0); // make sure the global used in this file is set
587 ui_widget_color_init(&btheme->tui);
588 btheme->tui.iconfile[0]= 0;
590 /* Bone Color Sets */
591 ui_theme_init_boneColorSets(btheme);
593 /* common (new) variables */
594 ui_theme_init_new(btheme);
597 SETCOLF(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
598 SETCOL(btheme->tv3d.text, 0, 0, 0, 255);
599 SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255);
601 SETCOLF(btheme->tv3d.header, 0.45, 0.45, 0.45, 1.0);
602 SETCOLF(btheme->tv3d.button, 0.45, 0.45, 0.45, 1.0);
603 SETCOL(btheme->tv3d.panel, 165, 165, 165, 127);
605 SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100);
606 SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
608 SETCOLF(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0);
609 SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
610 SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
611 SETCOL(btheme->tv3d.speaker, 0, 0, 0, 255);
612 SETCOL(btheme->tv3d.select, 241, 88, 0, 255);
613 SETCOL(btheme->tv3d.active, 255, 170, 64, 255);
614 SETCOL(btheme->tv3d.group, 8, 48, 8, 255);
615 SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255);
616 SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
617 SETCOL(btheme->tv3d.vertex, 0, 0, 0, 255);
618 SETCOL(btheme->tv3d.vertex_select, 255, 133, 0, 255);
619 btheme->tv3d.vertex_size= 3;
620 btheme->tv3d.outline_width= 1;
621 SETCOL(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255);
622 SETCOL(btheme->tv3d.edge_select, 255, 160, 0, 255);
623 SETCOL(btheme->tv3d.edge_seam, 219, 37, 18, 255);
624 SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
625 SETCOL(btheme->tv3d.face, 0, 0, 0, 18);
626 SETCOL(btheme->tv3d.face_select, 255, 133, 0, 60);
627 SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
628 SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
629 SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255);
630 SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
631 SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
632 SETCOL(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
633 SETCOL(btheme->tv3d.header_text, 0, 0, 0, 255);
634 SETCOL(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
635 SETCOL(btheme->tv3d.button_text, 0, 0, 0, 255);
636 SETCOL(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
637 SETCOL(btheme->tv3d.button_title, 0, 0, 0, 255);
638 SETCOL(btheme->tv3d.title, 0, 0, 0, 255);
640 btheme->tv3d.facedot_size= 4;
642 SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
643 SETCOL(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
644 SETCOL(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
646 SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
648 SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
649 SETCOL(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
650 SETCOL(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
651 SETCOL(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
653 SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
654 SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
655 SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
656 SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
657 SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
658 SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
659 SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
660 SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
662 SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
663 SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
665 SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
666 SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80); // alpha 80 is not meant editable, used for wire+action draw
668 SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
669 SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
672 /* to have something initialized */
673 btheme->tbuts= btheme->tv3d;
675 SETCOLF(btheme->tbuts.back, 0.45, 0.45, 0.45, 1.0);
676 SETCOL(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
679 btheme->tipo= btheme->tv3d;
680 SETCOLF(btheme->tipo.back, 0.42, 0.42, 0.42, 1.0);
681 SETCOLF(btheme->tipo.list, 0.4, 0.4, 0.4, 1.0);
682 SETCOL(btheme->tipo.grid, 94, 94, 94, 255);
683 SETCOL(btheme->tipo.panel, 255, 255, 255, 150);
684 SETCOL(btheme->tipo.shade1, 150, 150, 150, 100); /* scrollbars */
685 SETCOL(btheme->tipo.shade2, 0x70, 0x70, 0x70, 100);
686 SETCOL(btheme->tipo.vertex, 0, 0, 0, 255);
687 SETCOL(btheme->tipo.vertex_select, 255, 133, 0, 255);
688 SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
689 btheme->tipo.vertex_size= 3;
691 SETCOL(btheme->tipo.handle_vertex, 0, 0, 0, 255);
692 SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
693 SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
694 SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
695 btheme->tipo.handle_vertex_size= 4;
697 SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
698 SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
699 SETCOL(btheme->tipo.group, 79, 101, 73, 255);
700 SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
703 btheme->tact= btheme->tipo;
704 SETCOL(btheme->tact.strip, 12, 10, 10, 128);
705 SETCOL(btheme->tact.strip_select, 255, 140, 0, 255);
708 btheme->tnla= btheme->tact;
711 /* to have something initialized */
712 btheme->tfile= btheme->tv3d;
713 SETCOLF(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
714 SETCOLF(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
715 SETCOLF(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
716 SETCOL(btheme->tfile.text, 250, 250, 250, 255);
717 SETCOL(btheme->tfile.text_hi, 15, 15, 15, 255);
718 SETCOL(btheme->tfile.panel, 145, 145, 145, 255); // bookmark/ui regions
719 SETCOL(btheme->tfile.active, 130, 130, 130, 255); // selected files
720 SETCOL(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
722 SETCOL(btheme->tfile.grid, 250, 250, 250, 255);
723 SETCOL(btheme->tfile.image, 250, 250, 250, 255);
724 SETCOL(btheme->tfile.movie, 250, 250, 250, 255);
725 SETCOL(btheme->tfile.scene, 250, 250, 250, 255);
729 btheme->tseq= btheme->tv3d;
730 SETCOL(btheme->tseq.back, 116, 116, 116, 255);
731 SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
732 SETCOL(btheme->tseq.image, 109, 88, 129, 255);
733 SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
734 SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
735 SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
736 SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
737 SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
738 SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
742 btheme->tima= btheme->tv3d;
743 SETCOL(btheme->tima.back, 53, 53, 53, 255);
744 SETCOL(btheme->tima.vertex, 0, 0, 0, 255);
745 SETCOL(btheme->tima.vertex_select, 255, 133, 0, 255);
746 btheme->tima.vertex_size= 3;
747 btheme->tima.facedot_size= 3;
748 SETCOL(btheme->tima.face, 255, 255, 255, 10);
749 SETCOL(btheme->tima.face_select, 255, 133, 0, 60);
750 SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
751 SETCOLF(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
754 btheme->text= btheme->tv3d;
755 SETCOL(btheme->text.back, 153, 153, 153, 255);
756 SETCOL(btheme->text.shade1, 143, 143, 143, 255);
757 SETCOL(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
758 SETCOL(btheme->text.hilite, 255, 0, 0, 255);
760 /* syntax highlighting */
761 SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
762 SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
763 SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
764 SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
765 SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
768 btheme->toops= btheme->tv3d;
769 SETCOLF(btheme->toops.back, 0.45, 0.45, 0.45, 1.0);
772 btheme->tinfo= btheme->tv3d;
773 SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
775 /* space user preferences */
776 btheme->tuserpref= btheme->tv3d;
777 SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
780 btheme->tconsole= btheme->tv3d;
781 SETCOL(btheme->tconsole.back, 0, 0, 0, 255);
782 SETCOL(btheme->tconsole.console_output, 96, 128, 255, 255);
783 SETCOL(btheme->tconsole.console_input, 255, 255, 255, 255);
784 SETCOL(btheme->tconsole.console_info, 0, 170, 0, 255);
785 SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255);
786 SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255);
789 btheme->ttime= btheme->tv3d;
790 SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
791 SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
792 SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
794 /* space node, re-uses syntax color storage */
795 btheme->tnode= btheme->tv3d;
796 SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
797 SETCOL(btheme->tnode.syntaxl, 155, 155, 155, 160); /* TH_NODE, backdrop */
798 SETCOL(btheme->tnode.syntaxn, 100, 100, 100, 255); /* in/output */
799 SETCOL(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */
800 SETCOL(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */
801 SETCOL(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */
802 btheme->tnode.noodle_curving = 5;
805 btheme->tlogic= btheme->tv3d;
806 SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
809 btheme->tclip= btheme->tv3d;
811 SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
812 SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
813 SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
814 SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
815 SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
816 SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
817 SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
818 SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
819 SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
820 SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
821 SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
822 SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
823 btheme->tclip.handle_vertex_size= 4;
827 void UI_SetTheme(int spacetype, int regionid)
829 if(spacetype==0) { // called for safety, when delete themes
830 theme_active= U.themes.first;
831 theme_spacetype= SPACE_VIEW3D;
832 theme_regionid= RGN_TYPE_WINDOW;
835 // later on, a local theme can be found too
836 theme_active= U.themes.first;
837 theme_spacetype= spacetype;
838 theme_regionid= regionid;
842 // for space windows only
843 void UI_ThemeColor(int colorid)
845 const unsigned char *cp;
847 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
853 void UI_ThemeColor4(int colorid)
855 const unsigned char *cp;
857 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
862 // set the color with offset for shades
863 void UI_ThemeColorShade(int colorid, int offset)
866 const unsigned char *cp;
868 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
869 r= offset + (int) cp[0];
871 g= offset + (int) cp[1];
873 b= offset + (int) cp[2];
875 //glColor3ub(r, g, b);
876 glColor4ub(r, g, b, cp[3]);
878 void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
881 const unsigned char *cp;
883 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
884 r= coloffset + (int) cp[0];
886 g= coloffset + (int) cp[1];
888 b= coloffset + (int) cp[2];
890 a= alphaoffset + (int) cp[3];
892 glColor4ub(r, g, b, a);
895 // blend between to theme colors, and set it
896 void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
899 const unsigned char *cp1, *cp2;
901 cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
902 cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
904 CLAMP(fac, 0.0f, 1.0f);
905 r= floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
906 g= floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
907 b= floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
912 // blend between to theme colors, shade it, and set it
913 void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
916 const unsigned char *cp1, *cp2;
918 cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
919 cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
921 CLAMP(fac, 0.0f, 1.0f);
922 r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
923 g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
924 b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
933 // blend between to theme colors, shade it, and set it
934 void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset)
937 const unsigned char *cp1, *cp2;
939 cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
940 cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
942 CLAMP(fac, 0.0f, 1.0f);
943 r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
944 g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
945 b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
946 a= alphaoffset + floorf((1.0f-fac)*cp1[3] + fac*cp2[3]);
953 glColor4ub(r, g, b, a);
957 // get individual values, not scaled
958 float UI_GetThemeValuef(int colorid)
960 const unsigned char *cp;
962 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
963 return ((float)cp[0]);
967 // get individual values, not scaled
968 int UI_GetThemeValue(int colorid)
970 const unsigned char *cp;
972 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
973 return ((int) cp[0]);
978 // get the color, range 0.0-1.0
979 void UI_GetThemeColor3fv(int colorid, float *col)
981 const unsigned char *cp;
983 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
984 col[0]= ((float)cp[0])/255.0f;
985 col[1]= ((float)cp[1])/255.0f;
986 col[2]= ((float)cp[2])/255.0f;
989 // get the color, range 0.0-1.0, complete with shading offset
990 void UI_GetThemeColorShade3fv(int colorid, int offset, float *col)
993 const unsigned char *cp;
995 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
997 r= offset + (int) cp[0];
999 g= offset + (int) cp[1];
1001 b= offset + (int) cp[2];
1004 col[0]= ((float)r)/255.0f;
1005 col[1]= ((float)g)/255.0f;
1006 col[2]= ((float)b)/255.0f;
1009 // get the color, in char pointer
1010 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
1012 const unsigned char *cp;
1014 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1020 // get the color, in char pointer
1021 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
1023 const unsigned char *cp;
1025 cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1032 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
1034 const unsigned char *cp;
1036 cp= UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
1043 // blends and shades between two char color pointers
1044 void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset)
1047 CLAMP(fac, 0.0f, 1.0f);
1048 r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
1049 g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
1050 b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
1052 r= r<0?0:(r>255?255:r);
1053 g= g<0?0:(g>255?255:g);
1054 b= b<0?0:(b>255?255:b);
1056 glColor3ub(r, g, b);
1059 void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset)
1063 r= offset+(int)cp[0];
1064 g= offset+(int)cp[1];
1065 b= offset+(int)cp[2];
1076 // get a 3 byte color, blended and shaded between two other char color pointers
1077 void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset)
1081 CLAMP(fac, 0.0f, 1.0f);
1082 r= offset+floor((1.0f-fac)*cp1[0] + fac*cp2[0]);
1083 g= offset+floor((1.0f-fac)*cp1[1] + fac*cp2[1]);
1084 b= offset+floor((1.0f-fac)*cp1[2] + fac*cp2[2]);
1095 void UI_ThemeClearColor(int colorid)
1099 UI_GetThemeColor3fv(colorid, col);
1100 glClearColor(col[0], col[1], col[2], 0.0);
1103 void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
1108 dst_col[0]= src_col[0]>219?255:src_col[0]+36;
1109 dst_col[1]= src_col[1]<26?0:src_col[1]-26;
1110 dst_col[2]= src_col[2]<26?0:src_col[2]-26;
1113 dst_col[0]= src_col[0]<46?0:src_col[0]-36;
1114 dst_col[1]= src_col[1]>189?255:src_col[1]+66;
1115 dst_col[2]= src_col[2]<46?0:src_col[2]-36;
1118 dst_col[0]= src_col[0]<26?0:src_col[0]-26;
1119 dst_col[1]= src_col[1]<26?0:src_col[1]-26;
1120 dst_col[2]= src_col[2]>209?255:src_col[2]+46;
1123 BLI_assert(!"invalid axis arg");
1127 /* ************************************************************* */
1129 /* patching UserDef struct and Themes */
1130 void init_userdef_do_versions(void)
1132 Main *bmain= G.main;
1135 /* the UserDef struct is not corrected with do_versions() .... ugh! */
1136 if(U.wheellinescroll == 0) U.wheellinescroll = 3;
1137 if(U.menuthreshold1==0) {
1138 U.menuthreshold1= 5;
1139 U.menuthreshold2= 2;
1141 if(U.tb_leftmouse==0) {
1145 if(U.mixbufsize==0) U.mixbufsize= 2048;
1146 if (strcmp(U.tempdir, "/") == 0) {
1147 BLI_system_temporary_dir(U.tempdir);
1149 if (U.autokey_mode == 0) {
1150 /* 'add/replace' but not on */
1153 if (U.savetime <= 0) {
1155 // XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
1157 /* transform widget settings */
1158 if(U.tw_hotspot==0) {
1160 U.tw_size= 20; // percentage of window size
1161 U.tw_handlesize= 16; // percentage of widget radius
1163 if(U.pad_rot_angle==0)
1164 U.pad_rot_angle= 15;
1166 /* signal for derivedmesh to use colorband */
1167 /* run incase this was on and is now off in the user prefs [#28096] */
1168 vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
1170 if (bmain->versionfile <= 191) {
1171 BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir));
1172 strcpy(U.sounddir, "/");
1175 /* patch to set Dupli Armature */
1176 if (bmain->versionfile < 220) {
1177 U.dupflag |= USER_DUP_ARM;
1180 /* added seam, normal color, undo */
1181 if (bmain->versionfile <= 234) {
1184 U.uiflag |= USER_GLOBALUNDO;
1185 if (U.undosteps==0) U.undosteps=32;
1187 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1188 /* check for alpha==0 is safe, then color was never set */
1189 if(btheme->tv3d.edge_seam[3]==0) {
1190 SETCOL(btheme->tv3d.edge_seam, 230, 150, 50, 255);
1192 if(btheme->tv3d.normal[3]==0) {
1193 SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
1195 if(btheme->tv3d.vertex_normal[3]==0) {
1196 SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
1198 if(btheme->tv3d.face_dot[3]==0) {
1199 SETCOL(btheme->tv3d.face_dot, 255, 138, 48, 255);
1200 btheme->tv3d.facedot_size= 4;
1204 if (bmain->versionfile <= 235) {
1205 /* illegal combo... */
1206 if (U.flag & USER_LMOUSESELECT)
1207 U.flag &= ~USER_TWOBUTTONMOUSE;
1209 if (bmain->versionfile <= 236) {
1211 /* new space type */
1212 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1213 /* check for alpha==0 is safe, then color was never set */
1214 if(btheme->ttime.back[3]==0) {
1215 // copied from ui_theme_init_default
1216 btheme->ttime= btheme->tv3d;
1217 SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
1218 SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
1219 SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
1221 if(btheme->text.syntaxn[3]==0) {
1222 SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
1223 SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
1224 SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
1225 SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
1226 SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
1230 if (bmain->versionfile <= 237) {
1233 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1234 /* check for alpha==0 is safe, then color was never set */
1235 if(btheme->tv3d.bone_solid[3]==0) {
1236 SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
1237 SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);
1241 if (bmain->versionfile <= 238) {
1244 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1245 /* check for alpha==0 is safe, then color was never set */
1246 if(btheme->tnla.strip[3]==0) {
1247 SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
1248 SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
1252 if (bmain->versionfile <= 239) {
1255 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1256 /* Lamp theme, check for alpha==0 is safe, then color was never set */
1257 if(btheme->tv3d.lamp[3]==0) {
1258 SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
1259 /* TEMPORAL, remove me! (ton) */
1260 U.uiflag |= USER_PLAINMENUS;
1264 if(U.obcenter_dia==0) U.obcenter_dia= 6;
1266 if (bmain->versionfile <= 241) {
1268 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1269 /* Node editor theme, check for alpha==0 is safe, then color was never set */
1270 if(btheme->tnode.syntaxn[3]==0) {
1271 /* re-uses syntax color storage */
1272 btheme->tnode= btheme->tv3d;
1273 SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
1274 SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
1275 SETCOL(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
1276 SETCOL(btheme->tnode.syntaxb, 127,127,127, 255); /* operator */
1277 SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
1278 SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
1280 /* Group theme colors */
1281 if(btheme->tv3d.group[3]==0) {
1282 SETCOL(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
1283 SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
1285 /* Sequence editor theme*/
1286 if(btheme->tseq.movie[3]==0) {
1287 SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
1288 SETCOL(btheme->tseq.image, 109, 88, 129, 255);
1289 SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
1290 SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
1291 SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
1292 SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
1293 SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
1294 SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
1298 /* set defaults for 3D View rotating axis indicator */
1299 /* since size can't be set to 0, this indicates it's not saved in startup.blend */
1300 if (U.rvisize == 0) {
1303 U.uiflag |= USER_SHOW_ROTVIEWICON;
1307 if (bmain->versionfile <= 242) {
1310 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1311 /* long keyframe color */
1312 /* check for alpha==0 is safe, then color was never set */
1313 if(btheme->tact.strip[3]==0) {
1314 SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
1315 SETCOL(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
1316 SETCOL(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
1319 /* IPO-Editor - Vertex Size*/
1320 if(btheme->tipo.vertex_size == 0) {
1321 btheme->tipo.vertex_size= 3;
1325 if (bmain->versionfile <= 243) {
1326 /* set default number of recently-used files (if not set) */
1327 if (U.recent_files == 0) U.recent_files = 10;
1329 if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) {
1331 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1332 SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
1334 if(U.coba_weight.tot==0)
1335 init_colorband(&U.coba_weight, 1);
1337 if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
1339 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1340 /* these should all use the same color */
1341 SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
1342 SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
1343 SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
1344 SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
1345 SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
1346 //SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
1347 SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
1350 if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) {
1352 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1353 /* action channel groups (recolor anyway) */
1354 SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
1355 SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
1357 /* bone custom-color sets */
1358 if (btheme->tarm[0].solid[3] == 0)
1359 ui_theme_init_boneColorSets(btheme);
1362 if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 16)) {
1363 U.flag |= USER_ADD_VIEWALIGNED|USER_ADD_EDITMODE;
1365 if ((bmain->versionfile < 247) || (bmain->versionfile == 247 && bmain->subversionfile <= 2)) {
1369 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1372 /* IPO Editor: Handles/Vertices */
1373 col = btheme->tipo.vertex;
1374 SETCOL(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
1375 col = btheme->tipo.vertex_select;
1376 SETCOL(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
1377 btheme->tipo.handle_vertex_size= btheme->tipo.vertex_size;
1379 /* Sequence/Image Editor: colors for GPencil text */
1380 col = btheme->tv3d.bone_pose;
1381 SETCOL(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
1382 SETCOL(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
1383 col = btheme->tv3d.vertex_select;
1384 SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
1387 if (bmain->versionfile < 250) {
1390 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1391 /* this was not properly initialized in 2.45 */
1392 if(btheme->tima.face_dot[3]==0) {
1393 SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
1394 SETCOL(btheme->tima.face_dot, 255, 133, 0, 255);
1395 btheme->tima.facedot_size= 2;
1398 /* DopeSheet - (Object) Channel color */
1399 SETCOL(btheme->tact.ds_channel, 82, 96, 110, 255);
1400 SETCOL(btheme->tact.ds_subchannel, 124, 137, 150, 255);
1401 /* DopeSheet - Group Channel color (saner version) */
1402 SETCOL(btheme->tact.group, 79, 101, 73, 255);
1403 SETCOL(btheme->tact.group_active, 135, 177, 125, 255);
1405 /* Graph Editor - (Object) Channel color */
1406 SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
1407 SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
1408 /* Graph Editor - Group Channel color */
1409 SETCOL(btheme->tipo.group, 79, 101, 73, 255);
1410 SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
1412 /* Nla Editor - (Object) Channel color */
1413 SETCOL(btheme->tnla.ds_channel, 82, 96, 110, 255);
1414 SETCOL(btheme->tnla.ds_subchannel, 124, 137, 150, 255);
1415 /* NLA Editor - New Strip colors */
1416 SETCOL(btheme->tnla.strip, 12, 10, 10, 128);
1417 SETCOL(btheme->tnla.strip_select, 255, 140, 0, 255);
1420 /* adjust grease-pencil distances */
1421 U.gp_manhattendist= 1;
1422 U.gp_euclideandist= 2;
1424 /* adjust default interpolation for new IPO-curves */
1425 U.ipo_new= BEZT_IPO_BEZ;
1428 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
1431 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1433 /* common (new) variables, it checks for alpha==0 */
1434 ui_theme_init_new(btheme);
1436 if(btheme->tui.wcol_num.outline[3]==0)
1437 ui_widget_color_init(&btheme->tui);
1439 /* Logic editor theme, check for alpha==0 is safe, then color was never set */
1440 if(btheme->tlogic.syntaxn[3]==0) {
1441 /* re-uses syntax color storage */
1442 btheme->tlogic= btheme->tv3d;
1443 SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
1446 SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
1447 SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
1451 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) {
1452 /* new audio system */
1453 if(U.audiochannels == 0)
1454 U.audiochannels = 2;
1455 if(U.audiodevice == 0) {
1463 if(U.audioformat == 0)
1464 U.audioformat = 0x24;
1465 if(U.audiorate == 0)
1466 U.audiorate = 44100;
1469 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 5))
1470 U.gameflags |= USER_DISABLE_VBO;
1472 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
1475 for(km=U.user_keymaps.first; km; km=km->next) {
1476 if (strcmp(km->idname, "Armature_Sketch")==0)
1477 strcpy(km->idname, "Armature Sketch");
1478 else if (strcmp(km->idname, "View3D")==0)
1479 strcpy(km->idname, "3D View");
1480 else if (strcmp(km->idname, "View3D Generic")==0)
1481 strcpy(km->idname, "3D View Generic");
1482 else if (strcmp(km->idname, "EditMesh")==0)
1483 strcpy(km->idname, "Mesh");
1484 else if (strcmp(km->idname, "TimeLine")==0)
1485 strcpy(km->idname, "Timeline");
1486 else if (strcmp(km->idname, "UVEdit")==0)
1487 strcpy(km->idname, "UV Editor");
1488 else if (strcmp(km->idname, "Animation_Channels")==0)
1489 strcpy(km->idname, "Animation Channels");
1490 else if (strcmp(km->idname, "GraphEdit Keys")==0)
1491 strcpy(km->idname, "Graph Editor");
1492 else if (strcmp(km->idname, "GraphEdit Generic")==0)
1493 strcpy(km->idname, "Graph Editor Generic");
1494 else if (strcmp(km->idname, "Action_Keys")==0)
1495 strcpy(km->idname, "Dopesheet");
1496 else if (strcmp(km->idname, "NLA Data")==0)
1497 strcpy(km->idname, "NLA Editor");
1498 else if (strcmp(km->idname, "Node Generic")==0)
1499 strcpy(km->idname, "Node Editor");
1500 else if (strcmp(km->idname, "Logic Generic")==0)
1501 strcpy(km->idname, "Logic Editor");
1502 else if (strcmp(km->idname, "File")==0)
1503 strcpy(km->idname, "File Browser");
1504 else if (strcmp(km->idname, "FileMain")==0)
1505 strcpy(km->idname, "File Browser Main");
1506 else if (strcmp(km->idname, "FileButtons")==0)
1507 strcpy(km->idname, "File Browser Buttons");
1508 else if (strcmp(km->idname, "Buttons Generic")==0)
1509 strcpy(km->idname, "Property Editor");
1512 if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) {
1513 if(U.wmdrawmethod == USER_DRAW_TRIPLE)
1514 U.wmdrawmethod = USER_DRAW_AUTOMATIC;
1517 if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 3)) {
1518 if (U.flag & USER_LMOUSESELECT)
1519 U.flag &= ~USER_TWOBUTTONMOUSE;
1521 if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 4)) {
1524 /* default new handle type is auto handles */
1525 U.keyhandles_new = HD_AUTO;
1527 /* init new curve colors */
1528 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1529 /* init colors used for handles in 3D-View */
1530 SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
1531 SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
1532 SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
1533 SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
1534 SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
1535 SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
1536 SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
1537 SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
1538 SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
1540 /* same colors again for Graph Editor... */
1541 SETCOL(btheme->tipo.handle_free, 0, 0, 0, 255);
1542 SETCOL(btheme->tipo.handle_auto, 0x90, 0x90, 0x00, 255);
1543 SETCOL(btheme->tipo.handle_vect, 0x40, 0x90, 0x30, 255);
1544 SETCOL(btheme->tipo.handle_align, 0x80, 0x30, 0x60, 255);
1545 SETCOL(btheme->tipo.handle_sel_free, 0, 0, 0, 255);
1546 SETCOL(btheme->tipo.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
1547 SETCOL(btheme->tipo.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
1548 SETCOL(btheme->tipo.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
1551 SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
1554 if (bmain->versionfile <= 252) {
1557 /* init new curve colors */
1558 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1559 if (btheme->tv3d.lastsel_point[3] == 0)
1560 SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
1563 if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
1566 /* interface_widgets.c */
1567 struct uiWidgetColors wcol_progress= {
1569 {190, 190, 190, 255},
1570 {100, 100, 100, 180},
1574 {255, 255, 255, 255},
1580 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1581 /* init progress bar theme */
1582 btheme->tui.wcol_progress= wcol_progress;
1586 if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
1588 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1589 SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
1590 SETCOL(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
1591 SETCOL(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
1595 if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 4)) {
1597 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1598 if((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
1602 if (bmain->versionfile < 257) {
1603 /* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
1604 U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
1607 if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
1609 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1610 btheme->tnode.noodle_curving = 5;
1614 if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
1617 /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead */
1618 if (U.keyhandles_new == HD_AUTO)
1619 U.keyhandles_new = HD_AUTO_ANIM;
1621 /* theme color additions */
1622 for (btheme= U.themes.first; btheme; btheme= btheme->next) {
1623 /* auto-clamped handles -> based on auto */
1624 SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
1625 SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
1629 if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
1632 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1633 btheme->tv3d.speaker[3] = 255;
1639 for(btheme= U.themes.first; btheme; btheme= btheme->next) {
1640 if(btheme->tv3d.bundle_solid[3] == 0)
1641 SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
1643 if(btheme->tv3d.camera_path[3] == 0)
1644 SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
1646 if((btheme->tclip.back[3]) == 0) {
1647 btheme->tclip= btheme->tv3d;
1649 SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
1650 SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
1651 SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
1652 SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
1653 SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
1654 SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
1655 SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
1656 SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
1657 SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
1658 SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
1659 SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
1660 SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
1661 btheme->tclip.handle_vertex_size= 4;
1666 /* GL Texture Garbage Collection (variable abused above!) */
1667 if (U.textimeout == 0) {
1668 U.texcollectrate = 60;
1671 if (U.memcachelimit <= 0) {
1672 U.memcachelimit = 32;
1674 if (U.frameserverport == 0) {
1675 U.frameserverport = 8080;
1677 if (U.dbl_click_time == 0) {
1678 U.dbl_click_time = 350;
1680 if (U.anim_player_preset == 0) {
1681 U.anim_player_preset = 1 ;
1683 if (U.scrcastfps == 0) {
1687 if (U.v2d_min_gridsize == 0) {
1688 U.v2d_min_gridsize= 35;
1690 if (U.dragthreshold == 0 )
1692 if (U.widget_unit==0)
1693 U.widget_unit= (U.dpi * 20 + 36)/72;
1694 if (U.anisotropic_filter <= 0)
1695 U.anisotropic_filter = 1;
1697 if (U.ndof_sensitivity == 0.0f) {
1698 U.ndof_sensitivity = 1.0f;
1699 U.ndof_flag = NDOF_LOCK_HORIZON |
1700 NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
1703 /* funny name, but it is GE stuff, moves userdef stuff to engine */
1704 // XXX space_set_commmandline_options();
1705 /* this timer uses U */
1706 // XXX reset_autosave();