Cleanup: manually remove header text not handled by automation
[blender.git] / source / blender / editors / interface / resources.c
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19
20 /** \file blender/editors/interface/resources.c
21  *  \ingroup edinterface
22  */
23
24 #include <math.h>
25 #include <stdlib.h>
26 #include <string.h>
27
28 #include "MEM_guardedalloc.h"
29
30 #include "DNA_screen_types.h"
31 #include "DNA_space_types.h"
32 #include "DNA_userdef_types.h"
33
34 #include "BLI_blenlib.h"
35 #include "BLI_utildefines.h"
36 #include "BLI_math.h"
37
38 #include "BKE_addon.h"
39 #include "BKE_appdir.h"
40 #include "BKE_main.h"
41 #include "BKE_mesh_runtime.h"
42
43 #include "BLO_readfile.h"  /* for UserDef version patching. */
44
45 #include "BLF_api.h"
46
47 #include "ED_screen.h"
48
49 #include "UI_interface.h"
50 #include "UI_interface_icons.h"
51
52 #include "interface_intern.h"
53 #include "GPU_framebuffer.h"
54
55 /* global for themes */
56 typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
57
58 /* be sure to keep 'bThemeState' in sync */
59 static struct bThemeState g_theme_state = {
60     NULL,
61     SPACE_VIEW3D,
62     RGN_TYPE_WINDOW,
63 };
64
65 #define theme_active g_theme_state.theme
66 #define theme_spacetype g_theme_state.spacetype
67 #define theme_regionid g_theme_state.regionid
68
69 void ui_resources_init(void)
70 {
71         UI_icons_init();
72 }
73
74 void ui_resources_free(void)
75 {
76         UI_icons_free();
77 }
78
79
80 /* ******************************************************** */
81 /*    THEMES */
82 /* ******************************************************** */
83
84 const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
85 {
86         ThemeSpace *ts = NULL;
87         static char error[4] = {240, 0, 240, 255};
88         static char alert[4] = {240, 60, 60, 255};
89         static char headerdesel[4] = {0, 0, 0, 255};
90         static char back[4] = {0, 0, 0, 255};
91         static char setting = 0;
92         const char *cp = error;
93
94         /* ensure we're not getting a color after running BKE_blender_userdef_free */
95         BLI_assert(BLI_findindex(&U.themes, theme_active) != -1);
96         BLI_assert(colorid != TH_UNDEFINED);
97
98         if (btheme) {
99
100                 /* first check for ui buttons theme */
101                 if (colorid < TH_THEMEUI) {
102
103                         switch (colorid) {
104
105                                 case TH_REDALERT:
106                                         cp = alert; break;
107                         }
108                 }
109                 else {
110
111                         switch (spacetype) {
112                                 case SPACE_BUTS:
113                                         ts = &btheme->tbuts;
114                                         break;
115                                 case SPACE_VIEW3D:
116                                         ts = &btheme->tv3d;
117                                         break;
118                                 case SPACE_IPO:
119                                         ts = &btheme->tipo;
120                                         break;
121                                 case SPACE_FILE:
122                                         ts = &btheme->tfile;
123                                         break;
124                                 case SPACE_NLA:
125                                         ts = &btheme->tnla;
126                                         break;
127                                 case SPACE_ACTION:
128                                         ts = &btheme->tact;
129                                         break;
130                                 case SPACE_SEQ:
131                                         ts = &btheme->tseq;
132                                         break;
133                                 case SPACE_IMAGE:
134                                         ts = &btheme->tima;
135                                         break;
136                                 case SPACE_TEXT:
137                                         ts = &btheme->text;
138                                         break;
139                                 case SPACE_OUTLINER:
140                                         ts = &btheme->toops;
141                                         break;
142                                 case SPACE_INFO:
143                                         ts = &btheme->tinfo;
144                                         break;
145                                 case SPACE_USERPREF:
146                                         ts = &btheme->tuserpref;
147                                         break;
148                                 case SPACE_CONSOLE:
149                                         ts = &btheme->tconsole;
150                                         break;
151                                 case SPACE_NODE:
152                                         ts = &btheme->tnode;
153                                         break;
154                                 case SPACE_CLIP:
155                                         ts = &btheme->tclip;
156                                         break;
157                                 case SPACE_TOPBAR:
158                                         ts = &btheme->ttopbar;
159                                         break;
160                                 case SPACE_STATUSBAR:
161                                         ts = &btheme->tstatusbar;
162                                         break;
163                                 default:
164                                         ts = &btheme->tv3d;
165                                         break;
166                         }
167
168                         switch (colorid) {
169                                 case TH_BACK:
170                                         if (ELEM(theme_regionid, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW))
171                                                 cp = ts->back;
172                                         else if (theme_regionid == RGN_TYPE_CHANNELS)
173                                                 cp = ts->list;
174                                         else if (theme_regionid == RGN_TYPE_HEADER)
175                                                 cp = ts->header;
176                                         else if (theme_regionid == RGN_TYPE_NAV_BAR)
177                                                 cp = ts->navigation_bar;
178                                         else if (theme_regionid == RGN_TYPE_EXECUTE)
179                                                 cp = ts->execution_buts;
180                                         else
181                                                 cp = ts->button;
182
183                                         copy_v4_v4_char(back, cp);
184                                         if (!ED_region_is_overlap(spacetype, theme_regionid)) {
185                                                 back[3] = 255;
186                                         }
187                                         cp = back;
188                                         break;
189                                 case TH_BACK_GRAD:
190                                         cp = ts->back_grad;
191                                         break;
192
193                                 case TH_SHOW_BACK_GRAD:
194                                         cp = &setting;
195                                         setting = ts->show_back_grad;
196                                         break;
197                                 case TH_TEXT:
198                                         if (theme_regionid == RGN_TYPE_WINDOW)
199                                                 cp = ts->text;
200                                         else if (theme_regionid == RGN_TYPE_CHANNELS)
201                                                 cp = ts->list_text;
202                                         else if (theme_regionid == RGN_TYPE_HEADER)
203                                                 cp = ts->header_text;
204                                         else
205                                                 cp = ts->button_text;
206                                         break;
207                                 case TH_TEXT_HI:
208                                         if (theme_regionid == RGN_TYPE_WINDOW)
209                                                 cp = ts->text_hi;
210                                         else if (theme_regionid == RGN_TYPE_CHANNELS)
211                                                 cp = ts->list_text_hi;
212                                         else if (theme_regionid == RGN_TYPE_HEADER)
213                                                 cp = ts->header_text_hi;
214                                         else
215                                                 cp = ts->button_text_hi;
216                                         break;
217                                 case TH_TITLE:
218                                         if (theme_regionid == RGN_TYPE_WINDOW)
219                                                 cp = ts->title;
220                                         else if (theme_regionid == RGN_TYPE_CHANNELS)
221                                                 cp = ts->list_title;
222                                         else if (theme_regionid == RGN_TYPE_HEADER)
223                                                 cp = ts->header_title;
224                                         else
225                                                 cp = ts->button_title;
226                                         break;
227
228                                 case TH_HEADER:
229                                         cp = ts->header; break;
230                                 case TH_HEADERDESEL:
231                                         /* we calculate a dynamic builtin header deselect color,
232                                          * also for pulldowns... */
233                                         cp = ts->header;
234                                         headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
235                                         headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
236                                         headerdesel[2] = cp[2] > 10 ? cp[2] - 10 : 0;
237                                         headerdesel[3] = cp[3];
238                                         cp = headerdesel;
239                                         break;
240                                 case TH_HEADER_TEXT:
241                                         cp = ts->header_text; break;
242                                 case TH_HEADER_TEXT_HI:
243                                         cp = ts->header_text_hi; break;
244
245                                 case TH_PANEL_HEADER:
246                                         cp = ts->panelcolors.header; break;
247                                 case TH_PANEL_BACK:
248                                         cp = ts->panelcolors.back; break;
249                                 case TH_PANEL_SUB_BACK:
250                                         cp = ts->panelcolors.sub_back; break;
251
252                                 case TH_BUTBACK:
253                                         cp = ts->button; break;
254                                 case TH_BUTBACK_TEXT:
255                                         cp = ts->button_text; break;
256                                 case TH_BUTBACK_TEXT_HI:
257                                         cp = ts->button_text_hi; break;
258
259                                 case TH_TAB_ACTIVE:
260                                         cp = ts->tab_active; break;
261                                 case TH_TAB_INACTIVE:
262                                         cp = ts->tab_inactive; break;
263                                 case TH_TAB_BACK:
264                                         cp = ts->tab_back; break;
265                                 case TH_TAB_OUTLINE:
266                                         cp = ts->tab_outline; break;
267
268                                 case TH_SHADE1:
269                                         cp = ts->shade1; break;
270                                 case TH_SHADE2:
271                                         cp = ts->shade2; break;
272                                 case TH_HILITE:
273                                         cp = ts->hilite; break;
274
275                                 case TH_GRID:
276                                         cp = ts->grid; break;
277                                 case TH_VIEW_OVERLAY:
278                                         cp = ts->view_overlay; break;
279                                 case TH_WIRE:
280                                         cp = ts->wire; break;
281                                 case TH_WIRE_INNER:
282                                         cp = ts->syntaxr; break;
283                                 case TH_WIRE_EDIT:
284                                         cp = ts->wire_edit; break;
285                                 case TH_LAMP:
286                                         cp = ts->lamp; break;
287                                 case TH_SPEAKER:
288                                         cp = ts->speaker; break;
289                                 case TH_CAMERA:
290                                         cp = ts->camera; break;
291                                 case TH_EMPTY:
292                                         cp = ts->empty; break;
293                                 case TH_SELECT:
294                                         cp = ts->select; break;
295                                 case TH_ACTIVE:
296                                         cp = ts->active; break;
297                                 case TH_GROUP:
298                                         cp = ts->group; break;
299                                 case TH_GROUP_ACTIVE:
300                                         cp = ts->group_active; break;
301                                 case TH_TRANSFORM:
302                                         cp = ts->transform; break;
303                                 case TH_VERTEX:
304                                         cp = ts->vertex; break;
305                                 case TH_VERTEX_SELECT:
306                                         cp = ts->vertex_select; break;
307                                 case TH_VERTEX_BEVEL:
308                                         cp = ts->vertex_bevel; break;
309                                 case TH_VERTEX_UNREFERENCED:
310                                         cp = ts->vertex_unreferenced; break;
311                                 case TH_VERTEX_SIZE:
312                                         cp = &ts->vertex_size; break;
313                                 case TH_OUTLINE_WIDTH:
314                                         cp = &ts->outline_width; break;
315                                 case TH_EDGE:
316                                         cp = ts->edge; break;
317                                 case TH_EDGE_SELECT:
318                                         cp = ts->edge_select; break;
319                                 case TH_EDGE_SEAM:
320                                         cp = ts->edge_seam; break;
321                                 case TH_EDGE_SHARP:
322                                         cp = ts->edge_sharp; break;
323                                 case TH_EDGE_CREASE:
324                                         cp = ts->edge_crease; break;
325                                 case TH_EDGE_BEVEL:
326                                         cp = ts->edge_bevel; break;
327                                 case TH_EDITMESH_ACTIVE:
328                                         cp = ts->editmesh_active; break;
329                                 case TH_EDGE_FACESEL:
330                                         cp = ts->edge_facesel; break;
331                                 case TH_FACE:
332                                         cp = ts->face; break;
333                                 case TH_FACE_SELECT:
334                                         cp = ts->face_select; break;
335                                 case TH_FACE_DOT:
336                                         cp = ts->face_dot; break;
337                                 case TH_FACEDOT_SIZE:
338                                         cp = &ts->facedot_size; break;
339                                 case TH_DRAWEXTRA_EDGELEN:
340                                         cp = ts->extra_edge_len; break;
341                                 case TH_DRAWEXTRA_EDGEANG:
342                                         cp = ts->extra_edge_angle; break;
343                                 case TH_DRAWEXTRA_FACEAREA:
344                                         cp = ts->extra_face_area; break;
345                                 case TH_DRAWEXTRA_FACEANG:
346                                         cp = ts->extra_face_angle; break;
347                                 case TH_NORMAL:
348                                         cp = ts->normal; break;
349                                 case TH_VNORMAL:
350                                         cp = ts->vertex_normal; break;
351                                 case TH_LNORMAL:
352                                         cp = ts->loop_normal; break;
353                                 case TH_BONE_SOLID:
354                                         cp = ts->bone_solid; break;
355                                 case TH_BONE_POSE:
356                                         cp = ts->bone_pose; break;
357                                 case TH_BONE_POSE_ACTIVE:
358                                         cp = ts->bone_pose_active; break;
359                                 case TH_STRIP:
360                                         cp = ts->strip; break;
361                                 case TH_STRIP_SELECT:
362                                         cp = ts->strip_select; break;
363                                 case TH_KEYTYPE_KEYFRAME:
364                                         cp = ts->keytype_keyframe; break;
365                                 case TH_KEYTYPE_KEYFRAME_SELECT:
366                                         cp = ts->keytype_keyframe_select; break;
367                                 case TH_KEYTYPE_EXTREME:
368                                         cp = ts->keytype_extreme; break;
369                                 case TH_KEYTYPE_EXTREME_SELECT:
370                                         cp = ts->keytype_extreme_select; break;
371                                 case TH_KEYTYPE_BREAKDOWN:
372                                         cp = ts->keytype_breakdown; break;
373                                 case TH_KEYTYPE_BREAKDOWN_SELECT:
374                                         cp = ts->keytype_breakdown_select; break;
375                                 case TH_KEYTYPE_JITTER:
376                                         cp = ts->keytype_jitter; break;
377                                 case TH_KEYTYPE_JITTER_SELECT:
378                                         cp = ts->keytype_jitter_select; break;
379                                 case TH_KEYTYPE_MOVEHOLD:
380                                         cp = ts->keytype_movehold; break;
381                                 case TH_KEYTYPE_MOVEHOLD_SELECT:
382                                         cp = ts->keytype_movehold_select; break;
383                                 case TH_KEYBORDER:
384                                         cp = ts->keyborder; break;
385                                 case TH_KEYBORDER_SELECT:
386                                         cp = ts->keyborder_select; break;
387                                 case TH_CFRAME:
388                                         cp = ts->cframe; break;
389                                 case TH_TIME_KEYFRAME:
390                                         cp = ts->time_keyframe; break;
391                                 case TH_TIME_GP_KEYFRAME:
392                                         cp = ts->time_gp_keyframe; break;
393                                 case TH_NURB_ULINE:
394                                         cp = ts->nurb_uline; break;
395                                 case TH_NURB_VLINE:
396                                         cp = ts->nurb_vline; break;
397                                 case TH_NURB_SEL_ULINE:
398                                         cp = ts->nurb_sel_uline; break;
399                                 case TH_NURB_SEL_VLINE:
400                                         cp = ts->nurb_sel_vline; break;
401                                 case TH_ACTIVE_SPLINE:
402                                         cp = ts->act_spline; break;
403                                 case TH_ACTIVE_VERT:
404                                         cp = ts->lastsel_point; break;
405                                 case TH_HANDLE_FREE:
406                                         cp = ts->handle_free; break;
407                                 case TH_HANDLE_AUTO:
408                                         cp = ts->handle_auto; break;
409                                 case TH_HANDLE_AUTOCLAMP:
410                                         cp = ts->handle_auto_clamped; break;
411                                 case TH_HANDLE_VECT:
412                                         cp = ts->handle_vect; break;
413                                 case TH_HANDLE_ALIGN:
414                                         cp = ts->handle_align; break;
415                                 case TH_HANDLE_SEL_FREE:
416                                         cp = ts->handle_sel_free; break;
417                                 case TH_HANDLE_SEL_AUTO:
418                                         cp = ts->handle_sel_auto; break;
419                                 case TH_HANDLE_SEL_AUTOCLAMP:
420                                         cp = ts->handle_sel_auto_clamped; break;
421                                 case TH_HANDLE_SEL_VECT:
422                                         cp = ts->handle_sel_vect; break;
423                                 case TH_HANDLE_SEL_ALIGN:
424                                         cp = ts->handle_sel_align; break;
425                                 case TH_FREESTYLE_EDGE_MARK:
426                                         cp = ts->freestyle_edge_mark; break;
427                                 case TH_FREESTYLE_FACE_MARK:
428                                         cp = ts->freestyle_face_mark; break;
429
430                                 case TH_SYNTAX_B:
431                                         cp = ts->syntaxb; break;
432                                 case TH_SYNTAX_V:
433                                         cp = ts->syntaxv; break;
434                                 case TH_SYNTAX_C:
435                                         cp = ts->syntaxc; break;
436                                 case TH_SYNTAX_L:
437                                         cp = ts->syntaxl; break;
438                                 case TH_SYNTAX_D:
439                                         cp = ts->syntaxd; break;
440                                 case TH_SYNTAX_R:
441                                         cp = ts->syntaxr; break;
442                                 case TH_SYNTAX_N:
443                                         cp = ts->syntaxn; break;
444                                 case TH_SYNTAX_S:
445                                         cp = ts->syntaxs; break;
446
447                                 case TH_NODE:
448                                         cp = ts->syntaxl; break;
449                                 case TH_NODE_INPUT:
450                                         cp = ts->syntaxn; break;
451                                 case TH_NODE_OUTPUT:
452                                         cp = ts->nodeclass_output; break;
453                                 case TH_NODE_COLOR:
454                                         cp = ts->syntaxb; break;
455                                 case TH_NODE_FILTER:
456                                         cp = ts->nodeclass_filter; break;
457                                 case TH_NODE_VECTOR:
458                                         cp = ts->nodeclass_vector; break;
459                                 case TH_NODE_TEXTURE:
460                                         cp = ts->nodeclass_texture; break;
461                                 case TH_NODE_PATTERN:
462                                         cp = ts->nodeclass_pattern; break;
463                                 case TH_NODE_SCRIPT:
464                                         cp = ts->nodeclass_script; break;
465                                 case TH_NODE_LAYOUT:
466                                         cp = ts->nodeclass_layout; break;
467                                 case TH_NODE_SHADER:
468                                         cp = ts->nodeclass_shader; break;
469                                 case TH_NODE_CONVERTOR:
470                                         cp = ts->syntaxv; break;
471                                 case TH_NODE_GROUP:
472                                         cp = ts->syntaxc; break;
473                                 case TH_NODE_INTERFACE:
474                                         cp = ts->console_output; break;
475                                 case TH_NODE_FRAME:
476                                         cp = ts->movie; break;
477                                 case TH_NODE_MATTE:
478                                         cp = ts->syntaxs; break;
479                                 case TH_NODE_DISTORT:
480                                         cp = ts->syntaxd; break;
481                                 case TH_NODE_CURVING:
482                                         cp = &ts->noodle_curving; break;
483
484                                 case TH_SEQ_MOVIE:
485                                         cp = ts->movie; break;
486                                 case TH_SEQ_MOVIECLIP:
487                                         cp = ts->movieclip; break;
488                                 case TH_SEQ_MASK:
489                                         cp = ts->mask; break;
490                                 case TH_SEQ_IMAGE:
491                                         cp = ts->image; break;
492                                 case TH_SEQ_SCENE:
493                                         cp = ts->scene; break;
494                                 case TH_SEQ_AUDIO:
495                                         cp = ts->audio; break;
496                                 case TH_SEQ_EFFECT:
497                                         cp = ts->effect; break;
498                                 case TH_SEQ_TRANSITION:
499                                         cp = ts->transition; break;
500                                 case TH_SEQ_META:
501                                         cp = ts->meta; break;
502                                 case TH_SEQ_TEXT:
503                                         cp = ts->text_strip; break;
504                                 case TH_SEQ_PREVIEW:
505                                         cp = ts->preview_back; break;
506
507                                 case TH_CONSOLE_OUTPUT:
508                                         cp = ts->console_output; break;
509                                 case TH_CONSOLE_INPUT:
510                                         cp = ts->console_input; break;
511                                 case TH_CONSOLE_INFO:
512                                         cp = ts->console_info; break;
513                                 case TH_CONSOLE_ERROR:
514                                         cp = ts->console_error; break;
515                                 case TH_CONSOLE_CURSOR:
516                                         cp = ts->console_cursor; break;
517                                 case TH_CONSOLE_SELECT:
518                                         cp = ts->console_select; break;
519
520                                 case TH_HANDLE_VERTEX:
521                                         cp = ts->handle_vertex;
522                                         break;
523                                 case TH_HANDLE_VERTEX_SELECT:
524                                         cp = ts->handle_vertex_select;
525                                         break;
526                                 case TH_HANDLE_VERTEX_SIZE:
527                                         cp = &ts->handle_vertex_size;
528                                         break;
529
530                                 case TH_GP_VERTEX:
531                                         cp = ts->gp_vertex;
532                                         break;
533                                 case TH_GP_VERTEX_SELECT:
534                                         cp = ts->gp_vertex_select;
535                                         break;
536                                 case TH_GP_VERTEX_SIZE:
537                                         cp = &ts->gp_vertex_size;
538                                         break;
539
540                                 case TH_DOPESHEET_CHANNELOB:
541                                         cp = ts->ds_channel;
542                                         break;
543                                 case TH_DOPESHEET_CHANNELSUBOB:
544                                         cp = ts->ds_subchannel;
545                                         break;
546                                 case TH_DOPESHEET_IPOLINE:
547                                         cp = ts->ds_ipoline;
548                                         break;
549
550                                 case TH_PREVIEW_BACK:
551                                         cp = ts->preview_back;
552                                         break;
553
554                                 case TH_STITCH_PREVIEW_FACE:
555                                         cp = ts->preview_stitch_face;
556                                         break;
557
558                                 case TH_STITCH_PREVIEW_EDGE:
559                                         cp = ts->preview_stitch_edge;
560                                         break;
561
562                                 case TH_STITCH_PREVIEW_VERT:
563                                         cp = ts->preview_stitch_vert;
564                                         break;
565
566                                 case TH_STITCH_PREVIEW_STITCHABLE:
567                                         cp = ts->preview_stitch_stitchable;
568                                         break;
569
570                                 case TH_STITCH_PREVIEW_UNSTITCHABLE:
571                                         cp = ts->preview_stitch_unstitchable;
572                                         break;
573                                 case TH_STITCH_PREVIEW_ACTIVE:
574                                         cp = ts->preview_stitch_active;
575                                         break;
576
577                                 case TH_PAINT_CURVE_HANDLE:
578                                         cp = ts->paint_curve_handle;
579                                         break;
580                                 case TH_PAINT_CURVE_PIVOT:
581                                         cp = ts->paint_curve_pivot;
582                                         break;
583
584                                 case TH_METADATA_BG:
585                                         cp = ts->metadatabg;
586                                         break;
587                                 case TH_METADATA_TEXT:
588                                         cp = ts->metadatatext;
589                                         break;
590
591                                 case TH_UV_OTHERS:
592                                         cp = ts->uv_others;
593                                         break;
594                                 case TH_UV_SHADOW:
595                                         cp = ts->uv_shadow;
596                                         break;
597
598                                 case TH_MARKER_OUTLINE:
599                                         cp = ts->marker_outline; break;
600                                 case TH_MARKER:
601                                         cp = ts->marker; break;
602                                 case TH_ACT_MARKER:
603                                         cp = ts->act_marker; break;
604                                 case TH_SEL_MARKER:
605                                         cp = ts->sel_marker; break;
606                                 case TH_BUNDLE_SOLID:
607                                         cp = ts->bundle_solid; break;
608                                 case TH_DIS_MARKER:
609                                         cp = ts->dis_marker; break;
610                                 case TH_PATH_BEFORE:
611                                         cp = ts->path_before; break;
612                                 case TH_PATH_AFTER:
613                                         cp = ts->path_after; break;
614                                 case TH_CAMERA_PATH:
615                                         cp = ts->camera_path; break;
616                                 case TH_LOCK_MARKER:
617                                         cp = ts->lock_marker; break;
618
619                                 case TH_MATCH:
620                                         cp = ts->match;
621                                         break;
622
623                                 case TH_SELECT_HIGHLIGHT:
624                                         cp = ts->selected_highlight;
625                                         break;
626
627                                 case TH_SKIN_ROOT:
628                                         cp = ts->skin_root;
629                                         break;
630
631                                 case TH_ANIM_ACTIVE:
632                                         cp = ts->anim_active;
633                                         break;
634                                 case TH_ANIM_INACTIVE:
635                                         cp = ts->anim_non_active;
636                                         break;
637                                 case TH_ANIM_PREVIEW_RANGE:
638                                         cp = ts->anim_preview_range;
639                                         break;
640
641                                 case TH_NLA_TWEAK:
642                                         cp = ts->nla_tweaking;
643                                         break;
644                                 case TH_NLA_TWEAK_DUPLI:
645                                         cp = ts->nla_tweakdupli;
646                                         break;
647
648                                 case TH_NLA_TRANSITION:
649                                         cp = ts->nla_transition;
650                                         break;
651                                 case TH_NLA_TRANSITION_SEL:
652                                         cp = ts->nla_transition_sel;
653                                         break;
654                                 case TH_NLA_META:
655                                         cp = ts->nla_meta;
656                                         break;
657                                 case TH_NLA_META_SEL:
658                                         cp = ts->nla_meta_sel;
659                                         break;
660                                 case TH_NLA_SOUND:
661                                         cp = ts->nla_sound;
662                                         break;
663                                 case TH_NLA_SOUND_SEL:
664                                         cp = ts->nla_sound_sel;
665                                         break;
666
667                                 case TH_WIDGET_EMBOSS:
668                                         cp = btheme->tui.widget_emboss; break;
669
670                                 case TH_EDITOR_OUTLINE:
671                                         cp = btheme->tui.editor_outline;
672                                         break;
673                                 case TH_AXIS_X:
674                                         cp = btheme->tui.xaxis; break;
675                                 case TH_AXIS_Y:
676                                         cp = btheme->tui.yaxis; break;
677                                 case TH_AXIS_Z:
678                                         cp = btheme->tui.zaxis; break;
679
680                                 case TH_GIZMO_HI:
681                                         cp = btheme->tui.gizmo_hi; break;
682                                 case TH_GIZMO_PRIMARY:
683                                         cp = btheme->tui.gizmo_primary; break;
684                                 case TH_GIZMO_SECONDARY:
685                                         cp = btheme->tui.gizmo_secondary; break;
686                                 case TH_GIZMO_A:
687                                         cp = btheme->tui.gizmo_a; break;
688                                 case TH_GIZMO_B:
689                                         cp = btheme->tui.gizmo_b; break;
690
691                                 case TH_ICON_COLLECTION:
692                                         cp = btheme->tui.icon_collection; break;
693                                 case TH_ICON_OBJECT:
694                                         cp = btheme->tui.icon_object; break;
695                                 case TH_ICON_OBJECT_DATA:
696                                         cp = btheme->tui.icon_object_data; break;
697                                 case TH_ICON_MODIFIER:
698                                         cp = btheme->tui.icon_modifier; break;
699                                 case TH_ICON_SHADING:
700                                         cp = btheme->tui.icon_shading; break;
701
702                                 case TH_INFO_SELECTED:
703                                         cp = ts->info_selected;
704                                         break;
705                                 case TH_INFO_SELECTED_TEXT:
706                                         cp = ts->info_selected_text;
707                                         break;
708                                 case TH_INFO_ERROR:
709                                         cp = ts->info_error;
710                                         break;
711                                 case TH_INFO_ERROR_TEXT:
712                                         cp = ts->info_error_text;
713                                         break;
714                                 case TH_INFO_WARNING:
715                                         cp = ts->info_warning;
716                                         break;
717                                 case TH_INFO_WARNING_TEXT:
718                                         cp = ts->info_warning_text;
719                                         break;
720                                 case TH_INFO_INFO:
721                                         cp = ts->info_info;
722                                         break;
723                                 case TH_INFO_INFO_TEXT:
724                                         cp = ts->info_info_text;
725                                         break;
726                                 case TH_INFO_DEBUG:
727                                         cp = ts->info_debug;
728                                         break;
729                                 case TH_INFO_DEBUG_TEXT:
730                                         cp = ts->info_debug_text;
731                                         break;
732                                 case TH_V3D_CLIPPING_BORDER:
733                                         cp = ts->clipping_border_3d;
734                                         break;
735                         }
736                 }
737         }
738
739         return (const uchar *)cp;
740 }
741
742 /**
743  * initialize default theme
744  * \note: when you add new colors, created & saved themes need initialized
745  * use function below, init_userdef_do_versions()
746  */
747 void ui_theme_init_default(void)
748 {
749
750         /* we search for the theme with name Default */
751         bTheme *btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
752         if (btheme == NULL) {
753                 btheme = MEM_callocN(sizeof(bTheme), __func__);
754                 BLI_addtail(&U.themes, btheme);
755         }
756
757         UI_SetTheme(0, 0);  /* make sure the global used in this file is set */
758
759         const int active_theme_area = btheme->active_theme_area;
760         memcpy(btheme, &U_theme_default, sizeof(*btheme));
761         btheme->active_theme_area = active_theme_area;
762 }
763
764 void ui_style_init_default(void)
765 {
766         BLI_freelistN(&U.uistyles);
767         /* gets automatically re-allocated */
768         uiStyleInit();
769 }
770
771
772 void UI_SetTheme(int spacetype, int regionid)
773 {
774         if (spacetype) {
775                 /* later on, a local theme can be found too */
776                 theme_active = U.themes.first;
777                 theme_spacetype = spacetype;
778                 theme_regionid = regionid;
779         }
780         else if (regionid) {
781                 /* popups */
782                 theme_active = U.themes.first;
783                 theme_spacetype = SPACE_BUTS;
784                 theme_regionid = regionid;
785         }
786         else {
787                 /* for safety, when theme was deleted */
788                 theme_active = U.themes.first;
789                 theme_spacetype = SPACE_VIEW3D;
790                 theme_regionid = RGN_TYPE_WINDOW;
791         }
792 }
793
794 bTheme *UI_GetTheme(void)
795 {
796         return U.themes.first;
797 }
798
799 /**
800  * for the rare case we need to temp swap in a different theme (offscreen render)
801  */
802 void UI_Theme_Store(struct bThemeState *theme_state)
803 {
804         *theme_state = g_theme_state;
805 }
806 void UI_Theme_Restore(struct bThemeState *theme_state)
807 {
808         g_theme_state = *theme_state;
809 }
810
811 void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, uchar col[4])
812 {
813         int r, g, b, a;
814         const uchar *cp;
815
816         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
817         r = coloffset + (int) cp[0];
818         CLAMP(r, 0, 255);
819         g = coloffset + (int) cp[1];
820         CLAMP(g, 0, 255);
821         b = coloffset + (int) cp[2];
822         CLAMP(b, 0, 255);
823         a = alphaoffset + (int) cp[3];
824         CLAMP(a, 0, 255);
825
826         col[0] = r;
827         col[1] = g;
828         col[2] = b;
829         col[3] = a;
830 }
831
832 void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, uchar col[3])
833 {
834         const uchar *cp1, *cp2;
835
836         cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
837         cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
838
839         CLAMP(fac, 0.0f, 1.0f);
840         col[0] = floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
841         col[1] = floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
842         col[2] = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
843 }
844
845 void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3])
846 {
847         const uchar *cp1, *cp2;
848
849         cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
850         cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
851
852         CLAMP(fac, 0.0f, 1.0f);
853         r_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f;
854         r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f;
855         r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
856 }
857
858 void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4])
859 {
860         const uchar *cp1, *cp2;
861
862         cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
863         cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
864
865         CLAMP(fac, 0.0f, 1.0f);
866         r_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f;
867         r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f;
868         r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
869         r_col[3] = ((1.0f - fac) * cp1[3] + fac * cp2[3]) / 255.0f;
870 }
871
872 void UI_FontThemeColor(int fontid, int colorid)
873 {
874         uchar color[4];
875         UI_GetThemeColor4ubv(colorid, color);
876         BLF_color4ubv(fontid, color);
877 }
878
879 /* get individual values, not scaled */
880 float UI_GetThemeValuef(int colorid)
881 {
882         const uchar *cp;
883
884         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
885         return ((float)cp[0]);
886 }
887
888 /* get individual values, not scaled */
889 int UI_GetThemeValue(int colorid)
890 {
891         const uchar *cp;
892
893         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
894         return ((int) cp[0]);
895 }
896
897 /* versions of the function above, which take a space-type */
898 float UI_GetThemeValueTypef(int colorid, int spacetype)
899 {
900         const uchar *cp;
901
902         cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
903         return ((float)cp[0]);
904 }
905
906 int UI_GetThemeValueType(int colorid, int spacetype)
907 {
908         const uchar *cp;
909
910         cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
911         return ((int)cp[0]);
912 }
913
914
915 /* get the color, range 0.0-1.0 */
916 void UI_GetThemeColor3fv(int colorid, float col[3])
917 {
918         const uchar *cp;
919
920         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
921         col[0] = ((float)cp[0]) / 255.0f;
922         col[1] = ((float)cp[1]) / 255.0f;
923         col[2] = ((float)cp[2]) / 255.0f;
924 }
925
926 void UI_GetThemeColor4fv(int colorid, float col[4])
927 {
928         const uchar *cp;
929
930         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
931         col[0] = ((float)cp[0]) / 255.0f;
932         col[1] = ((float)cp[1]) / 255.0f;
933         col[2] = ((float)cp[2]) / 255.0f;
934         col[3] = ((float)cp[3]) / 255.0f;
935 }
936
937 /* get the color, range 0.0-1.0, complete with shading offset */
938 void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
939 {
940         int r, g, b;
941         const uchar *cp;
942
943         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
944
945         r = offset + (int) cp[0];
946         CLAMP(r, 0, 255);
947         g = offset + (int) cp[1];
948         CLAMP(g, 0, 255);
949         b = offset + (int) cp[2];
950         CLAMP(b, 0, 255);
951
952         col[0] = ((float)r) / 255.0f;
953         col[1] = ((float)g) / 255.0f;
954         col[2] = ((float)b) / 255.0f;
955 }
956
957 void UI_GetThemeColorShade3ubv(int colorid, int offset, uchar col[3])
958 {
959         int r, g, b;
960         const uchar *cp;
961
962         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
963
964         r = offset + (int) cp[0];
965         CLAMP(r, 0, 255);
966         g = offset + (int) cp[1];
967         CLAMP(g, 0, 255);
968         b = offset + (int) cp[2];
969         CLAMP(b, 0, 255);
970
971         col[0] = r;
972         col[1] = g;
973         col[2] = b;
974 }
975
976 void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, uchar col[3])
977 {
978         const uchar *cp1, *cp2;
979
980         cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
981         cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
982
983         CLAMP(fac, 0.0f, 1.0f);
984
985         float blend[3];
986         blend[0] = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
987         blend[1] = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
988         blend[2] = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
989
990         unit_float_to_uchar_clamp_v3(col, blend);
991 }
992
993 void UI_GetThemeColorShade4ubv(int colorid, int offset, uchar col[4])
994 {
995         int r, g, b;
996         const uchar *cp;
997
998         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
999         r = offset + (int) cp[0];
1000         CLAMP(r, 0, 255);
1001         g = offset + (int) cp[1];
1002         CLAMP(g, 0, 255);
1003         b = offset + (int) cp[2];
1004         CLAMP(b, 0, 255);
1005
1006         col[0] = r;
1007         col[1] = g;
1008         col[2] = b;
1009         col[3] = cp[3];
1010 }
1011
1012 void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4])
1013 {
1014         int r, g, b, a;
1015         const uchar *cp;
1016
1017         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1018
1019         r = coloffset + (int) cp[0];
1020         CLAMP(r, 0, 255);
1021         g = coloffset + (int) cp[1];
1022         CLAMP(g, 0, 255);
1023         b = coloffset + (int) cp[2];
1024         CLAMP(b, 0, 255);
1025         a = alphaoffset + (int) cp[3];
1026         CLAMP(b, 0, 255);
1027
1028         col[0] = ((float)r) / 255.0f;
1029         col[1] = ((float)g) / 255.0f;
1030         col[2] = ((float)b) / 255.0f;
1031         col[3] = ((float)a) / 255.0f;
1032 }
1033
1034 void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3])
1035 {
1036         int r, g, b;
1037         const uchar *cp1, *cp2;
1038
1039         cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
1040         cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
1041
1042         CLAMP(fac, 0.0f, 1.0f);
1043
1044         r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
1045         CLAMP(r, 0, 255);
1046         g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
1047         CLAMP(g, 0, 255);
1048         b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
1049         CLAMP(b, 0, 255);
1050
1051         col[0] = ((float)r) / 255.0f;
1052         col[1] = ((float)g) / 255.0f;
1053         col[2] = ((float)b) / 255.0f;
1054 }
1055
1056 void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
1057 {
1058         int r, g, b, a;
1059         const uchar *cp1, *cp2;
1060
1061         cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
1062         cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
1063
1064         CLAMP(fac, 0.0f, 1.0f);
1065
1066         r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
1067         CLAMP(r, 0, 255);
1068         g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
1069         CLAMP(g, 0, 255);
1070         b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
1071         CLAMP(b, 0, 255);
1072         a = offset + floorf((1.0f - fac) * cp1[3] + fac * cp2[3]);
1073         CLAMP(a, 0, 255);
1074
1075         col[0] = ((float)r) / 255.0f;
1076         col[1] = ((float)g) / 255.0f;
1077         col[2] = ((float)b) / 255.0f;
1078         col[3] = ((float)a) / 255.0f;
1079 }
1080
1081 /* get the color, in char pointer */
1082 void UI_GetThemeColor3ubv(int colorid, uchar col[3])
1083 {
1084         const uchar *cp;
1085
1086         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1087         col[0] = cp[0];
1088         col[1] = cp[1];
1089         col[2] = cp[2];
1090 }
1091
1092 /* get the color, range 0.0-1.0, complete with shading offset */
1093 void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
1094 {
1095         int r, g, b, a;
1096         const uchar *cp;
1097
1098         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1099
1100         r = offset + (int) cp[0];
1101         CLAMP(r, 0, 255);
1102         g = offset + (int) cp[1];
1103         CLAMP(g, 0, 255);
1104         b = offset + (int) cp[2];
1105         CLAMP(b, 0, 255);
1106
1107         a = (int) cp[3]; /* no shading offset... */
1108         CLAMP(a, 0, 255);
1109
1110         col[0] = ((float)r) / 255.0f;
1111         col[1] = ((float)g) / 255.0f;
1112         col[2] = ((float)b) / 255.0f;
1113         col[3] = ((float)a) / 255.0f;
1114 }
1115
1116 /* get the color, in char pointer */
1117 void UI_GetThemeColor4ubv(int colorid, uchar col[4])
1118 {
1119         const uchar *cp;
1120
1121         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1122         col[0] = cp[0];
1123         col[1] = cp[1];
1124         col[2] = cp[2];
1125         col[3] = cp[3];
1126 }
1127
1128 void UI_GetThemeColorType3ubv(int colorid, int spacetype, uchar col[3])
1129 {
1130         const uchar *cp;
1131
1132         cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
1133         col[0] = cp[0];
1134         col[1] = cp[1];
1135         col[2] = cp[2];
1136 }
1137
1138 void UI_GetThemeColorType4ubv(int colorid, int spacetype, uchar col[4])
1139 {
1140         const uchar *cp;
1141
1142         cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
1143         col[0] = cp[0];
1144         col[1] = cp[1];
1145         col[2] = cp[2];
1146         col[3] = cp[3];
1147 }
1148
1149 bool UI_GetIconThemeColor4fv(int colorid, float col[4])
1150 {
1151         if (colorid == 0) {
1152                 return false;
1153         }
1154
1155         /* Only colored icons in outliner and popups, overall UI is intended
1156          * to stay monochrome and out of the way except a few places where it
1157          * is important to communicate different data types. */
1158         if (!((theme_spacetype == SPACE_OUTLINER) ||
1159               (theme_regionid == RGN_TYPE_TEMPORARY)))
1160         {
1161                 return false;
1162         }
1163
1164         const uchar *cp;
1165         cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
1166         col[0] = ((float)cp[0]) / 255.0f;
1167         col[1] = ((float)cp[1]) / 255.0f;
1168         col[2] = ((float)cp[2]) / 255.0f;
1169         col[3] = ((float)cp[3]) / 255.0f;
1170
1171         return true;
1172 }
1173
1174 void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset)
1175 {
1176         int r, g, b;
1177
1178         r = offset + (int)cp[0];
1179         g = offset + (int)cp[1];
1180         b = offset + (int)cp[2];
1181
1182         CLAMP(r, 0, 255);
1183         CLAMP(g, 0, 255);
1184         CLAMP(b, 0, 255);
1185
1186         col[0] = r;
1187         col[1] = g;
1188         col[2] = b;
1189 }
1190
1191 /* get a 3 byte color, blended and shaded between two other char color pointers */
1192 void UI_GetColorPtrBlendShade3ubv(
1193         const uchar cp1[3], const uchar cp2[3], uchar col[3],
1194         float fac, int offset)
1195 {
1196         int r, g, b;
1197
1198         CLAMP(fac, 0.0f, 1.0f);
1199         r = offset + floor((1.0f - fac) * cp1[0] + fac * cp2[0]);
1200         g = offset + floor((1.0f - fac) * cp1[1] + fac * cp2[1]);
1201         b = offset + floor((1.0f - fac) * cp1[2] + fac * cp2[2]);
1202
1203         CLAMP(r, 0, 255);
1204         CLAMP(g, 0, 255);
1205         CLAMP(b, 0, 255);
1206
1207         col[0] = r;
1208         col[1] = g;
1209         col[2] = b;
1210 }
1211
1212 void UI_ThemeClearColor(int colorid)
1213 {
1214         float col[3];
1215
1216         UI_GetThemeColor3fv(colorid, col);
1217         GPU_clear_color(col[0], col[1], col[2], 0.0f);
1218 }
1219
1220 void UI_ThemeClearColorAlpha(int colorid, float alpha)
1221 {
1222         float col[3];
1223         UI_GetThemeColor3fv(colorid, col);
1224         GPU_clear_color(col[0], col[1], col[2], alpha);
1225 }
1226
1227
1228 int UI_ThemeMenuShadowWidth(void)
1229 {
1230         bTheme *btheme = UI_GetTheme();
1231         return (int)(btheme->tui.menu_shadow_width * UI_DPI_FAC);
1232 }
1233
1234 void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axis)
1235 {
1236         uchar col[3];
1237
1238         switch (axis) {
1239                 case 'X':
1240                         UI_GetThemeColor3ubv(TH_AXIS_X, col);
1241                         UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
1242                         break;
1243                 case 'Y':
1244                         UI_GetThemeColor3ubv(TH_AXIS_Y, col);
1245                         UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
1246                         break;
1247                 case 'Z':
1248                         UI_GetThemeColor3ubv(TH_AXIS_Z, col);
1249                         UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
1250                         break;
1251                 default:
1252                         BLI_assert(0);
1253                         break;
1254         }
1255 }
1256
1257 /* patching UserDef struct and Themes */
1258 void init_userdef_do_versions(Main *bmain)
1259 {
1260         BLO_version_defaults_userpref_blend(bmain, &U);
1261
1262         if (STREQ(U.tempdir, "/")) {
1263                 BKE_tempdir_system_init(U.tempdir);
1264         }
1265
1266         /* Not versioning, just avoid errors. */
1267 #ifndef WITH_CYCLES
1268         BKE_addon_remove_safe(&U.addons, "cycles");
1269 #endif
1270
1271 }