Avoid possible compatibility issues with tmp viewport flags

We can't prevent users from using this branch, so I'd say it's reasonable to be a bit careful about what we store to files. In this concrete case we were storing a bit-flag for temporary use (only during early viewport transition) in a bit-field that's saved in files. Doing so would mean we either can't reuse this bit later or we risk breaking files (admittedly, likely in a pretty minor way). Moved the bit-flag to a new bit-field which can be removed later.
This commit is contained in:
Julian Eisel 2016-10-07 03:33:50 +02:00
parent 49beb714c5
commit fc77787f6f
3 changed files with 13 additions and 6 deletions

View File

@ -318,7 +318,7 @@ extern bool view3d_camera_border_hack_test;
#endif
/* temporary test for blender 2.8 viewport */
#define IS_VIEWPORT_LEGACY(v3d) (v3d->flag3 & V3D_NEW_VIEWPORT) == 0
#define IS_VIEWPORT_LEGACY(v3d) (v3d->tmp_compat_flag & V3D_NEW_VIEWPORT) == 0
/* temporary for legacy viewport to work */
void VP_legacy_drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit);
@ -329,4 +329,4 @@ void VP_legacy_view3d_stereo3d_setup(Scene *scene, View3D *v3d, ARegion *ar);
void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *base);
bool VP_legacy_use_depth(Scene *scene, View3D *v3d);
#endif /* __VIEW3D_INTERN_H__ */
#endif /* __VIEW3D_INTERN_H__ */

View File

@ -217,8 +217,11 @@ typedef struct View3D {
char multiview_eye; /* multiview current eye - for internal use */
/* built-in shader effects (eGPUFXFlags) */
char pad3[4];
/* XXX tmp flags for 2.8 viewport transition to avoid compatibility issues that would be caused by
* using usual flag bitfields (which are saved to files). Can be removed when not needed anymore. */
char tmp_compat_flag;
char pad3[3];
/* note, 'fx_settings.dof' is currently _not_ allocated,
* instead set (temporarily) from camera */
@ -319,7 +322,11 @@ typedef struct View3D {
/* View3d->flag3 (short) */
#define V3D_SHOW_WORLD (1 << 0)
#define V3D_NEW_VIEWPORT (1 << 1)
/* View3d->tmp_compat_flag */
enum {
V3D_NEW_VIEWPORT = (1 << 0),
};
/* View3D->around */
enum {

View File

@ -2738,7 +2738,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
/* *** Blender 2.8 Viewport temporary *** */
prop = RNA_def_property(srna, "use_modern_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag3", V3D_NEW_VIEWPORT);
RNA_def_property_boolean_sdna(prop, NULL, "tmp_compat_flag", V3D_NEW_VIEWPORT);
RNA_def_property_ui_text(prop, "Modern Viewport", "Use modern viewport");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);