[Bf-blender-cvs] [afcbf7cf135] master: Cleanup: use G_FLAG_*/G_FILE_* for G.f/fileflags

Campbell Barton noreply at git.blender.org
Sat Feb 2 03:49:12 CET 2019


Commit: afcbf7cf1357723f59eca8e118a0ca9ef6cf6555
Author: Campbell Barton
Date:   Sat Feb 2 13:39:51 2019 +1100
Branches: master
https://developer.blender.org/rBafcbf7cf1357723f59eca8e118a0ca9ef6cf6555

Cleanup: use G_FLAG_*/G_FILE_* for G.f/fileflags

Was confusing eg: G_AUTOPACK belonged to G.fileflags, G_PICKSEL to G.f.

===================================================================

M	source/blender/blenkernel/BKE_global.h
M	source/blender/blenkernel/intern/blender.c
M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/font.c
M	source/blender/blenkernel/intern/image.c
M	source/blender/draw/intern/draw_manager_data.c
M	source/blender/draw/intern/draw_manager_exec.c
M	source/blender/editors/gpencil/annotate_draw.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/sound/sound_ops.c
M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_info/info_ops.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_draw_legacy.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/makesrna/intern/rna_main.c
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/python/intern/bpy_app.c
M	source/blender/python/intern/bpy_driver.c
M	source/blender/python/intern/bpy_interface.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/creator/creator_args.c

===================================================================

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/drawgpen

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list