Blender  V2.93
BKE_global.h
Go to the documentation of this file.
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 #pragma once
20 
29 #include "BLI_utildefines.h"
30 #include "DNA_listBase.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 struct Main;
37 
38 typedef struct Global {
39 
41  struct Main *main;
42 
44  char ima[1024], lib[1024]; /* 1024 = FILE_MAX */
45 
49  bool save_over;
50 
52  struct ListBase recent_files;
53 
55  bool is_break;
56 
57  bool background;
59 
60  short moving;
61 
64 
83  short debug_value;
84 
87  int f;
88 
89  struct {
91  int level;
93  void *file;
94  } log;
95 
97  int debug;
98 
101 
103  char autoexec_fail[200];
105 
106 /* **************** GLOBAL ********************* */
107 
109 enum {
111  G_FLAG_PICKSEL = (1 << 2),
115 
121 };
122 
124 #define G_FLAG_ALL_RUNTIME \
125  (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF | G_FLAG_EVENT_SIMULATE | \
126  G_FLAG_USERPREF_NO_SAVE_ON_EXIT)
127 
129 #define G_FLAG_ALL_READFILE 0
130 
132 enum {
133  G_DEBUG = (1 << 0), /* general debug flag, print more info in unexpected cases */
134  G_DEBUG_FFMPEG = (1 << 1),
135  G_DEBUG_PYTHON = (1 << 2), /* extra python info */
136  G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */
137  G_DEBUG_HANDLERS = (1 << 4), /* events handling */
138  G_DEBUG_WM = (1 << 5), /* operator, undo */
139  G_DEBUG_JOBS = (1 << 6), /* jobs time profiling */
140  G_DEBUG_FREESTYLE = (1 << 7), /* freestyle messages */
141  G_DEBUG_DEPSGRAPH_BUILD = (1 << 8), /* depsgraph construction messages */
142  G_DEBUG_DEPSGRAPH_EVAL = (1 << 9), /* depsgraph evaluation messages */
143  G_DEBUG_DEPSGRAPH_TAG = (1 << 10), /* depsgraph tagging messages */
144  G_DEBUG_DEPSGRAPH_TIME = (1 << 11), /* depsgraph timing statistics and messages */
145  G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 12), /* single threaded depsgraph */
146  G_DEBUG_DEPSGRAPH_PRETTY = (1 << 13), /* use pretty colors in depsgraph messages */
147  G_DEBUG_DEPSGRAPH_UUID = (1 << 14), /* use pretty colors in depsgraph messages */
150  G_DEBUG_SIMDATA = (1 << 15), /* sim debug data display */
151  G_DEBUG_GPU = (1 << 16), /* gpu debug */
152  G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...)*/
153  G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18), /* force gpu workarounds bypassing detections. */
154  G_DEBUG_XR = (1 << 19), /* XR/OpenXR messages */
155  G_DEBUG_XR_TIME = (1 << 20), /* XR/OpenXR timing messages */
156 
157  G_DEBUG_GHOST = (1 << 21), /* Debug GHOST module. */
158 };
159 
160 #define G_DEBUG_ALL \
161  (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
162  G_DEBUG_FREESTYLE | G_DEBUG_DEPSGRAPH | G_DEBUG_IO | G_DEBUG_GHOST)
163 
165 enum {
166  G_FILE_AUTOPACK = (1 << 0),
167  G_FILE_COMPRESS = (1 << 1),
168 
169  // G_FILE_DEPRECATED_9 = (1 << 9),
170  G_FILE_NO_UI = (1 << 10),
171 
172  /* Bits 11 to 22 (inclusive) are deprecated & need to be cleared */
173 
182  G_FILE_RECOVER_READ = (1 << 23),
190  G_FILE_RECOVER_WRITE = (1 << 24),
192  /* #define G_FILE_MESH_COMPAT (1 << 26) */
193  /* #define G_FILE_GLSL_NO_ENV_LIGHTING (1 << 28) */ /* deprecated */
194 };
195 
200 #define G_FILE_FLAG_ALL_RUNTIME (G_FILE_NO_UI | G_FILE_RECOVER_READ | G_FILE_RECOVER_WRITE)
201 
203 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
204 # error Either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined.
205 #endif
206 
207 #define L_ENDIAN 1
208 #define B_ENDIAN 0
209 
210 #ifdef __BIG_ENDIAN__
211 # define ENDIAN_ORDER B_ENDIAN
212 #else
213 # define ENDIAN_ORDER L_ENDIAN
214 #endif
215 
217 enum {
218  G_TRANSFORM_OBJ = (1 << 0),
219  G_TRANSFORM_EDIT = (1 << 1),
220  G_TRANSFORM_SEQ = (1 << 2),
222  G_TRANSFORM_WM = (1 << 4),
223 };
224 
226 extern Global G;
227 
232 #define G_MAIN (G).main
233 
234 #ifdef __cplusplus
235 }
236 #endif
struct Global Global
@ G_FILE_RECOVER_READ
Definition: BKE_global.h:182
@ G_FILE_AUTOPACK
Definition: BKE_global.h:166
@ G_FILE_RECOVER_WRITE
Definition: BKE_global.h:190
@ G_FILE_NO_UI
Definition: BKE_global.h:170
@ G_FILE_COMPRESS
Definition: BKE_global.h:167
@ G_DEBUG
Definition: BKE_global.h:133
@ G_DEBUG_GPU
Definition: BKE_global.h:151
@ G_DEBUG_GHOST
Definition: BKE_global.h:157
@ G_DEBUG_XR
Definition: BKE_global.h:154
@ G_DEBUG_HANDLERS
Definition: BKE_global.h:137
@ G_DEBUG_FREESTYLE
Definition: BKE_global.h:140
@ G_DEBUG_IO
Definition: BKE_global.h:152
@ G_DEBUG_JOBS
Definition: BKE_global.h:139
@ G_DEBUG_GPU_FORCE_WORKAROUNDS
Definition: BKE_global.h:153
@ G_DEBUG_SIMDATA
Definition: BKE_global.h:150
@ G_DEBUG_FFMPEG
Definition: BKE_global.h:134
@ G_DEBUG_DEPSGRAPH_PRETTY
Definition: BKE_global.h:146
@ G_DEBUG_XR_TIME
Definition: BKE_global.h:155
@ G_DEBUG_DEPSGRAPH_TIME
Definition: BKE_global.h:144
@ G_DEBUG_DEPSGRAPH
Definition: BKE_global.h:148
@ G_DEBUG_DEPSGRAPH_EVAL
Definition: BKE_global.h:142
@ G_DEBUG_DEPSGRAPH_NO_THREADS
Definition: BKE_global.h:145
@ G_DEBUG_DEPSGRAPH_TAG
Definition: BKE_global.h:143
@ G_DEBUG_WM
Definition: BKE_global.h:138
@ G_DEBUG_EVENTS
Definition: BKE_global.h:136
@ G_DEBUG_PYTHON
Definition: BKE_global.h:135
@ G_DEBUG_DEPSGRAPH_BUILD
Definition: BKE_global.h:141
@ G_DEBUG_DEPSGRAPH_UUID
Definition: BKE_global.h:147
@ G_TRANSFORM_OBJ
Definition: BKE_global.h:218
@ G_TRANSFORM_SEQ
Definition: BKE_global.h:220
@ G_TRANSFORM_EDIT
Definition: BKE_global.h:219
@ G_TRANSFORM_FCURVES
Definition: BKE_global.h:221
@ G_TRANSFORM_WM
Definition: BKE_global.h:222
Global G
Definition: blender.c:67
@ G_FLAG_SCRIPT_OVERRIDE_PREF
Definition: BKE_global.h:118
@ G_FLAG_EVENT_SIMULATE
Definition: BKE_global.h:113
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
Definition: BKE_global.h:120
@ G_FLAG_RENDER_VIEWPORT
Definition: BKE_global.h:110
@ G_FLAG_USERPREF_NO_SAVE_ON_EXIT
Definition: BKE_global.h:114
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
Definition: BKE_global.h:119
@ G_FLAG_PICKSEL
Definition: BKE_global.h:111
@ G_FLAG_SCRIPT_AUTOEXEC
Definition: BKE_global.h:116
These structs are the foundation for all linked lists in the library system.
int f
Definition: BKE_global.h:87
struct Global::@24 log
void * file
Definition: BKE_global.h:93
char lib[1024]
Definition: BKE_global.h:44
bool background
Definition: BKE_global.h:57
int debug
Definition: BKE_global.h:97
short moving
Definition: BKE_global.h:60
struct Main * main
Definition: BKE_global.h:41
bool relbase_valid
Definition: BKE_global.h:47
int level
Definition: BKE_global.h:91
bool is_rendering
Definition: BKE_global.h:63
short debug_value
Definition: BKE_global.h:83
char ima[1024]
Definition: BKE_global.h:44
int fileflags
Definition: BKE_global.h:100
bool file_loaded
Definition: BKE_global.h:48
bool factory_startup
Definition: BKE_global.h:58
char autoexec_fail[200]
Definition: BKE_global.h:103
struct ListBase recent_files
Definition: BKE_global.h:52
bool is_break
Definition: BKE_global.h:55
bool save_over
Definition: BKE_global.h:49
Definition: BKE_main.h:116