Blender V4.3
BKE_global.hh File Reference
#include "BLI_utildefines.h"
#include "DNA_listBase.h"

Go to the source code of this file.

Classes

struct  Global
 

Macros

#define G_FLAG_INTERNET_OVERRIDE_PREF_ANY    (G_FLAG_INTERNET_OVERRIDE_PREF_ONLINE | G_FLAG_INTERNET_OVERRIDE_PREF_OFFLINE)
 
#define G_FLAG_ALL_RUNTIME
 
#define G_FLAG_ALL_READFILE   0
 
#define G_DEBUG_ALL
 
#define G_FILE_FLAG_ALL_RUNTIME   (G_FILE_NO_UI | G_FILE_RECOVER_READ | G_FILE_RECOVER_WRITE)
 
#define G_MAIN   (G).main
 

Enumerations

enum  {
  G_FLAG_RENDER_VIEWPORT = (1 << 0) , G_FLAG_PICKSEL = (1 << 2) , G_FLAG_EVENT_SIMULATE = (1 << 3) , G_FLAG_USERPREF_NO_SAVE_ON_EXIT = (1 << 4) ,
  G_FLAG_INTERNET_ALLOW = (1 << 10) , G_FLAG_INTERNET_OVERRIDE_PREF_ONLINE = (1 << 11) , G_FLAG_INTERNET_OVERRIDE_PREF_OFFLINE = (1 << 12) , G_FLAG_SCRIPT_AUTOEXEC = (1 << 13) ,
  G_FLAG_SCRIPT_OVERRIDE_PREF = (1 << 14) , G_FLAG_SCRIPT_AUTOEXEC_FAIL = (1 << 15) , G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET = (1 << 16) , G_FLAG_GPU_BACKEND_FALLBACK = (1 << 17) ,
  G_FLAG_GPU_BACKEND_FALLBACK_QUIET = (1 << 18)
}
 
enum  {
  G_DEBUG = (1 << 0) , G_DEBUG_FFMPEG = (1 << 1) , G_DEBUG_PYTHON = (1 << 2) , G_DEBUG_EVENTS = (1 << 3) ,
  G_DEBUG_HANDLERS = (1 << 4) , G_DEBUG_WM = (1 << 5) , G_DEBUG_JOBS = (1 << 6) , G_DEBUG_FREESTYLE = (1 << 7) ,
  G_DEBUG_DEPSGRAPH_BUILD = (1 << 8) , G_DEBUG_DEPSGRAPH_EVAL = (1 << 9) , G_DEBUG_DEPSGRAPH_TAG = (1 << 10) , G_DEBUG_DEPSGRAPH_TIME = (1 << 11) ,
  G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 12) , G_DEBUG_DEPSGRAPH_PRETTY = (1 << 13) , G_DEBUG_DEPSGRAPH_UID = (1 << 14) , G_DEBUG_DEPSGRAPH ,
  G_DEBUG_SIMDATA = (1 << 15) , G_DEBUG_GPU = (1 << 16) , G_DEBUG_IO = (1 << 17) , G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18) ,
  G_DEBUG_GPU_COMPILE_SHADERS = (1 << 19) , G_DEBUG_GPU_RENDERDOC = (1 << 20) , G_DEBUG_XR = (1 << 21) , G_DEBUG_XR_TIME = (1 << 22) ,
  G_DEBUG_GHOST = (1 << 23) , G_DEBUG_WINTAB = (1 << 24)
}
 
enum  {
  G_FILE_AUTOPACK = (1 << 0) , G_FILE_COMPRESS = (1 << 1) , G_FILE_NO_UI = (1 << 10) , G_FILE_RECOVER_READ = (1 << 23) ,
  G_FILE_RECOVER_WRITE = (1 << 24) , G_FILE_ASSET_EDIT_FILE = (1 << 29)
}
 
enum  {
  G_TRANSFORM_OBJ = (1 << 0) , G_TRANSFORM_EDIT = (1 << 1) , G_TRANSFORM_SEQ = (1 << 2) , G_TRANSFORM_FCURVES = (1 << 3) ,
  G_TRANSFORM_WM = (1 << 4) , G_TRANSFORM_CURSOR = (1 << 5)
}
 

Variables

Global G
 

Detailed Description

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.

Definition in file BKE_global.hh.

Macro Definition Documentation

◆ G_DEBUG_ALL

#define G_DEBUG_ALL
Value:
@ G_DEBUG
@ G_DEBUG_GHOST
@ G_DEBUG_FREESTYLE
@ G_DEBUG_IO
@ G_DEBUG_JOBS
@ G_DEBUG_FFMPEG
@ G_DEBUG_WINTAB
@ G_DEBUG_DEPSGRAPH
@ G_DEBUG_WM
@ G_DEBUG_EVENTS
@ G_DEBUG_PYTHON

Definition at line 275 of file BKE_global.hh.

Referenced by arg_handle_debug_mode_all().

◆ G_FILE_FLAG_ALL_RUNTIME

#define G_FILE_FLAG_ALL_RUNTIME   (G_FILE_NO_UI | G_FILE_RECOVER_READ | G_FILE_RECOVER_WRITE)

Run-time only #G.fileflags which are never read or written to/from Blend files. This means we can change the values without worrying about do-versions.

Definition at line 321 of file BKE_global.hh.

Referenced by setup_app_data().

◆ G_FLAG_ALL_READFILE

#define G_FLAG_ALL_READFILE   0

Flags to read from blend file.

Definition at line 240 of file BKE_global.hh.

Referenced by setup_app_data(), and WM_file_read().

◆ G_FLAG_ALL_RUNTIME

#define G_FLAG_ALL_RUNTIME
Value:
\
/* #BPY_python_reset is responsible for resetting these flags on file load. */ \
@ G_FLAG_INTERNET_OVERRIDE_PREF_ONLINE
@ G_FLAG_SCRIPT_OVERRIDE_PREF
@ G_FLAG_EVENT_SIMULATE
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
@ G_FLAG_INTERNET_OVERRIDE_PREF_OFFLINE
@ G_FLAG_GPU_BACKEND_FALLBACK_QUIET
@ G_FLAG_USERPREF_NO_SAVE_ON_EXIT
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
@ G_FLAG_GPU_BACKEND_FALLBACK
@ G_FLAG_SCRIPT_AUTOEXEC
@ G_FLAG_INTERNET_ALLOW

Don't overwrite these flags when reading a file.

Definition at line 230 of file BKE_global.hh.

Referenced by setup_app_data(), and WM_file_read().

◆ G_FLAG_INTERNET_OVERRIDE_PREF_ANY

Definition at line 226 of file BKE_global.hh.

Referenced by wm_init_userdef().

◆ G_MAIN

#define G_MAIN   (G).main

Stupid macro to hide the few valid usages of G.main (from startup/exit code e.g.), helps with cleanup task.

Definition at line 351 of file BKE_global.hh.

Referenced by BKE_blender_globals_clear(), BKE_blender_globals_main_replace(), BKE_blender_globals_main_swap(), BKE_id_is_in_global_main(), BKE_image_user_file_path(), BKE_main_blendfile_path_from_global(), BKE_modifier_path_relbase_from_global(), BKE_rigidbody_free_object(), BKE_undosys_step_load_data_ex(), BKE_undosys_step_push_with_type(), BKE_vfont_builtin_get(), bpy_app_is_job_running(), bpy_batch_remove(), bpy_blend_paths(), bpy_bmesh_to_mesh(), bpy_orphans_purge(), bpy_rna_data_temp_data(), BPY_rna_module(), BPY_update_rna_module(), bpy_user_map(), do_write_image_or_movie(), dpaint_bake_endjob(), ED_editors_exit(), ED_object_particle_edit_mode_enter_ex(), ED_undo_object_editmode_restore_helper(), ED_undo_object_set_active_or_warn(), ED_undo_stack_get(), ED_uvedit_live_unwrap_begin(), ED_uvedit_live_unwrap_end(), ED_view3d_depth_override(), file_listener(), fluid_bake_endjob(), fluid_free_endjob(), gizmo_find_from_properties(), handle_load_file(), Freestyle::PythonInterpreter::interpretFile(), blender::bke::node_free_socket_type(), blender::bke::node_free_type(), blender::bke::node_register_socket_type(), blender::bke::node_register_type(), blender::bke::node_tree_type_add(), blender::bke::ntree_free_type(), ntreeCompositTagRender(), paste_mtex_copybuf(), pygpu_offscreen_draw_view3d(), pyrna_prop_repr_ex(), pyrna_struct_keyframe_insert(), pyrna_struct_repr(), blender::ed::object::quadriflow_end_job(), RE_FreeUnusedGPUResources(), render_endjob(), rna_property_editable_do(), screen_temp_region_exists(), search_id_collection(), blender::animrig::tests::ActionFilterTest::SetUp(), blender::bke::image::partial_update::ImagePartialUpdateTest::SetUp(), blender::bke::tests::ImageTest::SetUp(), setup_app_data(), sig_handle_crash(), stats_background(), blender::animrig::tests::ActionFilterTest::TearDown(), blender::bke::image::partial_update::ImagePartialUpdateTest::TearDown(), blender::bke::tests::ImageTest::TearDown(), undosys_step_decode(), v3d_cursor_snap_free(), view3d_main_region_listener(), wm_autosave_location(), WM_cursor_wait(), WM_drag_asset_id_import(), wm_event_free_and_remove_from_queue_if_valid(), WM_event_remove_modal_handler_all(), WM_file_tag_modified(), wm_gizmo_create(), wm_homefile_read_ex(), WM_init(), wm_keymap_item_equals_result(), WM_main_add_notifier(), WM_main_remap_editor_id_reference(), WM_main_remove_notifier_reference(), WM_modalkeymap_ensure(), WM_modalkeymap_operator_items_to_string(), wm_operator_free_for_fileselect(), WM_operator_last_properties_ensure(), WM_operator_name_call_with_properties(), WM_operator_properties_create(), WM_operator_properties_create_ptr(), WM_paint_cursor_activate(), WM_paint_cursor_end(), WM_reports_from_reports_move(), wm_window_free(), wm_window_reset_drawable(), WM_window_set_active_view_layer(), WM_window_title(), wm_xr_runtime_data_free(), wm_xr_session_create_cb(), wm_xr_session_update_screen_on_exit_cb(), and write_crash_blend().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Global.f

Enumerator
G_FLAG_RENDER_VIEWPORT 
G_FLAG_PICKSEL 
G_FLAG_EVENT_SIMULATE 

Support simulating events (for testing).

G_FLAG_USERPREF_NO_SAVE_ON_EXIT 
G_FLAG_INTERNET_ALLOW 

Internet access is allowed (offline mode when disabled).

Note
This setting doesn't prevent network access, rather it is a setting to disallow built-in utilities and 3rd party scripts from accessing the internet. While this isn't enforced, it is considered a bug when any script sends or receives data over the internet while this flag is set.
G_FLAG_INTERNET_OVERRIDE_PREF_ONLINE 

Launched with --offline-mode (overrides USER_INTERNET_ALLOW when set).

G_FLAG_INTERNET_OVERRIDE_PREF_OFFLINE 

Launched with --offline-mode (overrides USER_INTERNET_ALLOW when set).

G_FLAG_SCRIPT_AUTOEXEC 
G_FLAG_SCRIPT_OVERRIDE_PREF 

When this flag is set ignore the preferences USER_SCRIPT_AUTOEXEC_DISABLE.

G_FLAG_SCRIPT_AUTOEXEC_FAIL 
G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET 
G_FLAG_GPU_BACKEND_FALLBACK 

When this flag is set the active GPU Backend is different than the user wants to use.

G_FLAG_GPU_BACKEND_FALLBACK_QUIET 

Definition at line 187 of file BKE_global.hh.

◆ anonymous enum

anonymous enum

Global.debug

Enumerator
G_DEBUG 
G_DEBUG_FFMPEG 
G_DEBUG_PYTHON 
G_DEBUG_EVENTS 
G_DEBUG_HANDLERS 
G_DEBUG_WM 
G_DEBUG_JOBS 
G_DEBUG_FREESTYLE 
G_DEBUG_DEPSGRAPH_BUILD 
G_DEBUG_DEPSGRAPH_EVAL 
G_DEBUG_DEPSGRAPH_TAG 
G_DEBUG_DEPSGRAPH_TIME 
G_DEBUG_DEPSGRAPH_NO_THREADS 
G_DEBUG_DEPSGRAPH_PRETTY 
G_DEBUG_DEPSGRAPH_UID 
G_DEBUG_DEPSGRAPH 
G_DEBUG_SIMDATA 
G_DEBUG_GPU 
G_DEBUG_IO 
G_DEBUG_GPU_FORCE_WORKAROUNDS 
G_DEBUG_GPU_COMPILE_SHADERS 
G_DEBUG_GPU_RENDERDOC 
G_DEBUG_XR 
G_DEBUG_XR_TIME 
G_DEBUG_GHOST 
G_DEBUG_WINTAB 

Definition at line 243 of file BKE_global.hh.

◆ anonymous enum

anonymous enum

Global.fileflags

Enumerator
G_FILE_AUTOPACK 
G_FILE_COMPRESS 
G_FILE_NO_UI 
G_FILE_RECOVER_READ 

On read, use #FileGlobal.filename instead of the real location on-disk, needed for recovering temp files so relative paths resolve.

Note
In some ways it would be nicer to make this an argument passed to file loading. In practice this means recover needs to be passed around to too many low level functions, so keep this as a flag.
G_FILE_RECOVER_WRITE 

On write, assign use #FileGlobal.filename, otherwise leave it blank, needed so files can be recovered at their original locations.

Note
only BLENDER_QUIT_FILE and auto-save files include recovery information. As users/developers may not want their paths exposed in publicly distributed files.
G_FILE_ASSET_EDIT_FILE 

BMesh option to save as older mesh format This file contains a single asset and its dependencies. Users may edit the asset through the UI, at which point the file will be regenerated by the asset system (API in #BKE_asset_edit.hh). Stored with a .asset.blend prefix.

Definition at line 280 of file BKE_global.hh.

◆ anonymous enum

anonymous enum

Global.moving, signals drawing in (3d) window to denote transform

Enumerator
G_TRANSFORM_OBJ 
G_TRANSFORM_EDIT 
G_TRANSFORM_SEQ 
G_TRANSFORM_FCURVES 
G_TRANSFORM_WM 

Set while interactively transforming screen data (e.g. resizing areas & regions).

Note
Ideally this flag would also be used for resizing the window however that's handled outside by the windowing environment, so this is only used for internal windowing operations.
G_TRANSFORM_CURSOR 

Set when transforming the cursor itself. Used as a hint to draw the cursor (even when hidden). Otherwise it's not possible to see what's being transformed.

Definition at line 324 of file BKE_global.hh.

Variable Documentation

◆ G

Global G
extern

Defined in blender.cc

Definition at line 47 of file blender.cc.

Referenced by BKE_blender_free(), and BKE_blender_globals_init().