Merge branch 'master' into soc-2018-npr Fix errors
authorYiming Wu <xp8110@outlook.com>
Sat, 20 Apr 2019 06:10:24 +0000 (14:10 +0800)
committerYiming Wu <xp8110@outlook.com>
Sat, 20 Apr 2019 06:10:24 +0000 (14:10 +0800)
# Conflicts:
# intern/opensubdiv/internal/opensubdiv_evaluator.cc
# intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
# release/scripts/startup/bl_ui/properties_data_modifier.py
# source/blender/CMakeLists.txt
# source/blender/blenkernel/intern/scene.c
# source/blender/blenloader/intern/readfile.c
# source/blender/blenloader/intern/versioning_280.c
# source/blender/blenloader/intern/writefile.c
# source/blender/bmesh/intern/bmesh_polygon.c
# source/blender/draw/CMakeLists.txt
# source/blender/draw/intern/draw_manager.c
# source/blender/draw/modes/object_mode.c
# source/blender/editors/mesh/editmesh_tools.c
# source/blender/editors/mesh/mesh_ops.c
# source/blender/editors/render/render_intern.h
# source/blender/editors/render/render_ops.c
# source/blender/editors/space_outliner/outliner_draw.c
# source/blender/editors/space_view3d/space_view3d.c
# source/blender/makesdna/DNA_light_types.h
# source/blender/makesdna/DNA_modifier_types.h
# source/blender/makesdna/DNA_scene_types.h
# source/blender/makesdna/intern/makesdna.c
# source/blender/makesrna/intern/CMakeLists.txt
# source/blender/makesrna/intern/makesrna.c
# source/blender/makesrna/intern/rna_modifier.c
# source/blender/makesrna/intern/rna_scene.c
# source/blender/modifiers/CMakeLists.txt
# source/blender/modifiers/intern/MOD_util.c

32 files changed:
1  2 
intern/opensubdiv/opensubdiv_evaluator_capi.h
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_physics_fluid.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_280.c
source/blender/blenloader/intern/writefile.c
source/blender/draw/CMakeLists.txt
source/blender/draw/intern/DRW_render.h
source/blender/draw/intern/draw_manager.c
source/blender/draw/intern/draw_manager_texture.c
source/blender/draw/modes/object_mode.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/render/render_intern.h
source/blender/editors/render/render_ops.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_scene.c
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/MOD_modifiertypes.h
source/blender/modifiers/intern/MOD_util.c

index 8e6721ba767c08c5dd0e8d8ca1248fcbe72be1f3,ceb0c58feba689efd5ddd9c8e6cb10f3feba1976..a84a52b13f358ed548e1d0821939ca800f5dd697
@@@ -83,25 -84,19 +84,29 @@@ typedef struct OpenSubdiv_Evaluator 
  
    // Evaluate given ptex face at given bilinear coordinate.
    // If derivatives are NULL, they will not be evaluated.
-   void (*evaluateLimit)(struct OpenSubdiv_Evaluatorevaluator,
+   void (*evaluateLimit)(struct OpenSubdiv_Evaluator *evaluator,
                          const int ptex_face_index,
-                         float face_u, float face_v,
-                         float P[3], float dPdu[3], float dPdv[3]);
+                         float face_u,
+                         float face_v,
+                         float P[3],
+                         float dPdu[3],
+                         float dPdv[3]);
  
 +  void (*evaluateLimit2)(struct OpenSubdiv_Evaluator* evaluator,
 +                        const int ptex_face_index,
 +                        float face_u, float face_v,
 +                                              float P[3],
 +                                              float dPdu[3],
 +                                              float dPdv[3],
 +                                              float dPduu[3],
 +                                              float dPduv[3],
 +                                              float dPdvv[3]);
 +
    // Evaluate varying data at a given bilinear coordinate of given ptex face.
-   void (*evaluateVarying)(struct OpenSubdiv_Evaluatorevaluator,
+   void (*evaluateVarying)(struct OpenSubdiv_Evaluator *evaluator,
                            const int ptex_face_index,
-                           float face_u, float face_v,
+                           float face_u,
+                           float face_v,
                            float varying[3]);
  
    // Evaluate face-varying data at a given bilinear coordinate of given
index b454994e900d5dcdd5939fd24dccb86fb4330fef,df431000048fba3c599dfdf918ea812e4bf87085..3a12b89916b560bd8c3c5bd99ec946928dd98e43
@@@ -476,495 -420,9 +476,495 @@@ class SCENE_PT_rigid_body_field_weights
          scene = context.scene
          rbw = scene.rigidbody_world
  
-         effector_weights_ui(self, context, rbw.effector_weights, 'RIGID_BODY')
+         effector_weights_ui(self, rbw.effector_weights, 'RIGID_BODY')
  
  
 +class SCENE_PT_simplify(SceneButtonsPanel, Panel):
 +    bl_label = "Simplify"
 +    bl_options = {'DEFAULT_CLOSED'}
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL', 'BLENDER_LANPR'}
 +
 +    def draw_header(self, context):
 +        rd = context.scene.render
 +        self.layout.prop(rd, "use_simplify", text="")
 +
 +    def draw(self, context):
 +        pass
 +
 +
 +class SCENE_PT_simplify_viewport(SceneButtonsPanel, Panel):
 +    bl_label = "Viewport"
 +    bl_parent_id = "SCENE_PT_simplify"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL', 'BLENDER_LANPR'}
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        layout.use_property_split = True
 +
 +        rd = context.scene.render
 +
 +        layout.active = rd.use_simplify
 +
 +        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
 +
 +        col = flow.column()
 +        col.prop(rd, "simplify_subdivision", text="Max Subdivision")
 +
 +        col = flow.column()
 +        col.prop(rd, "simplify_child_particles", text="Max Child Particles")
 +
 +
 +class SCENE_PT_simplify_render(SceneButtonsPanel, Panel):
 +    bl_label = "Render"
 +    bl_parent_id = "SCENE_PT_simplify"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL', 'BLENDER_LANPR'}
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        layout.use_property_split = True
 +
 +        rd = context.scene.render
 +
 +        layout.active = rd.use_simplify
 +
 +        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
 +
 +        col = flow.column()
 +        col.prop(rd, "simplify_subdivision_render", text="Max Subdivision")
 +
 +        col = flow.column()
 +        col.prop(rd, "simplify_child_particles_render", text="Max Child Particles")
 +
 +
 +class SCENE_PT_simplify_greasepencil(SceneButtonsPanel, Panel):
 +    bl_label = "Grease Pencil"
 +    bl_parent_id = "SCENE_PT_simplify"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME', 'BLENDER_CLAY', 'BLENDER_EEVEE'}
 +    bl_options = {'DEFAULT_CLOSED'}
 +
 +    def draw_header(self, context):
 +        rd = context.scene.render
 +        self.layout.prop(rd, "simplify_gpencil", text="")
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        layout.use_property_split = True
 +
 +        rd = context.scene.render
 +
 +        layout.active = rd.simplify_gpencil
 +
 +        col = layout.column()
 +        col.prop(rd, "simplify_gpencil_onplay", text="Playback Only")
 +        col.prop(rd, "simplify_gpencil_view_modifier", text="Modifiers")
 +        col.prop(rd, "simplify_gpencil_shader_fx", text="ShaderFX")
 +
 +        col = layout.column(align=True)
 +        col.prop(rd, "simplify_gpencil_view_fill")
 +        sub = col.column()
 +        sub.active = rd.simplify_gpencil_view_fill
 +        sub.prop(rd, "simplify_gpencil_remove_lines", text="Lines")
 +
 +class SCENE_PT_viewport_display(SceneButtonsPanel, Panel):
 +    bl_label = "Viewport Display"
 +    bl_options = {'DEFAULT_CLOSED'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        return True
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        layout.use_property_split = True
 +        scene = context.scene
 +        col = layout.column()
 +        col.prop(scene.display, "light_direction")
 +        col.prop(scene.display, "shadow_shift")
 +
 +class LANPR_linesets(UIList):
 +    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
 +        lineset = item
 +        if self.layout_type in {'DEFAULT', 'COMPACT'}:
 +            split = layout.split(factor=0.6)
 +            split.label(text="Layer")
 +            row = split.row(align=True)
 +            row.prop(lineset, "color", text="", icon_value=icon)
 +            row.prop(lineset, "thickness", text="", icon_value=icon)
 +        elif self.layout_type == 'GRID':
 +            layout.alignment = 'CENTER'
 +            layout.label("", icon_value=icon)
 +
 +def lanpr_get_composition_scene(scene):
 +    n = scene.name+'_lanpr_comp'
 +    for s in bpy.data.scenes:
 +        if s.name == n: return s
 +    return None
 +
 +def lanpr_is_composition_scene(scene):
 +    return scene.name.endswith('_lanpr_comp')
 +
 +class SCENE_PT_lanpr(SceneButtonsPanel, Panel):
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL', 'BLENDER_EEVEE'}
 +    bl_label = "LANPR"
 +    bl_options = {'DEFAULT_CLOSED'}
 +    
 +    @classmethod
 +    def poll(cls, context):
 +        return True
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        active_layer = lanpr.layers.active_layer 
 +        
 +        sc = lanpr_get_composition_scene(scene)
 +        
 +        if sc is not None:
 +            layout.label(text = 'You are adjusting values for LANPR compostion scene.')
 +            row = layout.row()
 +            row.scale_y=1.5
 +            row.operator("lanpr.goto_composition_scene")
 +            layout.operator("lanpr.remove_composition_scene")
 +            scene = sc
 +            lanpr = scene.lanpr
 +            active_layer = lanpr.layers.active_layer
 +            return
 +        elif scene.render.engine!='BLENDER_LANPR':
 +            layout.label(text = 'Select LANPR engine or use composition scene.')
 +            layout.operator("lanpr.make_composition_scene")
 +            return
 +
 +        if lanpr_is_composition_scene(scene):
 +            row = layout.row()
 +            row.scale_y=1.5
 +            row.operator("lanpr.goto_original_scene") 
 +            
 +            layout.label(text='LANPR Composition')
 +            row = layout.row()
 +            row.scale_y=1.5
 +            row.scale_x=4
 +            row.operator("lanpr.render_composited", icon = 'RENDER_STILL')
 +            row.scale_x=1
 +            row.prop(lanpr,"composite_render_animation", toggle=True, icon = 'RENDER_ANIMATION')
 +        
 +        layout.label(text='Mode:')
 +        
 +        layout.prop(lanpr, "master_mode", expand=True) 
 +
 +        if lanpr.master_mode == "DPIX" or lanpr.master_mode == "SOFTWARE":
 +            
 +            layout.prop(lanpr, "background_color")
 +
 +            if lanpr.master_mode == "SOFTWARE":
 +                layout.label(text="Enable On Demand:")
 +                row = layout.row()
 +                row.prop(lanpr,"enable_intersections", text = "Intersection Lines")
 +                row.prop(lanpr,"enable_chaining", text = "Chaining (SLOW!)")
 +                layout.label(text="RUN:")
 +                layout.operator("scene.lanpr_calculate", icon='RENDER_STILL')
 +
 +                split = layout.split(factor=0.7)
 +                col = split.column()
 +                col.label(text="Layer Composition:")
 +                col = split.column()
 +                col.operator("scene.lanpr_auto_create_line_layer", text = "Default")#, icon = "ZOOMIN")
 +                layout.template_list("LANPR_linesets", "", lanpr, "layers", lanpr.layers, "active_layer_index", rows=4)
 +                if active_layer:
 +                    split = layout.split()
 +                    col = split.column()
 +                    col.operator("scene.lanpr_add_line_layer")#icon="ZOOMIN")
 +                    col.operator("scene.lanpr_delete_line_layer")#, icon="ZOOMOUT")
 +                    col = split.column()
 +                    col.operator("scene.lanpr_move_line_layer").direction = "UP"
 +                    col.operator("scene.lanpr_move_line_layer").direction = "DOWN"
 +                    layout.operator("scene.lanpr_rebuild_all_commands")
 +                else:
 +                    layout.operator("scene.lanpr_add_line_layer")
 +            
 +            if active_layer:
 +                layout.label(text= "Normal:")
 +                layout.prop(active_layer,"normal_mode", expand = True)
 +                if active_layer.normal_mode != "DISABLED":
 +                    layout.prop(active_layer,"normal_control_object")
 +                    layout.prop(active_layer,"normal_effect_inverse", toggle = True)
 +                    layout.prop(active_layer,"normal_ramp_begin")
 +                    layout.prop(active_layer,"normal_ramp_end")
 +                    layout.prop(active_layer,"normal_thickness_begin", slider=True)
 +                    layout.prop(active_layer,"normal_thickness_end", slider=True)
 +            
 +        else:
 +            layout.label(text="Vectorization:")
 +            layout.prop(lanpr, "enable_vector_trace", expand = True)
 +
 +
 +class SCENE_PT_lanpr_line_types(SceneButtonsPanel, Panel):
 +    bl_label = "Types"
 +    bl_parent_id = "SCENE_PT_lanpr"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        active_layer = lanpr.layers.active_layer
 +        return active_layer and lanpr.master_mode != "SNAKE"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        active_layer = lanpr.layers.active_layer
 +        if active_layer and lanpr.master_mode == "DPIX":
 +            active_layer = lanpr.layers[0]
 +
 +        layout.operator("scene.lanpr_enable_all_line_types")
 +
 +        split = layout.split(factor=0.3)
 +        col = split.column()
 +        col.prop(active_layer, "enable_contour", text="Contour", toggle=True)
 +        col.prop(active_layer, "enable_crease", text="Crease", toggle=True)
 +        col.prop(active_layer, "enable_edge_mark", text="Mark", toggle=True)
 +        col.prop(active_layer, "enable_material_seperate", text="Material", toggle=True)
 +        col.prop(active_layer, "enable_intersection", text="Intersection", toggle=True)
 +        col = split.column()
 +        row = col.row(align = True)
 +        #row.enabled = active_layer.enable_contour this is always enabled now
 +        row.prop(active_layer, "color", text="")
 +        row.prop(active_layer, "thickness", text="")
 +        row = col.row(align = True)
 +        row.enabled = active_layer.enable_crease
 +        row.prop(active_layer, "crease_color", text="")
 +        row.prop(active_layer, "thickness_crease", text="")
 +        row = col.row(align = True)
 +        row.enabled = active_layer.enable_edge_mark
 +        row.prop(active_layer, "edge_mark_color", text="")
 +        row.prop(active_layer, "thickness_edge_mark", text="")
 +        row = col.row(align = True)
 +        row.enabled = active_layer.enable_material_seperate
 +        row.prop(active_layer, "material_color", text="")
 +        row.prop(active_layer, "thickness_material", text="")
 +        row = col.row(align = True)
 +        if lanpr.enable_intersections:
 +            row.enabled = active_layer.enable_intersection
 +            row.prop(active_layer, "intersection_color", text="")
 +            row.prop(active_layer, "thickness_intersection", text="")
 +        else:
 +            row.label(text= "Intersection Calculation Disabled")
 +
 +        if lanpr.master_mode == "DPIX" and active_layer.enable_intersection:
 +            row = col.row(align = True)
 +            row.prop(lanpr,"enable_intersections", toggle = True, text = "Enable")
 +            if lanpr.enable_intersections:
 +                row.operator("scene.lanpr_calculate", text= "Recalculate")
 +
 +        if lanpr.master_mode == "SOFTWARE":
 +            row = layout.row(align=True)
 +            row.prop(active_layer, "qi_begin")
 +            row.prop(active_layer, "qi_end")
 +
 +class SCENE_PT_lanpr_line_components(SceneButtonsPanel, Panel):
 +    bl_label = "Including"
 +    bl_parent_id = "SCENE_PT_lanpr"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        active_layer = lanpr.layers.active_layer
 +        return active_layer and lanpr.master_mode == "SOFTWARE" and not lanpr.enable_chaining
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        active_layer = lanpr.layers.active_layer
 +
 +        layout.operator("scene.lanpr_add_line_component")#, icon = "ZOOMIN")
 +        
 +        i=0
 +        for c in active_layer.components:
 +            split = layout.split(factor=0.85)
 +            col = split.column()
 +            sp2 = col.split(factor=0.4)
 +            cl = sp2.column()
 +            cl.prop(c,"component_mode", text = "")
 +            cl = sp2.column()
 +            if c.component_mode == "OBJECT":
 +                cl.prop(c,"object_select", text = "")
 +            elif c.component_mode == "MATERIAL":
 +                cl.prop(c,"material_select", text = "")
 +            elif c.component_mode == "COLLECTION":
 +                cl.prop(c,"collection_select", text = "")
 +            col = split.column()
 +            col.operator("scene.lanpr_delete_line_component", text="").index=i
 +            i=i+1
 +
 +
 +class SCENE_PT_lanpr_line_effects(SceneButtonsPanel, Panel):
 +    bl_label = "Effects"
 +    bl_parent_id = "SCENE_PT_lanpr"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        return lanpr.master_mode == "DPIX"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        active_layer = lanpr.layers.active_layer
 +
 +        row = layout.row(align = True)
 +        row.prop(lanpr, "crease_threshold")
 +        row.prop(lanpr, "crease_fade_threshold")
 +        row = layout.row(align = True)
 +        row.prop(lanpr, "depth_width_influence")
 +        row.prop(lanpr, "depth_width_curve")
 +        row = layout.row(align = True)
 +        row.prop(lanpr, "depth_alpha_influence")
 +        row.prop(lanpr, "depth_alpha_curve")
 +
 +class SCENE_PT_lanpr_snake_sobel_parameters(SceneButtonsPanel, Panel):
 +    bl_label = "Sobel Parameters"
 +    bl_parent_id = "SCENE_PT_lanpr"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        return lanpr.master_mode == "SNAKE"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        layout.prop(lanpr, "depth_clamp")
 +        layout.prop(lanpr, "depth_strength")
 +        layout.prop(lanpr, "normal_clamp")
 +        layout.prop(lanpr, "normal_strength")
 +        if lanpr.enable_vector_trace == "DISABLED":
 +            layout.prop(lanpr, "display_thinning_result")
 +
 +class SCENE_PT_lanpr_snake_settings(SceneButtonsPanel, Panel):
 +    bl_label = "Snake Settings"
 +    bl_parent_id = "SCENE_PT_lanpr"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        return lanpr.master_mode == "SNAKE" and lanpr.enable_vector_trace == "ENABLED"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +
 +        split = layout.split()
 +        col = split.column()
 +        col.prop(lanpr, "background_color")
 +        col = split.column()
 +        col.prop(lanpr, "line_color")
 +        
 +        layout.prop(lanpr, "line_thickness")
 +
 +        split = layout.split()
 +        col = split.column()
 +        col.prop(lanpr, "depth_width_influence")
 +        col.prop(lanpr, "depth_alpha_influence")
 +        col = split.column()
 +        col.prop(lanpr, "depth_width_curve")
 +        col.prop(lanpr, "depth_alpha_curve")
 +        
 +        layout.label(text="Taper:")
 +        layout.prop(lanpr, "use_same_taper", expand = True)
 +        if lanpr.use_same_taper == "DISABLED":
 +            split = layout.split()
 +            col = split.column(align = True)
 +            col.label(text="Left:")
 +            col.prop(lanpr,"taper_left_distance")
 +            col.prop(lanpr,"taper_left_strength")
 +            col = split.column(align = True)
 +            col.label(text="Right:")
 +            col.prop(lanpr,"taper_right_distance")
 +            col.prop(lanpr,"taper_right_strength")
 +        else:
 +            split = layout.split()
 +            col = split.column(align = True)
 +            col.prop(lanpr,"taper_left_distance")
 +            col.prop(lanpr,"taper_left_strength") 
 +
 +        layout.label(text="Tip Extend:")
 +        layout.prop(lanpr, "enable_tip_extend",  expand = True)
 +        if lanpr.enable_tip_extend == "ENABLED":
 +            layout.label(text="---INOP---")
 +            layout.prop(lanpr,"extend_length")
 +
 +class SCENE_PT_lanpr_software_chain_styles(SceneButtonsPanel, Panel):
 +    bl_label = "Chain Styles"
 +    bl_parent_id = "SCENE_PT_lanpr"
 +    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_LANPR', 'BLENDER_OPENGL'}
 +
 +    @classmethod
 +    def poll(cls, context):
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        return lanpr.master_mode == "SOFTWARE" and lanpr.enable_chaining
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        scene = context.scene
 +        lanpr = scene.lanpr
 +        layout.label(text="Taper:")
 +        layout.prop(lanpr, "use_same_taper", expand = True)
 +        if lanpr.use_same_taper == "DISABLED":
 +            split = layout.split()
 +            col = split.column(align = True)
 +            col.label(text="Left:")
 +            col.prop(lanpr,"taper_left_distance")
 +            col.prop(lanpr,"taper_left_strength")
 +            col = split.column(align = True)
 +            col.label(text="Right:")
 +            col.prop(lanpr,"taper_right_distance")
 +            col.prop(lanpr,"taper_right_strength")
 +        else:
 +            split = layout.split()
 +            col = split.column(align = True)
 +            col.prop(lanpr,"taper_left_distance")
 +            col.prop(lanpr,"taper_left_strength") 
 +
 +        layout.label(text="Tip Extend:")
 +        layout.prop(lanpr, "enable_tip_extend",  expand = True)
 +        if lanpr.enable_tip_extend == "ENABLED":
 +            layout.label(text="---INOP---")
 +            layout.prop(lanpr,"extend_length")
 +
 +
 +class SCENE_PT_viewport_display_ssao(SceneButtonsPanel, Panel):
 +    bl_label = "Screen Space Ambient Occlusion"
 +    bl_parent_id = "SCENE_PT_viewport_display"
 +
 +    @classmethod
 +    def poll(cls, context):
 +        return True
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        layout.use_property_split = True
 +        scene = context.scene
 +        col = layout.column()
 +        col.prop(scene.display, "matcap_ssao_samples")
 +        col.prop(scene.display, "matcap_ssao_distance")
 +        col.prop(scene.display, "matcap_ssao_attenuation")
 +
 +
  class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel):
      _context_path = "scene"
      _property_type = bpy.types.Scene
index d859f9fbee88a64087f2d1f3c2529993f256d2bc,5fad95c54e2d21ab569d35ea7610b4fe5dc491e3..ee85ce40f2a973e114bb27679cdcb296c5029f4d
@@@ -534,450 -550,417 +550,440 @@@ void BKE_scene_free(Scene *sce
  
  void BKE_scene_init(Scene *sce)
  {
-       ParticleEditSettings *pset;
-       int a;
-       const char *colorspace_name;
-       SceneRenderView *srv;
-       CurveMapping *mblur_shutter_curve;
-       BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(sce, id));
-       sce->cursor.rotation_mode = ROT_MODE_XYZ;
-       sce->cursor.rotation_quaternion[0] = 1.0f;
-       sce->cursor.rotation_axis[1] = 1.0f;
-       sce->r.mode = R_OSA;
-       sce->r.cfra = 1;
-       sce->r.sfra = 1;
-       sce->r.efra = 250;
-       sce->r.frame_step = 1;
-       sce->r.xsch = 1920;
-       sce->r.ysch = 1080;
-       sce->r.xasp = 1;
-       sce->r.yasp = 1;
-       sce->r.tilex = 256;
-       sce->r.tiley = 256;
-       sce->r.size = 100;
-       sce->r.im_format.planes = R_IMF_PLANES_RGBA;
-       sce->r.im_format.imtype = R_IMF_IMTYPE_PNG;
-       sce->r.im_format.depth = R_IMF_CHAN_DEPTH_8;
-       sce->r.im_format.quality = 90;
-       sce->r.im_format.compress = 15;
-       sce->r.displaymode = R_OUTPUT_WINDOW;
-       sce->r.framapto = 100;
-       sce->r.images = 100;
-       sce->r.framelen = 1.0;
-       sce->r.blurfac = 0.5;
-       sce->r.frs_sec = 24;
-       sce->r.frs_sec_base = 1;
-       /* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used,
-        *            images would look in the same way as in current blender
-        *
-        *            perhaps at some point should be completely deprecated?
-        */
-       sce->r.color_mgt_flag |= R_COLOR_MANAGEMENT;
-       sce->r.gauss = 1.5;
-       sce->r.dither_intensity = 1.0f;
-       sce->r.bake_mode = 0;
-       sce->r.bake_filter = 16;
-       sce->r.bake_flag = R_BAKE_CLEAR;
-       sce->r.bake_samples = 256;
-       sce->r.bake_biasdist = 0.001;
-       sce->r.bake.flag = R_BAKE_CLEAR;
-       sce->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
-       sce->r.bake.width = 512;
-       sce->r.bake.height = 512;
-       sce->r.bake.margin = 16;
-       sce->r.bake.normal_space = R_BAKE_SPACE_TANGENT;
-       sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
-       sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
-       sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
-       BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
-       sce->r.bake.im_format.planes = R_IMF_PLANES_RGBA;
-       sce->r.bake.im_format.imtype = R_IMF_IMTYPE_PNG;
-       sce->r.bake.im_format.depth = R_IMF_CHAN_DEPTH_8;
-       sce->r.bake.im_format.quality = 90;
-       sce->r.bake.im_format.compress = 15;
-       sce->r.scemode = R_DOCOMP | R_DOSEQ | R_EXTENSION;
-       sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | R_STAMP_CAMERA | R_STAMP_SCENE | R_STAMP_FILENAME | R_STAMP_RENDERTIME | R_STAMP_MEMORY;
-       sce->r.stamp_font_id = 12;
-       sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
-       sce->r.fg_stamp[3] = 1.0f;
-       sce->r.bg_stamp[0] = sce->r.bg_stamp[1] = sce->r.bg_stamp[2] = 0.0f;
-       sce->r.bg_stamp[3] = 0.25f;
-       sce->r.seq_prev_type = OB_SOLID;
-       sce->r.seq_rend_type = OB_SOLID;
-       sce->r.seq_flag = 0;
-       sce->r.threads = 1;
-       sce->r.simplify_subsurf = 6;
-       sce->r.simplify_particles = 1.0f;
-       sce->r.border.xmin = 0.0f;
-       sce->r.border.ymin = 0.0f;
-       sce->r.border.xmax = 1.0f;
-       sce->r.border.ymax = 1.0f;
-       sce->r.preview_start_resolution = 64;
-       sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE;
-       sce->r.unit_line_thickness = 1.0f;
-       mblur_shutter_curve = &sce->r.mblur_shutter_curve;
-       curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f);
-       curvemapping_initialize(mblur_shutter_curve);
-       curvemap_reset(mblur_shutter_curve->cm,
-                      &mblur_shutter_curve->clipr,
-                      CURVE_PRESET_MAX,
-                      CURVEMAP_SLOPE_POS_NEG);
-       sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
-       sce->toolsettings->object_flag |= SCE_OBJECT_MODE_LOCK;
-       sce->toolsettings->doublimit = 0.001;
-       sce->toolsettings->vgroup_weight = 1.0f;
-       sce->toolsettings->uvcalc_margin = 0.001f;
-       sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT;
-       sce->toolsettings->unwrapper = 1;
-       sce->toolsettings->select_thresh = 0.01f;
-       sce->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
-       sce->toolsettings->selectmode = SCE_SELECT_VERTEX;
-       sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX;
-       sce->toolsettings->autokey_mode = U.autokey_mode;
-       sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
-       sce->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
-       sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
-       sce->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;
-       sce->toolsettings->snap_transform_mode_flag = SCE_SNAP_TRANSFORM_MODE_TRANSLATE;
-       sce->toolsettings->curve_paint_settings.curve_type = CU_BEZIER;
-       sce->toolsettings->curve_paint_settings.flag |= CURVE_PAINT_FLAG_CORNERS_DETECT;
-       sce->toolsettings->curve_paint_settings.error_threshold = 8;
-       sce->toolsettings->curve_paint_settings.radius_max = 1.0f;
-       sce->toolsettings->curve_paint_settings.corner_angle = DEG2RADF(70.0f);
-       sce->toolsettings->statvis.overhang_axis = OB_NEGZ;
-       sce->toolsettings->statvis.overhang_min = 0;
-       sce->toolsettings->statvis.overhang_max = DEG2RADF(45.0f);
-       sce->toolsettings->statvis.thickness_max = 0.1f;
-       sce->toolsettings->statvis.thickness_samples = 1;
-       sce->toolsettings->statvis.distort_min = DEG2RADF(5.0f);
-       sce->toolsettings->statvis.distort_max = DEG2RADF(45.0f);
-       sce->toolsettings->statvis.sharp_min = DEG2RADF(90.0f);
-       sce->toolsettings->statvis.sharp_max = DEG2RADF(180.0f);
-       sce->toolsettings->proportional_size = 1.0f;
-       sce->toolsettings->imapaint.paint.flags |= PAINT_SHOW_BRUSH;
-       sce->toolsettings->imapaint.normal_angle = 80;
-       sce->toolsettings->imapaint.seam_bleed = 2;
-       /* grease pencil multiframe falloff curve */
-       sce->toolsettings->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
-       CurveMapping *gp_falloff_curve = sce->toolsettings->gp_sculpt.cur_falloff;
-       curvemapping_initialize(gp_falloff_curve);
-       curvemap_reset(
-               gp_falloff_curve->cm,
-               &gp_falloff_curve->clipr,
-               CURVE_PRESET_GAUSS,
-               CURVEMAP_SLOPE_POSITIVE);
-       sce->toolsettings->gp_sculpt.cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
-       CurveMapping *gp_primitive_curve = sce->toolsettings->gp_sculpt.cur_primitive;
-       curvemapping_initialize(gp_primitive_curve);
-       curvemap_reset(
-               gp_primitive_curve->cm,
-               &gp_primitive_curve->clipr,
-               CURVE_PRESET_BELL,
-               CURVEMAP_SLOPE_POSITIVE);
-       sce->toolsettings->gp_sculpt.guide.spacing = 20.0f;
-       sce->physics_settings.gravity[0] = 0.0f;
-       sce->physics_settings.gravity[1] = 0.0f;
-       sce->physics_settings.gravity[2] = -9.81f;
-       sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
-       sce->unit.system = USER_UNIT_METRIC;
-       sce->unit.scale_length = 1.0f;
-       sce->unit.length_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_LENGTH);
-       sce->unit.mass_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_MASS);
-       sce->unit.time_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_TIME);
-       pset = &sce->toolsettings->particle;
-       pset->flag = PE_KEEP_LENGTHS | PE_LOCK_FIRST | PE_DEFLECT_EMITTER | PE_AUTO_VELOCITY;
-       pset->emitterdist = 0.25f;
-       pset->totrekey = 5;
-       pset->totaddkey = 5;
-       pset->brushtype = PE_BRUSH_COMB;
-       pset->draw_step = 2;
-       pset->fade_frames = 2;
-       pset->selectmode = SCE_SELECT_PATH;
-       for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
-               pset->brush[a].strength = 0.5f;
-               pset->brush[a].size = 50;
-               pset->brush[a].step = 10;
-               pset->brush[a].count = 10;
-       }
-       pset->brush[PE_BRUSH_CUT].strength = 1.0f;
-       sce->r.ffcodecdata.audio_mixrate = 48000;
-       sce->r.ffcodecdata.audio_volume = 1.0f;
-       sce->r.ffcodecdata.audio_bitrate = 192;
-       sce->r.ffcodecdata.audio_channels = 2;
-       BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine));
-       sce->audio.distance_model = 2.0f;
-       sce->audio.doppler_factor = 1.0f;
-       sce->audio.speed_of_sound = 343.3f;
-       sce->audio.volume = 1.0f;
-       sce->audio.flag = AUDIO_SYNC;
-       BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
-       BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
-       sce->r.osa = 8;
-       /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
-       /* multiview - stereo */
-       BKE_scene_add_render_view(sce, STEREO_LEFT_NAME);
-       srv = sce->r.views.first;
-       BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
-       BKE_scene_add_render_view(sce, STEREO_RIGHT_NAME);
-       srv = sce->r.views.last;
-       BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
-       BKE_sound_create_scene(sce);
-       /* color management */
-       colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
-       BKE_color_managed_display_settings_init(&sce->display_settings);
-       BKE_color_managed_view_settings_init_render(&sce->view_settings,
-                                                   &sce->display_settings,
-                                                   "Filmic");
-       BLI_strncpy(sce->sequencer_colorspace_settings.name, colorspace_name,
-                   sizeof(sce->sequencer_colorspace_settings.name));
-       /* Those next two sets (render and baking settings) are not currently in use,
-        * but are exposed to RNA API and hence must have valid data. */
-       BKE_color_managed_display_settings_init(&sce->r.im_format.display_settings);
-       BKE_color_managed_view_settings_init_render(&sce->r.im_format.view_settings,
-                                                   &sce->r.im_format.display_settings,
-                                                   "Filmic");
-       BKE_color_managed_display_settings_init(&sce->r.bake.im_format.display_settings);
-       BKE_color_managed_view_settings_init_render(&sce->r.bake.im_format.view_settings,
-                                                   &sce->r.bake.im_format.display_settings,
-                                                   "Filmic");
-       /* Safe Areas */
-       copy_v2_fl2(sce->safe_areas.title, 10.0f / 100.0f, 5.0f / 100.0f);
-       copy_v2_fl2(sce->safe_areas.action, 3.5f / 100.0f, 3.5f / 100.0f);
-       copy_v2_fl2(sce->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
-       copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
-       sce->preview = NULL;
-       /* GP Sculpt brushes */
-       {
-               GP_Sculpt_Settings *gset = &sce->toolsettings->gp_sculpt;
-               GP_Sculpt_Data *gp_brush;
-               float curcolor_add[3], curcolor_sub[3];
-               ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
-               ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_SMOOTH];
-               gp_brush->size = 25;
-               gp_brush->strength = 0.3f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_SMOOTH_PRESSURE | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_THICKNESS];
-               gp_brush->size = 25;
-               gp_brush->strength = 0.5f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_STRENGTH];
-               gp_brush->size = 25;
-               gp_brush->strength = 0.5f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_GRAB];
-               gp_brush->size = 50;
-               gp_brush->strength = 0.3f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_PUSH];
-               gp_brush->size = 25;
-               gp_brush->strength = 0.3f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_TWIST];
-               gp_brush->size = 50;
-               gp_brush->strength = 0.3f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_PINCH];
-               gp_brush->size = 50;
-               gp_brush->strength = 0.5f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-               gp_brush = &gset->brush[GP_SCULPT_TYPE_RANDOMIZE];
-               gp_brush->size = 25;
-               gp_brush->strength = 0.5f;
-               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-       }
-       /* GP Stroke Placement */
-       sce->toolsettings->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
-       sce->toolsettings->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
-       sce->toolsettings->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
-       sce->toolsettings->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
-       /* Annotations */
-       sce->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
-       sce->toolsettings->annotate_thickness = 3;
-       for (int i = 0; i < ARRAY_SIZE(sce->orientation_slots); i++) {
-               sce->orientation_slots[i].index_custom = -1;
-       }
-       /* Master Collection */
-       sce->master_collection = BKE_collection_master_add();
-       BKE_view_layer_add(sce, "View Layer");
-       /* SceneDisplay */
-       copy_v3_v3(sce->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3});
-       sce->display.shadow_shift = 0.1f;
-       sce->display.shadow_focus = 0.0f;
-       sce->display.matcap_ssao_distance = 0.2f;
-       sce->display.matcap_ssao_attenuation = 1.0f;
-       sce->display.matcap_ssao_samples = 16;
-       /* OpenGL Render. */
-       BKE_screen_view3d_shading_init(&sce->display.shading);
-       /* SceneEEVEE */
-       sce->eevee.gi_diffuse_bounces = 3;
-       sce->eevee.gi_cubemap_resolution = 512;
-       sce->eevee.gi_visibility_resolution = 32;
-       sce->eevee.gi_cubemap_draw_size = 0.3f;
-       sce->eevee.gi_irradiance_draw_size = 0.1f;
-       sce->eevee.gi_irradiance_smoothing = 0.1f;
-       sce->eevee.gi_filter_quality = 1.0f;
-       sce->eevee.taa_samples = 16;
-       sce->eevee.taa_render_samples = 64;
-       sce->eevee.sss_samples = 7;
-       sce->eevee.sss_jitter_threshold = 0.3f;
-       sce->eevee.ssr_quality = 0.25f;
-       sce->eevee.ssr_max_roughness = 0.5f;
-       sce->eevee.ssr_thickness = 0.2f;
-       sce->eevee.ssr_border_fade = 0.075f;
-       sce->eevee.ssr_firefly_fac = 10.0f;
-       sce->eevee.volumetric_start = 0.1f;
-       sce->eevee.volumetric_end = 100.0f;
-       sce->eevee.volumetric_tile_size = 8;
-       sce->eevee.volumetric_samples = 64;
-       sce->eevee.volumetric_sample_distribution = 0.8f;
-       sce->eevee.volumetric_light_clamp = 0.0f;
-       sce->eevee.volumetric_shadow_samples = 16;
-       sce->eevee.gtao_distance = 0.2f;
-       sce->eevee.gtao_factor = 1.0f;
-       sce->eevee.gtao_quality = 0.25f;
-       sce->eevee.bokeh_max_size = 100.0f;
-       sce->eevee.bokeh_threshold = 1.0f;
-       copy_v3_fl(sce->eevee.bloom_color, 1.0f);
-       sce->eevee.bloom_threshold = 0.8f;
-       sce->eevee.bloom_knee = 0.5f;
-       sce->eevee.bloom_intensity = 0.05f;
-       sce->eevee.bloom_radius = 6.5f;
-       sce->eevee.bloom_clamp = 0.0f;
-       sce->eevee.motion_blur_samples = 8;
-       sce->eevee.motion_blur_shutter = 0.5f;
-       sce->eevee.shadow_method = SHADOW_ESM;
-       sce->eevee.shadow_cube_size = 512;
-       sce->eevee.shadow_cascade_size = 1024;
-       sce->eevee.light_cache = NULL;
-       sce->eevee.light_threshold = 0.01f;
-       sce->eevee.overscan = 3.0f;
-       sce->eevee.flag =
-               SCE_EEVEE_VOLUMETRIC_LIGHTS |
-               SCE_EEVEE_GTAO_BENT_NORMALS |
-               SCE_EEVEE_GTAO_BOUNCE |
-               SCE_EEVEE_TAA_REPROJECTION |
-               SCE_EEVEE_SSR_HALF_RESOLUTION;
+   ParticleEditSettings *pset;
+   int a;
+   const char *colorspace_name;
+   SceneRenderView *srv;
+   CurveMapping *mblur_shutter_curve;
+   BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(sce, id));
+   sce->cursor.rotation_mode = ROT_MODE_XYZ;
+   sce->cursor.rotation_quaternion[0] = 1.0f;
+   sce->cursor.rotation_axis[1] = 1.0f;
+   sce->r.mode = R_OSA;
+   sce->r.cfra = 1;
+   sce->r.sfra = 1;
+   sce->r.efra = 250;
+   sce->r.frame_step = 1;
+   sce->r.xsch = 1920;
+   sce->r.ysch = 1080;
+   sce->r.xasp = 1;
+   sce->r.yasp = 1;
+   sce->r.tilex = 256;
+   sce->r.tiley = 256;
+   sce->r.size = 100;
+   sce->r.im_format.planes = R_IMF_PLANES_RGBA;
+   sce->r.im_format.imtype = R_IMF_IMTYPE_PNG;
+   sce->r.im_format.depth = R_IMF_CHAN_DEPTH_8;
+   sce->r.im_format.quality = 90;
+   sce->r.im_format.compress = 15;
+   sce->r.displaymode = R_OUTPUT_WINDOW;
+   sce->r.framapto = 100;
+   sce->r.images = 100;
+   sce->r.framelen = 1.0;
+   sce->r.blurfac = 0.5;
+   sce->r.frs_sec = 24;
+   sce->r.frs_sec_base = 1;
+   /* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used,
+    *            images would look in the same way as in current blender
+    *
+    *            perhaps at some point should be completely deprecated?
+    */
+   sce->r.color_mgt_flag |= R_COLOR_MANAGEMENT;
+   sce->r.gauss = 1.5;
+   sce->r.dither_intensity = 1.0f;
+   sce->r.bake_mode = 0;
+   sce->r.bake_filter = 16;
+   sce->r.bake_flag = R_BAKE_CLEAR;
+   sce->r.bake_samples = 256;
+   sce->r.bake_biasdist = 0.001;
+   sce->r.bake.flag = R_BAKE_CLEAR;
+   sce->r.bake.pass_filter = R_BAKE_PASS_FILTER_ALL;
+   sce->r.bake.width = 512;
+   sce->r.bake.height = 512;
+   sce->r.bake.margin = 16;
+   sce->r.bake.normal_space = R_BAKE_SPACE_TANGENT;
+   sce->r.bake.normal_swizzle[0] = R_BAKE_POSX;
+   sce->r.bake.normal_swizzle[1] = R_BAKE_POSY;
+   sce->r.bake.normal_swizzle[2] = R_BAKE_POSZ;
+   BLI_strncpy(sce->r.bake.filepath, U.renderdir, sizeof(sce->r.bake.filepath));
+   sce->r.bake.im_format.planes = R_IMF_PLANES_RGBA;
+   sce->r.bake.im_format.imtype = R_IMF_IMTYPE_PNG;
+   sce->r.bake.im_format.depth = R_IMF_CHAN_DEPTH_8;
+   sce->r.bake.im_format.quality = 90;
+   sce->r.bake.im_format.compress = 15;
+   sce->r.scemode = R_DOCOMP | R_DOSEQ | R_EXTENSION;
+   sce->r.stamp = R_STAMP_TIME | R_STAMP_FRAME | R_STAMP_DATE | R_STAMP_CAMERA | R_STAMP_SCENE |
+                  R_STAMP_FILENAME | R_STAMP_RENDERTIME | R_STAMP_MEMORY;
+   sce->r.stamp_font_id = 12;
+   sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
+   sce->r.fg_stamp[3] = 1.0f;
+   sce->r.bg_stamp[0] = sce->r.bg_stamp[1] = sce->r.bg_stamp[2] = 0.0f;
+   sce->r.bg_stamp[3] = 0.25f;
+   sce->r.seq_prev_type = OB_SOLID;
+   sce->r.seq_rend_type = OB_SOLID;
+   sce->r.seq_flag = 0;
+   sce->r.threads = 1;
+   sce->r.simplify_subsurf = 6;
+   sce->r.simplify_particles = 1.0f;
+   sce->r.border.xmin = 0.0f;
+   sce->r.border.ymin = 0.0f;
+   sce->r.border.xmax = 1.0f;
+   sce->r.border.ymax = 1.0f;
+   sce->r.preview_start_resolution = 64;
+   sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE;
+   sce->r.unit_line_thickness = 1.0f;
+   mblur_shutter_curve = &sce->r.mblur_shutter_curve;
+   curvemapping_set_defaults(mblur_shutter_curve, 1, 0.0f, 0.0f, 1.0f, 1.0f);
+   curvemapping_initialize(mblur_shutter_curve);
+   curvemap_reset(mblur_shutter_curve->cm,
+                  &mblur_shutter_curve->clipr,
+                  CURVE_PRESET_MAX,
+                  CURVEMAP_SLOPE_POS_NEG);
+   sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
+   sce->toolsettings->object_flag |= SCE_OBJECT_MODE_LOCK;
+   sce->toolsettings->doublimit = 0.001;
+   sce->toolsettings->vgroup_weight = 1.0f;
+   sce->toolsettings->uvcalc_margin = 0.001f;
+   sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT;
+   sce->toolsettings->unwrapper = 1;
+   sce->toolsettings->select_thresh = 0.01f;
+   sce->toolsettings->selectmode = SCE_SELECT_VERTEX;
+   sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX;
+   sce->toolsettings->autokey_mode = U.autokey_mode;
+   sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
+   sce->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
+   sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
+   sce->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;
+   sce->toolsettings->snap_transform_mode_flag = SCE_SNAP_TRANSFORM_MODE_TRANSLATE;
+   sce->toolsettings->curve_paint_settings.curve_type = CU_BEZIER;
+   sce->toolsettings->curve_paint_settings.flag |= CURVE_PAINT_FLAG_CORNERS_DETECT;
+   sce->toolsettings->curve_paint_settings.error_threshold = 8;
+   sce->toolsettings->curve_paint_settings.radius_max = 1.0f;
+   sce->toolsettings->curve_paint_settings.corner_angle = DEG2RADF(70.0f);
+   sce->toolsettings->statvis.overhang_axis = OB_NEGZ;
+   sce->toolsettings->statvis.overhang_min = 0;
+   sce->toolsettings->statvis.overhang_max = DEG2RADF(45.0f);
+   sce->toolsettings->statvis.thickness_max = 0.1f;
+   sce->toolsettings->statvis.thickness_samples = 1;
+   sce->toolsettings->statvis.distort_min = DEG2RADF(5.0f);
+   sce->toolsettings->statvis.distort_max = DEG2RADF(45.0f);
+   sce->toolsettings->statvis.sharp_min = DEG2RADF(90.0f);
+   sce->toolsettings->statvis.sharp_max = DEG2RADF(180.0f);
+   sce->toolsettings->proportional_size = 1.0f;
+   sce->toolsettings->imapaint.paint.flags |= PAINT_SHOW_BRUSH;
+   sce->toolsettings->imapaint.normal_angle = 80;
+   sce->toolsettings->imapaint.seam_bleed = 2;
+   /* grease pencil multiframe falloff curve */
+   sce->toolsettings->gp_sculpt.cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+   CurveMapping *gp_falloff_curve = sce->toolsettings->gp_sculpt.cur_falloff;
+   curvemapping_initialize(gp_falloff_curve);
+   curvemap_reset(
+       gp_falloff_curve->cm, &gp_falloff_curve->clipr, CURVE_PRESET_GAUSS, CURVEMAP_SLOPE_POSITIVE);
+   sce->toolsettings->gp_sculpt.cur_primitive = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+   CurveMapping *gp_primitive_curve = sce->toolsettings->gp_sculpt.cur_primitive;
+   curvemapping_initialize(gp_primitive_curve);
+   curvemap_reset(gp_primitive_curve->cm,
+                  &gp_primitive_curve->clipr,
+                  CURVE_PRESET_BELL,
+                  CURVEMAP_SLOPE_POSITIVE);
+   sce->toolsettings->gp_sculpt.guide.spacing = 20.0f;
+   sce->physics_settings.gravity[0] = 0.0f;
+   sce->physics_settings.gravity[1] = 0.0f;
+   sce->physics_settings.gravity[2] = -9.81f;
+   sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
+   sce->unit.system = USER_UNIT_METRIC;
+   sce->unit.scale_length = 1.0f;
+   sce->unit.length_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_LENGTH);
+   sce->unit.mass_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_MASS);
+   sce->unit.time_unit = bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_TIME);
+   pset = &sce->toolsettings->particle;
+   pset->flag = PE_KEEP_LENGTHS | PE_LOCK_FIRST | PE_DEFLECT_EMITTER | PE_AUTO_VELOCITY;
+   pset->emitterdist = 0.25f;
+   pset->totrekey = 5;
+   pset->totaddkey = 5;
+   pset->brushtype = PE_BRUSH_COMB;
+   pset->draw_step = 2;
+   pset->fade_frames = 2;
+   pset->selectmode = SCE_SELECT_PATH;
+   for (a = 0; a < ARRAY_SIZE(pset->brush); a++) {
+     pset->brush[a].strength = 0.5f;
+     pset->brush[a].size = 50;
+     pset->brush[a].step = 10;
+     pset->brush[a].count = 10;
+   }
+   pset->brush[PE_BRUSH_CUT].strength = 1.0f;
+   sce->r.ffcodecdata.audio_mixrate = 48000;
+   sce->r.ffcodecdata.audio_volume = 1.0f;
+   sce->r.ffcodecdata.audio_bitrate = 192;
+   sce->r.ffcodecdata.audio_channels = 2;
+   BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine));
+   sce->audio.distance_model = 2.0f;
+   sce->audio.doppler_factor = 1.0f;
+   sce->audio.speed_of_sound = 343.3f;
+   sce->audio.volume = 1.0f;
+   sce->audio.flag = AUDIO_SYNC;
+   BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
+   BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
+   sce->r.osa = 8;
+   /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
+   /* multiview - stereo */
+   BKE_scene_add_render_view(sce, STEREO_LEFT_NAME);
+   srv = sce->r.views.first;
+   BLI_strncpy(srv->suffix, STEREO_LEFT_SUFFIX, sizeof(srv->suffix));
+   BKE_scene_add_render_view(sce, STEREO_RIGHT_NAME);
+   srv = sce->r.views.last;
+   BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
+   BKE_sound_create_scene(sce);
+   /* color management */
+   colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
+   BKE_color_managed_display_settings_init(&sce->display_settings);
+   BKE_color_managed_view_settings_init_render(
+       &sce->view_settings, &sce->display_settings, "Filmic");
+   BLI_strncpy(sce->sequencer_colorspace_settings.name,
+               colorspace_name,
+               sizeof(sce->sequencer_colorspace_settings.name));
+   /* Those next two sets (render and baking settings) are not currently in use,
+    * but are exposed to RNA API and hence must have valid data. */
+   BKE_color_managed_display_settings_init(&sce->r.im_format.display_settings);
+   BKE_color_managed_view_settings_init_render(
+       &sce->r.im_format.view_settings, &sce->r.im_format.display_settings, "Filmic");
+   BKE_color_managed_display_settings_init(&sce->r.bake.im_format.display_settings);
+   BKE_color_managed_view_settings_init_render(
+       &sce->r.bake.im_format.view_settings, &sce->r.bake.im_format.display_settings, "Filmic");
+   /* Safe Areas */
+   copy_v2_fl2(sce->safe_areas.title, 10.0f / 100.0f, 5.0f / 100.0f);
+   copy_v2_fl2(sce->safe_areas.action, 3.5f / 100.0f, 3.5f / 100.0f);
+   copy_v2_fl2(sce->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
+   copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
+   sce->preview = NULL;
+   /* GP Sculpt brushes */
+   {
+     GP_Sculpt_Settings *gset = &sce->toolsettings->gp_sculpt;
+     GP_Sculpt_Data *gp_brush;
+     float curcolor_add[3], curcolor_sub[3];
+     ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
+     ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_SMOOTH];
+     gp_brush->size = 25;
+     gp_brush->strength = 0.3f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_SMOOTH_PRESSURE |
+                      GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_THICKNESS];
+     gp_brush->size = 25;
+     gp_brush->strength = 0.5f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_STRENGTH];
+     gp_brush->size = 25;
+     gp_brush->strength = 0.5f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_GRAB];
+     gp_brush->size = 50;
+     gp_brush->strength = 0.3f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_PUSH];
+     gp_brush->size = 25;
+     gp_brush->strength = 0.3f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_TWIST];
+     gp_brush->size = 50;
+     gp_brush->strength = 0.3f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_PINCH];
+     gp_brush->size = 50;
+     gp_brush->strength = 0.5f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+     gp_brush = &gset->brush[GP_SCULPT_TYPE_RANDOMIZE];
+     gp_brush->size = 25;
+     gp_brush->strength = 0.5f;
+     gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+     copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+     copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+   }
+   /* GP Stroke Placement */
+   sce->toolsettings->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
+   sce->toolsettings->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
+   sce->toolsettings->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
+   sce->toolsettings->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
+   /* Annotations */
+   sce->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
+   sce->toolsettings->annotate_thickness = 3;
+   for (int i = 0; i < ARRAY_SIZE(sce->orientation_slots); i++) {
+     sce->orientation_slots[i].index_custom = -1;
+   }
+   /* Master Collection */
+   sce->master_collection = BKE_collection_master_add();
+   BKE_view_layer_add(sce, "View Layer");
+   /* SceneDisplay */
+   copy_v3_v3(sce->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3});
+   sce->display.shadow_shift = 0.1f;
+   sce->display.shadow_focus = 0.0f;
+   sce->display.matcap_ssao_distance = 0.2f;
+   sce->display.matcap_ssao_attenuation = 1.0f;
+   sce->display.matcap_ssao_samples = 16;
+   /* OpenGL Render. */
+   BKE_screen_view3d_shading_init(&sce->display.shading);
+   /* SceneEEVEE */
+   sce->eevee.gi_diffuse_bounces = 3;
+   sce->eevee.gi_cubemap_resolution = 512;
+   sce->eevee.gi_visibility_resolution = 32;
+   sce->eevee.gi_cubemap_draw_size = 0.3f;
+   sce->eevee.gi_irradiance_draw_size = 0.1f;
+   sce->eevee.gi_irradiance_smoothing = 0.1f;
+   sce->eevee.gi_filter_quality = 1.0f;
+   sce->eevee.taa_samples = 16;
+   sce->eevee.taa_render_samples = 64;
+   sce->eevee.sss_samples = 7;
+   sce->eevee.sss_jitter_threshold = 0.3f;
+   sce->eevee.ssr_quality = 0.25f;
+   sce->eevee.ssr_max_roughness = 0.5f;
+   sce->eevee.ssr_thickness = 0.2f;
+   sce->eevee.ssr_border_fade = 0.075f;
+   sce->eevee.ssr_firefly_fac = 10.0f;
+   sce->eevee.volumetric_start = 0.1f;
+   sce->eevee.volumetric_end = 100.0f;
+   sce->eevee.volumetric_tile_size = 8;
+   sce->eevee.volumetric_samples = 64;
+   sce->eevee.volumetric_sample_distribution = 0.8f;
+   sce->eevee.volumetric_light_clamp = 0.0f;
+   sce->eevee.volumetric_shadow_samples = 16;
+   sce->eevee.gtao_distance = 0.2f;
+   sce->eevee.gtao_factor = 1.0f;
+   sce->eevee.gtao_quality = 0.25f;
+   sce->eevee.bokeh_max_size = 100.0f;
+   sce->eevee.bokeh_threshold = 1.0f;
+   copy_v3_fl(sce->eevee.bloom_color, 1.0f);
+   sce->eevee.bloom_threshold = 0.8f;
+   sce->eevee.bloom_knee = 0.5f;
+   sce->eevee.bloom_intensity = 0.05f;
+   sce->eevee.bloom_radius = 6.5f;
+   sce->eevee.bloom_clamp = 0.0f;
+   sce->eevee.motion_blur_samples = 8;
+   sce->eevee.motion_blur_shutter = 0.5f;
+   sce->eevee.shadow_method = SHADOW_ESM;
+   sce->eevee.shadow_cube_size = 512;
+   sce->eevee.shadow_cascade_size = 1024;
+   sce->eevee.light_cache = NULL;
+   sce->eevee.light_threshold = 0.01f;
+   sce->eevee.overscan = 3.0f;
+   sce->eevee.flag = SCE_EEVEE_VOLUMETRIC_LIGHTS | SCE_EEVEE_GTAO_BENT_NORMALS |
+                     SCE_EEVEE_GTAO_BOUNCE | SCE_EEVEE_TAA_REPROJECTION |
+                     SCE_EEVEE_SSR_HALF_RESOLUTION;
 +
 +      /* SceneLANPR */
 +      
 +      sce->lanpr.crease_threshold = 0.7;
 +
 +      sce->lanpr.line_thickness = 1.5;
 +      sce->lanpr.depth_clamp = 0.001;
 +      sce->lanpr.depth_strength = 800;
 +      sce->lanpr.normal_clamp = 2;
 +      sce->lanpr.normal_strength = 10;
 +      
 +      sce->lanpr.enable_intersections = 1;
 +
 +      sce->lanpr.background_color[0] = 0.76;
 +      sce->lanpr.background_color[1] = 0.54;
 +      sce->lanpr.background_color[2] = 0.29;
 +      sce->lanpr.background_color[3] = 1;
 +
 +      sce->lanpr.line_color[0] = 0.39;
 +      sce->lanpr.line_color[1] = 0.12;
 +      sce->lanpr.line_color[2] = 0.04;
 +      sce->lanpr.line_color[3] = 1;
 +
  }
  
  Scene *BKE_scene_add(Main *bmain, const char *name)
index 5867f4d9b3cc8666ce2634aee76e2e7339ba5465,6e3c459ddda4034bc0951cea929e39d499a8d425..eb37078f6817781a980337c5c8f8cb254f98e6ad
@@@ -6373,209 -6435,208 +6436,218 @@@ static bool scene_validate_setscene__li
  static void lib_link_scene(FileData *fd, Main *main)
  {
  #ifdef USE_SETSCENE_CHECK
-       bool need_check_set = false;
-       int totscene = 0;
+   bool need_check_set = false;
+   int totscene = 0;
  #endif
  
-       for (Scene *sce = main->scenes.first; sce; sce = sce->id.next) {
-               if (sce->id.tag & LIB_TAG_NEED_LINK) {
-                       /* Link ID Properties -- and copy this comment EXACTLY for easy finding
-                        * of library blocks that implement this.*/
-                       IDP_LibLinkProperty(sce->id.properties, fd);
-                       lib_link_animdata(fd, &sce->id, sce->adt);
-                       lib_link_keyingsets(fd, &sce->id, &sce->keyingsets);
-                       sce->camera = newlibadr(fd, sce->id.lib, sce->camera);
-                       sce->world = newlibadr_us(fd, sce->id.lib, sce->world);
-                       sce->set = newlibadr(fd, sce->id.lib, sce->set);
-                       sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd);
-                       link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
-                       link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
-                       link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
-                       link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
-                       link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint);
-                       link_paint(fd, sce, &sce->toolsettings->gp_paint->paint);
-                       if (sce->toolsettings->sculpt)
-                               sce->toolsettings->sculpt->gravity_object =
-                                       newlibadr(fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object);
-                       if (sce->toolsettings->imapaint.stencil)
-                               sce->toolsettings->imapaint.stencil =
-                                       newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.stencil);
-                       if (sce->toolsettings->imapaint.clone)
-                               sce->toolsettings->imapaint.clone =
-                                       newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.clone);
-                       if (sce->toolsettings->imapaint.canvas)
-                               sce->toolsettings->imapaint.canvas =
-                                       newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.canvas);
-                       sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object);
-                       sce->toolsettings->gp_sculpt.guide.reference_object = newlibadr(fd, sce->id.lib, sce->toolsettings->gp_sculpt.guide.reference_object);
-                       for (Base *base_legacy_next, *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy_next) {
-                               base_legacy_next = base_legacy->next;
-                               base_legacy->object = newlibadr_us(fd, sce->id.lib, base_legacy->object);
-                               if (base_legacy->object == NULL) {
-                                       blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: object lost from scene: '%s'"),
-                                                        sce->id.name + 2);
-                                       BLI_remlink(&sce->base, base_legacy);
-                                       if (base_legacy == sce->basact) sce->basact = NULL;
-                                       MEM_freeN(base_legacy);
-                               }
-                       }
-                       Sequence *seq;
-                       SEQ_BEGIN (sce->ed, seq)
-                       {
-                               IDP_LibLinkProperty(seq->prop, fd);
-                               if (seq->ipo) seq->ipo = newlibadr_us(fd, sce->id.lib, seq->ipo);  // XXX deprecated - old animation system
-                               seq->scene_sound = NULL;
-                               if (seq->scene) {
-                                       seq->scene = newlibadr(fd, sce->id.lib, seq->scene);
-                                       if (seq->scene) {
-                                               seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(sce, seq);
-                                       }
-                               }
-                               if (seq->clip) {
-                                       seq->clip = newlibadr_us(fd, sce->id.lib, seq->clip);
-                               }
-                               if (seq->mask) {
-                                       seq->mask = newlibadr_us(fd, sce->id.lib, seq->mask);
-                               }
-                               if (seq->scene_camera) {
-                                       seq->scene_camera = newlibadr(fd, sce->id.lib, seq->scene_camera);
-                               }
-                               if (seq->sound) {
-                                       seq->scene_sound = NULL;
-                                       if (seq->type == SEQ_TYPE_SOUND_HD) {
-                                               seq->type = SEQ_TYPE_SOUND_RAM;
-                                       }
-                                       else {
-                                               seq->sound = newlibadr(fd, sce->id.lib, seq->sound);
-                                       }
-                                       if (seq->sound) {
-                                               id_us_plus_no_lib((ID *)seq->sound);
-                                               seq->scene_sound = BKE_sound_add_scene_sound_defaults(sce, seq);
-                                       }
-                               }
-                               if (seq->type == SEQ_TYPE_TEXT) {
-                                       TextVars *t = seq->effectdata;
-                                       t->text_font = newlibadr_us(fd, sce->id.lib, t->text_font);
-                               }
-                               BLI_listbase_clear(&seq->anims);
-                               lib_link_sequence_modifiers(fd, sce, &seq->modifiers);
-                       } SEQ_END;
-                       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
-                               if (marker->camera) {
-                                       marker->camera = newlibadr(fd, sce->id.lib, marker->camera);
-                               }
-                       }
-                       BKE_sequencer_update_muting(sce->ed);
-                       BKE_sequencer_update_sound_bounds_all(sce);
-                       /* rigidbody world relies on it's linked collections */
-                       if (sce->rigidbody_world) {
-                               RigidBodyWorld *rbw = sce->rigidbody_world;
-                               if (rbw->group)
-                                       rbw->group = newlibadr(fd, sce->id.lib, rbw->group);
-                               if (rbw->constraints)
-                                       rbw->constraints = newlibadr(fd, sce->id.lib, rbw->constraints);
-                               if (rbw->effector_weights)
-                                       rbw->effector_weights->group = newlibadr(fd, sce->id.lib, rbw->effector_weights->group);
-                       }
-                       if (sce->nodetree) {
-                               lib_link_ntree(fd, &sce->id, sce->nodetree);
-                               sce->nodetree->id.lib = sce->id.lib;
-                               composite_patch(sce->nodetree, sce);
-                       }
-                       for (SceneRenderLayer *srl = sce->r.layers.first; srl; srl = srl->next) {
-                               srl->mat_override = newlibadr_us(fd, sce->id.lib, srl->mat_override);
-                               for (FreestyleModuleConfig *fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
-                                       fmc->script = newlibadr(fd, sce->id.lib, fmc->script);
-                               }
-                               for (FreestyleLineSet *fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
-                                       fls->linestyle = newlibadr_us(fd, sce->id.lib, fls->linestyle);
-                                       fls->group = newlibadr_us(fd, sce->id.lib, fls->group);
-                               }
-                       }
+   for (Scene *sce = main->scenes.first; sce; sce = sce->id.next) {
+     if (sce->id.tag & LIB_TAG_NEED_LINK) {
+       /* Link ID Properties -- and copy this comment EXACTLY for easy finding
+        * of library blocks that implement this.*/
+       IDP_LibLinkProperty(sce->id.properties, fd);
+       lib_link_animdata(fd, &sce->id, sce->adt);
+       lib_link_keyingsets(fd, &sce->id, &sce->keyingsets);
+       sce->camera = newlibadr(fd, sce->id.lib, sce->camera);
+       sce->world = newlibadr_us(fd, sce->id.lib, sce->world);
+       sce->set = newlibadr(fd, sce->id.lib, sce->set);
+       sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd);
+       link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
+       link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
+       link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
+       link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
+       link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint);
+       link_paint(fd, sce, &sce->toolsettings->gp_paint->paint);
+       if (sce->toolsettings->sculpt)
+         sce->toolsettings->sculpt->gravity_object = newlibadr(
+             fd, sce->id.lib, sce->toolsettings->sculpt->gravity_object);
+       if (sce->toolsettings->imapaint.stencil)
+         sce->toolsettings->imapaint.stencil = newlibadr_us(
+             fd, sce->id.lib, sce->toolsettings->imapaint.stencil);
+       if (sce->toolsettings->imapaint.clone)
+         sce->toolsettings->imapaint.clone = newlibadr_us(
+             fd, sce->id.lib, sce->toolsettings->imapaint.clone);
+       if (sce->toolsettings->imapaint.canvas)
+         sce->toolsettings->imapaint.canvas = newlibadr_us(
+             fd, sce->id.lib, sce->toolsettings->imapaint.canvas);
+       sce->toolsettings->particle.shape_object = newlibadr(
+           fd, sce->id.lib, sce->toolsettings->particle.shape_object);
+       sce->toolsettings->gp_sculpt.guide.reference_object = newlibadr(
+           fd, sce->id.lib, sce->toolsettings->gp_sculpt.guide.reference_object);
+       for (Base *base_legacy_next, *base_legacy = sce->base.first; base_legacy;
+            base_legacy = base_legacy_next) {
+         base_legacy_next = base_legacy->next;
+         base_legacy->object = newlibadr_us(fd, sce->id.lib, base_legacy->object);
+         if (base_legacy->object == NULL) {
+           blo_reportf_wrap(fd->reports,
+                            RPT_WARNING,
+                            TIP_("LIB: object lost from scene: '%s'"),
+                            sce->id.name + 2);
+           BLI_remlink(&sce->base, base_legacy);
+           if (base_legacy == sce->basact)
+             sce->basact = NULL;
+           MEM_freeN(base_legacy);
+         }
+       }
+       Sequence *seq;
+       SEQ_BEGIN (sce->ed, seq) {
+         IDP_LibLinkProperty(seq->prop, fd);
+         if (seq->ipo)
+           seq->ipo = newlibadr_us(
+               fd, sce->id.lib, seq->ipo);  // XXX deprecated - old animation system
+         seq->scene_sound = NULL;
+         if (seq->scene) {
+           seq->scene = newlibadr(fd, sce->id.lib, seq->scene);
+           if (seq->scene) {
+             seq->scene_sound = BKE_sound_scene_add_scene_sound_defaults(sce, seq);
+           }
+         }
+         if (seq->clip) {
+           seq->clip = newlibadr_us(fd, sce->id.lib, seq->clip);
+         }
+         if (seq->mask) {
+           seq->mask = newlibadr_us(fd, sce->id.lib, seq->mask);
+         }
+         if (seq->scene_camera) {
+           seq->scene_camera = newlibadr(fd, sce->id.lib, seq->scene_camera);
+         }
+         if (seq->sound) {
+           seq->scene_sound = NULL;
+           if (seq->type == SEQ_TYPE_SOUND_HD) {
+             seq->type = SEQ_TYPE_SOUND_RAM;
+           }
+           else {
+             seq->sound = newlibadr(fd, sce->id.lib, seq->sound);
+           }
+           if (seq->sound) {
+             id_us_plus_no_lib((ID *)seq->sound);
+             seq->scene_sound = BKE_sound_add_scene_sound_defaults(sce, seq);
+           }
+         }
+         if (seq->type == SEQ_TYPE_TEXT) {
+           TextVars *t = seq->effectdata;
+           t->text_font = newlibadr_us(fd, sce->id.lib, t->text_font);
+         }
+         BLI_listbase_clear(&seq->anims);
+         lib_link_sequence_modifiers(fd, sce, &seq->modifiers);
+       }
+       SEQ_END;
+       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
+         if (marker->camera) {
+           marker->camera = newlibadr(fd, sce->id.lib, marker->camera);
+         }
+       }
+       BKE_sequencer_update_muting(sce->ed);
+       BKE_sequencer_update_sound_bounds_all(sce);
+       /* rigidbody world relies on it's linked collections */
+       if (sce->rigidbody_world) {
+         RigidBodyWorld *rbw = sce->rigidbody_world;
+         if (rbw->group)
+           rbw->group = newlibadr(fd, sce->id.lib, rbw->group);
+         if (rbw->constraints)
+           rbw->constraints = newlibadr(fd, sce->id.lib, rbw->constraints);
+         if (rbw->effector_weights)
+           rbw->effector_weights->group = newlibadr(fd, sce->id.lib, rbw->effector_weights->group);
+       }
+       if (sce->nodetree) {
+         lib_link_ntree(fd, &sce->id, sce->nodetree);
+         sce->nodetree->id.lib = sce->id.lib;
+         composite_patch(sce->nodetree, sce);
+       }
+       for (SceneRenderLayer *srl = sce->r.layers.first; srl; srl = srl->next) {
+         srl->mat_override = newlibadr_us(fd, sce->id.lib, srl->mat_override);
+         for (FreestyleModuleConfig *fmc = srl->freestyleConfig.modules.first; fmc;
+              fmc = fmc->next) {
+           fmc->script = newlibadr(fd, sce->id.lib, fmc->script);
+         }
+         for (FreestyleLineSet *fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
+           fls->linestyle = newlibadr_us(fd, sce->id.lib, fls->linestyle);
+           fls->group = newlibadr_us(fd, sce->id.lib, fls->group);
+         }
+       }
 +
 +                      for (LANPR_LineLayer *ll = sce->lanpr.line_layers.first; ll; ll = ll->next) {
 +                              for (LANPR_LineLayerComponent *llc = ll->components.first; llc; llc = llc->next) {
 +                                      llc->object_select = newlibadr_us(fd, sce->id.lib, llc->object_select);
 +                                      llc->material_select = newlibadr_us(fd, sce->id.lib, llc->material_select);
 +                                      llc->collection_select = newlibadr_us(fd, sce->id.lib, llc->collection_select);
 +                              }
 +                              ll->normal_control_object = newlibadr_us(fd, sce->id.lib, ll->normal_control_object);
 +                      }
 +
-                       /* Motion Tracking */
-                       sce->clip = newlibadr_us(fd, sce->id.lib, sce->clip);
+       /* Motion Tracking */
+       sce->clip = newlibadr_us(fd, sce->id.lib, sce->clip);
  
  #ifdef USE_COLLECTION_COMPAT_28
-                       if (sce->collection) {
-                               lib_link_scene_collection(fd, sce->id.lib, sce->collection);
-                       }
+       if (sce->collection) {
+         lib_link_scene_collection(fd, sce->id.lib, sce->collection);
+       }
  #endif
  
-                       if (sce->master_collection) {
-                               lib_link_collection_data(fd, sce->id.lib, sce->master_collection);
-                       }
+       if (sce->master_collection) {
+         lib_link_collection_data(fd, sce->id.lib, sce->master_collection);
+       }
  
-                       for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
-                               lib_link_view_layer(fd, sce->id.lib, view_layer);
-                       }
+       for (ViewLayer *view_layer = sce->view_layers.first; view_layer;
+            view_layer = view_layer->next) {
+         lib_link_view_layer(fd, sce->id.lib, view_layer);
+       }
  
-                       if (sce->r.bake.cage_object) {
-                               sce->r.bake.cage_object = newlibadr(fd, sce->id.lib, sce->r.bake.cage_object);
-                       }
+       if (sce->r.bake.cage_object) {
+         sce->r.bake.cage_object = newlibadr(fd, sce->id.lib, sce->r.bake.cage_object);
+       }
  
  #ifdef USE_SETSCENE_CHECK
-                       if (sce->set != NULL) {
-                               /* link flag for scenes with set would be reset later,
-                                * so this way we only check cyclic for newly linked scenes.
-                                */
-                               need_check_set = true;
-                       }
-                       else {
-                               /* postpone un-setting the flag until we've checked the set-scene */
-                               sce->id.tag &= ~LIB_TAG_NEED_LINK;
-                       }
+       if (sce->set != NULL) {
+         /* link flag for scenes with set would be reset later,
+          * so this way we only check cyclic for newly linked scenes.
+          */
+         need_check_set = true;
+       }
+       else {
+         /* postpone un-setting the flag until we've checked the set-scene */
+         sce->id.tag &= ~LIB_TAG_NEED_LINK;
+       }
  #else
-                       sce->id.tag &= ~LIB_TAG_NEED_LINK;
+       sce->id.tag &= ~LIB_TAG_NEED_LINK;
  #endif
-               }
+     }
  
  #ifdef USE_SETSCENE_CHECK
-               totscene++;
+     totscene++;
  #endif
-       }
+   }
  
  #ifdef USE_SETSCENE_CHECK
-       if (need_check_set) {
-               for (Scene *sce = main->scenes.first; sce; sce = sce->id.next) {
-                       if (sce->id.tag & LIB_TAG_NEED_LINK) {
-                               sce->id.tag &= ~LIB_TAG_NEED_LINK;
-                               if (!scene_validate_setscene__liblink(sce, totscene)) {
-                                       printf("Found cyclic background scene when linking %s\n", sce->id.name + 2);
-                               }
-                       }
-               }
-       }
+   if (need_check_set) {
+     for (Scene *sce = main->scenes.first; sce; sce = sce->id.next) {
+       if (sce->id.tag & LIB_TAG_NEED_LINK) {
+         sce->id.tag &= ~LIB_TAG_NEED_LINK;
+         if (!scene_validate_setscene__liblink(sce, totscene)) {
+           printf("Found cyclic background scene when linking %s\n", sce->id.name + 2);
+         }
+       }
+     }
+   }
  #endif
  }
  
@@@ -6645,315 -6705,309 +6716,325 @@@ static void direct_link_sequence_modifi
  
  static void direct_link_scene(FileData *fd, Scene *sce)
  {
-       Editing *ed;
-       Sequence *seq;
-       MetaStack *ms;
-       RigidBodyWorld *rbw;
-       ViewLayer *view_layer;
-       SceneRenderLayer *srl;
-       sce->depsgraph_hash = NULL;
-       sce->fps_info = NULL;
-       memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask));
-       memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal));
-       BKE_sound_create_scene(sce);
-       /* set users to one by default, not in lib-link, this will increase it for compo nodes */
-       id_us_ensure_real(&sce->id);
-       link_list(fd, &(sce->base));
-       sce->adt = newdataadr(fd, sce->adt);
-       direct_link_animdata(fd, sce->adt);
-       link_list(fd, &sce->keyingsets);
-       direct_link_keyingsets(fd, &sce->keyingsets);
-       sce->basact = newdataadr(fd, sce->basact);
-       sce->toolsettings = newdataadr(fd, sce->toolsettings);
-       if (sce->toolsettings) {
-               direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->sculpt);
-               direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->vpaint);
-               direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->wpaint);
-               direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->uvsculpt);
-               direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->gp_paint);
-               direct_link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
-               sce->toolsettings->imapaint.paintcursor = NULL;
-               sce->toolsettings->particle.paintcursor = NULL;
-               sce->toolsettings->particle.scene = NULL;
-               sce->toolsettings->particle.object = NULL;
-               sce->toolsettings->gp_sculpt.paintcursor = NULL;
-               /* relink grease pencil interpolation curves */
-               sce->toolsettings->gp_interpolate.custom_ipo = newdataadr(fd, sce->toolsettings->gp_interpolate.custom_ipo);
-               if (sce->toolsettings->gp_interpolate.custom_ipo) {
-                       direct_link_curvemapping(fd, sce->toolsettings->gp_interpolate.custom_ipo);
-               }
-               /* relink grease pencil multiframe falloff curve */
-               sce->toolsettings->gp_sculpt.cur_falloff = newdataadr(fd, sce->toolsettings->gp_sculpt.cur_falloff);
-               if (sce->toolsettings->gp_sculpt.cur_falloff) {
-                       direct_link_curvemapping(fd, sce->toolsettings->gp_sculpt.cur_falloff);
-               }
-               /* relink grease pencil primitive curve */
-               sce->toolsettings->gp_sculpt.cur_primitive = newdataadr(fd, sce->toolsettings->gp_sculpt.cur_primitive);
-               if (sce->toolsettings->gp_sculpt.cur_primitive) {
-                       direct_link_curvemapping(fd, sce->toolsettings->gp_sculpt.cur_primitive);
-               }
-       }
-       if (sce->ed) {
-               ListBase *old_seqbasep = &sce->ed->seqbase;
-               ed = sce->ed = newdataadr(fd, sce->ed);
-               ed->act_seq = newdataadr(fd, ed->act_seq);
-               /* recursive link sequences, lb will be correctly initialized */
-               link_recurs_seq(fd, &ed->seqbase);
-               SEQ_BEGIN(ed, seq)
-               {
-                       seq->seq1 = newdataadr(fd, seq->seq1);
-                       seq->seq2 = newdataadr(fd, seq->seq2);
-                       seq->seq3 = newdataadr(fd, seq->seq3);
-                       /* a patch: after introduction of effects with 3 input strips */
-                       if (seq->seq3 == NULL) seq->seq3 = seq->seq2;
-                       seq->effectdata = newdataadr(fd, seq->effectdata);
-                       seq->stereo3d_format = newdataadr(fd, seq->stereo3d_format);
-                       if (seq->type & SEQ_TYPE_EFFECT)
-                               seq->flag |= SEQ_EFFECT_NOT_LOADED;
-                       if (seq->type == SEQ_TYPE_SPEED) {
-                               SpeedControlVars *s = seq->effectdata;
-                               s->frameMap = NULL;
-                       }
-                       if (seq->type == SEQ_TYPE_TEXT) {
-                               TextVars *t = seq->effectdata;
-                               t->text_blf_id = SEQ_FONT_NOT_LOADED;
-                       }
-                       seq->prop = newdataadr(fd, seq->prop);
-                       IDP_DirectLinkGroup_OrFree(&seq->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-                       seq->strip = newdataadr(fd, seq->strip);
-                       if (seq->strip && seq->strip->done == 0) {
-                               seq->strip->done = true;
-                               if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
-                                       seq->strip->stripdata = newdataadr(fd, seq->strip->stripdata);
-                               }
-                               else {
-                                       seq->strip->stripdata = NULL;
-                               }
-                               if (seq->flag & SEQ_USE_CROP) {
-                                       seq->strip->crop = newdataadr(fd, seq->strip->crop);
-                               }
-                               else {
-                                       seq->strip->crop = NULL;
-                               }
-                               if (seq->flag & SEQ_USE_TRANSFORM) {
-                                       seq->strip->transform = newdataadr(fd, seq->strip->transform);
-                               }
-                               else {
-                                       seq->strip->transform = NULL;
-                               }
-                               if (seq->flag & SEQ_USE_PROXY) {
-                                       seq->strip->proxy = newdataadr(fd, seq->strip->proxy);
-                                       if (seq->strip->proxy) {
-                                               seq->strip->proxy->anim = NULL;
-                                       }
-                                       else {
-                                               BKE_sequencer_proxy_set(seq, true);
-                                       }
-                               }
-                               else {
-                                       seq->strip->proxy = NULL;
-                               }
-                               /* need to load color balance to it could be converted to modifier */
-                               seq->strip->color_balance = newdataadr(fd, seq->strip->color_balance);
-                       }
-                       direct_link_sequence_modifiers(fd, &seq->modifiers);
-               } SEQ_END;
-               /* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */
-               {
-                       Sequence temp;
-                       void *poin;
-                       intptr_t offset;
-                       offset = ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp);
-                       /* root pointer */
-                       if (ed->seqbasep == old_seqbasep) {
-                               ed->seqbasep = &ed->seqbase;
-                       }
-                       else {
-                               poin = POINTER_OFFSET(ed->seqbasep, -offset);
-                               poin = newdataadr(fd, poin);
-                               if (poin)
-                                       ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset);
-                               else
-                                       ed->seqbasep = &ed->seqbase;
-                       }
-                       /* stack */
-                       link_list(fd, &(ed->metastack));
-                       for (ms = ed->metastack.first; ms; ms = ms->next) {
-                               ms->parseq = newdataadr(fd, ms->parseq);
-                               if (ms->oldbasep == old_seqbasep)
-                                       ms->oldbasep = &ed->seqbase;
-                               else {
-                                       poin = POINTER_OFFSET(ms->oldbasep, -offset);
-                                       poin = newdataadr(fd, poin);
-                                       if (poin)
-                                               ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset);
-                                       else
-                                               ms->oldbasep = &ed->seqbase;
-                               }
-                       }
-               }
-       }
-       sce->r.avicodecdata = newdataadr(fd, sce->r.avicodecdata);
-       if (sce->r.avicodecdata) {
-               sce->r.avicodecdata->lpFormat = newdataadr(fd, sce->r.avicodecdata->lpFormat);
-               sce->r.avicodecdata->lpParms = newdataadr(fd, sce->r.avicodecdata->lpParms);
-       }
-       if (sce->r.ffcodecdata.properties) {
-               sce->r.ffcodecdata.properties = newdataadr(fd, sce->r.ffcodecdata.properties);
-               IDP_DirectLinkGroup_OrFree(&sce->r.ffcodecdata.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-       }
-       link_list(fd, &(sce->markers));
-       link_list(fd, &(sce->transform_spaces));
-       link_list(fd, &(sce->r.layers));
-       link_list(fd, &(sce->r.views));
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
-               srl->prop = newdataadr(fd, srl->prop);
-               IDP_DirectLinkGroup_OrFree(&srl->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-               link_list(fd, &(srl->freestyleConfig.modules));
-               link_list(fd, &(srl->freestyleConfig.linesets));
-       }
-       sce->nodetree = newdataadr(fd, sce->nodetree);
-       if (sce->nodetree) {
-               direct_link_id(fd, &sce->nodetree->id);
-               direct_link_nodetree(fd, sce->nodetree);
-       }
-       direct_link_view_settings(fd, &sce->view_settings);
-       sce->rigidbody_world = newdataadr(fd, sce->rigidbody_world);
-       rbw = sce->rigidbody_world;
-       if (rbw) {
-               rbw->shared = newdataadr(fd, rbw->shared);
-               if (rbw->shared == NULL) {
-                       /* Link deprecated caches if they exist, so we can use them for versioning.
-                        * We should only do this when rbw->shared == NULL, because those pointers
-                        * are always set (for compatibility with older Blenders). We mustn't link
-                        * the same pointcache twice. */
-                       direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false);
-                       /* make sure simulation starts from the beginning after loading file */
-                       if (rbw->pointcache) {
-                               rbw->ltime = (float)rbw->pointcache->startframe;
-                       }
-               }
-               else {
-                       /* must nullify the reference to physics sim object, since it no-longer exist
-                        * (and will need to be recalculated)
-                        */
-                       rbw->shared->physics_world = NULL;
-                       /* link caches */
-                       direct_link_pointcache_list(fd, &rbw->shared->ptcaches, &rbw->shared->pointcache, false);
-                       /* make sure simulation starts from the beginning after loading file */
-                       if (rbw->shared->pointcache) {
-                               rbw->ltime = (float)rbw->shared->pointcache->startframe;
-                       }
-               }
-               rbw->objects = NULL;
-               rbw->numbodies = 0;
-               /* set effector weights */
-               rbw->effector_weights = newdataadr(fd, rbw->effector_weights);
-               if (!rbw->effector_weights)
-                       rbw->effector_weights = BKE_effector_add_weights(NULL);
-       }
-       sce->preview = direct_link_preview_image(fd, sce->preview);
-       direct_link_curvemapping(fd, &sce->r.mblur_shutter_curve);
+   Editing *ed;
+   Sequence *seq;
+   MetaStack *ms;
+   RigidBodyWorld *rbw;
+   ViewLayer *view_layer;
+   SceneRenderLayer *srl;
+   sce->depsgraph_hash = NULL;
+   sce->fps_info = NULL;
+   memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask));
+   memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal));
+   BKE_sound_create_scene(sce);
+   /* set users to one by default, not in lib-link, this will increase it for compo nodes */
+   id_us_ensure_real(&sce->id);
+   link_list(fd, &(sce->base));
+   sce->adt = newdataadr(fd, sce->adt);
+   direct_link_animdata(fd, sce->adt);
+   link_list(fd, &sce->keyingsets);
+   direct_link_keyingsets(fd, &sce->keyingsets);
+   sce->basact = newdataadr(fd, sce->basact);
+   sce->toolsettings = newdataadr(fd, sce->toolsettings);
+   if (sce->toolsettings) {
+     direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->sculpt);
+     direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->vpaint);
+     direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->wpaint);
+     direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->uvsculpt);
+     direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->gp_paint);
+     direct_link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
+     sce->toolsettings->imapaint.paintcursor = NULL;
+     sce->toolsettings->particle.paintcursor = NULL;
+     sce->toolsettings->particle.scene = NULL;
+     sce->toolsettings->particle.object = NULL;
+     sce->toolsettings->gp_sculpt.paintcursor = NULL;
+     /* relink grease pencil interpolation curves */
+     sce->toolsettings->gp_interpolate.custom_ipo = newdataadr(
+         fd, sce->toolsettings->gp_interpolate.custom_ipo);
+     if (sce->toolsettings->gp_interpolate.custom_ipo) {
+       direct_link_curvemapping(fd, sce->toolsettings->gp_interpolate.custom_ipo);
+     }
+     /* relink grease pencil multiframe falloff curve */
+     sce->toolsettings->gp_sculpt.cur_falloff = newdataadr(
+         fd, sce->toolsettings->gp_sculpt.cur_falloff);
+     if (sce->toolsettings->gp_sculpt.cur_falloff) {
+       direct_link_curvemapping(fd, sce->toolsettings->gp_sculpt.cur_falloff);
+     }
+     /* relink grease pencil primitive curve */
+     sce->toolsettings->gp_sculpt.cur_primitive = newdataadr(
+         fd, sce->toolsettings->gp_sculpt.cur_primitive);
+     if (sce->toolsettings->gp_sculpt.cur_primitive) {
+       direct_link_curvemapping(fd, sce->toolsettings->gp_sculpt.cur_primitive);
+     }
+   }
+   if (sce->ed) {
+     ListBase *old_seqbasep = &sce->ed->seqbase;
+     ed = sce->ed = newdataadr(fd, sce->ed);
+     ed->act_seq = newdataadr(fd, ed->act_seq);
+     /* recursive link sequences, lb will be correctly initialized */
+     link_recurs_seq(fd, &ed->seqbase);
+     SEQ_BEGIN (ed, seq) {
+       seq->seq1 = newdataadr(fd, seq->seq1);
+       seq->seq2 = newdataadr(fd, seq->seq2);
+       seq->seq3 = newdataadr(fd, seq->seq3);
+       /* a patch: after introduction of effects with 3 input strips */
+       if (seq->seq3 == NULL)
+         seq->seq3 = seq->seq2;
+       seq->effectdata = newdataadr(fd, seq->effectdata);
+       seq->stereo3d_format = newdataadr(fd, seq->stereo3d_format);
+       if (seq->type & SEQ_TYPE_EFFECT)
+         seq->flag |= SEQ_EFFECT_NOT_LOADED;
+       if (seq->type == SEQ_TYPE_SPEED) {
+         SpeedControlVars *s = seq->effectdata;
+         s->frameMap = NULL;
+       }
+       if (seq->type == SEQ_TYPE_TEXT) {
+         TextVars *t = seq->effectdata;
+         t->text_blf_id = SEQ_FONT_NOT_LOADED;
+       }
+       seq->prop = newdataadr(fd, seq->prop);
+       IDP_DirectLinkGroup_OrFree(&seq->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+       seq->strip = newdataadr(fd, seq->strip);
+       if (seq->strip && seq->strip->done == 0) {
+         seq->strip->done = true;
+         if (ELEM(seq->type,
+                  SEQ_TYPE_IMAGE,
+                  SEQ_TYPE_MOVIE,
+                  SEQ_TYPE_SOUND_RAM,
+                  SEQ_TYPE_SOUND_HD)) {
+           seq->strip->stripdata = newdataadr(fd, seq->strip->stripdata);
+         }
+         else {
+           seq->strip->stripdata = NULL;
+         }
+         if (seq->flag & SEQ_USE_CROP) {
+           seq->strip->crop = newdataadr(fd, seq->strip->crop);
+         }
+         else {
+           seq->strip->crop = NULL;
+         }
+         if (seq->flag & SEQ_USE_TRANSFORM) {
+           seq->strip->transform = newdataadr(fd, seq->strip->transform);
+         }
+         else {
+           seq->strip->transform = NULL;
+         }
+         if (seq->flag & SEQ_USE_PROXY) {
+           seq->strip->proxy = newdataadr(fd, seq->strip->proxy);
+           if (seq->strip->proxy) {
+             seq->strip->proxy->anim = NULL;
+           }
+           else {
+             BKE_sequencer_proxy_set(seq, true);
+           }
+         }
+         else {
+           seq->strip->proxy = NULL;
+         }
+         /* need to load color balance to it could be converted to modifier */
+         seq->strip->color_balance = newdataadr(fd, seq->strip->color_balance);
+       }
+       direct_link_sequence_modifiers(fd, &seq->modifiers);
+     }
+     SEQ_END;
+     /* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */
+     {
+       Sequence temp;
+       void *poin;
+       intptr_t offset;
+       offset = ((intptr_t) & (temp.seqbase)) - ((intptr_t)&temp);
+       /* root pointer */
+       if (ed->seqbasep == old_seqbasep) {
+         ed->seqbasep = &ed->seqbase;
+       }
+       else {
+         poin = POINTER_OFFSET(ed->seqbasep, -offset);
+         poin = newdataadr(fd, poin);
+         if (poin)
+           ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset);
+         else
+           ed->seqbasep = &ed->seqbase;
+       }
+       /* stack */
+       link_list(fd, &(ed->metastack));
+       for (ms = ed->metastack.first; ms; ms = ms->next) {
+         ms->parseq = newdataadr(fd, ms->parseq);
+         if (ms->oldbasep == old_seqbasep)
+           ms->oldbasep = &ed->seqbase;
+         else {
+           poin = POINTER_OFFSET(ms->oldbasep, -offset);
+           poin = newdataadr(fd, poin);
+           if (poin)
+             ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset);
+           else
+             ms->oldbasep = &ed->seqbase;
+         }
+       }
+     }
+   }
+   sce->r.avicodecdata = newdataadr(fd, sce->r.avicodecdata);
+   if (sce->r.avicodecdata) {
+     sce->r.avicodecdata->lpFormat = newdataadr(fd, sce->r.avicodecdata->lpFormat);
+     sce->r.avicodecdata->lpParms = newdataadr(fd, sce->r.avicodecdata->lpParms);
+   }
+   if (sce->r.ffcodecdata.properties) {
+     sce->r.ffcodecdata.properties = newdataadr(fd, sce->r.ffcodecdata.properties);
+     IDP_DirectLinkGroup_OrFree(
+         &sce->r.ffcodecdata.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+   }
+   link_list(fd, &(sce->markers));
+   link_list(fd, &(sce->transform_spaces));
+   link_list(fd, &(sce->r.layers));
+   link_list(fd, &(sce->r.views));
+   for (srl = sce->r.layers.first; srl; srl = srl->next) {
+     srl->prop = newdataadr(fd, srl->prop);
+     IDP_DirectLinkGroup_OrFree(&srl->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+     link_list(fd, &(srl->freestyleConfig.modules));
+     link_list(fd, &(srl->freestyleConfig.linesets));
+   }
+   sce->nodetree = newdataadr(fd, sce->nodetree);
+   if (sce->nodetree) {
+     direct_link_id(fd, &sce->nodetree->id);
+     direct_link_nodetree(fd, sce->nodetree);
+   }
+   direct_link_view_settings(fd, &sce->view_settings);
+   sce->rigidbody_world = newdataadr(fd, sce->rigidbody_world);
+   rbw = sce->rigidbody_world;
+   if (rbw) {
+     rbw->shared = newdataadr(fd, rbw->shared);
+     if (rbw->shared == NULL) {
+       /* Link deprecated caches if they exist, so we can use them for versioning.
+        * We should only do this when rbw->shared == NULL, because those pointers
+        * are always set (for compatibility with older Blenders). We mustn't link
+        * the same pointcache twice. */
+       direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false);
+       /* make sure simulation starts from the beginning after loading file */
+       if (rbw->pointcache) {
+         rbw->ltime = (float)rbw->pointcache->startframe;
+       }
+     }
+     else {
+       /* must nullify the reference to physics sim object, since it no-longer exist
+        * (and will need to be recalculated)
+        */
+       rbw->shared->physics_world = NULL;
+       /* link caches */
+       direct_link_pointcache_list(fd, &rbw->shared->ptcaches, &rbw->shared->pointcache, false);
+       /* make sure simulation starts from the beginning after loading file */
+       if (rbw->shared->pointcache) {
+         rbw->ltime = (float)rbw->shared->pointcache->startframe;
+       }
+     }
+     rbw->objects = NULL;
+     rbw->numbodies = 0;
+     /* set effector weights */
+     rbw->effector_weights = newdataadr(fd, rbw->effector_weights);
+     if (!rbw->effector_weights)
+       rbw->effector_weights = BKE_effector_add_weights(NULL);
+   }
+   sce->preview = direct_link_preview_image(fd, sce->preview);
+   direct_link_curvemapping(fd, &sce->r.mblur_shutter_curve);
  
  #ifdef USE_COLLECTION_COMPAT_28
-       /* this runs before the very first doversion */
-       if (sce->collection) {
-               sce->collection = newdataadr(fd, sce->collection);
-               direct_link_scene_collection(fd, sce->collection);
-       }
+   /* this runs before the very first doversion */
+   if (sce->collection) {
+     sce->collection = newdataadr(fd, sce->collection);
+     direct_link_scene_collection(fd, sce->collection);
+   }
  #endif
  
-       if (sce->master_collection) {
-               sce->master_collection = newdataadr(fd, sce->master_collection);
-               /* Needed because this is an ID outside of Main. */
-               direct_link_id(fd, &sce->master_collection->id);
-               direct_link_collection(fd, sce->master_collection);
-       }
-       /* insert into global old-new map for reading without UI (link_global accesses it again) */
-       link_glob_list(fd, &sce->view_layers);
-       for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
-               direct_link_view_layer(fd, view_layer);
-       }
-       if (fd->memfile) {
-               /* If it's undo try to recover the cache. */
-               if (fd->scenemap) sce->eevee.light_cache = newsceadr(fd, sce->eevee.light_cache);
-               else sce->eevee.light_cache = NULL;
-       }
-       else {
-               /* else try to read the cache from file. */
-               sce->eevee.light_cache = newdataadr(fd, sce->eevee.light_cache);
-               if (sce->eevee.light_cache) {
-                       direct_link_lightcache(fd, sce->eevee.light_cache);
-               }
-       }
+   if (sce->master_collection) {
+     sce->master_collection = newdataadr(fd, sce->master_collection);
+     /* Needed because this is an ID outside of Main. */
+     direct_link_id(fd, &sce->master_collection->id);
+     direct_link_collection(fd, sce->master_collection);
+   }
+   /* insert into global old-new map for reading without UI (link_global accesses it again) */
+   link_glob_list(fd, &sce->view_layers);
+   for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
+     direct_link_view_layer(fd, view_layer);
+   }
+   if (fd->memfile) {
+     /* If it's undo try to recover the cache. */
+     if (fd->scenemap)
+       sce->eevee.light_cache = newsceadr(fd, sce->eevee.light_cache);
+     else
+       sce->eevee.light_cache = NULL;
+   }
+   else {
+     /* else try to read the cache from file. */
+     sce->eevee.light_cache = newdataadr(fd, sce->eevee.light_cache);
+     if (sce->eevee.light_cache) {
+       direct_link_lightcache(fd, sce->eevee.light_cache);
+     }
+   }
  
-       sce->layer_properties = newdataadr(fd, sce->layer_properties);
-       IDP_DirectLinkGroup_OrFree(&sce->layer_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 +      /* LANPR things */
 +      sce->lanpr.active_layer = newdataadr(fd, sce->lanpr.active_layer);
 +      sce->lanpr.render_buffer = NULL;
 +      link_list(fd, &sce->lanpr.line_layers);
 +      for (LANPR_LineLayer *ll = sce->lanpr.line_layers.first; ll; ll = ll->next) {
 +              link_list(fd, &ll->components);
 +              for(LANPR_LineLayerComponent *llc = ll->components.first; llc;llc=llc->next){
 +                      //llc->object_select = newlibadr(fd, sce->id.lib, llc->object_select);
 +                      //llc->material_select = newlibadr(fd, sce->id.lib, llc->material_select);
 +                      //llc->collection_select = newlibadr(fd, sce->id.lib, llc->collection_select);
 +              }
 +              ll->batch = NULL;
 +              ll->shgrp = NULL;
 +              //ll->normal_control_object = newlibadr(fd, sce->id.lib, ll->normal_control_object);
 +      }
 +
+   sce->layer_properties = newdataadr(fd, sce->layer_properties);
+   IDP_DirectLinkGroup_OrFree(&sce->layer_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
  }
  
  /** \} */
@@@ -10442,116 -10554,110 +10581,121 @@@ static void expand_scene_collection(Fil
  
  static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
  {
-       SceneRenderLayer *srl;
-       FreestyleModuleConfig *module;
-       FreestyleLineSet *lineset;
+   SceneRenderLayer *srl;
+   FreestyleModuleConfig *module;
+   FreestyleLineSet *lineset;
 +      LANPR_LineLayer* ll;
 +      LANPR_LineLayerComponent* llc;
  
-       for (Base *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy->next) {
-               expand_doit(fd, mainvar, base_legacy->object);
-       }
-       expand_doit(fd, mainvar, sce->camera);
-       expand_doit(fd, mainvar, sce->world);
-       if (sce->adt)
-               expand_animdata(fd, mainvar, sce->adt);
-       expand_keyingsets(fd, mainvar, &sce->keyingsets);
-       if (sce->set)
-               expand_doit(fd, mainvar, sce->set);
-       if (sce->nodetree)
-               expand_nodetree(fd, mainvar, sce->nodetree);
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
-               expand_doit(fd, mainvar, srl->mat_override);
-               for (module = srl->freestyleConfig.modules.first; module; module = module->next) {
-                       if (module->script)
-                               expand_doit(fd, mainvar, module->script);
-               }
-               for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
-                       if (lineset->group)
-                               expand_doit(fd, mainvar, lineset->group);
-                       expand_doit(fd, mainvar, lineset->linestyle);
-               }
-       }
-       for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
-               expand_idprops(fd, mainvar, view_layer->id_properties);
-               for (module = view_layer->freestyle_config.modules.first; module; module = module->next) {
-                       if (module->script) {
-                               expand_doit(fd, mainvar, module->script);
-                       }
-               }
-               for (lineset = view_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
-                       if (lineset->group) {
-                               expand_doit(fd, mainvar, lineset->group);
-                       }
-                       expand_doit(fd, mainvar, lineset->linestyle);
-               }
-       }
+   for (Base *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy->next) {
+     expand_doit(fd, mainvar, base_legacy->object);
+   }
+   expand_doit(fd, mainvar, sce->camera);
+   expand_doit(fd, mainvar, sce->world);
+   if (sce->adt)
+     expand_animdata(fd, mainvar, sce->adt);
+   expand_keyingsets(fd, mainvar, &sce->keyingsets);
+   if (sce->set)
+     expand_doit(fd, mainvar, sce->set);
+   if (sce->nodetree)
+     expand_nodetree(fd, mainvar, sce->nodetree);
+   for (srl = sce->r.layers.first; srl; srl = srl->next) {
+     expand_doit(fd, mainvar, srl->mat_override);
+     for (module = srl->freestyleConfig.modules.first; module; module = module->next) {
+       if (module->script)
+         expand_doit(fd, mainvar, module->script);
+     }
+     for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+       if (lineset->group)
+         expand_doit(fd, mainvar, lineset->group);
+       expand_doit(fd, mainvar, lineset->linestyle);
+     }
+   }
+   for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
+     expand_idprops(fd, mainvar, view_layer->id_properties);
+     for (module = view_layer->freestyle_config.modules.first; module; module = module->next) {
+       if (module->script) {
+         expand_doit(fd, mainvar, module->script);
+       }
+     }
+     for (lineset = view_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
+       if (lineset->group) {
+         expand_doit(fd, mainvar, lineset->group);
+       }
+       expand_doit(fd, mainvar, lineset->linestyle);
+     }
+   }
  
-       if (sce->gpd)
-               expand_doit(fd, mainvar, sce->gpd);
 +      for (LANPR_LineLayer *ll = sce->lanpr.line_layers.first; ll; ll = ll->next) {
 +              for (LANPR_LineLayerComponent *llc = ll->components.first; llc; llc = llc->next) {
 +                      if (llc->object_select) expand_doit(fd, mainvar, llc->object_select);
 +                      if (llc->material_select) expand_doit(fd, mainvar, llc->material_select);
 +                      if (llc->collection_select) expand_doit(fd, mainvar, llc->collection_select);
 +              }
 +              if (ll->normal_control_object) expand_doit(fd, mainvar, ll->normal_control_object);
 +      }
 +
+   if (sce->gpd)
+     expand_doit(fd, mainvar, sce->gpd);
  
-       if (sce->ed) {
-               Sequence *seq;
+   if (sce->ed) {
+     Sequence *seq;
  
-               SEQ_BEGIN(sce->ed, seq)
-               {
-                       expand_idprops(fd, mainvar, seq->prop);
+     SEQ_BEGIN (sce->ed, seq) {
+       expand_idprops(fd, mainvar, seq->prop);
  
-                       if (seq->scene) expand_doit(fd, mainvar, seq->scene);
-                       if (seq->scene_camera) expand_doit(fd, mainvar, seq->scene_camera);
-                       if (seq->clip) expand_doit(fd, mainvar, seq->clip);
-                       if (seq->mask) expand_doit(fd, mainvar, seq->mask);
-                       if (seq->sound) expand_doit(fd, mainvar, seq->sound);
+       if (seq->scene)
+         expand_doit(fd, mainvar, seq->scene);
+       if (seq->scene_camera)
+         expand_doit(fd, mainvar, seq->scene_camera);
+       if (seq->clip)
+         expand_doit(fd, mainvar, seq->clip);
+       if (seq->mask)
+         expand_doit(fd, mainvar, seq->mask);
+       if (seq->sound)
+         expand_doit(fd, mainvar, seq->sound);
  
-                       if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
-                               TextVars *data = seq->effectdata;
-                               expand_doit(fd, mainvar, data->text_font);
-                       }
-               } SEQ_END;
-       }
+       if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) {
+         TextVars *data = seq->effectdata;
+         expand_doit(fd, mainvar, data->text_font);
+       }
+     }
+     SEQ_END;
+   }
  
-       if (sce->rigidbody_world) {
-               expand_doit(fd, mainvar, sce->rigidbody_world->group);
-               expand_doit(fd, mainvar, sce->rigidbody_world->constraints);
-       }
+   if (sce->rigidbody_world) {
+     expand_doit(fd, mainvar, sce->rigidbody_world->group);
+     expand_doit(fd, mainvar, sce->rigidbody_world->constraints);
+   }
  
-       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
-               if (marker->camera) {
-                       expand_doit(fd, mainvar, marker->camera);
-               }
-       }
+   for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
+     if (marker->camera) {
+       expand_doit(fd, mainvar, marker->camera);
+     }
+   }
  
-       expand_doit(fd, mainvar, sce->clip);
+   expand_doit(fd, mainvar, sce->clip);
  
  #ifdef USE_COLLECTION_COMPAT_28
-       if (sce->collection) {
-               expand_scene_collection(fd, mainvar, sce->collection);
-       }
+   if (sce->collection) {
+     expand_scene_collection(fd, mainvar, sce->collection);
+   }
  #endif
  
-       if (sce->master_collection) {
-               expand_collection(fd, mainvar, sce->master_collection);
-       }
+   if (sce->master_collection) {
+     expand_collection(fd, mainvar, sce->master_collection);
+   }
  
-       if (sce->r.bake.cage_object) {
-               expand_doit(fd, mainvar, sce->r.bake.cage_object);
-       }
+   if (sce->r.bake.cage_object) {
+     expand_doit(fd, mainvar, sce->r.bake.cage_object);
+   }
  }
  
  static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
index 1c286db6919404f568877e1ef9f5f1ca6a909457,e43553cd64ffadfb801497e21271911a5e0d04f4..d832967a329d61a637ed68bb094816515c392f67
@@@ -1590,829 -1622,855 +1622,881 @@@ void blo_do_versions_280(FileData *fd, 
  #undef EEVEE_GET_FLOAT
  #undef EEVEE_GET_INT
  #undef EEVEE_GET_BOOL
-                       }
-               }
+       }
+     }
  
 +              if (!DNA_struct_find(fd->filesdna, "SceneLANPR")) {
 +                      for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
 +
 +                              scene->lanpr.crease_threshold = 0.7;
 +
 +                              scene->lanpr.line_thickness = 1.5;
 +                              scene->lanpr.depth_clamp = 0.001;
 +                              scene->lanpr.depth_strength = 800;
 +                              scene->lanpr.normal_clamp = 2;
 +                              scene->lanpr.normal_strength = 10;
 +                              
 +                              scene->lanpr.enable_intersections = 1;
 +                              
 +                              scene->lanpr.background_color[0] = 0.76;
 +                              scene->lanpr.background_color[1] = 0.54;
 +                              scene->lanpr.background_color[2] = 0.29;
 +                              scene->lanpr.background_color[3] = 1;
 +                              
 +                              scene->lanpr.line_color[0] = 0.39;
 +                              scene->lanpr.line_color[1] = 0.12;
 +                              scene->lanpr.line_color[2] = 0.04;
 +                              scene->lanpr.line_color[3] = 1;
 +
 +                      }
 +              }
 +
+     if (!MAIN_VERSION_ATLEAST(bmain, 280, 15)) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->display.matcap_ssao_distance = 0.2f;
+         scene->display.matcap_ssao_attenuation = 1.0f;
+         scene->display.matcap_ssao_samples = 16;
+       }
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_OUTLINER) {
+               SpaceOutliner *soops = (SpaceOutliner *)sl;
+               soops->filter_id_type = ID_GR;
+               soops->outlinevis = SO_VIEW_LAYER;
+             }
+           }
+         }
+       }
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         switch (scene->toolsettings->snap_mode) {
+           case 0:
+             scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
+             break;
+           case 1:
+             scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX;
+             break;
+           case 2:
+             scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE;
+             break;
+           case 3:
+             scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE;
+             break;
+           case 4:
+             scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME;
+             break;
+         }
+         switch (scene->toolsettings->snap_node_mode) {
+           case 5:
+             scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X;
+             break;
+           case 6:
+             scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y;
+             break;
+           case 7:
+             scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y;
+             break;
+           case 8:
+             scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
+             break;
+         }
+         switch (scene->toolsettings->snap_uv_mode) {
+           case 0:
+             scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;
+             break;
+           case 1:
+             scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX;
+             break;
+         }
+       }
+       ParticleSettings *part;
+       for (part = bmain->particles.first; part; part = part->id.next) {
+         part->shape_flag = PART_SHAPE_CLOSE_TIP;
+         part->shape = 0.0f;
+         part->rad_root = 1.0f;
+         part->rad_tip = 0.0f;
+         part->rad_scale = 0.01f;
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 18)) {
+     if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "roughness")) {
+       for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
+         if (mat->use_nodes) {
+           if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
+             mat->roughness = mat->gloss_mir;
+           }
+           else {
+             mat->roughness = 0.25f;
+           }
+         }
+         else {
+           mat->roughness = 1.0f - mat->gloss_mir;
+         }
+         mat->metallic = mat->ray_mirror;
+       }
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->shading.xray_alpha = 0.5f;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "matcap[256]")) {
+       StudioLight *default_matcap = BKE_studiolight_find_default(STUDIOLIGHT_TYPE_MATCAP);
+       /* when loading the internal file is loaded before the matcaps */
+       if (default_matcap) {
+         for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+           for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+             for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+               if (sl->spacetype == SPACE_VIEW3D) {
+                 View3D *v3d = (View3D *)sl;
+                 BLI_strncpy(v3d->shading.matcap, default_matcap->name, FILE_MAXFILE);
+               }
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_threshold")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->overlay.wireframe_threshold = 0.5f;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "cavity_valley_factor")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->shading.cavity_valley_factor = 1.0f;
+               v3d->shading.cavity_ridge_factor = 1.0f;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "xray_alpha_bone")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->overlay.xray_alpha_bone = 0.5f;
+             }
+           }
+         }
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 19)) {
+     if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "renderslot")) {
+       for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
+         if (ima->type == IMA_TYPE_R_RESULT) {
+           for (int i = 0; i < 8; i++) {
+             RenderSlot *slot = MEM_callocN(sizeof(RenderSlot), "Image Render Slot Init");
+             BLI_snprintf(slot->name, sizeof(slot->name), "Slot %d", i + 1);
+             BLI_addtail(&ima->renderslots, slot);
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SpaceAction", "char", "mode_prev")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_ACTION) {
+               SpaceAction *saction = (SpaceAction *)sl;
+               /* "Dopesheet" should be default here, unless it looks like the Action Editor was active instead */
+               if ((saction->mode_prev == 0) && (saction->action == NULL)) {
+                 saction->mode_prev = SACTCONT_DOPESHEET;
+               }
+             }
+           }
+         }
+       }
+     }
+     for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+         for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+           if (sl->spacetype == SPACE_VIEW3D) {
+             View3D *v3d = (View3D *)sl;
+             if (v3d->drawtype == OB_TEXTURE) {
+               v3d->drawtype = OB_SOLID;
+               v3d->shading.light = V3D_LIGHTING_STUDIO;
+               v3d->shading.color_type = V3D_SHADING_TEXTURE_COLOR;
+             }
+           }
+         }
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 21)) {
+     for (Scene *sce = bmain->scenes.first; sce != NULL; sce = sce->id.next) {
+       if (sce->ed != NULL && sce->ed->seqbase.first != NULL) {
+         do_versions_seq_unique_name_all_strips(sce, &sce->ed->seqbase);
+       }
+     }
+     if (!DNA_struct_elem_find(
+             fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               enum {
+                 V3D_SHOW_MODE_SHADE_OVERRIDE = (1 << 15),
+               };
+               View3D *v3d = (View3D *)sl;
+               float alpha = v3d->flag2 & V3D_SHOW_MODE_SHADE_OVERRIDE ? 0.0f : 1.0f;
+               v3d->overlay.texture_paint_mode_opacity = alpha;
+               v3d->overlay.vertex_paint_mode_opacity = alpha;
+               v3d->overlay.weight_paint_mode_opacity = alpha;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "background_type")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               copy_v3_fl(v3d->shading.background_color, 0.05f);
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_cubemap_draw_size")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->eevee.gi_irradiance_draw_size = 0.1f;
+         scene->eevee.gi_cubemap_draw_size = 0.3f;
+       }
+     }
+     if (!DNA_struct_elem_find(
+             fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         RigidBodyWorld *rbw = scene->rigidbody_world;
+         if (rbw == NULL) {
+           continue;
+         }
+         if (rbw->shared == NULL) {
+           rbw->shared = MEM_callocN(sizeof(*rbw->shared), "RigidBodyWorld_Shared");
+         }
+         /* Move shared pointers from deprecated location to current location */
+         rbw->shared->pointcache = rbw->pointcache;
+         rbw->shared->ptcaches = rbw->ptcaches;
+         rbw->pointcache = NULL;
+         BLI_listbase_clear(&rbw->ptcaches);
+         if (rbw->shared->pointcache == NULL) {
+           rbw->shared->pointcache = BKE_ptcache_add(&(rbw->shared->ptcaches));
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SoftBody", "SoftBody_Shared", "*shared")) {
+       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+         SoftBody *sb = ob->soft;
+         if (sb == NULL) {
+           continue;
+         }
+         if (sb->shared == NULL) {
+           sb->shared = MEM_callocN(sizeof(*sb->shared), "SoftBody_Shared");
+         }
+         /* Move shared pointers from deprecated location to current location */
+         sb->shared->pointcache = sb->pointcache;
+         sb->shared->ptcaches = sb->ptcaches;
+         sb->pointcache = NULL;
+         BLI_listbase_clear(&sb->ptcaches);
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "short", "type")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               if (v3d->drawtype == OB_RENDER) {
+                 v3d->drawtype = OB_SOLID;
+               }
+               v3d->shading.type = v3d->drawtype;
+               v3d->shading.prev_type = OB_SOLID;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "View3DShading", "shading")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         BKE_screen_view3d_shading_init(&scene->display.shading);
+       }
+     }
+     /* initialize grease pencil view data */
+     if (!DNA_struct_elem_find(fd->filesdna, "SpaceView3D", "float", "vertex_opacity")) {
+       for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
+         for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->vertex_opacity = 1.0f;
+               v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
+             }
+           }
+         }
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 22)) {
+     if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "annotate_v3d_align")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
+         scene->toolsettings->annotate_thickness = 3;
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "short", "line_change")) {
+       for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+         for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+           gpl->line_change = gpl->thickness;
+           if ((gpl->thickness < 1) || (gpl->thickness > 10)) {
+             gpl->thickness = 3;
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_opacity")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->overlay.gpencil_paper_opacity = 0.5f;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_grid_opacity")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->overlay.gpencil_grid_opacity = 0.5f;
+             }
+           }
+         }
+       }
+     }
+     /* default loc axis */
+     if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "lock_axis")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         /* lock axis */
+         GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
+         if (gset) {
+           gset->lock_axis = GP_LOCKAXIS_Y;
+         }
+       }
+     }
+     /* Versioning code for Subsurf modifier. */
+     if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "uv_smooth")) {
+       for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
+         for (ModifierData *md = object->modifiers.first; md; md = md->next) {
+           if (md->type == eModifierType_Subsurf) {
+             SubsurfModifierData *smd = (SubsurfModifierData *)md;
+             if (smd->flags & eSubsurfModifierFlag_SubsurfUv_DEPRECATED) {
+               smd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
+             }
+             else {
+               smd->uv_smooth = SUBSURF_UV_SMOOTH_NONE;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "quality")) {
+       for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
+         for (ModifierData *md = object->modifiers.first; md; md = md->next) {
+           if (md->type == eModifierType_Subsurf) {
+             SubsurfModifierData *smd = (SubsurfModifierData *)md;
+             smd->quality = min_ii(smd->renderLevels, 3);
+           }
+         }
+       }
+     }
+     /* Versioning code for Multires modifier. */
+     if (!DNA_struct_elem_find(fd->filesdna, "MultiresModifier", "short", "quality")) {
+       for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
+         for (ModifierData *md = object->modifiers.first; md; md = md->next) {
+           if (md->type == eModifierType_Multires) {
+             MultiresModifierData *mmd = (MultiresModifierData *)md;
+             mmd->quality = 3;
+             if (mmd->flags & eMultiresModifierFlag_PlainUv_DEPRECATED) {
+               mmd->uv_smooth = SUBSURF_UV_SMOOTH_NONE;
+             }
+             else {
+               mmd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "short", "bending_model")) {
+       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+         for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+           ClothModifierData *clmd = NULL;
+           if (md->type == eModifierType_Cloth) {
+             clmd = (ClothModifierData *)md;
+           }
+           else if (md->type == eModifierType_ParticleSystem) {
+             ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
+             ParticleSystem *psys = psmd->psys;
+             clmd = psys->clmd;
+           }
+           if (clmd != NULL) {
+             clmd->sim_parms->bending_model = CLOTH_BENDING_LINEAR;
+             clmd->sim_parms->tension = clmd->sim_parms->structural;
+             clmd->sim_parms->compression = clmd->sim_parms->structural;
+             clmd->sim_parms->shear = clmd->sim_parms->structural;
+             clmd->sim_parms->max_tension = clmd->sim_parms->max_struct;
+             clmd->sim_parms->max_compression = clmd->sim_parms->max_struct;
+             clmd->sim_parms->max_shear = clmd->sim_parms->max_struct;
+             clmd->sim_parms->vgroup_shear = clmd->sim_parms->vgroup_struct;
+             clmd->sim_parms->tension_damp = clmd->sim_parms->Cdis;
+             clmd->sim_parms->compression_damp = clmd->sim_parms->Cdis;
+             clmd->sim_parms->shear_damp = clmd->sim_parms->Cdis;
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "era_strength_f")) {
+       for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
+         if (brush->gpencil_settings != NULL) {
+           BrushGpencilSettings *gp = brush->gpencil_settings;
+           if (gp->brush_type == GPAINT_TOOL_ERASE) {
+             gp->era_strength_f = 100.0f;
+             gp->era_thickness_f = 10.0f;
+           }
+         }
+       }
+     }
+     for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+       for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+         if (md->type == eModifierType_Cloth) {
+           ClothModifierData *clmd = (ClothModifierData *)md;
+           if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)) {
+             clmd->sim_parms->vgroup_mass = 0;
+           }
+           if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING)) {
+             clmd->sim_parms->vgroup_struct = 0;
+             clmd->sim_parms->vgroup_shear = 0;
+             clmd->sim_parms->vgroup_bend = 0;
+           }
+           if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW)) {
+             clmd->sim_parms->shrink_min = 0.0f;
+             clmd->sim_parms->vgroup_shrink = 0;
+           }
+           if (!(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED)) {
+             clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
+           }
+         }
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 24)) {
+     for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+         for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+           if (sl->spacetype == SPACE_VIEW3D) {
+             View3D *v3d = (View3D *)sl;
+             v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_FACES | V3D_OVERLAY_EDIT_SEAMS |
+                                       V3D_OVERLAY_EDIT_SHARP | V3D_OVERLAY_EDIT_FREESTYLE_EDGE |
+                                       V3D_OVERLAY_EDIT_FREESTYLE_FACE | V3D_OVERLAY_EDIT_EDGES |
+                                       V3D_OVERLAY_EDIT_CREASES | V3D_OVERLAY_EDIT_BWEIGHTS |
+                                       V3D_OVERLAY_EDIT_CU_HANDLES | V3D_OVERLAY_EDIT_CU_NORMALS;
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode")) {
+       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+         for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+           if (md->type == eModifierType_Shrinkwrap) {
+             ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
+             if (smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) {
+               smd->shrinkMode = MOD_SHRINKWRAP_ABOVE_SURFACE;
+               smd->shrinkOpts &= ~MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE;
+             }
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "pdef_cfrict")) {
+       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+         if (ob->pd) {
+           ob->pd->pdef_cfrict = 5.0f;
+         }
+         for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+           if (md->type == eModifierType_Cloth) {
+             ClothModifierData *clmd = (ClothModifierData *)md;
+             clmd->coll_parms->selfepsilon = 0.015f;
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha_wire")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->shading.xray_alpha_wire = 0.5f;
+             }
+           }
+         }
+       }
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->shading.flag |= V3D_SHADING_XRAY_BONE;
+             }
+           }
+         }
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 25)) {
+     for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+       UnitSettings *unit = &scene->unit;
+       if (unit->system != USER_UNIT_NONE) {
+         unit->length_unit = bUnit_GetBaseUnitOfType(scene->unit.system, B_UNIT_LENGTH);
+         unit->mass_unit = bUnit_GetBaseUnitOfType(scene->unit.system, B_UNIT_MASS);
+       }
+       unit->time_unit = bUnit_GetBaseUnitOfType(USER_UNIT_NONE, B_UNIT_TIME);
+     }
+     /* gpencil grid settings */
+     for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
+       ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f);  // Color
+       ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f);        // Scale
+       gpd->grid.lines = GP_DEFAULT_GRID_LINES;             // Number of lines
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 28)) {
+     for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) {
+       BKE_mesh_calc_edges_loose(mesh);
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 29)) {
+     for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+         for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+           if (sl->spacetype == SPACE_VIEW3D) {
+             enum { V3D_OCCLUDE_WIRE = (1 << 14) };
+             View3D *v3d = (View3D *)sl;
+             if (v3d->flag2 & V3D_OCCLUDE_WIRE) {
+               v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_OCCLUDE_WIRE;
+               v3d->flag2 &= ~V3D_OCCLUDE_WIRE;
+             }
+           }
+         }
+       }
+     }
+     for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+         for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+           if (sl->spacetype == SPACE_PROPERTIES) {
+             ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+             ARegion *ar = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
+             ARegion *ar_header = NULL;
+             for (ar_header = regionbase->first; ar_header; ar_header = ar_header->next) {
+               if (ar_header->regiontype == RGN_TYPE_HEADER) {
+                 break;
+               }
+             }
+             BLI_assert(ar_header);
+             BLI_insertlinkafter(regionbase, ar_header, ar);
+             ar->regiontype = RGN_TYPE_NAV_BAR;
+             ar->alignment = RGN_ALIGN_LEFT;
+           }
+         }
+       }
+     }
+     /* grease pencil fade layer opacity */
+     if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_fade_layer")) {
+       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+         for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+           for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+             if (sl->spacetype == SPACE_VIEW3D) {
+               View3D *v3d = (View3D *)sl;
+               v3d->overlay.gpencil_fade_layer = 0.5f;
+             }
+           }
+         }
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 30)) {
+     /* grease pencil main material show switches */
+     for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
+       if (mat->gp_style) {
+         mat->gp_style->flag |= GP_STYLE_STROKE_SHOW;
+         mat->gp_style->flag |= GP_STYLE_FILL_SHOW;
+       }
+     }
+   }
+   if (!MAIN_VERSION_ATLEAST(bmain, 280, 33)) {
+     /* Grease pencil reset sculpt brushes after struct rename  */
+     if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "weighttype")) {
+       float curcolor_add[3], curcolor_sub[3];
+       ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
+       ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         /* sculpt brushes */
+         GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
+         if (gset) {
+           for (int i = 0; i < GP_SCULPT_TYPE_MAX; i++) {
+             GP_Sculpt_Data *gp_brush = &gset->brush[i];
+             gp_brush->size = 30;
+             gp_brush->strength = 0.5f;
+             gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
+             copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
+             copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
+           }
+         }
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "overscan")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->eevee.overscan = 3.0f;
+       }
+     }
+     for (Light *la = bmain->lights.first; la; la = la->id.next) {
+       /* Removed Hemi lights. */
+       if (!ELEM(la->type, LA_LOCAL, LA_SUN, LA_SPOT, LA_AREA)) {
+         la->type = LA_SUN;
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "light_threshold")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->eevee.light_threshold = 0.01f;
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_irradiance_smoothing")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->eevee.gi_irradiance_smoothing = 0.1f;
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_filter_quality")) {
+       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+         scene->eevee.gi_filter_quality = 1.0f;
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "att_dist")) {
+       for (Light *la = bmain->lights.first; la; la = la->id.next) {
+         la->att_dist = la->clipend;
+       }
+     }
+     if (!DNA_struct_elem_find(fd->filesdna, "Brush", "char", "weightpaint_tool")) {
+       /* Magic defines from old files (2.7x) */
  
-               if (!MAIN_VERSION_ATLEAST(bmain, 280, 15)) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->display.matcap_ssao_distance = 0.2f;
-                               scene->display.matcap_ssao_attenuation = 1.0f;
-                               scene->display.matcap_ssao_samples = 16;
-                       }
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_OUTLINER) {
-                                                       SpaceOutliner *soops = (SpaceOutliner *)sl;
-                                                       soops->filter_id_type = ID_GR;
-                                                       soops->outlinevis = SO_VIEW_LAYER;
-                                               }
-                                       }
-                               }
-                       }
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               switch (scene->toolsettings->snap_mode) {
-                                       case 0: scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; break;
-                                       case 1: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX   ; break;
-                                       case 2: scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE     ; break;
-                                       case 3: scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE     ; break;
-                                       case 4: scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME   ; break;
-                               }
-                               switch (scene->toolsettings->snap_node_mode) {
-                                       case 5: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X; break;
-                                       case 6: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y; break;
-                                       case 7: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y; break;
-                                       case 8: scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID  ; break;
-                               }
-                               switch (scene->toolsettings->snap_uv_mode) {
-                                       case 0: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT; break;
-                                       case 1: scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX   ; break;
-                               }
-                       }
-                       ParticleSettings *part;
-                       for (part = bmain->particles.first; part; part = part->id.next) {
-                               part->shape_flag = PART_SHAPE_CLOSE_TIP;
-                               part->shape = 0.0f;
-                               part->rad_root = 1.0f;
-                               part->rad_tip = 0.0f;
-                               part->rad_scale = 0.01f;
-                       }
-               }
+ #define PAINT_BLEND_MIX 0
+ #define PAINT_BLEND_ADD 1
+ #define PAINT_BLEND_SUB 2
+ #define PAINT_BLEND_MUL 3
+ #define PAINT_BLEND_BLUR 4
+ #define PAINT_BLEND_LIGHTEN 5
+ #define PAINT_BLEND_DARKEN 6
+ #define PAINT_BLEND_AVERAGE 7
+ #define PAINT_BLEND_SMEAR 8
+ #define PAINT_BLEND_COLORDODGE 9
+ #define PAINT_BLEND_DIFFERENCE 10
+ #define PAINT_BLEND_SCREEN 11
+ #define PAINT_BLEND_HARDLIGHT 12
+ #define PAINT_BLEND_OVERLAY 13
+ #define PAINT_BLEND_SOFTLIGHT 14
+ #define PAINT_BLEND_EXCLUSION 15
+ #define PAINT_BLEND_LUMINOSITY 16
+ #define PAINT_BLEND_SATURATION 17
+ #define PAINT_BLEND_HUE 18
+ #define PAINT_BLEND_ALPHA_SUB 19
+ #define PAINT_BLEND_ALPHA_ADD 20
  
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 18)) {
-               if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "roughness")) {
-                       for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
-                               if (mat->use_nodes) {
-                                       if (MAIN_VERSION_ATLEAST(bmain, 280, 0)) {
-                                               mat->roughness = mat->gloss_mir;
-                                       }
-                                       else {
-                                               mat->roughness = 0.25f;
-                                       }
-                               }
-                               else {
-                                       mat->roughness = 1.0f - mat->gloss_mir;
-                               }
-                               mat->metallic = mat->ray_mirror;
-                       }
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->shading.flag |= V3D_SHADING_SPECULAR_HIGHLIGHT;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->shading.xray_alpha = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "matcap[256]")) {
-                       StudioLight *default_matcap = BKE_studiolight_find_default(STUDIOLIGHT_TYPE_MATCAP);
-                       /* when loading the internal file is loaded before the matcaps */
-                       if (default_matcap) {
-                               for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                                       if (sl->spacetype == SPACE_VIEW3D) {
-                                                               View3D *v3d = (View3D *)sl;
-                                                               BLI_strncpy(v3d->shading.matcap, default_matcap->name, FILE_MAXFILE);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_threshold")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->overlay.wireframe_threshold = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "cavity_valley_factor")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->shading.cavity_valley_factor = 1.0f;
-                                                       v3d->shading.cavity_ridge_factor = 1.0f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "xray_alpha_bone")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->overlay.xray_alpha_bone = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 19)) {
-               if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "renderslot")) {
-                       for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
-                               if (ima->type == IMA_TYPE_R_RESULT) {
-                                       for (int i = 0; i < 8; i++) {
-                                               RenderSlot *slot = MEM_callocN(sizeof(RenderSlot), "Image Render Slot Init");
-                                               BLI_snprintf(slot->name, sizeof(slot->name), "Slot %d", i + 1);
-                                               BLI_addtail(&ima->renderslots, slot);
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SpaceAction", "char", "mode_prev")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_ACTION) {
-                                                       SpaceAction *saction = (SpaceAction *)sl;
-                                                       /* "Dopesheet" should be default here, unless it looks like the Action Editor was active instead */
-                                                       if ((saction->mode_prev == 0) && (saction->action == NULL)) {
-                                                               saction->mode_prev = SACTCONT_DOPESHEET;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-               for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                       if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D *)sl;
-                                               if (v3d->drawtype == OB_TEXTURE) {
-                                                       v3d->drawtype = OB_SOLID;
-                                                       v3d->shading.light = V3D_LIGHTING_STUDIO;
-                                                       v3d->shading.color_type = V3D_SHADING_TEXTURE_COLOR;
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 21)) {
-               for (Scene *sce = bmain->scenes.first; sce != NULL; sce = sce->id.next) {
-                       if (sce->ed != NULL && sce->ed->seqbase.first != NULL) {
-                               do_versions_seq_unique_name_all_strips(sce, &sce->ed->seqbase);
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       enum { V3D_SHOW_MODE_SHADE_OVERRIDE = (1 << 15), };
-                                                       View3D *v3d = (View3D *)sl;
-                                                       float alpha = v3d->flag2 & V3D_SHOW_MODE_SHADE_OVERRIDE ? 0.0f : 1.0f;
-                                                       v3d->overlay.texture_paint_mode_opacity = alpha;
-                                                       v3d->overlay.vertex_paint_mode_opacity = alpha;
-                                                       v3d->overlay.weight_paint_mode_opacity = alpha;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "background_type")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       copy_v3_fl(v3d->shading.background_color, 0.05f);
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_cubemap_draw_size")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->eevee.gi_irradiance_draw_size = 0.1f;
-                               scene->eevee.gi_cubemap_draw_size = 0.3f;
-                       }
-               }
-               for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                       if (scene->toolsettings->gizmo_flag == 0) {
-                               scene->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               RigidBodyWorld *rbw = scene->rigidbody_world;
-                               if (rbw == NULL) {
-                                       continue;
-                               }
-                               if (rbw->shared == NULL) {
-                                       rbw->shared = MEM_callocN(sizeof(*rbw->shared), "RigidBodyWorld_Shared");
-                               }
-                               /* Move shared pointers from deprecated location to current location */
-                               rbw->shared->pointcache = rbw->pointcache;
-                               rbw->shared->ptcaches = rbw->ptcaches;
-                               rbw->pointcache = NULL;
-                               BLI_listbase_clear(&rbw->ptcaches);
-                               if (rbw->shared->pointcache == NULL) {
-                                       rbw->shared->pointcache = BKE_ptcache_add(&(rbw->shared->ptcaches));
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SoftBody", "SoftBody_Shared", "*shared")) {
-                       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-                               SoftBody *sb = ob->soft;
-                               if (sb == NULL) {
-                                       continue;
-                               }
-                               if (sb->shared == NULL) {
-                                       sb->shared = MEM_callocN(sizeof(*sb->shared), "SoftBody_Shared");
-                               }
-                               /* Move shared pointers from deprecated location to current location */
-                               sb->shared->pointcache = sb->pointcache;
-                               sb->shared->ptcaches = sb->ptcaches;
-                               sb->pointcache = NULL;
-                               BLI_listbase_clear(&sb->ptcaches);
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "short", "type")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       if (v3d->drawtype == OB_RENDER) {
-                                                               v3d->drawtype = OB_SOLID;
-                                                       }
-                                                       v3d->shading.type = v3d->drawtype;
-                                                       v3d->shading.prev_type = OB_SOLID;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "View3DShading", "shading")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               BKE_screen_view3d_shading_init(&scene->display.shading);
-                       }
-               }
-               /* initialize grease pencil view data */
-               if (!DNA_struct_elem_find(fd->filesdna, "SpaceView3D", "float", "vertex_opacity")) {
-                       for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
-                               for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->vertex_opacity = 1.0f;
-                                                       v3d->gp_flag |= V3D_GP_SHOW_EDIT_LINES;
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 22)) {
-               if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "annotate_v3d_align")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
-                               scene->toolsettings->annotate_thickness = 3;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "short", "line_change")) {
-                       for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
-                               for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-                                       gpl->line_change = gpl->thickness;
-                                       if ((gpl->thickness < 1) || (gpl->thickness > 10)) {
-                                               gpl->thickness = 3;
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_opacity")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->overlay.gpencil_paper_opacity = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_grid_opacity")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->overlay.gpencil_grid_opacity = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               /* default loc axis */
-               if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "lock_axis")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               /* lock axis */
-                               GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
-                               if (gset) {
-                                       gset->lock_axis = GP_LOCKAXIS_Y;
-                               }
-                       }
-               }
-               /* Versioning code for Subsurf modifier. */
-               if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "uv_smooth")) {
-                       for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
-                               for (ModifierData *md = object->modifiers.first; md; md = md->next) {
-                                       if (md->type == eModifierType_Subsurf) {
-                                               SubsurfModifierData *smd = (SubsurfModifierData *)md;
-                                               if (smd->flags & eSubsurfModifierFlag_SubsurfUv_DEPRECATED) {
-                                                       smd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
-                                               }
-                                               else {
-                                                       smd->uv_smooth = SUBSURF_UV_SMOOTH_NONE;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "quality")) {
-                       for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
-                               for (ModifierData *md = object->modifiers.first; md; md = md->next) {
-                                       if (md->type == eModifierType_Subsurf) {
-                                               SubsurfModifierData *smd = (SubsurfModifierData *)md;
-                                               smd->quality = min_ii(smd->renderLevels, 3);
-                                       }
-                               }
-                       }
-               }
-               /* Versioning code for Multires modifier. */
-               if (!DNA_struct_elem_find(fd->filesdna, "MultiresModifier", "short", "quality")) {
-                       for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
-                               for (ModifierData *md = object->modifiers.first; md; md = md->next) {
-                                       if (md->type == eModifierType_Multires) {
-                                               MultiresModifierData *mmd = (MultiresModifierData *)md;
-                                               mmd->quality = 3;
-                                               if (mmd->flags & eMultiresModifierFlag_PlainUv_DEPRECATED) {
-                                                       mmd->uv_smooth = SUBSURF_UV_SMOOTH_NONE;
-                                               }
-                                               else {
-                                                       mmd->uv_smooth = SUBSURF_UV_SMOOTH_PRESERVE_CORNERS;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "short", "bending_model")) {
-                       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-                               for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
-                                       ClothModifierData *clmd = NULL;
-                                       if (md->type == eModifierType_Cloth) {
-                                               clmd = (ClothModifierData *)md;
-                                       }
-                                       else if (md->type == eModifierType_ParticleSystem) {
-                                               ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
-                                               ParticleSystem *psys = psmd->psys;
-                                               clmd = psys->clmd;
-                                       }
-                                       if (clmd != NULL) {
-                                               clmd->sim_parms->bending_model = CLOTH_BENDING_LINEAR;
-                                               clmd->sim_parms->tension = clmd->sim_parms->structural;
-                                               clmd->sim_parms->compression = clmd->sim_parms->structural;
-                                               clmd->sim_parms->shear = clmd->sim_parms->structural;
-                                               clmd->sim_parms->max_tension = clmd->sim_parms->max_struct;
-                                               clmd->sim_parms->max_compression = clmd->sim_parms->max_struct;
-                                               clmd->sim_parms->max_shear = clmd->sim_parms->max_struct;
-                                               clmd->sim_parms->vgroup_shear = clmd->sim_parms->vgroup_struct;
-                                               clmd->sim_parms->tension_damp = clmd->sim_parms->Cdis;
-                                               clmd->sim_parms->compression_damp = clmd->sim_parms->Cdis;
-                                               clmd->sim_parms->shear_damp = clmd->sim_parms->Cdis;
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "era_strength_f")) {
-                       for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
-                               if (brush->gpencil_settings != NULL) {
-                                       BrushGpencilSettings *gp = brush->gpencil_settings;
-                                       if (gp->brush_type == GPAINT_TOOL_ERASE) {
-                                               gp->era_strength_f = 100.0f;
-                                               gp->era_thickness_f = 10.0f;
-                                       }
-                               }
-                       }
-               }
-               for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-                       for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
-                               if (md->type == eModifierType_Cloth) {
-                                       ClothModifierData *clmd = (ClothModifierData *)md;
-                                       if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)) {
-                                               clmd->sim_parms->vgroup_mass = 0;
-                                       }
-                                       if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING)) {
-                                               clmd->sim_parms->vgroup_struct = 0;
-                                               clmd->sim_parms->vgroup_shear = 0;
-                                               clmd->sim_parms->vgroup_bend = 0;
-                                       }
-                                       if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW)) {
-                                               clmd->sim_parms->shrink_min = 0.0f;
-                                               clmd->sim_parms->vgroup_shrink = 0;
-                                       }
-                                       if (!(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED)) {
-                                               clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
-                                       }
-                               }
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 24)) {
-               for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                       if (sl->spacetype == SPACE_VIEW3D) {
-                                               View3D *v3d = (View3D *)sl;
-                                               v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_FACES |
-                                                                         V3D_OVERLAY_EDIT_SEAMS |
-                                                                         V3D_OVERLAY_EDIT_SHARP |
-                                                                         V3D_OVERLAY_EDIT_FREESTYLE_EDGE |
-                                                                         V3D_OVERLAY_EDIT_FREESTYLE_FACE |
-                                                                         V3D_OVERLAY_EDIT_EDGES |
-                                                                         V3D_OVERLAY_EDIT_CREASES |
-                                                                         V3D_OVERLAY_EDIT_BWEIGHTS |
-                                                                         V3D_OVERLAY_EDIT_CU_HANDLES |
-                                                                         V3D_OVERLAY_EDIT_CU_NORMALS;
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode")) {
-                       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-                               for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
-                                       if (md->type == eModifierType_Shrinkwrap) {
-                                               ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
-                                               if (smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) {
-                                                       smd->shrinkMode = MOD_SHRINKWRAP_ABOVE_SURFACE;
-                                                       smd->shrinkOpts &= ~MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "pdef_cfrict")) {
-                       for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-                               if (ob->pd) {
-                                       ob->pd->pdef_cfrict = 5.0f;
-                               }
-                               for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
-                                       if (md->type == eModifierType_Cloth) {
-                                               ClothModifierData *clmd = (ClothModifierData *)md;
-                                               clmd->coll_parms->selfepsilon = 0.015f;
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha_wire")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->shading.xray_alpha_wire = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->shading.flag |= V3D_SHADING_XRAY_BONE;
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 25)) {
-               for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                       UnitSettings *unit = &scene->unit;
-                       if (unit->system != USER_UNIT_NONE) {
-                               unit->length_unit = bUnit_GetBaseUnitOfType(scene->unit.system, B_UNIT_LENGTH);
-                               unit->mass_unit = bUnit_GetBaseUnitOfType(scene->unit.system, B_UNIT_MASS);
-                       }
-                       unit->time_unit = bUnit_GetBaseUnitOfType(USER_UNIT_NONE, B_UNIT_TIME);
-               }
-               /* gpencil grid settings */
-               for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
-                       ARRAY_SET_ITEMS(gpd->grid.color, 0.5f, 0.5f, 0.5f); // Color
-                       ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f); // Scale
-                       gpd->grid.lines = GP_DEFAULT_GRID_LINES; // Number of lines
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 28)) {
-               for (Mesh *mesh = bmain->meshes.first; mesh; mesh = mesh->id.next) {
-                       BKE_mesh_calc_edges_loose(mesh);
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 29)) {
-               for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                       if (sl->spacetype == SPACE_VIEW3D) {
-                                               enum { V3D_OCCLUDE_WIRE = (1 << 14) };
-                                               View3D *v3d = (View3D *)sl;
-                                               if (v3d->flag2 & V3D_OCCLUDE_WIRE) {
-                                                       v3d->overlay.edit_flag |= V3D_OVERLAY_EDIT_OCCLUDE_WIRE;
-                                                       v3d->flag2 &= ~V3D_OCCLUDE_WIRE;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                               for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                       if (sl->spacetype == SPACE_PROPERTIES) {
-                                               ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
-                                               ARegion *ar = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
-                                               ARegion *ar_header = NULL;
-                                               for (ar_header = regionbase->first; ar_header; ar_header = ar_header->next) {
-                                                       if (ar_header->regiontype == RGN_TYPE_HEADER) {
-                                                               break;
-                                                       }
-                                               }
-                                               BLI_assert(ar_header);
-                                               BLI_insertlinkafter(regionbase, ar_header, ar);
-                                               ar->regiontype = RGN_TYPE_NAV_BAR;
-                                               ar->alignment = RGN_ALIGN_LEFT;
-                                       }
-                               }
-                       }
-               }
-               /* grease pencil fade layer opacity */
-               if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_fade_layer")) {
-                       for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-                               for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                                       for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
-                                               if (sl->spacetype == SPACE_VIEW3D) {
-                                                       View3D *v3d = (View3D *)sl;
-                                                       v3d->overlay.gpencil_fade_layer = 0.5f;
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 30)) {
-               /* grease pencil main material show switches */
-               for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
-                       if (mat->gp_style) {
-                               mat->gp_style->flag |= GP_STYLE_STROKE_SHOW;
-                               mat->gp_style->flag |= GP_STYLE_FILL_SHOW;
-                       }
-               }
-       }
-       if (!MAIN_VERSION_ATLEAST(bmain, 280, 33)) {
-               /* Grease pencil reset sculpt brushes after struct rename  */
-               if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "weighttype")) {
-                       float curcolor_add[3], curcolor_sub[3];
-                       ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
-                       ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               /* sculpt brushes */
-                               GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
-                               if (gset) {
-                                       for (int i = 0; i < GP_SCULPT_TYPE_MAX; i++) {
-                                               GP_Sculpt_Data *gp_brush = &gset->brush[i];
-                                               gp_brush->size = 30;
-                                               gp_brush->strength = 0.5f;
-                                               gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
-                                               copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
-                                               copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
-                                       }
-                               }
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "overscan")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->eevee.overscan = 3.0f;
-                       }
-               }
-               for (Light *la = bmain->lights.first; la; la = la->id.next) {
-                       /* Removed Hemi lights. */
-                       if (!ELEM(la->type, LA_LOCAL, LA_SUN, LA_SPOT, LA_AREA)) {
-                               la->type = LA_SUN;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "light_threshold")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->eevee.light_threshold = 0.01f;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_irradiance_smoothing")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->eevee.gi_irradiance_smoothing = 0.1f;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_filter_quality")) {
-                       for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
-                               scene->eevee.gi_filter_quality = 1.0f;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "Light", "float", "att_dist")) {
-                       for (Light *la = bmain->lights.first; la; la = la->id.next) {
-                               la->att_dist = la->clipend;
-                       }
-               }
-               if (!DNA_struct_elem_find(fd->filesdna, "Brush", "char", "weightpaint_tool")) {
-                       /* Magic defines from old files (2.7x) */
- #define PAINT_BLEND_MIX 0
- #define PAINT_BLEND_ADD 1
- #define PAINT_BLEND_SUB 2
- #define PAINT_BLEND_MUL 3
- #define PAINT_BLEND_BLUR 4
- #define PAINT_BLEND_LIGHTEN 5
- #define PAINT_BLEND_DARKEN 6
- #define PAINT_BLEND_AVERAGE 7
- #define PAINT_BLEND_SMEAR 8
- #define PAINT_BLEND_COLORDODGE 9
- #define PAINT_BLEND_DIFFERENCE 10
- #define PAINT_BLEND_SCREEN 11
- #define PAINT_BLEND_HARDLIGHT 12
- #define PAINT_BLEND_OVERLAY 13
- #define PAINT_BLEND_SOFTLIGHT 14
- #define PAINT_BLEND_EXCLUSION 15
- #define PAINT_BLEND_LUMINOSITY 16
- #define PAINT_BLEND_SATURATION 17
- #define PAINT_BLEND_HUE 18
- #define PAINT_BLEND_ALPHA_SUB 19
- #define PAINT_BLEND_ALPHA_ADD 20
-                       for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
-                               if (brush->ob_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
-                                       const char tool_init = brush->vertexpaint_tool;
-                                       bool is_blend = false;
-                                       {
-                                               char tool = tool_init;
-                                               switch (tool_init) {
-                                                       case PAINT_BLEND_MIX: tool = VPAINT_TOOL_DRAW; break;
-                                                       case PAINT_BLEND_BLUR: tool = VPAINT_TOOL_BLUR; break;
-                                                       case PAINT_BLEND_AVERAGE: tool = VPAINT_TOOL_AVERAGE; break;
-                                                       case PAINT_BLEND_SMEAR: tool = VPAINT_TOOL_SMEAR; break;
-                                                       default:
-                                                               tool = VPAINT_TOOL_DRAW;
-                                                               is_blend = true;
-                                                               break;
-                                               }
-                                               brush->vertexpaint_tool = tool;
-                                       }
-                                       if (is_blend == false) {
-                                               brush->blend = IMB_BLEND_MIX;
-                                       }
-                                       else {
-                                               short blend = IMB_BLEND_MIX;
-                                               switch (tool_init) {
-                                                       case PAINT_BLEND_ADD: blend = IMB_BLEND_ADD; break;
-                                                       case PAINT_BLEND_SUB: blend = IMB_BLEND_SUB; break;
-                                                       case PAINT_BLEND_MUL: blend = IMB_BLEND_MUL; break;
-                                                       case PAINT_BLEND_LIGHTEN: blend = IMB_BLEND_LIGHTEN; break;
-                                                       case PAINT_BLEND_DARKEN: blend = IMB_BLEND_DARKEN; break;
-                                                       case PAINT_BLEND_COLORDODGE: blend = IMB_BLEND_COLORDODGE; break;
-                                                       case PAINT_BLEND_DIFFERENCE: blend = IMB_BLEND_DIFFERENCE; break;
-                                                       case PAINT_BLEND_SCREEN: blend = IMB_BLEND_SCREEN; break;
-                                                       case PAINT_BLEND_HARDLIGHT: blend = IMB_BLEND_HARDLIGHT; break;
-                                                       case PAINT_BLEND_OVERLAY: blend = IMB_BLEND_OVERLAY; break;
-                                                       case PAINT_BLEND_SOFTLIGHT: blend = IMB_BLEND_SOFTLIGHT; break;
-                                                       case PAINT_BLEND_EXCLUSION: blend = IMB_BLEND_EXCLUSION; break;
-                                                       case PAINT_BLEND_LUMINOSITY: blend = IMB_BLEND_LUMINOSITY; break;
-                                                       case PAINT_BLEND_SATURATION: blend = IMB_BLEND_SATURATION; break;
-                                                       case PAINT_BLEND_HUE: blend = IMB_BLEND_HUE; break;
-                                                       case PAINT_BLEND_ALPHA_SUB: blend = IMB_BLEND_ERASE_ALPHA; break;
-                                                       case PAINT_BLEND_ALPHA_ADD: blend = IMB_BLEND_ADD_ALPHA; break;
-                                               }
-                                               brush->blend = blend;
-                                       }
-                               }
-                               /* For now these match, in the future new items may not. */
-                               brush->weightpaint_tool = brush->vertexpaint_tool;
-                       }
+       for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
+         if (brush->ob_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
+           const char tool_init = brush->vertexpaint_tool;
+           bool is_blend = false;
+           {
+             char tool = tool_init;
+             switch (tool_init) {
+               case PAINT_BLEND_MIX:
+                 tool = VPAINT_TOOL_DRAW;
+                 break;
+               case PAINT_BLEND_BLUR:
+                 tool = VPAINT_TOOL_BLUR;
+                 break;
+               case PAINT_BLEND_AVERAGE:
+                 tool = VPAINT_TOOL_AVERAGE;
+                 break;
+               case PAINT_BLEND_SMEAR:
+                 tool = VPAINT_TOOL_SMEAR;
+                 break;
+               default:
+                 tool = VPAINT_TOOL_DRAW;
+                 is_blend = true;
+                 break;
+             }
+             brush->vertexpaint_tool = tool;
+           }
+           if (is_blend == false) {
+             brush->blend = IMB_BLEND_MIX;
+           }
+           else {
+             short blend = IMB_BLEND_MIX;
+             switch (tool_init) {
+               case PAINT_BLEND_ADD:
+                 blend = IMB_BLEND_ADD;
+                 break;
+               case PAINT_BLEND_SUB:
+                 blend = IMB_BLEND_SUB;
+                 break;
+               case PAINT_BLEND_MUL:
+                 blend = IMB_BLEND_MUL;
+                 break;
+               case PAINT_BLEND_LIGHTEN:
+                 blend = IMB_BLEND_LIGHTEN;
+                 break;
+               case PAINT_BLEND_DARKEN:
+                 blend = IMB_BLEND_DARKEN;
+                 break;
+               case PAINT_BLEND_COLORDODGE:
+                 blend = IMB_BLEND_COLORDODGE;
+                 break;
+               case PAINT_BLEND_DIFFERENCE:
+                 blend = IMB_BLEND_DIFFERENCE;
+                 break;
+               case PAINT_BLEND_SCREEN:
+                 blend = IMB_BLEND_SCREEN;
+                 break;
+               case PAINT_BLEND_HARDLIGHT:
+                 blend = IMB_BLEND_HARDLIGHT;
+                 break;
+               case PAINT_BLEND_OVERLAY:
+                 blend = IMB_BLEND_OVERLAY;
+                 break;
+               case PAINT_BLEND_SOFTLIGHT:
+                 blend = IMB_BLEND_SOFTLIGHT;
+                 break;
+               case PAINT_BLEND_EXCLUSION:
+                 blend = IMB_BLEND_EXCLUSION;
+                 break;
+               case PAINT_BLEND_LUMINOSITY:
+                 blend = IMB_BLEND_LUMINOSITY;
+                 break;
+               case PAINT_BLEND_SATURATION:
+                 blend = IMB_BLEND_SATURATION;
+                 break;
+               case PAINT_BLEND_HUE:
+                 blend = IMB_BLEND_HUE;
+                 break;
+               case PAINT_BLEND_ALPHA_SUB:
+                 blend = IMB_BLEND_ERASE_ALPHA;
+                 break;
+               case PAINT_BLEND_ALPHA_ADD:
+                 blend = IMB_BLEND_ADD_ALPHA;
+                 break;
+             }
+             brush->blend = blend;
+           }
+         }
+         /* For now these match, in the future new items may not. */
+         brush->weightpaint_tool = brush->vertexpaint_tool;
+       }
  
  #undef PAINT_BLEND_MIX
  #undef PAINT_BLEND_ADD
index 374085571ead7747d0bf17ee64a53b4a93e90ecc,79cd7678f906787a147ff58d7d9a4f9813953e11..33c89b3b3e63d90c5b86bc505780b76372003eb0
@@@ -2519,216 -2518,210 +2519,218 @@@ static void write_lightcache(WriteData 
  
  static void write_scene(WriteData *wd, Scene *sce)
  {
-       /* write LibData */
-       writestruct(wd, ID_SCE, Scene, 1, sce);
-       write_iddata(wd, &sce->id);
-       if (sce->adt) {
-               write_animdata(wd, sce->adt);
-       }
-       write_keyingsets(wd, &sce->keyingsets);
-       /* direct data */
-       ToolSettings *tos = sce->toolsettings;
-       writestruct(wd, DATA, ToolSettings, 1, tos);
-       if (tos->vpaint) {
-               writestruct(wd, DATA, VPaint, 1, tos->vpaint);
-               write_paint(wd, &tos->vpaint->paint);
-       }
-       if (tos->wpaint) {
-               writestruct(wd, DATA, VPaint, 1, tos->wpaint);
-               write_paint(wd, &tos->wpaint->paint);
-       }
-       if (tos->sculpt) {
-               writestruct(wd, DATA, Sculpt, 1, tos->sculpt);
-               write_paint(wd, &tos->sculpt->paint);
-       }
-       if (tos->uvsculpt) {
-               writestruct(wd, DATA, UvSculpt, 1, tos->uvsculpt);
-               write_paint(wd, &tos->uvsculpt->paint);
-       }
-       if (tos->gp_paint) {
-               writestruct(wd, DATA, GpPaint, 1, tos->gp_paint);
-               write_paint(wd, &tos->gp_paint->paint);
-       }
-       /* write grease-pencil custom ipo curve to file */
-       if (tos->gp_interpolate.custom_ipo) {
-               write_curvemapping(wd, tos->gp_interpolate.custom_ipo);
-       }
-       /* write grease-pencil multiframe falloff curve to file */
-       if (tos->gp_sculpt.cur_falloff) {
-               write_curvemapping(wd, tos->gp_sculpt.cur_falloff);
-       }
-       /* write grease-pencil primitive curve to file */
-       if (tos->gp_sculpt.cur_primitive) {
-               write_curvemapping(wd, tos->gp_sculpt.cur_primitive);
-       }
-       write_paint(wd, &tos->imapaint.paint);
-       Editing *ed = sce->ed;
-       if (ed) {
-               Sequence *seq;
-               writestruct(wd, DATA, Editing, 1, ed);
-               /* reset write flags too */
-               SEQ_BEGIN(ed, seq)
-               {
-                       if (seq->strip) {
-                               seq->strip->done = false;
-                       }
-                       writestruct(wd, DATA, Sequence, 1, seq);
-               } SEQ_END;
-               SEQ_BEGIN(ed, seq)
-               {
-                       if (seq->strip && seq->strip->done == 0) {
-                               /* write strip with 'done' at 0 because readfile */
-                               if (seq->effectdata) {
-                                       switch (seq->type) {
-                                               case SEQ_TYPE_COLOR:
-                                                       writestruct(wd, DATA, SolidColorVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_SPEED:
-                                                       writestruct(wd, DATA, SpeedControlVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_WIPE:
-                                                       writestruct(wd, DATA, WipeVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_GLOW:
-                                                       writestruct(wd, DATA, GlowVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_TRANSFORM:
-                                                       writestruct(wd, DATA, TransformVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_GAUSSIAN_BLUR:
-                                                       writestruct(wd, DATA, GaussianBlurVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_TEXT:
-                                                       writestruct(wd, DATA, TextVars, 1, seq->effectdata);
-                                                       break;
-                                               case SEQ_TYPE_COLORMIX:
-                                                       writestruct(wd, DATA, ColorMixVars, 1, seq->effectdata);
-                                                       break;
-                                       }
-                               }
-                               writestruct(wd, DATA, Stereo3dFormat, 1, seq->stereo3d_format);
-                               Strip *strip = seq->strip;
-                               writestruct(wd, DATA, Strip, 1, strip);
-                               if (seq->flag & SEQ_USE_CROP && strip->crop) {
-                                       writestruct(wd, DATA, StripCrop, 1, strip->crop);
-                               }
-                               if (seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
-                                       writestruct(wd, DATA, StripTransform, 1, strip->transform);
-                               }
-                               if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
-                                       writestruct(wd, DATA, StripProxy, 1, strip->proxy);
-                               }
-                               if (seq->type == SEQ_TYPE_IMAGE) {
-                                       writestruct(wd, DATA, StripElem,
-                                                   MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem),
-                                                   strip->stripdata);
-                               }
-                               else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
-                                       writestruct(wd, DATA, StripElem, 1, strip->stripdata);
-                               }
-                               strip->done = true;
-                       }
-                       if (seq->prop) {
-                               IDP_WriteProperty(seq->prop, wd);
-                       }
-                       write_sequence_modifiers(wd, &seq->modifiers);
-               } SEQ_END;
-               /* new; meta stack too, even when its nasty restore code */
-               for (MetaStack *ms = ed->metastack.first; ms; ms = ms->next) {
-                       writestruct(wd, DATA, MetaStack, 1, ms);
-               }
-       }
-       if (sce->r.avicodecdata) {
-               writestruct(wd, DATA, AviCodecData, 1, sce->r.avicodecdata);
-               if (sce->r.avicodecdata->lpFormat) {
-                       writedata(wd, DATA, sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat);
-               }
-               if (sce->r.avicodecdata->lpParms) {
-                       writedata(wd, DATA, sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms);
-               }
-       }
-       if (sce->r.ffcodecdata.properties) {
-               IDP_WriteProperty(sce->r.ffcodecdata.properties, wd);
-       }
-       /* writing dynamic list of TimeMarkers to the blend file */
-       for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
-               writestruct(wd, DATA, TimeMarker, 1, marker);
-       }
-       /* writing dynamic list of TransformOrientations to the blend file */
-       for (TransformOrientation *ts = sce->transform_spaces.first; ts; ts = ts->next) {
-               writestruct(wd, DATA, TransformOrientation, 1, ts);
-       }
-       /* writing MultiView to the blend file */
-       for (SceneRenderView *srv = sce->r.views.first; srv; srv = srv->next) {
-               writestruct(wd, DATA, SceneRenderView, 1, srv);
-       }
-       if (sce->nodetree) {
-               writestruct(wd, DATA, bNodeTree, 1, sce->nodetree);
-               write_nodetree_nolib(wd, sce->nodetree);
-       }
-       write_view_settings(wd, &sce->view_settings);
-       /* writing RigidBodyWorld data to the blend file */
-       if (sce->rigidbody_world) {
-               /* Set deprecated pointers to prevent crashes of older Blenders */
-               sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache;
-               sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches;
-               writestruct(wd, DATA, RigidBodyWorld, 1, sce->rigidbody_world);
-               writestruct(wd, DATA, RigidBodyWorld_Shared, 1, sce->rigidbody_world->shared);
-               writestruct(wd, DATA, EffectorWeights, 1, sce->rigidbody_world->effector_weights);
-               write_pointcaches(wd, &(sce->rigidbody_world->shared->ptcaches));
-       }
-       write_previews(wd, sce->preview);
-       write_curvemapping_curves(wd, &sce->r.mblur_shutter_curve);
-       for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
-               write_view_layer(wd, view_layer);
-       }
-       if (sce->master_collection) {
-               writestruct(wd, DATA, Collection, 1, sce->master_collection);
-               write_collection_nolib(wd, sce->master_collection);
-       }
-       /* Eevee Lightcache */
-       if (sce->eevee.light_cache && !wd->use_memfile) {
-               writestruct(wd, DATA, LightCache, 1, sce->eevee.light_cache);
-               write_lightcache(wd, sce->eevee.light_cache);
-       }
+   /* write LibData */
+   writestruct(wd, ID_SCE, Scene, 1, sce);
+   write_iddata(wd, &sce->id);
+   if (sce->adt) {
+     write_animdata(wd, sce->adt);
+   }
+   write_keyingsets(wd, &sce->keyingsets);
+   /* direct data */
+   ToolSettings *tos = sce->toolsettings;
+   writestruct(wd, DATA, ToolSettings, 1, tos);
+   if (tos->vpaint) {
+     writestruct(wd, DATA, VPaint, 1, tos->vpaint);
+     write_paint(wd, &tos->vpaint->paint);
+   }
+   if (tos->wpaint) {
+     writestruct(wd, DATA, VPaint, 1, tos->wpaint);
+     write_paint(wd, &tos->wpaint->paint);
+   }
+   if (tos->sculpt) {
+     writestruct(wd, DATA, Sculpt, 1, tos->sculpt);
+     write_paint(wd, &tos->sculpt->paint);
+   }
+   if (tos->uvsculpt) {
+     writestruct(wd, DATA, UvSculpt, 1, tos->uvsculpt);
+     write_paint(wd, &tos->uvsculpt->paint);
+   }
+   if (tos->gp_paint) {
+     writestruct(wd, DATA, GpPaint, 1, tos->gp_paint);
+     write_paint(wd, &tos->gp_paint->paint);
+   }
+   /* write grease-pencil custom ipo curve to file */
+   if (tos->gp_interpolate.custom_ipo) {
+     write_curvemapping(wd, tos->gp_interpolate.custom_ipo);
+   }
+   /* write grease-pencil multiframe falloff curve to file */
+   if (tos->gp_sculpt.cur_falloff) {
+     write_curvemapping(wd, tos->gp_sculpt.cur_falloff);
+   }
+   /* write grease-pencil primitive curve to file */
+   if (tos->gp_sculpt.cur_primitive) {
+     write_curvemapping(wd, tos->gp_sculpt.cur_primitive);
+   }
+   write_paint(wd, &tos->imapaint.paint);
+   Editing *ed = sce->ed;
+   if (ed) {
+     Sequence *seq;
+     writestruct(wd, DATA, Editing, 1, ed);
+     /* reset write flags too */
+     SEQ_BEGIN (ed, seq) {
+       if (seq->strip) {
+         seq->strip->done = false;
+       }
+       writestruct(wd, DATA, Sequence, 1, seq);
+     }
+     SEQ_END;
+     SEQ_BEGIN (ed, seq) {
+       if (seq->strip && seq->strip->done == 0) {
+         /* write strip with 'done' at 0 because readfile */
+         if (seq->effectdata) {
+           switch (seq->type) {
+             case SEQ_TYPE_COLOR:
+               writestruct(wd, DATA, SolidColorVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_SPEED:
+               writestruct(wd, DATA, SpeedControlVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_WIPE:
+               writestruct(wd, DATA, WipeVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_GLOW:
+               writestruct(wd, DATA, GlowVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_TRANSFORM:
+               writestruct(wd, DATA, TransformVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_GAUSSIAN_BLUR:
+               writestruct(wd, DATA, GaussianBlurVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_TEXT:
+               writestruct(wd, DATA, TextVars, 1, seq->effectdata);
+               break;
+             case SEQ_TYPE_COLORMIX:
+               writestruct(wd, DATA, ColorMixVars, 1, seq->effectdata);
+               break;
+           }
+         }
+         writestruct(wd, DATA, Stereo3dFormat, 1, seq->stereo3d_format);
+         Strip *strip = seq->strip;
+         writestruct(wd, DATA, Strip, 1, strip);
+         if (seq->flag & SEQ_USE_CROP && strip->crop) {
+           writestruct(wd, DATA, StripCrop, 1, strip->crop);
+         }
+         if (seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
+           writestruct(wd, DATA, StripTransform, 1, strip->transform);
+         }
+         if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
+           writestruct(wd, DATA, StripProxy, 1, strip->proxy);
+         }
+         if (seq->type == SEQ_TYPE_IMAGE) {
+           writestruct(wd,
+                       DATA,
+                       StripElem,
+                       MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem),
+                       strip->stripdata);
+         }
+         else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
+           writestruct(wd, DATA, StripElem, 1, strip->stripdata);
+         }
+         strip->done = true;
+       }
+       if (seq->prop) {
+         IDP_WriteProperty(seq->prop, wd);
+       }
+       write_sequence_modifiers(wd, &seq->modifiers);
+     }
+     SEQ_END;
+     /* new; meta stack too, even when its nasty restore code */
+     for (MetaStack *ms = ed->metastack.first; ms; ms = ms->next) {
+       writestruct(wd, DATA, MetaStack, 1, ms);
+     }
+   }
+   if (sce->r.avicodecdata) {
+     writestruct(wd, DATA, AviCodecData, 1, sce->r.avicodecdata);
+     if (sce->r.avicodecdata->lpFormat) {
+       writedata(wd, DATA, sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat);
+     }
+     if (sce->r.avicodecdata->lpParms) {
+       writedata(wd, DATA, sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms);
+     }
+   }
+   if (sce->r.ffcodecdata.properties) {
+     IDP_WriteProperty(sce->r.ffcodecdata.properties, wd);
+   }
+   /* writing dynamic list of TimeMarkers to the blend file */
+   for (TimeMarker *marker = sce->markers.first; marker; marker = marker->next) {
+     writestruct(wd, DATA, TimeMarker, 1, marker);
+   }
+   /* writing dynamic list of TransformOrientations to the blend file */
+   for (TransformOrientation *ts = sce->transform_spaces.first; ts; ts = ts->next) {
+     writestruct(wd, DATA, TransformOrientation, 1, ts);
+   }
+   /* writing MultiView to the blend file */
+   for (SceneRenderView *srv = sce->r.views.first; srv; srv = srv->next) {
+     writestruct(wd, DATA, SceneRenderView, 1, srv);
+   }
+   if (sce->nodetree) {
+     writestruct(wd, DATA, bNodeTree, 1, sce->nodetree);
+     write_nodetree_nolib(wd, sce->nodetree);
+   }
+   write_view_settings(wd, &sce->view_settings);
+   /* writing RigidBodyWorld data to the blend file */
+   if (sce->rigidbody_world) {
+     /* Set deprecated pointers to prevent crashes of older Blenders */
+     sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache;
+     sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches;
+     writestruct(wd, DATA, RigidBodyWorld, 1, sce->rigidbody_world);
+     writestruct(wd, DATA, RigidBodyWorld_Shared, 1, sce->rigidbody_world->shared);
+     writestruct(wd, DATA, EffectorWeights, 1, sce->rigidbody_world->effector_weights);
+     write_pointcaches(wd, &(sce->rigidbody_world->shared->ptcaches));
+   }
+   write_previews(wd, sce->preview);
+   write_curvemapping_curves(wd, &sce->r.mblur_shutter_curve);
+   for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
+     write_view_layer(wd, view_layer);
+   }
+   if (sce->master_collection) {
+     writestruct(wd, DATA, Collection, 1, sce->master_collection);
+     write_collection_nolib(wd, sce->master_collection);
+   }
+   /* Eevee Lightcache */
+   if (sce->eevee.light_cache && !wd->use_memfile) {
+     writestruct(wd, DATA, LightCache, 1, sce->eevee.light_cache);
+     write_lightcache(wd, sce->eevee.light_cache);
+   }
  
-       /* Freed on doversion. */
-       BLI_assert(sce->layer_properties == NULL);
 +      /* LANPR Line Layers */
 +      for (LANPR_LineLayer *ll = sce->lanpr.line_layers.first; ll; ll = ll->next) {
 +              writestruct(wd, DATA, LANPR_LineLayer, 1, ll);
 +              for (LANPR_LineLayerComponent *llc = ll->components.first; llc; llc = llc->next) {
 +                      writestruct(wd, DATA, LANPR_LineLayerComponent, 1, llc);
 +              }
 +      }
 +
+   /* Freed on doversion. */
+   BLI_assert(sce->layer_properties == NULL);
  }
  
  static void write_gpencil(WriteData *wd, bGPdata *gpd)
index 9a28bcda90595e69dbd5f925e7ec63058697a669,0d1752af4dc8c6564118f02a2607a9981c45d38d..13888167d2ce3b6f65c2caa9a73a0f6757c364a6
@@@ -49,116 -49,114 +49,123 @@@ set(INC_SY
  )
  
  set(SRC
-       intern/draw_anim_viz.c
-       intern/draw_armature.c
-       intern/draw_cache.c
-       intern/draw_cache_impl_curve.c
-       intern/draw_cache_impl_displist.c
-       intern/draw_cache_impl_lattice.c
-       intern/draw_cache_impl_mesh.c
-       intern/draw_cache_impl_metaball.c
-       intern/draw_cache_impl_particles.c
-       intern/draw_common.c
-       intern/draw_debug.c
-       intern/draw_hair.c
-       intern/draw_instance_data.c
-       intern/draw_manager.c
-       intern/draw_manager_data.c
-       intern/draw_manager_exec.c
-       intern/draw_manager_profiling.c
-       intern/draw_manager_shader.c
-       intern/draw_manager_text.c
-       intern/draw_manager_texture.c
-       intern/draw_view.c
-       modes/edit_armature_mode.c
-       modes/edit_curve_mode.c
-       modes/edit_lattice_mode.c
-       modes/edit_mesh_mode.c
-       modes/edit_mesh_mode_text.c
-       modes/edit_metaball_mode.c
-       modes/edit_text_mode.c
-       modes/object_mode.c
-       modes/overlay_mode.c
-       modes/paint_texture_mode.c
-       modes/paint_vertex_mode.c
-       modes/particle_mode.c
-       modes/pose_mode.c
-       modes/sculpt_mode.c
-       engines/basic/basic_engine.c
-       engines/eevee/eevee_bloom.c
-       engines/eevee/eevee_data.c
-       engines/eevee/eevee_depth_of_field.c
-       engines/eevee/eevee_effects.c
-       engines/eevee/eevee_engine.c
-       engines/eevee/eevee_lightcache.c
-       engines/eevee/eevee_lightprobes.c
-       engines/eevee/eevee_lights.c
-       engines/eevee/eevee_lookdev.c
-       engines/eevee/eevee_materials.c
-       engines/eevee/eevee_mist.c
-       engines/eevee/eevee_motion_blur.c
-       engines/eevee/eevee_occlusion.c
-       engines/eevee/eevee_render.c
-       engines/eevee/eevee_screen_raytrace.c
-       engines/eevee/eevee_shaders.c
-       engines/eevee/eevee_subsurface.c
-       engines/eevee/eevee_temporal_sampling.c
-       engines/eevee/eevee_volumes.c
-       engines/workbench/solid_mode.c
-       engines/workbench/transparent_mode.c
-       engines/workbench/workbench_data.c
-       engines/workbench/workbench_deferred.c
-       engines/workbench/workbench_effect_aa.c
-       engines/workbench/workbench_effect_dof.c
-       engines/workbench/workbench_effect_fxaa.c
-       engines/workbench/workbench_effect_taa.c
-       engines/workbench/workbench_engine.c
-       engines/workbench/workbench_forward.c
-       engines/workbench/workbench_materials.c
-       engines/workbench/workbench_render.c
-       engines/workbench/workbench_studiolight.c
-       engines/workbench/workbench_volume.c
-       engines/external/external_engine.c
-       engines/gpencil/gpencil_cache_utils.c
-       engines/gpencil/gpencil_draw_cache_impl.c
-       engines/gpencil/gpencil_draw_utils.c
-       engines/gpencil/gpencil_engine.c
-       engines/gpencil/gpencil_engine.h
-       engines/gpencil/gpencil_render.c
-       engines/gpencil/gpencil_shader_fx.c
+   intern/draw_anim_viz.c
+   intern/draw_armature.c
+   intern/draw_cache.c
+   intern/draw_cache_impl_curve.c
+   intern/draw_cache_impl_displist.c
+   intern/draw_cache_impl_lattice.c
+   intern/draw_cache_impl_mesh.c
+   intern/draw_cache_impl_metaball.c
+   intern/draw_cache_impl_particles.c
+   intern/draw_common.c
+   intern/draw_debug.c
+   intern/draw_hair.c
+   intern/draw_instance_data.c
+   intern/draw_manager.c
+   intern/draw_manager_data.c
+   intern/draw_manager_exec.c
+   intern/draw_manager_profiling.c
+   intern/draw_manager_shader.c
+   intern/draw_manager_text.c
+   intern/draw_manager_texture.c
+   intern/draw_view.c
+   modes/edit_armature_mode.c
+   modes/edit_curve_mode.c
+   modes/edit_lattice_mode.c
+   modes/edit_mesh_mode.c
+   modes/edit_mesh_mode_text.c
+   modes/edit_metaball_mode.c
+   modes/edit_text_mode.c
+   modes/object_mode.c
+   modes/overlay_mode.c
+   modes/paint_texture_mode.c
+   modes/paint_vertex_mode.c
+   modes/particle_mode.c
+   modes/pose_mode.c
+   modes/sculpt_mode.c
+   engines/basic/basic_engine.c
+   engines/eevee/eevee_bloom.c
+   engines/eevee/eevee_data.c
+   engines/eevee/eevee_depth_of_field.c
+   engines/eevee/eevee_effects.c
+   engines/eevee/eevee_engine.c
+   engines/eevee/eevee_lightcache.c
+   engines/eevee/eevee_lightprobes.c
+   engines/eevee/eevee_lights.c
+   engines/eevee/eevee_lookdev.c
+   engines/eevee/eevee_materials.c
+   engines/eevee/eevee_mist.c
+   engines/eevee/eevee_motion_blur.c
+   engines/eevee/eevee_occlusion.c
+   engines/eevee/eevee_render.c
+   engines/eevee/eevee_screen_raytrace.c
+   engines/eevee/eevee_shaders.c
+   engines/eevee/eevee_subsurface.c
+   engines/eevee/eevee_temporal_sampling.c
+   engines/eevee/eevee_volumes.c
+   engines/workbench/solid_mode.c
+   engines/workbench/transparent_mode.c
+   engines/workbench/workbench_data.c
+   engines/workbench/workbench_deferred.c
+   engines/workbench/workbench_effect_aa.c
+   engines/workbench/workbench_effect_dof.c
+   engines/workbench/workbench_effect_fxaa.c
+   engines/workbench/workbench_effect_taa.c
+   engines/workbench/workbench_engine.c
+   engines/workbench/workbench_forward.c
+   engines/workbench/workbench_materials.c
+   engines/workbench/workbench_render.c
+   engines/workbench/workbench_studiolight.c
+   engines/workbench/workbench_volume.c
+   engines/external/external_engine.c
+   engines/gpencil/gpencil_cache_utils.c
+   engines/gpencil/gpencil_draw_cache_impl.c
+   engines/gpencil/gpencil_draw_utils.c
+   engines/gpencil/gpencil_engine.c
+   engines/gpencil/gpencil_engine.h
+   engines/gpencil/gpencil_render.c
+   engines/gpencil/gpencil_shader_fx.c
 +      engines/lanpr/lanpr_dpix.c
 +      engines/lanpr/lanpr_engine.c
 +      engines/lanpr/lanpr_snake.c
 +      engines/lanpr/lanpr_ops.c
 +      engines/lanpr/lanpr_util.c
 +      engines/lanpr/lanpr_chain.c
 +
-       DRW_engine.h
-       intern/DRW_render.h
-       intern/draw_cache.h
-       intern/draw_cache_impl.h
-       intern/draw_common.h
-       intern/draw_debug.h
-       intern/draw_hair_private.h
-       intern/draw_instance_data.h
-       intern/draw_manager.h
-       intern/draw_manager_profiling.h
-       intern/draw_manager_text.h
-       intern/draw_view.h
-       modes/draw_mode_engines.h
-       modes/edit_mesh_mode_intern.h
-       engines/basic/basic_engine.h
-       engines/eevee/eevee_engine.h
-       engines/eevee/eevee_lightcache.h
-       engines/eevee/eevee_lut.h
-       engines/eevee/eevee_private.h
-       engines/external/external_engine.h
-       engines/workbench/workbench_engine.h
-       engines/workbench/workbench_private.h
+   DRW_engine.h
+   intern/DRW_render.h
+   intern/draw_cache.h
+   intern/draw_cache_impl.h
+   intern/draw_common.h
+   intern/draw_debug.h
+   intern/draw_hair_private.h
+   intern/draw_instance_data.h
+   intern/draw_manager.h
+   intern/draw_manager_profiling.h
+   intern/draw_manager_text.h
+   intern/draw_view.h
+   modes/draw_mode_engines.h
+   modes/edit_mesh_mode_intern.h
+   engines/basic/basic_engine.h
+   engines/eevee/eevee_engine.h
+   engines/eevee/eevee_lightcache.h
+   engines/eevee/eevee_lut.h
+   engines/eevee/eevee_private.h
+   engines/external/external_engine.h
+   engines/workbench/workbench_engine.h
+   engines/workbench/workbench_private.h
 +      engines/lanpr/lanpr_util.h
 +      engines/lanpr/lanpr_all.h
  )
  
+ set(LIB
+   bf_blenkernel
+   bf_blenlib
+   bf_windowmanager
+ )
  data_to_c_simple(engines/eevee/shaders/ambient_occlusion_lib.glsl SRC)
  data_to_c_simple(engines/eevee/shaders/default_frag.glsl SRC)
  data_to_c_simple(engines/eevee/shaders/default_world_frag.glsl SRC)
index b26e000b41eb6202595302e68f39bd06873800b2,b0320a522f830272c0bf6c4483860ff6d7304b95..bfb258e5c3123c9e58889e65d87cfa7e398dff7f
@@@ -194,37 -198,41 +198,46 @@@ typedef enum 
  /* Textures from DRW_texture_pool_query_* have the options
   * DRW_TEX_FILTER for color float textures, and no options
   * for depth textures and integer textures. */
- struct GPUTexture *DRW_texture_pool_query_2d(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type);
- struct GPUTexture *DRW_texture_create_1d(
-         int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+ struct GPUTexture *DRW_texture_pool_query_2d(int w,
+                                              int h,
+                                              eGPUTextureFormat format,
+                                              DrawEngineType *engine_type);
+ struct GPUTexture *DRW_texture_create_1d(int w,
+                                          eGPUTextureFormat format,
+                                          DRWTextureFlag flags,
+                                          const float *fpixels);
  struct GPUTexture *DRW_texture_create_2d(
-         int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+     int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
  struct GPUTexture *DRW_texture_create_2d_array(
-         int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+     int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
  struct GPUTexture *DRW_texture_create_3d(
-         int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
- struct GPUTexture *DRW_texture_create_cube(
-         int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
- void DRW_texture_ensure_fullscreen_2d(
-         struct GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags);
+     int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
+ struct GPUTexture *DRW_texture_create_cube(int w,
+                                            eGPUTextureFormat format,
+                                            DRWTextureFlag flags,
+                                            const float *fpixels);
+ void DRW_texture_ensure_fullscreen_2d(struct GPUTexture **tex,
+                                       eGPUTextureFormat format,
+                                       DRWTextureFlag flags);
  void DRW_texture_ensure_2d(
-         struct GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags);
+     struct GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags);
  
 +void DRW_texture_ensure_fullscreen_2D_multisample(
 +        struct GPUTexture **tex, eGPUTextureFormat format, int samples, DRWTextureFlag flags);
 +void DRW_texture_ensure_2D_multisample(
 +        struct GPUTexture **tex, int w, int h, eGPUTextureFormat format, int samples, DRWTextureFlag flags);
 +
  void DRW_texture_generate_mipmaps(struct GPUTexture *tex);
  void DRW_texture_free(struct GPUTexture *tex);
- #define DRW_TEXTURE_FREE_SAFE(tex) do { \
-       if (tex != NULL) { \
-               DRW_texture_free(tex); \
-               tex = NULL; \
-       } \
- } while (0)
+ #define DRW_TEXTURE_FREE_SAFE(tex) \
+   do { \
+     if (tex != NULL) { \
+       DRW_texture_free(tex); \
+       tex = NULL; \
+     } \
+   } while (0)
  
  /* UBOs */
  struct GPUUniformBuffer *DRW_uniformbuffer_create(int size, const void *data);
index 7f623186356d706d1cefca4f8bb273826a8816b7,6c3bc7eb0213b1e73f982e04ab08da7e3f941100..e6a2fbe691cf41bcf3de723cc07b6e36ce384a7f
@@@ -2705,49 -2752,48 +2753,49 @@@ void DRW_engine_register(DrawEngineTyp
  
  void DRW_engines_register(void)
  {
 -  RE_engines_register(&DRW_engine_viewport_eevee_type);
 -  RE_engines_register(&DRW_engine_viewport_workbench_type);
 +      RE_engines_register(&DRW_engine_viewport_eevee_type);
 +      RE_engines_register(&DRW_engine_viewport_workbench_type);
 +      RE_engines_register(&DRW_engine_viewport_lanpr_type);
  
-       DRW_engine_register(&draw_engine_workbench_solid);
-       DRW_engine_register(&draw_engine_workbench_transparent);
+   DRW_engine_register(&draw_engine_workbench_solid);
+   DRW_engine_register(&draw_engine_workbench_transparent);
  
-       DRW_engine_register(&draw_engine_object_type);
-       DRW_engine_register(&draw_engine_edit_armature_type);
-       DRW_engine_register(&draw_engine_edit_curve_type);
-       DRW_engine_register(&draw_engine_edit_lattice_type);
-       DRW_engine_register(&draw_engine_edit_mesh_type);
-       DRW_engine_register(&draw_engine_edit_metaball_type);
-       DRW_engine_register(&draw_engine_edit_text_type);
-       DRW_engine_register(&draw_engine_motion_path_type);
-       DRW_engine_register(&draw_engine_overlay_type);
-       DRW_engine_register(&draw_engine_paint_texture_type);
-       DRW_engine_register(&draw_engine_paint_vertex_type);
-       DRW_engine_register(&draw_engine_particle_type);
-       DRW_engine_register(&draw_engine_pose_type);
-       DRW_engine_register(&draw_engine_sculpt_type);
-       DRW_engine_register(&draw_engine_gpencil_type);
+   DRW_engine_register(&draw_engine_object_type);
+   DRW_engine_register(&draw_engine_edit_armature_type);
+   DRW_engine_register(&draw_engine_edit_curve_type);
+   DRW_engine_register(&draw_engine_edit_lattice_type);
+   DRW_engine_register(&draw_engine_edit_mesh_type);
+   DRW_engine_register(&draw_engine_edit_metaball_type);
+   DRW_engine_register(&draw_engine_edit_text_type);
+   DRW_engine_register(&draw_engine_motion_path_type);
+   DRW_engine_register(&draw_engine_overlay_type);
+   DRW_engine_register(&draw_engine_paint_texture_type);
+   DRW_engine_register(&draw_engine_paint_vertex_type);
+   DRW_engine_register(&draw_engine_particle_type);
+   DRW_engine_register(&draw_engine_pose_type);
+   DRW_engine_register(&draw_engine_sculpt_type);
+   DRW_engine_register(&draw_engine_gpencil_type);
  
-       /* setup callbacks */
-       {
-               BKE_mball_batch_cache_dirty_tag_cb = DRW_mball_batch_cache_dirty_tag;
-               BKE_mball_batch_cache_free_cb = DRW_mball_batch_cache_free;
+   /* setup callbacks */
+   {
+     BKE_mball_batch_cache_dirty_tag_cb = DRW_mball_batch_cache_dirty_tag;
+     BKE_mball_batch_cache_free_cb = DRW_mball_batch_cache_free;
  
-               BKE_curve_batch_cache_dirty_tag_cb = DRW_curve_batch_cache_dirty_tag;
-               BKE_curve_batch_cache_free_cb = DRW_curve_batch_cache_free;
+     BKE_curve_batch_cache_dirty_tag_cb = DRW_curve_batch_cache_dirty_tag;
+     BKE_curve_batch_cache_free_cb = DRW_curve_batch_cache_free;
  
-               BKE_mesh_batch_cache_dirty_tag_cb = DRW_mesh_batch_cache_dirty_tag;
-               BKE_mesh_batch_cache_free_cb = DRW_mesh_batch_cache_free;
+     BKE_mesh_batch_cache_dirty_tag_cb = DRW_mesh_batch_cache_dirty_tag;
+     BKE_mesh_batch_cache_free_cb = DRW_mesh_batch_cache_free;
  
-               BKE_lattice_batch_cache_dirty_tag_cb = DRW_lattice_batch_cache_dirty_tag;
-               BKE_lattice_batch_cache_free_cb = DRW_lattice_batch_cache_free;
+     BKE_lattice_batch_cache_dirty_tag_cb = DRW_lattice_batch_cache_dirty_tag;
+     BKE_lattice_batch_cache_free_cb = DRW_lattice_batch_cache_free;
  
-               BKE_particle_batch_cache_dirty_tag_cb = DRW_particle_batch_cache_dirty_tag;
-               BKE_particle_batch_cache_free_cb = DRW_particle_batch_cache_free;
+     BKE_particle_batch_cache_dirty_tag_cb = DRW_particle_batch_cache_dirty_tag;
+     BKE_particle_batch_cache_free_cb = DRW_particle_batch_cache_free;
  
-               BKE_gpencil_batch_cache_dirty_tag_cb = DRW_gpencil_batch_cache_dirty_tag;
-               BKE_gpencil_batch_cache_free_cb = DRW_gpencil_batch_cache_free;
-       }
+     BKE_gpencil_batch_cache_dirty_tag_cb = DRW_gpencil_batch_cache_dirty_tag;
+     BKE_gpencil_batch_cache_free_cb = DRW_gpencil_batch_cache_free;
+   }
  }
  
  void DRW_engines_free(void)
index ed7da41692ff1990a7afadb6d8060a6202551c5c,4750a35d784f3cd1290a9ea507bd32ce90c14cb0..a0f86880eb0035aea4350fec23394384f1fc0e45
@@@ -90,82 -94,68 +94,91 @@@ GPUTexture *DRW_texture_create_2d
  }
  
  GPUTexture *DRW_texture_create_2d_array(
-         int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+     int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
  {
-       GPUTexture *tex = GPU_texture_create_2d_array(w, h, d, format, fpixels, NULL);
-       drw_texture_set_parameters(tex, flags);
+   GPUTexture *tex = GPU_texture_create_2d_array(w, h, d, format, fpixels, NULL);
+   drw_texture_set_parameters(tex, flags);
  
-       return tex;
+   return tex;
  }
  
 +GPUTexture *DRW_texture_create_2d_multisample(int w, int h, eGPUTextureFormat format, int samples, DRWTextureFlag flags, const float *fpixels)
 +{
 +      GPUTexture *tex = GPU_texture_create_2d_multisample(w, h, format, fpixels, samples, NULL);
 +      drw_texture_set_parameters(tex, flags);
 +
 +      return tex;
 +}
 +
  GPUTexture *DRW_texture_create_3d(
-         int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+     int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
  {
-       GPUTexture *tex = GPU_texture_create_3d(w, h, d, format, fpixels, NULL);
-       drw_texture_set_parameters(tex, flags);
+   GPUTexture *tex = GPU_texture_create_3d(w, h, d, format, fpixels, NULL);
+   drw_texture_set_parameters(tex, flags);
  
-       return tex;
+   return tex;
  }
  
- GPUTexture *DRW_texture_create_cube(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
+ GPUTexture *DRW_texture_create_cube(int w,
+                                     eGPUTextureFormat format,
+                                     DRWTextureFlag flags,
+                                     const float *fpixels)
  {
-       GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL);
-       drw_texture_set_parameters(tex, flags);
+   GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL);
+   drw_texture_set_parameters(tex, flags);
  
-       return tex;
+   return tex;
  }
  
- GPUTexture *DRW_texture_pool_query_2d(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type)
+ GPUTexture *DRW_texture_pool_query_2d(int w,
+                                       int h,
+                                       eGPUTextureFormat format,
+                                       DrawEngineType *engine_type)
  {
-       BLI_assert(drw_texture_format_supports_framebuffer(format));
-       GPUTexture *tex = GPU_viewport_texture_pool_query(DST.viewport, engine_type, w, h, format);
+   BLI_assert(drw_texture_format_supports_framebuffer(format));
+   GPUTexture *tex = GPU_viewport_texture_pool_query(DST.viewport, engine_type, w, h, format);
  
-       return tex;
+   return tex;
  }
  
- void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
+ void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex,
+                                       eGPUTextureFormat format,
+                                       DRWTextureFlag flags)
  {
-       if (*(tex) == NULL) {
-               const float *size = DRW_viewport_size_get();
-               *(tex) = DRW_texture_create_2d((int)size[0], (int)size[1], format, flags, NULL);
-       }
+   if (*(tex) == NULL) {
+     const float *size = DRW_viewport_size_get();
+     *(tex) = DRW_texture_create_2d((int)size[0], (int)size[1], format, flags, NULL);
+   }
  }
  
- void DRW_texture_ensure_2d(GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags)
+ void DRW_texture_ensure_2d(
+     GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags)
  {
-       if (*(tex) == NULL) {
-               *(tex) = DRW_texture_create_2d(w, h, format, flags, NULL);
-       }
+   if (*(tex) == NULL) {
+     *(tex) = DRW_texture_create_2d(w, h, format, flags, NULL);
+   }
  }
  
 +void DRW_texture_ensure_fullscreen_2D_multisample(GPUTexture **tex, eGPUTextureFormat format, int samples, DRWTextureFlag flags)
 +{
 +      if (*(tex) == NULL) {
 +              const float *size = DRW_viewport_size_get();
 +              *(tex) = DRW_texture_create_2d_multisample((int)size[0], (int)size[1], format, samples, flags, NULL);
 +      }
 +}
 +
 +void DRW_texture_ensure_2D_multisample(GPUTexture **tex, int w, int h, eGPUTextureFormat format, int samples, DRWTextureFlag flags)
 +{
 +      if (*(tex) == NULL) {
 +              *(tex) = DRW_texture_create_2d_multisample(w, h, format, samples, flags, NULL);
 +      }
 +}
 +
  void DRW_texture_generate_mipmaps(GPUTexture *tex)
  {
-       GPU_texture_bind(tex, 0);
-       GPU_texture_generate_mipmap(tex);
-       GPU_texture_unbind(tex);
+   GPU_texture_bind(tex, 0);
+   GPU_texture_generate_mipmap(tex);
+   GPU_texture_unbind(tex);
  }
  
  void DRW_texture_free(GPUTexture *tex)
index 9d0512bbcf2f599d734f79059991c635fc2b3963,7d42f59fea0ee2eaf05652fdb05db0d150d3b39c..f113f60e73113ebf7e8eb20f4e1bb7c1e4ad8e0b
@@@ -3417,21 -3545,18 +3545,21 @@@ static void OBJECT_draw_scene(void *ved
  
  static const DrawEngineDataSize OBJECT_data_size = DRW_VIEWPORT_DATA_SIZE(OBJECT_Data);
  
 +struct LANPR_Data;
 +void lanpr_id_update(struct LANPR_Data *vedata, ID *id);
 +
  DrawEngineType draw_engine_object_type = {
-       NULL, NULL,
-       N_("ObjectMode"),
-       &OBJECT_data_size,
-       &OBJECT_engine_init,
-       &OBJECT_engine_free,
-       &OBJECT_cache_init,
-       &OBJECT_cache_populate,
-       &OBJECT_cache_finish,
-       NULL,
-       &OBJECT_draw_scene,
-       NULL,
-       &lanpr_id_update,
-       NULL,
+     NULL,
+     NULL,
+     N_("ObjectMode"),
+     &OBJECT_data_size,
+     &OBJECT_engine_init,
+     &OBJECT_engine_free,
+     &OBJECT_cache_init,
+     &OBJECT_cache_populate,
+     &OBJECT_cache_finish,
+     NULL,
+     &OBJECT_draw_scene,
+     NULL,
+     NULL,
  };
index 566f49878fb3cd582afe0723feaf3b7835e1f424,8a51b9ba54e4900dd3ab1d57be8d1cdd6cf65e18..275bbf36198bd633791d48124f25c5340571e7da
  
  void ED_operatortypes_mesh(void)
  {
 -  WM_operatortype_append(MESH_OT_select_all);
 -  WM_operatortype_append(MESH_OT_select_interior_faces);
 -  WM_operatortype_append(MESH_OT_select_more);
 -  WM_operatortype_append(MESH_OT_select_less);
 -  WM_operatortype_append(MESH_OT_select_non_manifold);
 -  WM_operatortype_append(MESH_OT_select_linked);
 -  WM_operatortype_append(MESH_OT_select_linked_pick);
 -  WM_operatortype_append(MESH_OT_select_random);
 -  WM_operatortype_append(MESH_OT_select_ungrouped);
 -  WM_operatortype_append(MESH_OT_hide);
 -  WM_operatortype_append(MESH_OT_reveal);
 -  WM_operatortype_append(MESH_OT_select_face_by_sides);
 -  WM_operatortype_append(MESH_OT_select_loose);
 -  WM_operatortype_append(MESH_OT_select_mirror);
 -  WM_operatortype_append(MESH_OT_normals_make_consistent);
 -  WM_operatortype_append(MESH_OT_merge);
 -  WM_operatortype_append(MESH_OT_subdivide);
 -  WM_operatortype_append(MESH_OT_subdivide_edgering);
 -  WM_operatortype_append(MESH_OT_unsubdivide);
 -  WM_operatortype_append(MESH_OT_faces_select_linked_flat);
 -  WM_operatortype_append(MESH_OT_edges_select_sharp);
 -  WM_operatortype_append(MESH_OT_primitive_plane_add);
 -  WM_operatortype_append(MESH_OT_primitive_cube_add);
 -  WM_operatortype_append(MESH_OT_primitive_circle_add);
 -  WM_operatortype_append(MESH_OT_primitive_cylinder_add);
 -  WM_operatortype_append(MESH_OT_primitive_cone_add);
 -  WM_operatortype_append(MESH_OT_primitive_grid_add);
 -  WM_operatortype_append(MESH_OT_primitive_monkey_add);
 -  WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
 -  WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
 -
 -  WM_operatortype_append(MESH_OT_primitive_cube_add_gizmo);
 -
 -  WM_operatortype_append(MESH_OT_duplicate);
 -  WM_operatortype_append(MESH_OT_remove_doubles);
 -  WM_operatortype_append(MESH_OT_spin);
 -  WM_operatortype_append(MESH_OT_screw);
 -
 -  WM_operatortype_append(MESH_OT_extrude_region);
 -  WM_operatortype_append(MESH_OT_extrude_context);
 -  WM_operatortype_append(MESH_OT_extrude_faces_indiv);
 -  WM_operatortype_append(MESH_OT_extrude_edges_indiv);
 -  WM_operatortype_append(MESH_OT_extrude_verts_indiv);
 -
 -  WM_operatortype_append(MESH_OT_split);
 -  WM_operatortype_append(MESH_OT_extrude_repeat);
 -  WM_operatortype_append(MESH_OT_edge_rotate);
 -  WM_operatortype_append(MESH_OT_shortest_path_select);
 -  WM_operatortype_append(MESH_OT_loop_to_region);
 -  WM_operatortype_append(MESH_OT_region_to_loop);
 -  WM_operatortype_append(MESH_OT_select_axis);
 -
 -  WM_operatortype_append(MESH_OT_uvs_rotate);
 -  WM_operatortype_append(MESH_OT_uvs_reverse);
 -  WM_operatortype_append(MESH_OT_colors_rotate);
 -  WM_operatortype_append(MESH_OT_colors_reverse);
 -
 -  WM_operatortype_append(MESH_OT_fill);
 -  WM_operatortype_append(MESH_OT_fill_grid);
 -  WM_operatortype_append(MESH_OT_fill_holes);
 -  WM_operatortype_append(MESH_OT_beautify_fill);
 -  WM_operatortype_append(MESH_OT_quads_convert_to_tris);
 -  WM_operatortype_append(MESH_OT_tris_convert_to_quads);
 -  WM_operatortype_append(MESH_OT_decimate);
 -  WM_operatortype_append(MESH_OT_dissolve_verts);
 -  WM_operatortype_append(MESH_OT_dissolve_edges);
 -  WM_operatortype_append(MESH_OT_dissolve_faces);
 -  WM_operatortype_append(MESH_OT_dissolve_mode);
 -  WM_operatortype_append(MESH_OT_dissolve_limited);
 -  WM_operatortype_append(MESH_OT_dissolve_degenerate);
 -  WM_operatortype_append(MESH_OT_delete_edgeloop);
 -  WM_operatortype_append(MESH_OT_faces_shade_smooth);
 -  WM_operatortype_append(MESH_OT_faces_shade_flat);
 -  WM_operatortype_append(MESH_OT_sort_elements);
 -#ifdef WITH_FREESTYLE
 -  WM_operatortype_append(MESH_OT_mark_freestyle_face);
 -#endif
 -
 -  WM_operatortype_append(MESH_OT_delete);
 -  WM_operatortype_append(MESH_OT_delete_loose);
 -  WM_operatortype_append(MESH_OT_edge_collapse);
 -
 -  WM_operatortype_append(MESH_OT_separate);
 -  WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
 -  WM_operatortype_append(MESH_OT_loop_select);
 -  WM_operatortype_append(MESH_OT_edge_face_add);
 -  WM_operatortype_append(MESH_OT_shortest_path_pick);
 -  WM_operatortype_append(MESH_OT_select_similar);
 -  WM_operatortype_append(MESH_OT_select_similar_region);
 -  WM_operatortype_append(MESH_OT_select_mode);
 -  WM_operatortype_append(MESH_OT_loop_multi_select);
 -  WM_operatortype_append(MESH_OT_mark_seam);
 -  WM_operatortype_append(MESH_OT_mark_sharp);
 -#ifdef WITH_FREESTYLE
 -  WM_operatortype_append(MESH_OT_mark_freestyle_edge);
 -#endif
 -  WM_operatortype_append(MESH_OT_vertices_smooth);
 -  WM_operatortype_append(MESH_OT_vertices_smooth_laplacian);
 -  WM_operatortype_append(MESH_OT_flip_normals);
 -  WM_operatortype_append(MESH_OT_rip);
 -  WM_operatortype_append(MESH_OT_rip_edge);
 -  WM_operatortype_append(MESH_OT_blend_from_shape);
 -  WM_operatortype_append(MESH_OT_shape_propagate_to_all);
 -
 -  /* editmesh_polybuild */
 -  WM_operatortype_append(MESH_OT_polybuild_face_at_cursor);
 -  WM_operatortype_append(MESH_OT_polybuild_split_at_cursor);
 -  WM_operatortype_append(MESH_OT_polybuild_dissolve_at_cursor);
 -
 -  WM_operatortype_append(MESH_OT_uv_texture_add);
 -  WM_operatortype_append(MESH_OT_uv_texture_remove);
 -  WM_operatortype_append(MESH_OT_vertex_color_add);
 -  WM_operatortype_append(MESH_OT_vertex_color_remove);
 -  WM_operatortype_append(MESH_OT_customdata_mask_clear);
 -  WM_operatortype_append(MESH_OT_customdata_skin_add);
 -  WM_operatortype_append(MESH_OT_customdata_skin_clear);
 -  WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_add);
 -  WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_clear);
 -
 -  WM_operatortype_append(MESH_OT_edgering_select);
 -  WM_operatortype_append(MESH_OT_loopcut);
 -
 -  WM_operatortype_append(MESH_OT_solidify);
 -  WM_operatortype_append(MESH_OT_select_nth);
 -  WM_operatortype_append(MESH_OT_vert_connect);
 -  WM_operatortype_append(MESH_OT_vert_connect_path);
 -  WM_operatortype_append(MESH_OT_vert_connect_concave);
 -  WM_operatortype_append(MESH_OT_vert_connect_nonplanar);
 -  WM_operatortype_append(MESH_OT_face_make_planar);
 -  WM_operatortype_append(MESH_OT_knife_tool);
 -  WM_operatortype_append(MESH_OT_knife_project);
 -
 -  WM_operatortype_append(MESH_OT_bevel);
 -
 -  WM_operatortype_append(MESH_OT_bridge_edge_loops);
 -  WM_operatortype_append(MESH_OT_inset);
 -  WM_operatortype_append(MESH_OT_offset_edge_loops);
 -  WM_operatortype_append(MESH_OT_intersect);
 -  WM_operatortype_append(MESH_OT_intersect_boolean);
 -  WM_operatortype_append(MESH_OT_face_split_by_edges);
 -  WM_operatortype_append(MESH_OT_poke);
 -  WM_operatortype_append(MESH_OT_wireframe);
 -  WM_operatortype_append(MESH_OT_edge_split);
 +      WM_operatortype_append(MESH_OT_select_all);
 +      WM_operatortype_append(MESH_OT_select_interior_faces);
 +      WM_operatortype_append(MESH_OT_select_more);
 +      WM_operatortype_append(MESH_OT_select_less);
 +      WM_operatortype_append(MESH_OT_select_non_manifold);
 +      WM_operatortype_append(MESH_OT_select_linked);
 +      WM_operatortype_append(MESH_OT_select_linked_pick);
 +      WM_operatortype_append(MESH_OT_select_random);
 +      WM_operatortype_append(MESH_OT_select_ungrouped);
 +      WM_operatortype_append(MESH_OT_hide);
 +      WM_operatortype_append(MESH_OT_reveal);
 +      WM_operatortype_append(MESH_OT_select_face_by_sides);
 +      WM_operatortype_append(MESH_OT_select_loose);
 +      WM_operatortype_append(MESH_OT_select_mirror);
 +      WM_operatortype_append(MESH_OT_normals_make_consistent);
 +      WM_operatortype_append(MESH_OT_merge);
 +      WM_operatortype_append(MESH_OT_subdivide);
 +      WM_operatortype_append(MESH_OT_subdivide_edgering);
 +      WM_operatortype_append(MESH_OT_unsubdivide);
 +      WM_operatortype_append(MESH_OT_faces_select_linked_flat);
 +      WM_operatortype_append(MESH_OT_edges_select_sharp);
 +      WM_operatortype_append(MESH_OT_primitive_plane_add);
 +      WM_operatortype_append(MESH_OT_primitive_cube_add);
 +      WM_operatortype_append(MESH_OT_primitive_circle_add);
 +      WM_operatortype_append(MESH_OT_primitive_cylinder_add);
 +      WM_operatortype_append(MESH_OT_primitive_cone_add);
 +      WM_operatortype_append(MESH_OT_primitive_grid_add);
 +      WM_operatortype_append(MESH_OT_primitive_monkey_add);
 +      WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
 +      WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
 +
 +      WM_operatortype_append(MESH_OT_primitive_cube_add_gizmo);
 +
 +      WM_operatortype_append(MESH_OT_duplicate);
 +      WM_operatortype_append(MESH_OT_remove_doubles);
 +      WM_operatortype_append(MESH_OT_spin);
 +      WM_operatortype_append(MESH_OT_screw);
 +
 +      WM_operatortype_append(MESH_OT_extrude_region);
 +      WM_operatortype_append(MESH_OT_extrude_context);
 +      WM_operatortype_append(MESH_OT_extrude_faces_indiv);
 +      WM_operatortype_append(MESH_OT_extrude_edges_indiv);
 +      WM_operatortype_append(MESH_OT_extrude_verts_indiv);
 +
 +      WM_operatortype_append(MESH_OT_split);
 +      WM_operatortype_append(MESH_OT_extrude_repeat);
 +      WM_operatortype_append(MESH_OT_edge_rotate);
 +      WM_operatortype_append(MESH_OT_shortest_path_select);
 +      WM_operatortype_append(MESH_OT_loop_to_region);
 +      WM_operatortype_append(MESH_OT_region_to_loop);
 +      WM_operatortype_append(MESH_OT_select_axis);
 +
 +      WM_operatortype_append(MESH_OT_uvs_rotate);
 +      WM_operatortype_append(MESH_OT_uvs_reverse);
 +      WM_operatortype_append(MESH_OT_colors_rotate);
 +      WM_operatortype_append(MESH_OT_colors_reverse);
 +
 +      WM_operatortype_append(MESH_OT_fill);
 +      WM_operatortype_append(MESH_OT_fill_grid);
 +      WM_operatortype_append(MESH_OT_fill_holes);
 +      WM_operatortype_append(MESH_OT_beautify_fill);
 +      WM_operatortype_append(MESH_OT_quads_convert_to_tris);
 +      WM_operatortype_append(MESH_OT_tris_convert_to_quads);
 +      WM_operatortype_append(MESH_OT_decimate);
 +      WM_operatortype_append(MESH_OT_dissolve_verts);
 +      WM_operatortype_append(MESH_OT_dissolve_edges);
 +      WM_operatortype_append(MESH_OT_dissolve_faces);
 +      WM_operatortype_append(MESH_OT_dissolve_mode);
 +      WM_operatortype_append(MESH_OT_dissolve_limited);
 +      WM_operatortype_append(MESH_OT_dissolve_degenerate);
 +      WM_operatortype_append(MESH_OT_delete_edgeloop);
 +      WM_operatortype_append(MESH_OT_faces_shade_smooth);
 +      WM_operatortype_append(MESH_OT_faces_shade_flat);
 +      WM_operatortype_append(MESH_OT_sort_elements);
 +//#ifdef WITH_FREESTYLE
 +      WM_operatortype_append(MESH_OT_mark_freestyle_face);
 +//#endif
 +
 +      WM_operatortype_append(MESH_OT_delete);
 +      WM_operatortype_append(MESH_OT_delete_loose);
 +      WM_operatortype_append(MESH_OT_edge_collapse);
 +
 +      WM_operatortype_append(MESH_OT_separate);
 +      WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
 +      WM_operatortype_append(MESH_OT_loop_select);
 +      WM_operatortype_append(MESH_OT_edge_face_add);
 +      WM_operatortype_append(MESH_OT_shortest_path_pick);
 +      WM_operatortype_append(MESH_OT_select_similar);
 +      WM_operatortype_append(MESH_OT_select_similar_region);
 +      WM_operatortype_append(MESH_OT_select_mode);
 +      WM_operatortype_append(MESH_OT_loop_multi_select);
 +      WM_operatortype_append(MESH_OT_mark_seam);
 +      WM_operatortype_append(MESH_OT_mark_sharp);
 +//#ifdef WITH_FREESTYLE
 +      WM_operatortype_append(MESH_OT_mark_freestyle_edge);
 +//#endif
 +      WM_operatortype_append(MESH_OT_vertices_smooth);
 +      WM_operatortype_append(MESH_OT_vertices_smooth_laplacian);
 +      WM_operatortype_append(MESH_OT_flip_normals);
 +      WM_operatortype_append(MESH_OT_rip);
 +      WM_operatortype_append(MESH_OT_rip_edge);
 +      WM_operatortype_append(MESH_OT_blend_from_shape);
 +      WM_operatortype_append(MESH_OT_shape_propagate_to_all);
 +
 +      /* editmesh_polybuild */
 +      WM_operatortype_append(MESH_OT_polybuild_face_at_cursor);
 +      WM_operatortype_append(MESH_OT_polybuild_split_at_cursor);
 +      WM_operatortype_append(MESH_OT_polybuild_dissolve_at_cursor);
 +
 +      WM_operatortype_append(MESH_OT_uv_texture_add);
 +      WM_operatortype_append(MESH_OT_uv_texture_remove);
 +      WM_operatortype_append(MESH_OT_vertex_color_add);
 +      WM_operatortype_append(MESH_OT_vertex_color_remove);
 +      WM_operatortype_append(MESH_OT_customdata_mask_clear);
 +      WM_operatortype_append(MESH_OT_customdata_skin_add);
 +      WM_operatortype_append(MESH_OT_customdata_skin_clear);
 +      WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_add);
 +      WM_operatortype_append(MESH_OT_customdata_custom_splitnormals_clear);
 +
 +      WM_operatortype_append(MESH_OT_edgering_select);
 +      WM_operatortype_append(MESH_OT_loopcut);
 +
 +      WM_operatortype_append(MESH_OT_solidify);
 +      WM_operatortype_append(MESH_OT_select_nth);
 +      WM_operatortype_append(MESH_OT_vert_connect);
 +      WM_operatortype_append(MESH_OT_vert_connect_path);
 +      WM_operatortype_append(MESH_OT_vert_connect_concave);
 +      WM_operatortype_append(MESH_OT_vert_connect_nonplanar);
 +      WM_operatortype_append(MESH_OT_face_make_planar);
 +      WM_operatortype_append(MESH_OT_knife_tool);
 +      WM_operatortype_append(MESH_OT_knife_project);
 +
 +      WM_operatortype_append(MESH_OT_bevel);
 +
 +      WM_operatortype_append(MESH_OT_bridge_edge_loops);
 +      WM_operatortype_append(MESH_OT_inset);
 +      WM_operatortype_append(MESH_OT_offset_edge_loops);
 +      WM_operatortype_append(MESH_OT_intersect);
 +      WM_operatortype_append(MESH_OT_intersect_boolean);
 +      WM_operatortype_append(MESH_OT_face_split_by_edges);
 +      WM_operatortype_append(MESH_OT_poke);
 +      WM_operatortype_append(MESH_OT_wireframe);
 +      WM_operatortype_append(MESH_OT_edge_split);
  
  #ifdef WITH_BULLET
-       WM_operatortype_append(MESH_OT_convex_hull);
+   WM_operatortype_append(MESH_OT_convex_hull);
  #endif
  
-       WM_operatortype_append(MESH_OT_bisect);
-       WM_operatortype_append(MESH_OT_symmetrize);
-       WM_operatortype_append(MESH_OT_symmetry_snap);
-       WM_operatortype_append(MESH_OT_point_normals);
-       WM_operatortype_append(MESH_OT_merge_normals);
-       WM_operatortype_append(MESH_OT_split_normals);
-       WM_operatortype_append(MESH_OT_normals_tools);
-       WM_operatortype_append(MESH_OT_set_normals_from_faces);
-       WM_operatortype_append(MESH_OT_average_normals);
-       WM_operatortype_append(MESH_OT_smoothen_normals);
-       WM_operatortype_append(MESH_OT_mod_weighted_strength);
+   WM_operatortype_append(MESH_OT_bisect);
+   WM_operatortype_append(MESH_OT_symmetrize);
+   WM_operatortype_append(MESH_OT_symmetry_snap);
+   WM_operatortype_append(MESH_OT_point_normals);
+   WM_operatortype_append(MESH_OT_merge_normals);
+   WM_operatortype_append(MESH_OT_split_normals);
+   WM_operatortype_append(MESH_OT_normals_tools);
+   WM_operatortype_append(MESH_OT_set_normals_from_faces);
+   WM_operatortype_append(MESH_OT_average_normals);
+   WM_operatortype_append(MESH_OT_smoothen_normals);
+   WM_operatortype_append(MESH_OT_mod_weighted_strength);
  }
  
  #if 0 /* UNUSED, remove? */
index 4468f58c01e632c9ceff58a1a6ddf4f1349f662f,b77f5c2bbad26c88b3c8bfd41c60092e868e9bf0..3782eac427e609aa10a5c7d53e69755afa783ed6
  
  void ED_operatortypes_render(void)
  {
-       WM_operatortype_append(OBJECT_OT_material_slot_add);
-       WM_operatortype_append(OBJECT_OT_material_slot_remove);
-       WM_operatortype_append(OBJECT_OT_material_slot_assign);
-       WM_operatortype_append(OBJECT_OT_material_slot_select);
-       WM_operatortype_append(OBJECT_OT_material_slot_deselect);
-       WM_operatortype_append(OBJECT_OT_material_slot_copy);
-       WM_operatortype_append(OBJECT_OT_material_slot_move);
+   WM_operatortype_append(OBJECT_OT_material_slot_add);
+   WM_operatortype_append(OBJECT_OT_material_slot_remove);
+   WM_operatortype_append(OBJECT_OT_material_slot_assign);
+   WM_operatortype_append(OBJECT_OT_material_slot_select);
+   WM_operatortype_append(OBJECT_OT_material_slot_deselect);
+   WM_operatortype_append(OBJECT_OT_material_slot_copy);
+   WM_operatortype_append(OBJECT_OT_material_slot_move);
  
-       WM_operatortype_append(MATERIAL_OT_new);
-       WM_operatortype_append(TEXTURE_OT_new);
-       WM_operatortype_append(WORLD_OT_new);
+   WM_operatortype_append(MATERIAL_OT_new);
+   WM_operatortype_append(TEXTURE_OT_new);
+   WM_operatortype_append(WORLD_OT_new);
  
-       WM_operatortype_append(MATERIAL_OT_copy);
-       WM_operatortype_append(MATERIAL_OT_paste);
+   WM_operatortype_append(MATERIAL_OT_copy);
+   WM_operatortype_append(MATERIAL_OT_paste);
  
-       WM_operatortype_append(SCENE_OT_view_layer_add);
-       WM_operatortype_append(SCENE_OT_view_layer_remove);
+   WM_operatortype_append(SCENE_OT_view_layer_add);
+   WM_operatortype_append(SCENE_OT_view_layer_remove);
  
-       WM_operatortype_append(SCENE_OT_render_view_add);
-       WM_operatortype_append(SCENE_OT_render_view_remove);
+   WM_operatortype_append(SCENE_OT_render_view_add);
+   WM_operatortype_append(SCENE_OT_render_view_remove);
  
-       WM_operatortype_append(SCENE_OT_light_cache_bake);
-       WM_operatortype_append(SCENE_OT_light_cache_free);
+   WM_operatortype_append(SCENE_OT_light_cache_bake);
+   WM_operatortype_append(SCENE_OT_light_cache_free);
  
  #ifdef WITH_FREESTYLE
-       WM_operatortype_append(SCENE_OT_freestyle_module_add);
-       WM_operatortype_append(SCENE_OT_freestyle_module_remove);
-       WM_operatortype_append(SCENE_OT_freestyle_module_move);
-       WM_operatortype_append(SCENE_OT_freestyle_lineset_add);
-       WM_operatortype_append(SCENE_OT_freestyle_lineset_copy);
-       WM_operatortype_append(SCENE_OT_freestyle_lineset_paste);
-       WM_operatortype_append(SCENE_OT_freestyle_lineset_remove);
-       WM_operatortype_append(SCENE_OT_freestyle_lineset_move);
-       WM_operatortype_append(SCENE_OT_freestyle_linestyle_new);
-       WM_operatortype_append(SCENE_OT_freestyle_color_modifier_add);
-       WM_operatortype_append(SCENE_OT_freestyle_alpha_modifier_add);
-       WM_operatortype_append(SCENE_OT_freestyle_thickness_modifier_add);
-       WM_operatortype_append(SCENE_OT_freestyle_geometry_modifier_add);
-       WM_operatortype_append(SCENE_OT_freestyle_modifier_remove);
-       WM_operatortype_append(SCENE_OT_freestyle_modifier_move);
-       WM_operatortype_append(SCENE_OT_freestyle_modifier_copy);
-       WM_operatortype_append(SCENE_OT_freestyle_stroke_material_create);
+   WM_operatortype_append(SCENE_OT_freestyle_module_add);
+   WM_operatortype_append(SCENE_OT_freestyle_module_remove);
+   WM_operatortype_append(SCENE_OT_freestyle_module_move);
+   WM_operatortype_append(SCENE_OT_freestyle_lineset_add);
+   WM_operatortype_append(SCENE_OT_freestyle_lineset_copy);
+   WM_operatortype_append(SCENE_OT_freestyle_lineset_paste);
+   WM_operatortype_append(SCENE_OT_freestyle_lineset_remove);
+   WM_operatortype_append(SCENE_OT_freestyle_lineset_move);
+   WM_operatortype_append(SCENE_OT_freestyle_linestyle_new);
+   WM_operatortype_append(SCENE_OT_freestyle_color_modifier_add);
+   WM_operatortype_append(SCENE_OT_freestyle_alpha_modifier_add);
+   WM_operatortype_append(SCENE_OT_freestyle_thickness_modifier_add);
+   WM_operatortype_append(SCENE_OT_freestyle_geometry_modifier_add);
+   WM_operatortype_append(SCENE_OT_freestyle_modifier_remove);
+   WM_operatortype_append(SCENE_OT_freestyle_modifier_move);
+   WM_operatortype_append(SCENE_OT_freestyle_modifier_copy);
+   WM_operatortype_append(SCENE_OT_freestyle_stroke_material_create);
  #endif
  
 -  WM_operatortype_append(TEXTURE_OT_slot_copy);
 -  WM_operatortype_append(TEXTURE_OT_slot_paste);
 -  WM_operatortype_append(TEXTURE_OT_slot_move);
 +    /* lanpr:  */
 +    WM_operatortype_append(SCENE_OT_lanpr_calculate_feature_lines);
 +    WM_operatortype_append(SCENE_OT_lanpr_add_line_layer);
 +    WM_operatortype_append(SCENE_OT_lanpr_delete_line_layer);
 +      WM_operatortype_append(SCENE_OT_lanpr_rebuild_all_commands);
 +      WM_operatortype_append(SCENE_OT_lanpr_auto_create_line_layer);
 +      WM_operatortype_append(SCENE_OT_lanpr_move_line_layer);
 +      WM_operatortype_append(SCENE_OT_lanpr_add_line_component);
 +      WM_operatortype_append(SCENE_OT_lanpr_delete_line_component);
 +      WM_operatortype_append(SCENE_OT_lanpr_enable_all_line_types);
 +
 +
 +      WM_operatortype_append(TEXTURE_OT_slot_copy);
 +      WM_operatortype_append(TEXTURE_OT_slot_paste);
 +      WM_operatortype_append(TEXTURE_OT_slot_move);
  
-       /* render_internal.c */
-       WM_operatortype_append(RENDER_OT_view_show);
-       WM_operatortype_append(RENDER_OT_render);
-       WM_operatortype_append(RENDER_OT_view_cancel);
-       WM_operatortype_append(RENDER_OT_shutter_curve_preset);
+   /* render_internal.c */
+   WM_operatortype_append(RENDER_OT_view_show);
+   WM_operatortype_append(RENDER_OT_render);
+   WM_operatortype_append(RENDER_OT_view_cancel);
+   WM_operatortype_append(RENDER_OT_shutter_curve_preset);
  
-       /* render_opengl.c */
-       WM_operatortype_append(RENDER_OT_opengl);
+   /* render_opengl.c */
+   WM_operatortype_append(RENDER_OT_opengl);
  }
index 06c10b1b253f02a4cc89bb65557d89821274dfe6,8a0d1b5b32298c2f038779b3537574e4976841ed..72e27fb3e37fd1ed6080a5f98f67450002ba2df3
@@@ -778,341 -730,335 +730,336 @@@ static void *view3d_main_region_duplica
  }
  
  static void view3d_main_region_listener(
-         wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar,
-         wmNotifier *wmn, const Scene *scene)
+     wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar, wmNotifier *wmn, const Scene *scene)
  {
-       View3D *v3d = sa->spacedata.first;
-       RegionView3D *rv3d = ar->regiondata;
-       wmGizmoMap *gzmap = ar->gizmo_map;
-       /* context changes */
-       switch (wmn->category) {
-               case NC_WM:
-                       if (ELEM(wmn->data, ND_UNDO)) {
-                               WM_gizmomap_tag_refresh(gzmap);
-                       }
-                       break;
-               case NC_ANIMATION:
-                       switch (wmn->data) {
-                               case ND_KEYFRAME_PROP:
-                               case ND_NLA_ACTCHANGE:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                               case ND_NLA:
-                               case ND_KEYFRAME:
-                                       if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
-                                               ED_region_tag_redraw(ar);
-                                       }
-                                       break;
-                               case ND_ANIMCHAN:
-                                       if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED)) {
-                                               ED_region_tag_redraw(ar);
-                                       }
-                                       break;
-                       }
-                       break;
-               case NC_SCENE:
-                       switch (wmn->data) {
-                               case ND_SCENEBROWSE:
-                               case ND_LAYER_CONTENT:
-                                       ED_region_tag_redraw(ar);
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       break;
-                               case ND_LAYER:
-                                       if (wmn->reference) {
-                                               BKE_screen_view3d_sync(v3d, wmn->reference);
-                                       }
-                                       ED_region_tag_redraw(ar);
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       break;
-                               case ND_OB_ACTIVE:
-                               case ND_OB_SELECT:
-                                       ATTR_FALLTHROUGH;
-                               case ND_FRAME:
-                               case ND_TRANSFORM:
-                               case ND_OB_VISIBLE:
-                               case ND_RENDER_OPTIONS:
-                               case ND_MARKERS:
-                               case ND_MODE:
-                                       ED_region_tag_redraw(ar);
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       break;
-                               case ND_WORLD:
-                                       /* handled by space_view3d_listener() for v3d access */
-                                       break;
-                               case ND_DRAW_RENDER_VIEWPORT:
-                               {
-                                       if (v3d->camera && (scene == wmn->reference)) {
-                                               if (rv3d->persp == RV3D_CAMOB) {
-                                                       ED_region_tag_redraw(ar);
-                                               }
-                                       }
-                                       break;
-                               }
-                       }
-                       if (wmn->action == NA_EDITED) {
-                               ED_region_tag_redraw(ar);
-                       }
-                       break;
-               case NC_OBJECT:
-                       switch (wmn->data) {
-                               case ND_BONE_ACTIVE:
-                               case ND_BONE_SELECT:
-                               case ND_TRANSFORM:
-                               case ND_POSE:
-                               case ND_DRAW:
-                               case ND_MODIFIER:
-                               case ND_CONSTRAINT:
-                               case ND_KEYS:
-                               case ND_PARTICLE:
-                               case ND_POINTCACHE:
-                               case ND_LOD:
-                                       ED_region_tag_redraw(ar);
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       break;
-                       }
-                       switch (wmn->action) {
-                               case NA_ADDED:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       break;
-               case NC_GEOM:
-                       switch (wmn->data) {
-                               case ND_SELECT:
-                               {
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       ATTR_FALLTHROUGH;
-                               }
-                               case ND_DATA:
-                               case ND_VERTEX_GROUP:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       switch (wmn->action) {
-                               case NA_EDITED:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       break;
-               case NC_CAMERA:
-                       switch (wmn->data) {
-                               case ND_DRAW_RENDER_VIEWPORT:
-                               {
-                                       if (v3d->camera && (v3d->camera->data == wmn->reference)) {
-                                               if (rv3d->persp == RV3D_CAMOB) {
-                                                       ED_region_tag_redraw(ar);
-                                               }
-                                       }
-                                       break;
-                               }
-                       }
-                       break;
-               case NC_GROUP:
-                       /* all group ops for now */
-                       ED_region_tag_redraw(ar);
-                       break;
-               case NC_BRUSH:
-                       switch (wmn->action) {
-                               case NA_EDITED:
-                                       ED_region_tag_redraw_overlay(ar);
-                                       break;
-                               case NA_SELECTED:
-                                       /* used on brush changes - needed because 3d cursor
-                                        * has to be drawn if clone brush is selected */
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       break;
-               case NC_MATERIAL:
-                       switch (wmn->data) {
-                               case ND_SHADING:
-                               case ND_NODES:
-                                       /* TODO(sergey) This is a bit too much updates, but needed to
-                                        * have proper material drivers update in the viewport.
-                                        *
-                                        * How to solve?
-                                        */
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                               case ND_SHADING_DRAW:
-                               case ND_SHADING_LINKS:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       break;
-               case NC_WORLD:
-                       switch (wmn->data) {
-                               case ND_WORLD_DRAW:
-                                       /* handled by space_view3d_listener() for v3d access */
-                                       break;
-                               case ND_WORLD:
-                                       /* Needed for updating world materials */
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       break;
-               case NC_LAMP:
-                       switch (wmn->data) {
-                               case ND_LIGHTING:
-                                       /* TODO(sergey): This is a bit too much, but needed to
-                                        * handle updates from new depsgraph.
-                                        */
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                               case ND_LIGHTING_DRAW:
-                                       ED_region_tag_redraw(ar);
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       break;
-                       }
-                       break;
-               case NC_LIGHTPROBE:
-                       ED_area_tag_refresh(sa);
-                       break;
-               case NC_IMAGE:
-                       /* this could be more fine grained checks if we had
-                        * more context than just the region */
-                       ED_region_tag_redraw(ar);
-                       break;
-               case NC_TEXTURE:
-                       /* same as above */
-                       ED_region_tag_redraw(ar);
-                       break;
-               case NC_MOVIECLIP:
-                       if (wmn->data == ND_DISPLAY || wmn->action == NA_EDITED) {
-                               ED_region_tag_redraw(ar);
-                       }
-                       break;
-               case NC_SPACE:
-                       if (wmn->data == ND_SPACE_VIEW3D) {
-                               if (wmn->subtype == NS_VIEW3D_GPU) {
-                                       rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
-                               }
-                               ED_region_tag_redraw(ar);
-                               WM_gizmomap_tag_refresh(gzmap);
-                       }
-                       break;
-               case NC_ID:
-                       if (wmn->action == NA_RENAME) {
-                               ED_region_tag_redraw(ar);
-                       }
-                       break;
-               case NC_SCREEN:
-                       switch (wmn->data) {
-                               case ND_ANIMPLAY:
-                               case ND_SKETCH:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                               case ND_LAYOUTBROWSE:
-                               case ND_LAYOUTDELETE:
-                               case ND_LAYOUTSET:
-                                       WM_gizmomap_tag_refresh(gzmap);
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                               case ND_LAYER:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
-                       break;
-               case NC_GPENCIL:
-                       if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
-                               ED_region_tag_redraw(ar);
-                       }
-                       break;
-       }
+   View3D *v3d = sa->spacedata.first;
+   RegionView3D *rv3d = ar->regiondata;
+   wmGizmoMap *gzmap = ar->gizmo_map;
+   /* context changes */
+   switch (wmn->category) {
+     case NC_WM:
+       if (ELEM(wmn->data, ND_UNDO)) {
+         WM_gizmomap_tag_refresh(gzmap);
+       }
+       break;
+     case NC_ANIMATION:
+       switch (wmn->data) {
+         case ND_KEYFRAME_PROP:
+         case ND_NLA_ACTCHANGE:
+           ED_region_tag_redraw(ar);
+           break;
+         case ND_NLA:
+         case ND_KEYFRAME:
+           if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
+             ED_region_tag_redraw(ar);
+           }
+           break;
+         case ND_ANIMCHAN:
+           if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED)) {
+             ED_region_tag_redraw(ar);
+           }
+           break;
+       }
+       break;
+     case NC_SCENE:
+       switch (wmn->data) {
+         case ND_SCENEBROWSE:
+         case ND_LAYER_CONTENT:
+           ED_region_tag_redraw(ar);
+           WM_gizmomap_tag_refresh(gzmap);
+           break;
+         case ND_LAYER:
+           if (wmn->reference) {
+             BKE_screen_view3d_sync(v3d, wmn->reference);
+           }
+           ED_region_tag_redraw(ar);
+           WM_gizmomap_tag_refresh(gzmap);
+           break;
+         case ND_OB_ACTIVE:
+         case ND_OB_SELECT:
+           ATTR_FALLTHROUGH;
+         case ND_FRAME:
+         case ND_TRANSFORM:
+         case ND_OB_VISIBLE:
+         case ND_RENDER_OPTIONS:
+         case ND_MARKERS:
+         case ND_MODE:
+           ED_region_tag_redraw(ar);
+           WM_gizmomap_tag_refresh(gzmap);
+           break;
+         case ND_WORLD:
+           /* handled by space_view3d_listener() for v3d access */
+           break;
+         case ND_DRAW_RENDER_VIEWPORT: {
+           if (v3d->camera && (scene == wmn->reference)) {
+             if (rv3d->persp == RV3D_CAMOB) {
+               ED_region_tag_redraw(ar);
+             }
+           }
+           break;
+         }
+       }
+       if (wmn->action == NA_EDITED) {
+         ED_region_tag_redraw(ar);
+       }
+       break;
+     case NC_OBJECT:
+       switch (wmn->data) {
+         case ND_BONE_ACTIVE:
+         case ND_BONE_SELECT:
+         case ND_TRANSFORM:
+         case ND_POSE:
+         case ND_DRAW:
+         case ND_MODIFIER:
+         case ND_CONSTRAINT:
+         case ND_KEYS:
+         case ND_PARTICLE:
+         case ND_POINTCACHE:
+         case ND_LOD:
+           ED_region_tag_redraw(ar);
+           WM_gizmomap_tag_refresh(gzmap);
+           break;
+       }
+       switch (wmn->action) {
+         case NA_ADDED:
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       break;
+     case NC_GEOM:
+       switch (wmn->data) {
+         case ND_SELECT: {
+           WM_gizmomap_tag_refresh(gzmap);
+           ATTR_FALLTHROUGH;
+         }
+         case ND_DATA:
+         case ND_VERTEX_GROUP:
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       switch (wmn->action) {
+         case NA_EDITED:
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       break;
+     case NC_CAMERA:
+       switch (wmn->data) {
+         case ND_DRAW_RENDER_VIEWPORT: {
+           if (v3d->camera && (v3d->camera->data == wmn->reference)) {
+             if (rv3d->persp == RV3D_CAMOB) {
+               ED_region_tag_redraw(ar);
+             }
+           }
+           break;
+         }
+       }
+       break;
+     case NC_GROUP:
+       /* all group ops for now */
+       ED_region_tag_redraw(ar);
+       break;
+     case NC_BRUSH:
+       switch (wmn->action) {
+         case NA_EDITED:
+           ED_region_tag_redraw_overlay(ar);
+           break;
+         case NA_SELECTED:
+           /* used on brush changes - needed because 3d cursor
+            * has to be drawn if clone brush is selected */
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       break;
+     case NC_MATERIAL:
+       switch (wmn->data) {
+         case ND_SHADING:
+         case ND_NODES:
+           /* TODO(sergey) This is a bit too much updates, but needed to
+            * have proper material drivers update in the viewport.
+            *
+            * How to solve?
+            */
+           ED_region_tag_redraw(ar);
+           break;
+         case ND_SHADING_DRAW:
+         case ND_SHADING_LINKS:
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       break;
+     case NC_WORLD:
+       switch (wmn->data) {
+         case ND_WORLD_DRAW:
+           /* handled by space_view3d_listener() for v3d access */
+           break;
+         case ND_WORLD:
+           /* Needed for updating world materials */
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       break;
+     case NC_LAMP:
+       switch (wmn->data) {
+         case ND_LIGHTING:
+           /* TODO(sergey): This is a bit too much, but needed to
+            * handle updates from new depsgraph.
+            */
+           ED_region_tag_redraw(ar);
+           break;
+         case ND_LIGHTING_DRAW:
+           ED_region_tag_redraw(ar);
+           WM_gizmomap_tag_refresh(gzmap);
+           break;
+       }
+       break;
+     case NC_LIGHTPROBE:
+       ED_area_tag_refresh(sa);
+       break;
+     case NC_IMAGE:
+       /* this could be more fine grained checks if we had
+        * more context than just the region */
+       ED_region_tag_redraw(ar);
+       break;
+     case NC_TEXTURE:
+       /* same as above */
+       ED_region_tag_redraw(ar);
+       break;
+     case NC_MOVIECLIP:
+       if (wmn->data == ND_DISPLAY || wmn->action == NA_EDITED) {
+         ED_region_tag_redraw(ar);
+       }
+       break;
+     case NC_SPACE:
+       if (wmn->data == ND_SPACE_VIEW3D) {
+         if (wmn->subtype == NS_VIEW3D_GPU) {
+           rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
+         }
+         ED_region_tag_redraw(ar);
+         WM_gizmomap_tag_refresh(gzmap);
+       }
+       break;
+     case NC_ID:
+       if (wmn->action == NA_RENAME) {
+         ED_region_tag_redraw(ar);
+       }
+       break;
+     case NC_SCREEN:
+       switch (wmn->data) {
+         case ND_ANIMPLAY:
+         case ND_SKETCH:
+           ED_region_tag_redraw(ar);
+           break;
+         case ND_LAYOUTBROWSE:
+         case ND_LAYOUTDELETE:
+         case ND_LAYOUTSET:
+           WM_gizmomap_tag_refresh(gzmap);
+           ED_region_tag_redraw(ar);
+           break;
+         case ND_LAYER:
+           ED_region_tag_redraw(ar);
+           break;
+       }
+       break;
+     case NC_GPENCIL:
+       if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
+         ED_region_tag_redraw(ar);
+       }
+       break;
+   }
  }
  
- static void view3d_main_region_message_subscribe(
-         const struct bContext *C,
-         struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene),
-         struct bScreen *UNUSED(screen), struct ScrArea *sa, struct ARegion *ar,
-         struct wmMsgBus *mbus)
+ static void view3d_main_region_message_subscribe(const struct bContext *C,
+                                                  struct WorkSpace *UNUSED(workspace),
+                                                  struct Scene *UNUSED(scene),
+                                                  struct bScreen *UNUSED(screen),
+                                                  struct ScrArea *sa,
+                                                  struct ARegion *ar,
+                                                  struct wmMsgBus *mbus)
  {
-       /* Developer note: there are many properties that impact 3D view drawing,
-        * so instead of subscribing to individual properties, just subscribe to types
-        * accepting some redundant redraws.
-        *
-        * For other space types we might try avoid this, keep the 3D view as an exceptional case! */
-       wmMsgParams_RNA msg_key_params = {{{0}}};
-       /* Only subscribe to types. */
-       StructRNA *type_array[] = {
-               &RNA_Window,
-               /* These object have properties that impact drawing. */
-               &RNA_AreaLight,
-               &RNA_Camera,
-               &RNA_Light,
-               &RNA_Speaker,
-               &RNA_SunLight,
-               /* General types the 3D view depends on. */
-               &RNA_Object,
-               &RNA_UnitSettings,  /* grid-floor */
-               &RNA_View3DOverlay,
-               &RNA_View3DShading,
-               &RNA_World,
-       };
-       wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
-               .owner = ar,
-               .user_data = ar,
-               .notify = ED_region_do_msg_notify_tag_redraw,
-       };
-       for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
-               msg_key_params.ptr.type = type_array[i];
-               WM_msg_subscribe_rna_params(
-                       mbus,
-                       &msg_key_params,
-                       &msg_sub_value_region_tag_redraw,
-                       __func__);
-       }
-       /* Subscribe to a handful of other properties. */
-       RegionView3D *rv3d = ar->regiondata;
-       WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, resolution_x, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, resolution_y, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_region_tag_redraw);
-       if (rv3d->persp == RV3D_CAMOB) {
-               WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, use_border, &msg_sub_value_region_tag_redraw);
-       }
-       WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_type(mbus, SceneLANPR, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, &msg_sub_value_region_tag_redraw);
-       WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw);
-       ViewLayer *view_layer = CTX_data_view_layer(C);
-       Object *obact = OBACT(view_layer);
-       if (obact != NULL) {
-               switch (obact->mode) {
-                       case OB_MODE_PARTICLE_EDIT:
-                               WM_msg_subscribe_rna_anon_type(mbus, ParticleEdit, &msg_sub_value_region_tag_redraw);
-                               break;
-                       default:
-                               break;
-               }
-       }
-       {
-               wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
-                       .owner = ar,
-                       .user_data = sa,
-                       .notify = WM_toolsystem_do_msg_notify_tag_refresh,
-               };
-               WM_msg_subscribe_rna_anon_prop(
-                       mbus, Object, mode,
-                       &msg_sub_value_region_tag_refresh);
-               WM_msg_subscribe_rna_anon_prop(
-                       mbus, LayerObjects, active,
-                       &msg_sub_value_region_tag_refresh);
-       }
+   /* Developer note: there are many properties that impact 3D view drawing,
+    * so instead of subscribing to individual properties, just subscribe to types
+    * accepting some redundant redraws.
+    *
+    * For other space types we might try avoid this, keep the 3D view as an exceptional case! */
+   wmMsgParams_RNA msg_key_params = {{{0}}};
+   /* Only subscribe to types. */
+   StructRNA *type_array[] = {
+       &RNA_Window,
+       /* These object have properties that impact drawing. */
+       &RNA_AreaLight,
+       &RNA_Camera,
+       &RNA_Light,
+       &RNA_Speaker,
+       &RNA_SunLight,
+       /* General types the 3D view depends on. */
+       &RNA_Object,
+       &RNA_UnitSettings, /* grid-floor */
+       &RNA_View3DOverlay,
+       &RNA_View3DShading,
+       &RNA_World,
+   };
+   wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
+       .owner = ar,
+       .user_data = ar,
+       .notify = ED_region_do_msg_notify_tag_redraw,
+   };
+   for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
+     msg_key_params.ptr.type = type_array[i];
+     WM_msg_subscribe_rna_params(mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__);
+   }
+   /* Subscribe to a handful of other properties. */
+   RegionView3D *rv3d = ar->regiondata;
+   WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_prop(
+       mbus, RenderSettings, resolution_x, &msg_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_prop(
+       mbus, RenderSettings, resolution_y, &msg_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_prop(
+       mbus, RenderSettings, pixel_aspect_x, &msg_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_prop(
+       mbus, RenderSettings, pixel_aspect_y, &msg_sub_value_region_tag_redraw);
+   if (rv3d->persp == RV3D_CAMOB) {
+     WM_msg_subscribe_rna_anon_prop(
+         mbus, RenderSettings, use_border, &msg_sub_value_region_tag_redraw);
+   }
+   WM_msg_subscribe_rna_anon_type(mbus, SceneEEVEE, &msg_sub_value_region_tag_redraw);
++  WM_msg_subscribe_rna_anon_type(mbus, SceneLANPR, &msg_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_type(mbus, SceneDisplay, &msg_sub_value_region_tag_redraw);
+   WM_msg_subscribe_rna_anon_type(mbus, ObjectDisplay, &msg_sub_value_region_tag_redraw);
+   ViewLayer *view_layer = CTX_data_view_layer(C);
+   Object *obact = OBACT(view_layer);
+   if (obact != NULL) {
+     switch (obact->mode) {
+       case OB_MODE_PARTICLE_EDIT:
+         WM_msg_subscribe_rna_anon_type(mbus, ParticleEdit, &msg_sub_value_region_tag_redraw);
+         break;
+       default:
+         break;
+     }
+   }
+   {
+     wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
+         .owner = ar,
+         .user_data = sa,
+         .notify = WM_toolsystem_do_msg_notify_tag_refresh,
+     };
+     WM_msg_subscribe_rna_anon_prop(mbus, Object, mode, &msg_sub_value_region_tag_refresh);
+     WM_msg_subscribe_rna_anon_prop(mbus, LayerObjects, active, &msg_sub_value_region_tag_refresh);
+   }
  }
  
  /* concept is to retrieve cursor type context-less */
index 0a05197f6bd763baacb01def0a9fbc69e73a431f,1b85fb26c0e10b50ff0d2d40089e1fed7809546b..eeeadd161814dbfe8f3d107857dbda4499d9acd0
@@@ -33,63 -33,62 +33,63 @@@ struct Scene
  struct Subdiv;
  
  typedef enum ModifierType {
-       eModifierType_None              = 0,
-       eModifierType_Subsurf           = 1,
-       eModifierType_Lattice           = 2,
-       eModifierType_Curve             = 3,
-       eModifierType_Build             = 4,
-       eModifierType_Mirror            = 5,
-       eModifierType_Decimate          = 6,
-       eModifierType_Wave              = 7,
-       eModifierType_Armature          = 8,
-       eModifierType_Hook              = 9,
-       eModifierType_Softbody          = 10,
-       eModifierType_Boolean           = 11,
-       eModifierType_Array             = 12,
-       eModifierType_EdgeSplit         = 13,
-       eModifierType_Displace          = 14,
-       eModifierType_UVProject         = 15,
-       eModifierType_Smooth            = 16,
-       eModifierType_Cast              = 17,
-       eModifierType_MeshDeform        = 18,
-       eModifierType_ParticleSystem    = 19,
-       eModifierType_ParticleInstance  = 20,
-       eModifierType_Explode           = 21,
-       eModifierType_Cloth             = 22,
-       eModifierType_Collision         = 23,
-       eModifierType_Bevel             = 24,
-       eModifierType_Shrinkwrap        = 25,
-       eModifierType_Fluidsim          = 26,
-       eModifierType_Mask              = 27,
-       eModifierType_SimpleDeform      = 28,
-       eModifierType_Multires          = 29,
-       eModifierType_Surface           = 30,
-       eModifierType_Smoke             = 31,
-       eModifierType_ShapeKey          = 32,
-       eModifierType_Solidify          = 33,
-       eModifierType_Screw             = 34,
-       eModifierType_Warp              = 35,
-       eModifierType_WeightVGEdit      = 36,
-       eModifierType_WeightVGMix       = 37,
-       eModifierType_WeightVGProximity = 38,
-       eModifierType_Ocean             = 39,
-       eModifierType_DynamicPaint      = 40,
-       eModifierType_Remesh            = 41,
-       eModifierType_Skin              = 42,
-       eModifierType_LaplacianSmooth   = 43,
-       eModifierType_Triangulate       = 44,
-       eModifierType_UVWarp            = 45,
-       eModifierType_MeshCache         = 46,
-       eModifierType_LaplacianDeform   = 47,
-       eModifierType_Wireframe         = 48,
-       eModifierType_DataTransfer      = 49,
-       eModifierType_NormalEdit        = 50,
-       eModifierType_CorrectiveSmooth  = 51,
-       eModifierType_MeshSequenceCache = 52,
-       eModifierType_SurfaceDeform     = 53,
-       eModifierType_WeightedNormal    = 54,
+   eModifierType_None = 0,
+   eModifierType_Subsurf = 1,
+   eModifierType_Lattice = 2,
+   eModifierType_Curve = 3,
+   eModifierType_Build = 4,
+   eModifierType_Mirror = 5,
+   eModifierType_Decimate = 6,
+   eModifierType_Wave = 7,
+   eModifierType_Armature = 8,
+   eModifierType_Hook = 9,
+   eModifierType_Softbody = 10,
+   eModifierType_Boolean = 11,
+   eModifierType_Array = 12,
+   eModifierType_EdgeSplit = 13,
+   eModifierType_Displace = 14,
+   eModifierType_UVProject = 15,
+   eModifierType_Smooth = 16,
+   eModifierType_Cast = 17,
+   eModifierType_MeshDeform = 18,
+   eModifierType_ParticleSystem = 19,
+   eModifierType_ParticleInstance = 20,
+   eModifierType_Explode = 21,
+   eModifierType_Cloth = 22,
+   eModifierType_Collision = 23,
+   eModifierType_Bevel = 24,
+   eModifierType_Shrinkwrap = 25,
+   eModifierType_Fluidsim = 26,
+   eModifierType_Mask = 27,
+   eModifierType_SimpleDeform = 28,
+   eModifierType_Multires = 29,
+   eModifierType_Surface = 30,
+   eModifierType_Smoke = 31,
+   eModifierType_ShapeKey = 32,
+   eModifierType_Solidify = 33,
+   eModifierType_Screw = 34,
+   eModifierType_Warp = 35,
+   eModifierType_WeightVGEdit = 36,
+   eModifierType_WeightVGMix = 37,
+   eModifierType_WeightVGProximity = 38,
+   eModifierType_Ocean = 39,
+   eModifierType_DynamicPaint = 40,
+   eModifierType_Remesh = 41,
+   eModifierType_Skin = 42,
+   eModifierType_LaplacianSmooth = 43,
+   eModifierType_Triangulate = 44,
+   eModifierType_UVWarp = 45,
+   eModifierType_MeshCache = 46,
+   eModifierType_LaplacianDeform = 47,
+   eModifierType_Wireframe = 48,
+   eModifierType_DataTransfer = 49,
+   eModifierType_NormalEdit = 50,
+   eModifierType_CorrectiveSmooth = 51,
+   eModifierType_MeshSequenceCache = 52,
+   eModifierType_SurfaceDeform = 53,
+   eModifierType_WeightedNormal = 54,
 +      eModifierType_MyBMesh           = 55,
-       NUM_MODIFIER_TYPES
+   NUM_MODIFIER_TYPES,
  } ModifierType;
  
  typedef enum ModifierMode {
@@@ -1757,55 -1755,46 +1756,55 @@@ typedef struct WireframeModifierData 
  } WireframeModifierData;
  
  enum {
-       MOD_WIREFRAME_INVERT_VGROUP = (1 << 0),
-       MOD_WIREFRAME_REPLACE       = (1 << 1),
-       MOD_WIREFRAME_BOUNDARY      = (1 << 2),
-       MOD_WIREFRAME_OFS_EVEN      = (1 << 3),
-       MOD_WIREFRAME_OFS_RELATIVE  = (1 << 4),
-       MOD_WIREFRAME_CREASE        = (1 << 5),
+   MOD_WIREFRAME_INVERT_VGROUP = (1 << 0),
+   MOD_WIREFRAME_REPLACE = (1 << 1),
+   MOD_WIREFRAME_BOUNDARY = (1 << 2),
+   MOD_WIREFRAME_OFS_EVEN = (1 << 3),
+   MOD_WIREFRAME_OFS_RELATIVE = (1 << 4),
+   MOD_WIREFRAME_CREASE = (1 << 5),
  };
  
 +/* Modifier data stored in the blend file */
 +typedef struct MyBMeshModifierData {
 +      ModifierData modifier;
 +      struct Object *camera_ob;
 +      void *osd_eval;
 +      int flag;  /* options stored here */
 +      short _pad[2];
 +} MyBMeshModifierData;
 +
  typedef struct DataTransferModifierData {
-       ModifierData modifier;
+   ModifierData modifier;
  
-       struct Object *ob_source;
+   struct Object *ob_source;
  
-       /** See DT_TYPE_ enum in ED_object.h. */
-       int data_types;
+   /** See DT_TYPE_ enum in ED_object.h. */
+   int data_types;
  
-       /* See MREMAP_MODE_ enum in BKE_mesh_mapping.h */
-       int vmap_mode;
-       int emap_mode;
-       int lmap_mode;
-       int pmap_mode;
+   /* See MREMAP_MODE_ enum in BKE_mesh_mapping.h */
+   int vmap_mode;
+   int emap_mode;
+   int lmap_mode;
+   int pmap_mode;
  
-       float map_max_distance;
-       float map_ray_radius;
-       float islands_precision;
+   float map_max_distance;
+   float map_ray_radius;
+   float islands_precision;
  
-       char _pad1[4];
+   char _pad1[4];
  
-       /** DT_MULTILAYER_INDEX_MAX; See DT_FROMLAYERS_ enum in ED_object.h. */
-       int layers_select_src[4];
-       /** DT_MULTILAYER_INDEX_MAX; See DT_TOLAYERS_ enum in ED_object.h. */
-       int layers_select_dst[4];
+   /** DT_MULTILAYER_INDEX_MAX; See DT_FROMLAYERS_ enum in ED_object.h. */
+   int layers_select_src[4];
+   /** DT_MULTILAYER_INDEX_MAX; See DT_TOLAYERS_ enum in ED_object.h. */
+   int layers_select_dst[4];
  
-       /** See CDT_MIX_ enum in BKE_customdata.h. */
-       int mix_mode;
-       float mix_factor;
-       /** MAX_VGROUP_NAME. */
-       char defgrp_name[64];
+   /** See CDT_MIX_ enum in BKE_customdata.h. */
+   int mix_mode;
+   float mix_factor;
+   /** MAX_VGROUP_NAM