diff options
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_fileglobal_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_layer_types.h | 22 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 22 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_workspace_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 65 |
6 files changed, 89 insertions, 26 deletions
diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h index 6a01878a9ef..ed9640c365f 100644 --- a/source/blender/makesdna/DNA_fileglobal_types.h +++ b/source/blender/makesdna/DNA_fileglobal_types.h @@ -43,7 +43,7 @@ typedef struct FileGlobal { char pad[6]; struct bScreen *curscreen; struct Scene *curscene; - struct SceneLayer *cur_render_layer; + struct ViewLayer *cur_view_layer; void *pad1; int fileflags; diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index d78a6af1d11..3eac7f0aab3 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -51,12 +51,12 @@ typedef struct CollectionOverride { /* TODO proper data */ } CollectionOverride; -typedef struct SceneLayerEngineData { - struct SceneLayerEngineData *next, *prev; +typedef struct ViewLayerEngineData { + struct ViewLayerEngineData *next, *prev; struct DrawEngineType *engine_type; void *storage; void (*free)(void *storage); -} SceneLayerEngineData; +} ViewLayerEngineData; typedef struct LayerCollection { struct LayerCollection *next, *prev; @@ -72,8 +72,8 @@ typedef struct LayerCollection { struct IDProperty *properties_evaluated; } LayerCollection; -typedef struct SceneLayer { - struct SceneLayer *next, *prev; +typedef struct ViewLayer { + struct ViewLayer *next, *prev; char name[64]; /* MAX_NAME */ short active_collection; short flag; @@ -96,8 +96,8 @@ typedef struct SceneLayer { struct FreestyleConfig freestyle_config; /* Runtime data */ - ListBase drawdata; /* SceneLayerEngineData */ -} SceneLayer; + ListBase drawdata; /* ViewLayerEngineData */ +} ViewLayer; typedef struct SceneCollection { struct SceneCollection *next, *prev; @@ -127,11 +127,11 @@ enum { COLLECTION_DISABLED = (1 << 2), }; -/* SceneLayer->flag */ +/* ViewLayer->flag */ enum { - SCENE_LAYER_RENDER = (1 << 0), - SCENE_LAYER_ENGINE_DIRTY = (1 << 1), - SCENE_LAYER_FREESTYLE = (1 << 2), + VIEW_LAYER_RENDER = (1 << 0), + VIEW_LAYER_ENGINE_DIRTY = (1 << 1), + VIEW_LAYER_FREESTYLE = (1 << 2), }; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 9e42c0d0fc8..00e5e51e12d 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -174,22 +174,22 @@ typedef struct SceneRenderLayer { char name[64] DNA_DEPRECATED; /* MAX_NAME */ - struct Material *mat_override DNA_DEPRECATED; /* Converted to SceneLayer override. */ + struct Material *mat_override DNA_DEPRECATED; /* Converted to ViewLayer override. */ unsigned int lay DNA_DEPRECATED; /* Converted to LayerCollection cycles camera visibility override. */ unsigned int lay_zmask DNA_DEPRECATED; /* Converted to LayerCollection cycles holdout override. */ unsigned int lay_exclude DNA_DEPRECATED; - int layflag DNA_DEPRECATED; /* Converted to SceneLayer layflag and flag. */ + int layflag DNA_DEPRECATED; /* Converted to ViewLayer layflag and flag. */ int passflag DNA_DEPRECATED; /* pass_xor has to be after passflag */ - int pass_xor DNA_DEPRECATED; /* Converted to SceneLayer passflag and flag. */ + int pass_xor DNA_DEPRECATED; /* Converted to ViewLayer passflag and flag. */ - int samples DNA_DEPRECATED; /* Converted to SceneLayer override. */ - float pass_alpha_threshold DNA_DEPRECATED; /* Converted to SceneLayer pass_alpha_threshold. */ + int samples DNA_DEPRECATED; /* Converted to ViewLayer override. */ + float pass_alpha_threshold DNA_DEPRECATED; /* Converted to ViewLayer pass_alpha_threshold. */ - IDProperty *prop DNA_DEPRECATED; /* Converted to SceneLayer id_properties. */ + IDProperty *prop DNA_DEPRECATED; /* Converted to ViewLayer id_properties. */ - struct FreestyleConfig freestyleConfig DNA_DEPRECATED; /* Converted to SceneLayer freestyleConfig. */ + struct FreestyleConfig freestyleConfig DNA_DEPRECATED; /* Converted to ViewLayer freestyleConfig. */ } SceneRenderLayer; /* srl->layflag */ @@ -662,7 +662,7 @@ typedef struct RenderData { rcti disprect; /* information on different layers to be rendered */ - ListBase layers DNA_DEPRECATED; /* Converted to Scene->render_layers. */ + ListBase layers DNA_DEPRECATED; /* Converted to Scene->view_layers. */ short actlay DNA_DEPRECATED; /* Converted to Scene->active_layer. */ /* number of mblur samples */ @@ -1075,7 +1075,7 @@ typedef struct ParticleEditSettings { int draw_step, fade_frames; struct Scene *scene; - struct SceneLayer *scene_layer; + struct ViewLayer *view_layer; struct Object *object; struct Object *shape_object; } ParticleEditSettings; @@ -1688,9 +1688,9 @@ typedef struct Scene { struct PreviewImage *preview; - ListBase render_layers; + ListBase view_layers; struct SceneCollection *collection; - int active_layer; + int active_view_layer; int pad4; IDProperty *collection_properties; /* settings to be overriden by layer collections */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 8ce1410070f..34679e04f8d 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -180,7 +180,7 @@ typedef enum eSpaceButtons_Context { BCONTEXT_MODIFIER = 10, BCONTEXT_CONSTRAINT = 11, BCONTEXT_BONE_CONSTRAINT = 12, - BCONTEXT_RENDER_LAYER = 13, + BCONTEXT_VIEW_LAYER = 13, BCONTEXT_COLLECTION = 14, BCONTEXT_WORKSPACE = 15, diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index 1e650fcfb6d..f69f1b68930 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -94,7 +94,7 @@ typedef struct WorkSpace { /* should be: '#ifdef USE_WORKSPACE_TOOL'. */ bToolDef tool; - struct SceneLayer *render_layer DNA_PRIVATE_WORKSPACE; + struct ViewLayer *view_layer DNA_PRIVATE_WORKSPACE; struct ViewRender view_render; } WorkSpace; diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 181d01e04fc..c8312ce568b 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -311,10 +311,39 @@ BLI_INLINE const char *pad_up_4(const char *ptr) } /** + * Temporary DNA doversion for files that were created with Blender 2.80 + * between October 2016, and November 2017 (>=280.0 and < 280.2). + * + * /note This would be way more efficient if we can get the version from SDNA + * So we could return true if version == 280 && subversion < 2. + * + * Returns true if we need to do the DNA renaming. + */ +static bool need_doversion_280(SDNA *sdna, int *data, const bool data_alloc) +{ + if (data_alloc == false) { + return false; + } + + const char *cp = (char *)data; + for (int nr = 0; nr < sdna->nr_names; nr++) { + if (strcmp(cp, "*cur_render_layer") == 0) { + return true; + } + + while (*cp) cp++; + cp++; + } + + return false; +} + +/** * In sdna->data the data, now we convert that to something understandable */ static bool init_structDNA( SDNA *sdna, bool do_endian_swap, + bool data_alloc, const char **r_error_message) { int *data, *verg, gravity_fix = -1; @@ -359,6 +388,10 @@ static bool init_structDNA( *r_error_message = "NAME error in SDNA file"; return false; } + + /* Temporary DNA doversion for files that were created with Blender 2.80 + * between 280.0 and 280.2. */ + const bool doversion_280 = need_doversion_280(sdna, data, data_alloc); cp = (char *)data; for (int nr = 0; nr < sdna->nr_names; nr++) { @@ -373,6 +406,28 @@ static bool init_structDNA( gravity_fix = nr; } } + else if (doversion_280) { + if (strcmp(cp, "*render_layer") == 0) { + /* WorkSpace. */ + sdna->names[nr] = "*view_layer"; + } + else if (strcmp(cp, "*scene_layer") == 0) { + /* ParticleEditSettings. */ + sdna->names[nr] = "*view_layer"; + } + else if (strcmp(cp, "render_layers") == 0) { + /* Scene. */ + sdna->names[nr] = "view_layers"; + } + else if (strcmp(cp, "active_layer") == 0) { + /* Scene. */ + sdna->names[nr] = "active_view_layer"; + } + else if (strcmp(cp, "*cur_render_layer") == 0) { + /* FileGlobal. */ + sdna->names[nr] = "*cur_view_layer"; + } + } while (*cp) cp++; cp++; @@ -410,6 +465,14 @@ static bool init_structDNA( /* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */ if (strcmp("bScreen", cp) == 0) sdna->types[nr] = cp + 1; } + else if (doversion_280) { + if (strcmp(cp, "SceneLayer") == 0) { + sdna->types[nr] = "ViewLayer"; + } + else if (strcmp(cp, "SceneLayerEngineData") == 0) { + sdna->types[nr] = "ViewLayerEngineData"; + } + } while (*cp) cp++; cp++; @@ -552,7 +615,7 @@ SDNA *DNA_sdna_from_data( sdna->data_alloc = data_alloc; - if (init_structDNA(sdna, do_endian_swap, &error_message)) { + if (init_structDNA(sdna, do_endian_swap, data_alloc, &error_message)) { return sdna; } else { |