Blender  V3.3
Macros | Functions
versioning_defaults.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_system.h"
#include "BLI_utildefines.h"
#include "DNA_camera_types.h"
#include "DNA_curveprofile_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_light_types.h"
#include "DNA_mask_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "BKE_appdir.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_curveprofile.h"
#include "BKE_customdata.h"
#include "BKE_gpencil.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_main_namemap.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BKE_node_tree_update.h"
#include "BKE_paint.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
#include "BLO_readfile.h"
#include "BLT_translation.h"
#include "versioning_common.h"

Go to the source code of this file.

Macros

#define U   (*((const UserDef *)&U))
 

Functions

static bool blo_is_builtin_template (const char *app_template)
 
static void blo_update_defaults_screen (bScreen *screen, const char *app_template, const char *workspace_name)
 
void BLO_update_defaults_workspace (WorkSpace *workspace, const char *app_template)
 
static void blo_update_defaults_scene (Main *bmain, Scene *scene)
 
void BLO_update_defaults_startup_blend (Main *bmain, const char *app_template)
 

Detailed Description

This file handles updating the startup.blend, this is used when reading old files.

Unlike regular versioning this makes changes that ensure the startup file has brushes and other presets setup to take advantage of newer features.

To update preference defaults see userdef_default.c.

Definition in file versioning_defaults.c.

Macro Definition Documentation

◆ U

#define U   (*((const UserDef *)&U))

Definition at line 64 of file versioning_defaults.c.

Function Documentation

◆ blo_is_builtin_template()

static bool blo_is_builtin_template ( const char *  app_template)
static

◆ blo_update_defaults_scene()

static void blo_update_defaults_scene ( Main bmain,
Scene scene 
)
static

◆ blo_update_defaults_screen()

static void blo_update_defaults_screen ( bScreen screen,
const char *  app_template,
const char *  workspace_name 
)
static

Definition at line 74 of file versioning_defaults.c.

References SpaceAction::ads, ADS_FLAG_SUMMARY_COLLAPSED, app_template, blender::compositor::area(), bScreen::areabase, SpaceClip::around, View3DShading::background_color, View3DShading::background_type, BKE_appdir_folder_default(), BKE_area_region_panels_free(), MaskSpaceInfo::blend_factor, BLI_freelistN(), blo_is_builtin_template(), View3DShading::cavity_type, View3D::clip_start, View3DShading::color_type, copy_v3_fl(), FileSelectParams::dir, MaskSpaceInfo::draw_flag, View3DOverlay::edit_flag, ELEM, FileSelectParams::file, bDopeSheet::flag, SpaceAction::flag, SpaceGraph::flag, SpaceNla::flag, SequencerPreviewOverlay::flag, SequencerTimelineOverlay::flag, SpaceSeq::flag, View3DShading::flag, View3D::flag2, View3D::gp_flag, LISTBASE_FOREACH, MASK_DRAWFLAG_SPLINE, SpaceClip::mask_info, SpaceAction::mode, SpaceImage::mode, View3DOverlay::normals_constant_screen_size, View3D::overlay, SpaceFile::params, SpaceSeq::preview_overlay, SpaceSeq::render_size, RGN_FLAG_HIDDEN, RGN_FLAG_HIDDEN_BY_USER, RGN_TYPE_CHANNELS, RGN_TYPE_TOOL_HEADER, RGN_TYPE_TOOL_PROPS, RGN_TYPE_TOOLS, RGN_TYPE_UI, SACTCONT_TIMELINE, SACTION_SHOW_MARKERS, SACTION_SLIDERS, SEQ_PREVIEW_SHOW_OUTLINE_SELECTED, SEQ_RENDER_SIZE_PROXY_100, SEQ_SHOW_MARKERS, SEQ_SHOW_OVERLAY, SEQ_TIMELINE_SHOW_GRID, SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG, SEQ_TIMELINE_SHOW_STRIP_DURATION, SEQ_TIMELINE_SHOW_STRIP_NAME, SEQ_TIMELINE_SHOW_STRIP_SOURCE, SEQ_USE_PROXIES, SEQ_ZOOM_TO_FIT, View3D::shading, SpaceText::showlinenrs, SpaceText::showsyntax, SI_MODE_UV, SI_MODE_VIEW, SIPO_SHOW_MARKERS, SNLA_SHOW_MARKERS, SPACE_ACTION, SPACE_CLIP, SPACE_FILE, SPACE_GRAPH, SPACE_IMAGE, SPACE_NLA, SPACE_SEQ, SPACE_TEXT, SPACE_VIEW3D, STREQ, STRNCPY, View3DOverlay::texture_paint_mode_opacity, SpaceSeq::timeline_overlay, V2D_IS_INIT, V3D_AROUND_CENTER_MEDIAN, V3D_GP_SHOW_EDIT_LINES, V3D_OVERLAY_EDIT_CU_NORMALS, V3D_OVERLAY_EDIT_EDGES, V3D_SHADING_BACKGROUND_VIEWPORT, V3D_SHADING_CAVITY_CURVATURE, V3D_SHADING_MATERIAL_COLOR, V3D_SHADING_SPECULAR_HIGHLIGHT, V3D_SHOW_ANNOTATION, View3D::vertex_opacity, View3DOverlay::vertex_paint_mode_opacity, View3DOverlay::weight_paint_mode_opacity, and View3DShading::xray_alpha_wire.

Referenced by BLO_update_defaults_workspace().

◆ BLO_update_defaults_startup_blend()

void BLO_update_defaults_startup_blend ( struct Main bmain,
const char *  app_template 
)

Update defaults in startup.blend, without having to save and embed it.

Note
defaults for preferences are stored in userdef_default.c and can be updated there. Update defaults in startup.blend, without having to save and embed the file. This function can be emptied each time the startup.blend is updated.
Screen data may be cleared at this point, this will happen in the case an app-template's data needs to be versioned when read-file is called with "Load UI" disabled. Versioning the screen data can be safely skipped without "Load UI" since the screen data will have been versioned when it was first loaded.

Definition at line 372 of file versioning_defaults.c.

References app_template, Scene::audio, AUDIO_SYNC, BKE_brush_add(), BKE_brush_gpencil_paint_presets(), BKE_brush_gpencil_sculpt_presets(), BKE_brush_gpencil_vertex_presets(), BKE_brush_gpencil_weight_presets(), BKE_brush_sculpt_reset(), BKE_gpencil_material_add(), BKE_gpencil_palette_ensure(), BKE_id_delete(), BKE_main_namemap_remove_name(), BKE_mesh_smooth_flag_set(), BKE_ntree_update_tag_node_property(), BKE_paint_ensure_from_paintmode(), BKE_workspace_active_layout_for_workspace_get(), BKE_workspace_layout_remove(), BLI_assert, BLI_findstring(), BLI_libblock_ensure_unique_name(), BLI_strncpy(), blo_is_builtin_template(), blo_update_defaults_scene(), BLO_update_defaults_workspace(), BRUSH_PAINT_ANTIALIASING, Main::brushes, camera, Main::cameras, CD_GRID_PAINT_MASK, CD_PAINT_MASK, CustomData_free_layers(), DEG2RADF, do_versions_rename_id(), Object::dtx, ListBase::first, bGPdata::flag, MaterialGPencilStyle::flag, Mesh::flag, AudioData::flag, Scene::flag, Paint::flags, GP_BRUSH_ICON_PEN, GP_DATA_STROKE_PAINTMODE, GP_MATERIAL_MODE_DOT, GP_MATERIAL_MODE_SQUARE, GP_MATERIAL_STROKE_SHOW, ToolSettings::gp_paint, ToolSettings::gp_sculptpaint, GP_SELECTMODE_STROKE, Material::gp_style, ToolSettings::gp_vertexpaint, ToolSettings::gp_weightpaint, ToolSettings::gpencil_selectmode_edit, Brush::gpencil_settings, BrushGpencilSettings::icon_id, Brush::id, Mesh::id, Scene::id, bScreen::id, ID_BR, ID_LA, ID_MA, ID_OB, id_us_min(), Mesh::ldata, Main::lights, LISTBASE_FOREACH, LISTBASE_FOREACH_MUTABLE, ColorManagedViewSettings::look, Main::materials, ME_REMESH_REPROJECT_PAINT_MASK, ME_REMESH_REPROJECT_SCULPT_FACE_SETS, ME_REMESH_REPROJECT_VERTEX_COLORS, ME_REMESH_REPROJECT_VOLUME, mesh, Main::meshes, MaterialGPencilStyle::mix_factor, MaterialGPencilStyle::mix_rgba, MaterialGPencilStyle::mode, ID::name, ID::next, node, nodeFindSocket(), NULL, OB_GPENCIL, Brush::ob_mode, OB_MODE_EDIT, OB_MODE_PAINT_GPENCIL, OB_MODE_SCULPT, OB_USE_GPENCIL_LIGHTS, Main::objects, GpPaint::paint, PAINT_MODE_SCULPT_GPENCIL, PAINT_MODE_VERTEX_GPENCIL, PAINT_MODE_WEIGHT_GPENCIL, PAINT_SHOW_BRUSH, Mesh::remesh_voxel_size, roughness_socket, SCE_FRAME_DROP, scene, Main::scenes, WorkSpaceLayout::screen, Brush::sculpt_tool, SCULPT_TOOL_BOUNDARY, SCULPT_TOOL_CLAY_THUMB, SCULPT_TOOL_CLOTH, SCULPT_TOOL_DISPLACEMENT_ERASER, SCULPT_TOOL_DISPLACEMENT_SMEAR, SCULPT_TOOL_DRAW_FACE_SETS, SCULPT_TOOL_DRAW_SHARP, SCULPT_TOOL_ELASTIC_DEFORM, SCULPT_TOOL_MULTIPLANE_SCRAPE, SCULPT_TOOL_PAINT, SCULPT_TOOL_POSE, SCULPT_TOOL_SIMPLIFY, SCULPT_TOOL_SLIDE_RELAX, SCULPT_TOOL_SMEAR, SH_NODE_BSDF_PRINCIPLED, SH_NODE_SUBSURFACE_SCATTERING, SHD_SUBSURFACE_RANDOM_WALK, Mesh::smoothresh, SOCK_IN, Brush::spacing, STREQ, STRNCPY, MaterialGPencilStyle::texture_offset, Scene::toolsettings, Mesh::totloop, Mesh::totvert, Object::type, bNodeSocketValueFloat::value, Mesh::vdata, Scene::view_settings, ColorManagedViewSettings::view_transform, Main::wm, and Main::workspaces.

Referenced by BKE_blendfile_read_setup_ex().

◆ BLO_update_defaults_workspace()

void BLO_update_defaults_workspace ( WorkSpace workspace,
const char *  app_template 
)