diff options
Diffstat (limited to 'source/blender')
25 files changed, 87 insertions, 97 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 0724a82c8d7..75eb5a327de 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -106,24 +106,14 @@ typedef struct Global { /** #Global.f */ enum { - G_RENDER_OGL = (1 << 0), - G_SWAP_EXCHANGE = (1 << 1), -/* #define G_RENDER_SHADOW (1 << 3) */ /* temp flag, removed */ - G_BACKBUFSEL = (1 << 4), - G_PICKSEL = (1 << 5), - -/* #define G_FACESELECT (1 << 8) use (mesh->editflag & ME_EDIT_PAINT_FACE_SEL) */ - - G_SCRIPT_AUTOEXEC = (1 << 13), - /** When this flag is set ignore the userprefs. */ - G_SCRIPT_OVERRIDE_PREF = (1 << 14), - G_SCRIPT_AUTOEXEC_FAIL = (1 << 15), - G_SCRIPT_AUTOEXEC_FAIL_QUIET = (1 << 16), - -/* #define G_NOFROZEN (1 << 17) also removed */ -/* #define G_GREASEPENCIL (1 << 17) also removed */ - -/* #define G_AUTOMATKEYS (1 << 30) also removed */ + G_FLAG_RENDER_VIEWPORT = (1 << 0), + G_FLAG_BACKBUFSEL = (1 << 4), + G_FLAG_PICKSEL = (1 << 5), + G_FLAG_SCRIPT_AUTOEXEC = (1 << 13), + /** When this flag is set ignore the prefs #USER_SCRIPT_AUTOEXEC_DISABLE. */ + G_FLAG_SCRIPT_OVERRIDE_PREF = (1 << 14), + G_FLAG_SCRIPT_AUTOEXEC_FAIL = (1 << 15), + G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET = (1 << 16), }; /** #Global.debug */ @@ -161,7 +151,7 @@ enum { /** #Global.fileflags */ enum { - G_AUTOPACK = (1 << 0), + G_FILE_AUTOPACK = (1 << 0), G_FILE_COMPRESS = (1 << 1), G_FILE_USERPREFS = (1 << 9), diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index d046b91ea19..d6b3008062a 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -127,9 +127,9 @@ void BKE_blender_globals_init(void) BKE_blender_version_string(versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true); #ifndef WITH_PYTHON_SECURITY /* default */ - G.f |= G_SCRIPT_AUTOEXEC; + G.f |= G_FLAG_SCRIPT_AUTOEXEC; #else - G.f &= ~G_SCRIPT_AUTOEXEC; + G.f &= ~G_FLAG_SCRIPT_AUTOEXEC; #endif G.log.level = 1; diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 589f0bee470..164b0a2bd30 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -291,7 +291,7 @@ static void setup_app_data( /* special cases, override loaded flags: */ if (G.f != bfd->globalf) { - const int flags_keep = (G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF); + const int flags_keep = (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF); bfd->globalf = (bfd->globalf & ~flags_keep) | (G.f & flags_keep); } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index e83964f543d..0eded353031 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2055,7 +2055,7 @@ static void pycon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), /* only execute target calculation if allowed */ #ifdef WITH_PYTHON - if (G.f & G_SCRIPT_AUTOEXEC) + if (G.f & G_FLAG_SCRIPT_AUTOEXEC) BPY_pyconstraint_target(data, ct); #endif } @@ -2072,7 +2072,7 @@ static void pycon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targe bPythonConstraint *data = con->data; /* only evaluate in python if we're allowed to do so */ - if ((G.f & G_SCRIPT_AUTOEXEC) == 0) return; + if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) return; /* Now, run the actual 'constraint' function, which should only access the matrices */ BPY_pyconstraint_exec(data, cob, targets); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 5f62ea2ad37..1a70fb398ae 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -269,7 +269,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) BLI_strncpy(vfont->name, filepath, sizeof(vfont->name)); /* if autopack is on store the packedfile in de font structure */ - if (!is_builtin && (G.fileflags & G_AUTOPACK)) { + if (!is_builtin && (G.fileflags & G_FILE_AUTOPACK)) { vfont->packedfile = pf; } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index c9fbb45a5b7..321d02e7dc3 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3474,7 +3474,7 @@ static ImBuf *load_image_single( *r_assign = true; /* make packed file for autopack */ - if ((has_packed == false) && (G.fileflags & G_AUTOPACK)) { + if ((has_packed == false) && (G.fileflags & G_FILE_AUTOPACK)) { ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image Packefile"); BLI_addtail(&ima->packedfiles, imapf); diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index f4c0df61f13..5c14a10101c 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -594,7 +594,7 @@ void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, Object *ob, float (*o void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *attr[], uint attr_len) { #ifdef USE_GPU_SELECT - if (G.f & G_PICKSEL) { + if (G.f & G_FLAG_PICKSEL) { if (shgroup->instance_count == shgroup->inst_selectid->vertex_len) { GPU_vertbuf_data_resize(shgroup->inst_selectid, shgroup->instance_count + 32); } @@ -711,7 +711,7 @@ static void drw_shgroup_instance_init( &shgroup->instance_geom, &shgroup->instance_vbo); #ifdef USE_GPU_SELECT - if (G.f & G_PICKSEL) { + if (G.f & G_FLAG_PICKSEL) { /* Not actually used for rendering but alloced in one chunk. * Plus we don't have to care about ownership. */ static GPUVertFormat inst_select_format = {0}; @@ -748,7 +748,7 @@ static void drw_shgroup_batching_init( &shgroup->batch_geom, &shgroup->batch_vbo); #ifdef USE_GPU_SELECT - if (G.f & G_PICKSEL) { + if (G.f & G_FLAG_PICKSEL) { /* Not actually used for rendering but alloced in one chunk. */ static GPUVertFormat inst_select_format = {0}; if (inst_select_format.attr_len == 0) { @@ -887,7 +887,7 @@ DRWShadingGroup *DRW_shgroup_material_empty_tri_batch_create( struct GPUMaterial *material, DRWPass *pass, int tri_count) { #ifdef USE_GPU_SELECT - BLI_assert((G.f & G_PICKSEL) == 0); + BLI_assert((G.f & G_FLAG_PICKSEL) == 0); #endif GPUPass *gpupass = GPU_material_get_pass(material); DRWShadingGroup *shgroup = drw_shgroup_material_create_ex(gpupass, pass); @@ -960,7 +960,7 @@ DRWShadingGroup *DRW_shgroup_line_batch_create(struct GPUShader *shader, DRWPass DRWShadingGroup *DRW_shgroup_empty_tri_batch_create(struct GPUShader *shader, DRWPass *pass, int tri_count) { #ifdef USE_GPU_SELECT - BLI_assert((G.f & G_PICKSEL) == 0); + BLI_assert((G.f & G_FLAG_PICKSEL) == 0); #endif DRWShadingGroup *shgroup = drw_shgroup_create_ex(shader, pass); diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 22b477327cc..8147da90899 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -38,7 +38,7 @@ #ifdef USE_GPU_SELECT void DRW_select_load_id(uint id) { - BLI_assert(G.f & G_PICKSEL); + BLI_assert(G.f & G_FLAG_PICKSEL); DST.select_id = id; } #endif @@ -1131,12 +1131,12 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) #ifdef USE_GPU_SELECT # define GPU_SELECT_LOAD_IF_PICKSEL(_select_id) \ - if (G.f & G_PICKSEL) { \ + if (G.f & G_FLAG_PICKSEL) { \ GPU_select_load_id(_select_id); \ } ((void)0) # define GPU_SELECT_LOAD_IF_PICKSEL_CALL(_call) \ - if ((G.f & G_PICKSEL) && (_call)) { \ + if ((G.f & G_FLAG_PICKSEL) && (_call)) { \ GPU_select_load_id((_call)->select_id); \ } ((void)0) @@ -1144,7 +1144,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) _start = 0; \ _count = _shgroup->instance_count; \ int *select_id = NULL; \ - if (G.f & G_PICKSEL) { \ + if (G.f & G_FLAG_PICKSEL) { \ if (_shgroup->override_selectid == -1) { \ /* Hack : get vbo data without actually drawing. */ \ GPUVertBufRaw raw; \ diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index ea8f2731bb8..d4f328a0071 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -848,7 +848,7 @@ static void gp_draw_data_layers( * (NOTE: doing it this way means that the toggling editmode shows visible change immediately) */ /* XXX: perhaps we don't want to show these when users are drawing... */ - if ((G.f & G_RENDER_OGL) == 0 && + if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 && (gpl->flag & GP_LAYER_LOCKED) == 0 && (gpd->flag & GP_DATA_STROKE_EDITMODE)) { @@ -881,7 +881,7 @@ static void gp_draw_status_text(const bGPdata *gpd, ARegion *ar) rcti rect; /* Cannot draw any status text when drawing OpenGL Renders */ - if (G.f & G_RENDER_OGL) + if (G.f & G_FLAG_RENDER_VIEWPORT) return; /* Get bounds of region - Necessary to avoid problems with region overlap */ @@ -1099,7 +1099,7 @@ void ED_gpencil_draw_view3d_annotations( /* when rendering to the offscreen buffer we don't want to * deal with the camera border, otherwise map the coords to the camera border. */ - if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { + if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) { rctf rectf; ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */ diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index d94a505ad1b..2de17623ad9 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -1476,7 +1476,7 @@ static void gp_draw_data_layers(RegionView3D *rv3d, * (NOTE: doing it this way means that the toggling editmode shows visible change immediately) */ /* XXX: perhaps we don't want to show these when users are drawing... */ - if ((G.f & G_RENDER_OGL) == 0 && + if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 && (gpl->flag & GP_LAYER_LOCKED) == 0 && (gpd->flag & GP_DATA_STROKE_EDITMODE)) { @@ -1518,7 +1518,7 @@ static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar rcti rect; /* Cannot draw any status text when drawing OpenGL Renders */ - if (G.f & G_RENDER_OGL) + if (G.f & G_FLAG_RENDER_VIEWPORT) return; /* Get bounds of region - Necessary to avoid problems with region overlap */ @@ -1643,7 +1643,7 @@ void ED_gpencil_draw_view3d( /* when rendering to the offscreen buffer we don't want to * deal with the camera border, otherwise map the coords to the camera border. */ - if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { + if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) { rctf rectf; ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */ @@ -1699,7 +1699,7 @@ void ED_gpencil_draw_view3d_object(wmWindowManager *wm, Scene *scene, Depsgraph /* when rendering to the offscreen buffer we don't want to * deal with the camera border, otherwise map the coords to the camera border. */ - if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { + if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) { rctf rectf; ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 9d9edc77b93..accd0fcdc5d 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -324,10 +324,10 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R wmOrtho2(0, sizex, 0, sizey); GPU_matrix_translate_2f(sizex / 2, sizey / 2); - G.f |= G_RENDER_OGL; + G.f |= G_FLAG_RENDER_VIEWPORT; ED_gpencil_draw_ex( view_layer, rv3d, scene, gpd, sizex, sizey, scene->r.cfra, SPACE_SEQ); - G.f &= ~G_RENDER_OGL; + G.f &= ~G_FLAG_RENDER_VIEWPORT; gp_rect = MEM_mallocN(sizex * sizey * sizeof(unsigned char) * 4, "offscreen rect"); GPU_offscreen_read_pixels(oglrender->ofs, GL_UNSIGNED_BYTE, gp_rect); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index fe136ddc712..805d10583ba 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -759,7 +759,7 @@ static int sound_unpack_exec(bContext *C, wmOperator *op) if (!sound || !sound->packedfile) return OPERATOR_CANCELLED; - if (G.fileflags & G_AUTOPACK) + if (G.fileflags & G_FILE_AUTOPACK) BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save"); unpackSound(bmain, op->reports, sound, method); @@ -783,7 +783,7 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE if (!sound || !sound->packedfile) return OPERATOR_CANCELLED; - if (G.fileflags & G_AUTOPACK) + if (G.fileflags & G_FILE_AUTOPACK) BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save"); unpack_menu(C, "SOUND_OT_unpack", sound->id.name + 2, sound->name, "sounds", sound->packedfile); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 7b7920bcbb0..93f4d9a36bd 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -818,7 +818,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, ID *id, FCurve *f uiItemL(col, IFACE_("ERROR: Invalid Python expression"), ICON_CANCEL); } else if (!BKE_driver_has_simple_expression(driver)) { - if ((G.f & G_SCRIPT_AUTOEXEC) == 0) { + if ((G.f & G_FLAG_SCRIPT_AUTOEXEC) == 0) { /* TODO: Add button to enable? */ uiItemL(col, IFACE_("WARNING: Python expressions limited for security"), ICON_ERROR); } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 8221227bdd1..60c7b4e2b66 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2810,7 +2810,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if (G.fileflags & G_AUTOPACK) + if (G.fileflags & G_FILE_AUTOPACK) BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save"); /* XXX unpackImage frees image buffers */ @@ -2838,7 +2838,7 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE return OPERATOR_CANCELLED; } - if (G.fileflags & G_AUTOPACK) + if (G.fileflags & G_FILE_AUTOPACK) BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save"); unpack_menu(C, "IMAGE_OT_unpack", ima->id.name + 2, ima->name, "textures", BKE_image_has_packedfile(ima) ? ((ImagePackedFile *)ima->packedfiles.first)->packedfile : NULL); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 82927bd21b1..d9932436413 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -123,12 +123,12 @@ static int autopack_toggle_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - if (G.fileflags & G_AUTOPACK) { - G.fileflags &= ~G_AUTOPACK; + if (G.fileflags & G_FILE_AUTOPACK) { + G.fileflags &= ~G_FILE_AUTOPACK; } else { packAll(bmain, op->reports, true); - G.fileflags |= G_AUTOPACK; + G.fileflags |= G_FILE_AUTOPACK; } return OPERATOR_FINISHED; @@ -219,7 +219,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) int method = RNA_enum_get(op->ptr, "method"); if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */ - G.fileflags &= ~G_AUTOPACK; + G.fileflags &= ~G_FILE_AUTOPACK; return OPERATOR_FINISHED; } @@ -236,7 +236,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( if (!count) { BKE_report(op->reports, RPT_WARNING, "No packed files to unpack"); - G.fileflags &= ~G_AUTOPACK; + G.fileflags &= ~G_FILE_AUTOPACK; return OPERATOR_CANCELLED; } @@ -304,7 +304,7 @@ static int unpack_item_exec(bContext *C, wmOperator *op) if (method != PF_KEEP) BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */ - G.fileflags &= ~G_AUTOPACK; + G.fileflags &= ~G_FILE_AUTOPACK; return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 25524ec62dc..79c4705c915 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -64,7 +64,7 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0) return false; - if (G.f & G_BACKBUFSEL) + if (G.f & G_FLAG_BACKBUFSEL) return false; /* if its drawing textures with zbuf sel, then don't draw dots */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 33611db0c4e..1bcac0d1068 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1420,7 +1420,7 @@ void ED_view3d_draw_offscreen( UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); /* set flags */ - G.f |= G_RENDER_OGL; + G.f |= G_FLAG_RENDER_VIEWPORT; { /* free images which can have changed on frame-change @@ -1453,7 +1453,7 @@ void ED_view3d_draw_offscreen( UI_Theme_Restore(&theme_state); - G.f &= ~G_RENDER_OGL; + G.f &= ~G_FLAG_RENDER_VIEWPORT; } /** diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 5213307db3a..7a358c46f75 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -229,7 +229,7 @@ static void backdrawview3d( if (rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_set(rv3d); - G.f |= G_BACKBUFSEL; + G.f |= G_FLAG_BACKBUFSEL; if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) { draw_object_backbufsel(depsgraph, scene_eval, v3d, rv3d, obact_eval, select_mode); @@ -240,7 +240,7 @@ static void backdrawview3d( v3d->flag &= ~V3D_INVALID_BACKBUF; - G.f &= ~G_BACKBUFSEL; + G.f &= ~G_FLAG_BACKBUFSEL; GPU_depth_test(false); glEnable(GL_DITHER); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index bc8377896a9..0dead55ca46 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1024,7 +1024,7 @@ int view3d_opengl_select( /* All of the queries need to be perform on the drawing context. */ DRW_opengl_context_enable(); - G.f |= G_PICKSEL; + G.f |= G_FLAG_PICKSEL; /* Important we use the 'viewmat' and don't re-calculate since * the object & bone view locking takes 'rect' into account, see: T51629. */ @@ -1082,7 +1082,7 @@ int view3d_opengl_select( hits = drw_select_loop_user_data.hits; } - G.f &= ~G_PICKSEL; + G.f &= ~G_FLAG_PICKSEL; ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); if (v3d->shading.type > OB_WIRE) { diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 12b62b0f2fc..4bba1dd6181 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -39,7 +39,7 @@ static bool rna_Main_use_autopack_get(PointerRNA *UNUSED(ptr)) { - if (G.fileflags & G_AUTOPACK) + if (G.fileflags & G_FILE_AUTOPACK) return 1; return 0; @@ -48,9 +48,9 @@ static bool rna_Main_use_autopack_get(PointerRNA *UNUSED(ptr)) static void rna_Main_use_autopack_set(PointerRNA *UNUSED(ptr), bool value) { if (value) - G.fileflags |= G_AUTOPACK; + G.fileflags |= G_FILE_AUTOPACK; else - G.fileflags &= ~G_AUTOPACK; + G.fileflags &= ~G_FILE_AUTOPACK; } static bool rna_Main_is_saved_get(PointerRNA *UNUSED(ptr)) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 201684d5fc0..0cffbcb2b9c 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -163,8 +163,8 @@ static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; - if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC; - else G.f |= G_SCRIPT_AUTOEXEC; + if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_FLAG_SCRIPT_AUTOEXEC; + else G.f |= G_FLAG_SCRIPT_AUTOEXEC; } static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 09a063e11f4..992694a71c2 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -412,8 +412,8 @@ static PyGetSetDef bpy_app_getsets[] = { {(char *)"render_preview_size", bpy_app_preview_render_size_get, NULL, (char *)bpy_app_preview_render_size_doc, (void *)ICON_SIZE_PREVIEW}, /* security */ - {(char *)"autoexec_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL}, - {(char *)"autoexec_fail_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL_QUIET}, + {(char *)"autoexec_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_FLAG_SCRIPT_AUTOEXEC_FAIL}, + {(char *)"autoexec_fail_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET}, {(char *)"autoexec_fail_message", bpy_app_autoexec_fail_message_get, NULL, NULL, NULL}, {NULL, NULL, NULL, NULL, NULL} }; diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index a8e21d0e2e1..e45a9c221f6 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -402,9 +402,9 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C return 0.0f; #ifndef USE_BYTECODE_WHITELIST - if (!(G.f & G_SCRIPT_AUTOEXEC)) { - if (!(G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET)) { - G.f |= G_SCRIPT_AUTOEXEC_FAIL; + if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) { + if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) { + G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL; BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Driver '%s'", expr); printf("skipping driver '%s', automatic scripts are disabled\n", expr); @@ -543,7 +543,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, C #ifdef USE_BYTECODE_WHITELIST if (is_recompile && expr_code) { - if (!(G.f & G_SCRIPT_AUTOEXEC)) { + if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) { if (!bpy_driver_secure_bytecode_validate( expr_code, (PyObject *[]){ bpy_pydriver_Dict, diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 287313d6f3e..c7186c8fb85 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -389,7 +389,7 @@ void BPY_python_end(void) void BPY_python_reset(bContext *C) { /* unrelated security stuff */ - G.f &= ~(G_SCRIPT_AUTOEXEC_FAIL | G_SCRIPT_AUTOEXEC_FAIL_QUIET); + G.f &= ~(G_FLAG_SCRIPT_AUTOEXEC_FAIL | G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET); G.autoexec_fail[0] = '\0'; BPY_driver_reset(); @@ -764,9 +764,9 @@ void BPY_modules_load_user(bContext *C) for (text = bmain->text.first; text; text = text->id.next) { if (text->flags & TXT_ISSCRIPT && BLI_path_extension_check(text->id.name + 2, ".py")) { - if (!(G.f & G_SCRIPT_AUTOEXEC)) { - if (!(G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET)) { - G.f |= G_SCRIPT_AUTOEXEC_FAIL; + if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) { + if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET)) { + G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL; BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Text '%s'", text->id.name + 2); printf("scripts disabled for \"%s\", skipping '%s'\n", BKE_main_blendfile_path(bmain), text->id.name + 2); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 137870dc1ef..3a5def1df28 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -354,8 +354,8 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory) /* set the python auto-execute setting from user prefs */ /* enabled by default, unless explicitly enabled in the command line which overrides */ - if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) { - SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC); + if ((G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) == 0) { + SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC); } /* avoid re-saving for every small change to our prefs, allow overrides */ @@ -429,15 +429,15 @@ static int wm_read_exotic(const char *name) void WM_file_autoexec_init(const char *filepath) { - if (G.f & G_SCRIPT_OVERRIDE_PREF) { + if (G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) { return; } - if (G.f & G_SCRIPT_AUTOEXEC) { + if (G.f & G_FLAG_SCRIPT_AUTOEXEC) { char path[FILE_MAX]; BLI_split_dir_part(filepath, path, sizeof(path)); if (BKE_autoexec_match(path)) { - G.f &= ~G_SCRIPT_AUTOEXEC; + G.f &= ~G_FLAG_SCRIPT_AUTOEXEC; } } } @@ -615,7 +615,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) /* this flag is initialized by the operator but overwritten on read. * need to re-enable it here else drivers + registered scripts wont work. */ if (G.f != G_f) { - const int flags_keep = (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF); + const int flags_keep = (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF); G.f = (G.f & ~flags_keep) | (G_f & flags_keep); } @@ -771,8 +771,8 @@ void wm_homefile_read( /* options exclude eachother */ BLI_assert((use_factory_settings && filepath_startup_override) == 0); - if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) { - SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_SCRIPT_AUTOEXEC); + if ((G.f & G_FLAG_SCRIPT_OVERRIDE_PREF) == 0) { + SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC); } BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE); @@ -1283,7 +1283,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo /* operator now handles overwrite checks */ - if (G.fileflags & G_AUTOPACK) { + if (G.fileflags & G_FILE_AUTOPACK) { packAll(bmain, reports, false); } @@ -1490,12 +1490,12 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs) { PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_scripts"); if (!RNA_property_is_set(op->ptr, prop)) { - /* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if + /* use G_FLAG_SCRIPT_AUTOEXEC rather than the userpref because this means if * the flag has been disabled from the command line, then opening * from the menu wont enable this setting. */ bool value = use_prefs ? ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) : - ((G.f & G_SCRIPT_AUTOEXEC) != 0); + ((G.f & G_FLAG_SCRIPT_AUTOEXEC) != 0); RNA_property_boolean_set(op->ptr, prop, value); } @@ -1915,11 +1915,11 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op) G.fileflags |= G_FILE_NO_UI; if (RNA_boolean_get(op->ptr, "use_scripts")) - G.f |= G_SCRIPT_AUTOEXEC; + G.f |= G_FLAG_SCRIPT_AUTOEXEC; else - G.f &= ~G_SCRIPT_AUTOEXEC; + G.f &= ~G_FLAG_SCRIPT_AUTOEXEC; - success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_SCRIPT_AUTOEXEC)); + success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC)); /* for file open also popup for warnings, not only errors */ BKE_report_print_level_set(op->reports, RPT_WARNING); @@ -2018,12 +2018,12 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op) wm_open_init_use_scripts(op, false); if (RNA_boolean_get(op->ptr, "use_scripts")) - G.f |= G_SCRIPT_AUTOEXEC; + G.f |= G_FLAG_SCRIPT_AUTOEXEC; else - G.f &= ~G_SCRIPT_AUTOEXEC; + G.f &= ~G_FLAG_SCRIPT_AUTOEXEC; BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath)); - success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_SCRIPT_AUTOEXEC)); + success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC)); if (success) { return OPERATOR_FINISHED; @@ -2461,16 +2461,16 @@ static uiBlock *block_create_autorun_warning(struct bContext *C, struct ARegion void wm_test_autorun_warning(bContext *C) { /* Test if any auto-execution of scripts failed. */ - if ((G.f & G_SCRIPT_AUTOEXEC_FAIL) == 0) { + if ((G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL) == 0) { return; } /* Only show the warning once. */ - if (G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET) { + if (G.f & G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET) { return; } - G.f |= G_SCRIPT_AUTOEXEC_FAIL_QUIET; + G.f |= G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET; wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = (wm->winactive) ? wm->winactive : wm->windows.first; |