2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_GLOBAL_H__
|
|
|
|
#define __BKE_GLOBAL_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_global.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \section aboutglobal Global settings
|
|
|
|
* Global settings, handles, pointers. This is the root for finding
|
|
|
|
* any data in Blender. This block is not serialized, but built anew
|
|
|
|
* for every fresh Blender run.
|
|
|
|
*/
|
2013-05-28 16:57:28 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct Main;
|
|
|
|
|
|
|
|
typedef struct Global {
|
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Active pointers. */
|
2005-11-22 18:50:03 +00:00
|
|
|
struct Main *main;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Strings: last saved */
|
2012-01-21 14:54:53 +00:00
|
|
|
char ima[1024], lib[1024]; /* 1024 = FILE_MAX */
|
2006-05-30 13:38:22 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** When set: `G_MAIN->name` contains valid relative base path. */
|
2013-05-28 13:01:31 +00:00
|
|
|
bool relbase_valid;
|
|
|
|
bool file_loaded;
|
|
|
|
bool save_over;
|
2006-08-20 14:41:13 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Strings of recent opened files. */
|
2006-05-30 13:38:22 +00:00
|
|
|
struct ListBase recent_files;
|
2012-08-08 18:21:54 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Has escape been pressed or Ctrl+C pressed in background mode, used for render quit. */
|
2013-05-28 13:01:31 +00:00
|
|
|
bool is_break;
|
2012-08-08 18:37:06 +00:00
|
|
|
|
2013-05-28 13:01:31 +00:00
|
|
|
bool background;
|
|
|
|
bool factory_startup;
|
|
|
|
|
|
|
|
short moving;
|
2012-08-08 18:37:06 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** To indicate render is busy, prevent renderwindow events etc. */
|
2014-02-03 18:55:59 +11:00
|
|
|
bool is_rendering;
|
2008-12-19 19:11:02 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/**
|
|
|
|
* Debug value, can be set from the UI and python, used for testing nonstandard features.
|
2019-01-16 19:41:29 +01:00
|
|
|
* DO NOT abuse it with generic checks like `if (G.debug_value > 0)`. Do not use it as bitflags.
|
|
|
|
* Only precise specific values should be checked for, to avoid unpredictable side-effects.
|
|
|
|
* Please document here the value(s) you are using (or a range of values reserved to some area).
|
|
|
|
* * -16384 and below: Reserved for python (add-ons) usage.
|
|
|
|
* * -1: Disable faster motion paths computation (since 08/2018).
|
|
|
|
* * 1 - 30: EEVEE debug/stats values (01/2018).
|
|
|
|
* * 101: Enable UI debug drawing of fullscreen area's corner widget (10/2014).
|
|
|
|
* * 527: Old mysterious switch in behavior of MeshDeform modifier (before 04/2010).
|
2019-01-17 12:09:07 +01:00
|
|
|
* * 666: Use quicker batch delete for outliners' delete hierarchy (01/2019).
|
2019-01-16 19:41:29 +01:00
|
|
|
* * 777: Enable UI node panel's sockets polling (11/2011).
|
|
|
|
* * 799: Enable some mysterious new depsgraph behavior (05/2015).
|
|
|
|
* * 1112: Disable new Cloth internal springs hanlding (09/2014).
|
|
|
|
* * 1234: Disable new dyntopo code fixing skinny faces generation (04/2015).
|
|
|
|
* * 16384 and above: Reserved for python (add-ons) usage.
|
|
|
|
*/
|
2012-08-08 18:21:54 +00:00
|
|
|
short debug_value;
|
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Saved to the blend file as #FileGlobal.globalf,
|
|
|
|
* however this is now only used for runtime options. */
|
2002-10-12 11:37:38 +00:00
|
|
|
int f;
|
2012-08-08 18:21:54 +00:00
|
|
|
|
2018-03-29 20:38:32 +02:00
|
|
|
struct {
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Logging vars (different loggers may use). */
|
2018-03-29 20:38:32 +02:00
|
|
|
int level;
|
2019-01-31 16:22:25 +11:00
|
|
|
/** FILE handle or use stderr (we own this so close when done). */
|
2018-03-29 20:38:32 +02:00
|
|
|
void *file;
|
|
|
|
} log;
|
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** debug flag, #G_DEBUG, #G_DEBUG_PYTHON & friends, set python or command line args */
|
2012-03-31 00:59:17 +00:00
|
|
|
int debug;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** This variable is written to / read from #FileGlobal.fileflags */
|
2005-11-22 18:50:03 +00:00
|
|
|
int fileflags;
|
2012-08-08 18:21:54 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Message to use when auto execution fails. */
|
2013-06-10 00:42:16 +00:00
|
|
|
char autoexec_fail[200];
|
2002-10-12 11:37:38 +00:00
|
|
|
} Global;
|
|
|
|
|
|
|
|
/* **************** GLOBAL ********************* */
|
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** #Global.f */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_RENDER_OGL (1 << 0)
|
|
|
|
#define G_SWAP_EXCHANGE (1 << 1)
|
2010-03-16 17:49:31 +00:00
|
|
|
/* #define G_RENDER_SHADOW (1 << 3) */ /* temp flag, removed */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_BACKBUFSEL (1 << 4)
|
|
|
|
#define G_PICKSEL (1 << 5)
|
2009-01-31 13:30:56 +00:00
|
|
|
|
2012-12-22 14:25:34 +00:00
|
|
|
/* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_FACE_SEL) */
|
2009-01-31 13:30:56 +00:00
|
|
|
|
2010-02-27 01:47:46 +00:00
|
|
|
#define G_SCRIPT_AUTOEXEC (1 << 13)
|
2011-03-15 08:04:11 +00:00
|
|
|
#define G_SCRIPT_OVERRIDE_PREF (1 << 14) /* when this flag is set ignore the userprefs */
|
2013-06-10 00:42:16 +00:00
|
|
|
#define G_SCRIPT_AUTOEXEC_FAIL (1 << 15)
|
|
|
|
#define G_SCRIPT_AUTOEXEC_FAIL_QUIET (1 << 16)
|
2009-01-31 13:30:56 +00:00
|
|
|
|
2005-05-03 10:54:42 +00:00
|
|
|
/* #define G_NOFROZEN (1 << 17) also removed */
|
2012-05-12 20:39:39 +00:00
|
|
|
/* #define G_GREASEPENCIL (1 << 17) also removed */
|
2009-01-31 13:30:56 +00:00
|
|
|
|
2008-01-10 01:36:22 +00:00
|
|
|
/* #define G_AUTOMATKEYS (1 << 30) also removed */
|
Visual Keying refactor
This code was always kludgy and this clean it up a bit.
insertmatrixkey() has been properly renamed insertkey_float().
Matrix calculations have been excised from the interface code,
and placed in insertmatrixkey(), so that you can call it from
anywhere without preliminaries and the proper values are calced
based on the passed adr code.
By much request, several semi-bug reports and discussion with
production animators, visual keying is now used automatic
for objects and bones that have constraints that cause them
to ignore their Ipos (CopyLoc, TrackTo, etc.). In those cases,
visual keying is used instead of the normal Ipo insertion
method. This "auto" functionality is toggled from the
"Use Visual Keying" button found along with "Needed" and
"Available" in the Edit Methods prefs.
Logic as to which constraints trigger visual keying on
which adrcodes can be tweaked in match_adr_constraint()
src/editipo.c
This has been tested by a couple of people, myself included,
but I may not have hit every constraint case, so evolutionary
feedback is welcome.
2007-07-31 13:37:59 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** #Global.debug */
|
2012-03-31 00:59:17 +00:00
|
|
|
enum {
|
2018-10-17 16:42:18 +02:00
|
|
|
G_DEBUG = (1 << 0), /* general debug flag, print more info in unexpected cases */
|
2012-03-31 00:59:17 +00:00
|
|
|
G_DEBUG_FFMPEG = (1 << 1),
|
2018-10-17 16:42:18 +02:00
|
|
|
G_DEBUG_PYTHON = (1 << 2), /* extra python info */
|
|
|
|
G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */
|
|
|
|
G_DEBUG_HANDLERS = (1 << 4), /* events handling */
|
|
|
|
G_DEBUG_WM = (1 << 5), /* operator, undo */
|
|
|
|
G_DEBUG_JOBS = (1 << 6), /* jobs time profiling */
|
|
|
|
G_DEBUG_FREESTYLE = (1 << 7), /* freestyle messages */
|
2018-02-21 10:44:36 +01:00
|
|
|
G_DEBUG_DEPSGRAPH_BUILD = (1 << 8), /* depsgraph construction messages */
|
|
|
|
G_DEBUG_DEPSGRAPH_EVAL = (1 << 9), /* depsgraph evaluation messages */
|
|
|
|
G_DEBUG_DEPSGRAPH_TAG = (1 << 10), /* depsgraph tagging messages */
|
2018-03-12 17:03:54 +01:00
|
|
|
G_DEBUG_DEPSGRAPH_TIME = (1 << 11), /* depsgraph timing statistics and messages */
|
2018-03-12 17:01:02 +01:00
|
|
|
G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 12), /* single threaded depsgraph */
|
2018-03-16 12:24:08 +01:00
|
|
|
G_DEBUG_DEPSGRAPH_PRETTY = (1 << 13), /* use pretty colors in depsgraph messages */
|
2018-03-12 17:01:02 +01:00
|
|
|
G_DEBUG_DEPSGRAPH = (G_DEBUG_DEPSGRAPH_BUILD |
|
|
|
|
G_DEBUG_DEPSGRAPH_EVAL |
|
|
|
|
G_DEBUG_DEPSGRAPH_TAG |
|
|
|
|
G_DEBUG_DEPSGRAPH_TIME),
|
2018-10-17 16:42:18 +02:00
|
|
|
G_DEBUG_SIMDATA = (1 << 14), /* sim debug data display */
|
|
|
|
G_DEBUG_GPU_MEM = (1 << 15), /* gpu memory in status bar */
|
|
|
|
G_DEBUG_GPU = (1 << 16), /* gpu debug */
|
|
|
|
G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...)*/
|
|
|
|
G_DEBUG_GPU_SHADERS = (1 << 18), /* GLSL shaders */
|
2018-12-05 03:05:39 +01:00
|
|
|
G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 19), /* force gpu workarounds bypassing detections. */
|
2012-03-31 00:59:17 +00:00
|
|
|
};
|
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
#define G_DEBUG_ALL \
|
|
|
|
(G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
|
|
|
|
G_DEBUG_FREESTYLE | G_DEBUG_DEPSGRAPH | G_DEBUG_GPU_MEM | G_DEBUG_IO | G_DEBUG_GPU_SHADERS)
|
2012-03-31 00:59:17 +00:00
|
|
|
|
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** #Global.fileflags */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-03 18:48:22 +00:00
|
|
|
#define G_AUTOPACK (1 << 0)
|
|
|
|
#define G_FILE_COMPRESS (1 << 1)
|
2015-07-27 10:36:11 +10:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define G_FILE_USERPREFS (1 << 9)
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_FILE_NO_UI (1 << 10)
|
2019-01-26 16:50:13 +11:00
|
|
|
|
|
|
|
/* Bits 11 to 22 (inclusive) are deprecated & need to be cleared */
|
2015-07-27 10:36:11 +10:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** On read, use #FileGlobal.filename instead of the real location on-disk,
|
2015-07-27 10:36:11 +10:00
|
|
|
* needed for recovering temp files so relative paths resolve */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_FILE_RECOVER (1 << 23)
|
2019-01-31 16:22:25 +11:00
|
|
|
/** On write, remap relative file paths to the new file location. */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_FILE_RELATIVE_REMAP (1 << 24)
|
2019-01-31 16:22:25 +11:00
|
|
|
/** On write, make backup `.blend1`, `.blend2` ... files, when the users preference is enabled */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_FILE_HISTORY (1 << 25)
|
2019-01-31 16:22:25 +11:00
|
|
|
/** BMesh option to save as older mesh format */
|
|
|
|
/* #define G_FILE_MESH_COMPAT (1 << 26) */
|
|
|
|
/** On write, restore paths after editing them (G_FILE_RELATIVE_REMAP) */
|
2015-07-27 10:36:11 +10:00
|
|
|
#define G_FILE_SAVE_COPY (1 << 27)
|
2019-01-26 16:50:13 +11:00
|
|
|
/* #define G_FILE_GLSL_NO_ENV_LIGHTING (1 << 28) */ /* deprecated */
|
2012-11-07 04:13:03 +00:00
|
|
|
|
2018-07-12 21:32:18 +02:00
|
|
|
#define G_FILE_FLAGS_RUNTIME (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_SAVE_COPY)
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** ENDIAN_ORDER: indicates what endianness the platform where the file was written had. */
|
2012-05-12 20:39:39 +00:00
|
|
|
#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
|
2011-09-19 08:02:17 +00:00
|
|
|
# error Either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined.
|
|
|
|
#endif
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
#define L_ENDIAN 1
|
|
|
|
#define B_ENDIAN 0
|
2011-09-19 08:02:17 +00:00
|
|
|
|
|
|
|
#ifdef __BIG_ENDIAN__
|
|
|
|
# define ENDIAN_ORDER B_ENDIAN
|
|
|
|
#else
|
|
|
|
# define ENDIAN_ORDER L_ENDIAN
|
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** #Global.moving, signals drawing in (3d) window to denote transform */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define G_TRANSFORM_OBJ 1
|
|
|
|
#define G_TRANSFORM_EDIT 2
|
2013-06-24 22:41:37 +00:00
|
|
|
#define G_TRANSFORM_SEQ 4
|
2013-10-29 18:10:52 +00:00
|
|
|
#define G_TRANSFORM_FCURVES 8
|
2018-11-28 13:50:15 +11:00
|
|
|
#define G_TRANSFORM_WM 16
|
2005-03-19 20:27:13 +00:00
|
|
|
|
2019-01-31 16:22:25 +11:00
|
|
|
/** Defined in blender.c */
|
2002-10-12 11:37:38 +00:00
|
|
|
extern Global G;
|
|
|
|
|
2018-06-11 12:14:18 +02:00
|
|
|
/**
|
2019-01-31 16:22:25 +11:00
|
|
|
* Stupid macro to hide the few *valid* usages of `G.main` (from startup/exit code e.g.),
|
|
|
|
* helps with cleanup task.
|
2018-06-11 12:14:18 +02:00
|
|
|
*/
|
|
|
|
#define G_MAIN (G).main
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|